This commit is contained in:
Brecht Van Lommel 2011-05-31 09:51:46 +00:00
commit 6a128eee7b
370 changed files with 4509 additions and 3086 deletions

@ -55,33 +55,19 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules/")
# quiet output for Makefiles, 'make -s' helps too
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
# ignore system set flag, use our own
# must be before project(...)
# if the user wants to add their own its ok after first run.
if(DEFINED CMAKE_C_STANDARD_LIBRARIES)
set(_reset_standard_libraries OFF)
else()
set(_reset_standard_libraries ON)
endif()
#-----------------------------------------------------------------------------
# Load some macros.
include(build_files/cmake/macros.cmake)
#-----------------------------------------------------------------------------
# Initialize project.
blender_project_hack_pre()
project(Blender)
if (_reset_standard_libraries)
# Must come after project(...)
#
# MINGW workaround for -ladvapi32 being included which surprisingly causes
# string formatting of floats, eg: printf("%.*f", 3, value). to crash blender
# with a meaningless stack trace. by overriding this flag we ensure we only
# have libs we define and that cmake & scons builds match.
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
mark_as_advanced(CMAKE_C_STANDARD_LIBRARIES)
mark_as_advanced(CMAKE_CXX_STANDARD_LIBRARIES)
endif()
unset(_reset_standard_libraries)
blender_project_hack_post()
enable_testing()
@ -92,10 +78,6 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE )
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE )
set(INCLUDE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/include CACHE INTERNAL "" FORCE )
#-----------------------------------------------------------------------------
# Load some macros.
include(build_files/cmake/macros.cmake)
#-----------------------------------------------------------------------------
# Set default config options
@ -107,7 +89,7 @@ option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF)
mark_as_advanced(WITH_PYTHON) # dont want people disabling this unless they really know what they are doing.
mark_as_advanced(WITH_PYTHON_SECURITY) # some distrobutions see this as a security issue, rather then have them patch it, make a build option.
mark_as_advanced(WITH_PYTHON_SECURITY) # some distrobutions see this as a security issue, rather than have them patch it, make a build option.
option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
option(WITH_PYTHON_MODULE "Enable building as a python module (experemental, only enable for development)" OFF)
@ -989,6 +971,12 @@ endif()
#-----------------------------------------------------------------------------
# Common.
if(APPLE OR WIN32)
if(NOT IS_DIRECTORY "${LIBDIR}")
message(FATAL_ERROR "Apple and Windows require pre-compiled libs at: '${LIBDIR}'")
endif()
endif()
if(WITH_RAYOPTIMIZATION)
if(CMAKE_COMPILER_IS_GNUCC)
if(SUPPORT_SSE_BUILD)
@ -1149,9 +1137,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
#-------------------------------------------------------------------------------
# Global Defines
# better not define flags here but this is a debugging option thats off by default.
# better not set includes here but this debugging option is off by default.
if(WITH_CXX_GUARDEDALLOC)
set(CMAKE_CXX_FLAGS " -DWITH_CXX_GUARDEDALLOC -I${CMAKE_SOURCE_DIR}/intern/guardedalloc ${CMAKE_CXX_FLAGS}")
include_directories(${CMAKE_SOURCE_DIR}/intern/guardedalloc)
endif()
if(WITH_ASSERT_ABORT)

@ -29,7 +29,8 @@ BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/
'${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
'${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
'${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
'${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a'
'${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
'${BF_FFMPEG_LIBPATH}/libfaad.a'
# Don't depend on system's libstdc++
WITH_BF_STATICCXX = True

@ -29,7 +29,8 @@ BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/
'${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
'${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
'${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
'${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a'
'${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
'${BF_FFMPEG_LIBPATH}/libfaad.a'
# Don't depend on system's libstdc++
WITH_BF_STATICCXX = True

@ -33,7 +33,7 @@ Windows not supported so far
from project_info import *
import os
from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
from os.path import join, dirname, normpath, relpath, exists
def create_nb_project_main():
@ -50,7 +50,6 @@ def create_nb_project_main():
includes.sort()
PROJECT_NAME = "Blender"
FILE_NAME = PROJECT_NAME.lower()
# --------------- NB spesific
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
@ -76,7 +75,7 @@ def create_nb_project_main():
if not exists(PROJECT_DIR_NB):
os.mkdir(PROJECT_DIR_NB)
SOURCE_DIR_REL = relpath(SOURCE_DIR, PROJECT_DIR)
# SOURCE_DIR_REL = relpath(SOURCE_DIR, PROJECT_DIR)
f = open(join(PROJECT_DIR_NB, "project.xml"), 'w')

@ -34,54 +34,52 @@ example linux usage
from project_info import *
import os
from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
import sys
def create_qtc_project_main():
files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
files_rel.sort()
# --- qtcreator specific, simple format
if SIMPLE_PROJECTFILE:
# --- qtcreator specific, simple format
PROJECT_NAME = "Blender"
f = open(join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w')
f = open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w')
f.write("\n".join(files_rel))
f = open(join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w')
f.write("\n".join(sorted(list(set(dirname(f) for f in files_rel if is_c_header(f))))))
f = open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w')
f.write("\n".join(sorted(list(set(os.path.dirname(f) for f in files_rel if is_c_header(f))))))
qtc_prj = join(PROJECT_DIR, "%s.creator" % PROJECT_NAME)
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME)
f = open(qtc_prj, 'w')
f.write("[General]\n")
qtc_cfg = join(PROJECT_DIR, "%s.config" % PROJECT_NAME)
if not exists(qtc_cfg):
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME)
if not os.path.exists(qtc_cfg):
f = open(qtc_cfg, 'w')
f.write("// ADD PREDEFINED MACROS HERE!\n")
else:
includes, defines = cmake_advanced_info()
# for some reason it doesnt give all internal includes
includes = list(set(includes) | set(dirname(f) for f in files_rel if is_c_header(f)))
includes = list(set(includes) | set(os.path.dirname(f) for f in files_rel if is_c_header(f)))
includes.sort()
PROJECT_NAME = "Blender"
FILE_NAME = PROJECT_NAME.lower()
f = open(join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
f.write("\n".join(files_rel))
f = open(join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w')
f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w')
f.write("\n".join(sorted(includes)))
qtc_prj = join(PROJECT_DIR, "%s.creator" % FILE_NAME)
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
f = open(qtc_prj, 'w')
f.write("[General]\n")
qtc_cfg = join(PROJECT_DIR, "%s.config" % FILE_NAME)
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
f = open(qtc_cfg, 'w')
f.write("// ADD PREDEFINED MACROS HERE!\n")
defines_final = [("#define %s %s" % item) for item in defines]
@ -95,21 +93,21 @@ def create_qtc_project_main():
def create_qtc_project_python():
files = list(source_list(SOURCE_DIR, filename_check=is_py))
files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
files_rel.sort()
# --- qtcreator specific, simple format
PROJECT_NAME = "Blender_Python"
FILE_NAME = PROJECT_NAME.lower()
f = open(join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
f.write("\n".join(files_rel))
qtc_prj = join(PROJECT_DIR, "%s.creator" % FILE_NAME)
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
f = open(qtc_prj, 'w')
f.write("[General]\n")
qtc_cfg = join(PROJECT_DIR, "%s.config" % FILE_NAME)
if not exists(qtc_cfg):
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
if not os.path.exists(qtc_cfg):
f = open(qtc_cfg, 'w')
f.write("// ADD PREDEFINED MACROS HERE!\n")

@ -13,19 +13,22 @@ macro(blender_include_dirs
include_directories(${all_incs})
endmacro()
# only MSVC uses SOURCE_GROUP
macro(blender_add_lib_nolist
name
sources
macro(blender_include_dirs_sys
includes)
# message(STATUS "Configuring library ${name}")
foreach(inc ${ARGV})
get_filename_component(abs_inc ${inc} ABSOLUTE)
list(APPEND all_incs ${abs_inc})
endforeach()
include_directories(SYSTEM ${all_incs})
endmacro()
blender_include_dirs("${includes}")
add_library(${name} ${sources})
macro(blender_source_group
sources)
# Group by location on disk
source_group("Source Files" FILES CMakeLists.txt)
foreach(SRC ${sources})
get_filename_component(SRC_EXT ${SRC} EXT)
if(${SRC_EXT} MATCHES ".h" OR ${SRC_EXT} MATCHES ".hpp")
@ -36,28 +39,42 @@ macro(blender_add_lib_nolist
endforeach()
endmacro()
# # works fine but having the includes listed is helpful for IDE's (QtCreator/MSVC)
# macro(blender_add_lib_nolist
# name
# sources
# includes)
#
# message(STATUS "Configuring library ${name}")
# include_directories(${includes})
# add_library(${name} ${sources})
# endmacro()
# only MSVC uses SOURCE_GROUP
macro(blender_add_lib_nolist
name
sources
includes
includes_sys)
# message(STATUS "Configuring library ${name}")
# include_directories(${includes})
# include_directories(SYSTEM ${includes_sys})
blender_include_dirs("${includes}")
blender_include_dirs_sys("${includes_sys}")
add_library(${name} ${sources})
# works fine without having the includes
# listed is helpful for IDE's (QtCreator/MSVC)
blender_source_group("${sources}")
endmacro()
macro(blender_add_lib
name
sources
includes)
includes
includes_sys)
blender_add_lib_nolist(${name} "${sources}" "${includes}")
blender_add_lib_nolist(${name} "${sources}" "${includes}" "${includes_sys}")
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
endmacro()
macro(SETUP_LIBDIRS)
# see "cmake --help-policy CMP0003"
if(COMMAND cmake_policy)
@ -388,3 +405,71 @@ macro(get_blender_version)
# message(STATUS "Version (Internal): ${BLENDER_VERSION}.${BLENDER_SUBVERSION}, Version (external): ${BLENDER_VERSION}${BLENDER_VERSION_CHAR}-${BLENDER_VERSION_CYCLE}")
endmacro()
# hacks to override initial project settings
# these macros must be called directly before/after project(Blender)
macro(blender_project_hack_pre)
# ----------------
# MINGW HACK START
# ignore system set flag, use our own
# must be before project(...)
# if the user wants to add their own its ok after first run.
if(DEFINED CMAKE_C_STANDARD_LIBRARIES)
set(_reset_standard_libraries OFF)
else()
set(_reset_standard_libraries ON)
endif()
# ------------------
# GCC -O3 HACK START
# needed because O3 can cause problems but
# allow the builder to set O3 manually after.
if(DEFINED CMAKE_C_FLAGS_RELEASE)
set(_reset_standard_cflags_rel OFF)
else()
set(_reset_standard_cflags_rel ON)
endif()
if(DEFINED CMAKE_CXX_FLAGS_RELEASE)
set(_reset_standard_cxxflags_rel OFF)
else()
set(_reset_standard_cxxflags_rel ON)
endif()
endmacro()
macro(blender_project_hack_post)
# --------------
# MINGW HACK END
if (_reset_standard_libraries)
# Must come after project(...)
#
# MINGW workaround for -ladvapi32 being included which surprisingly causes
# string formatting of floats, eg: printf("%.*f", 3, value). to crash blender
# with a meaningless stack trace. by overriding this flag we ensure we only
# have libs we define and that cmake & scons builds match.
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
mark_as_advanced(CMAKE_C_STANDARD_LIBRARIES)
mark_as_advanced(CMAKE_CXX_STANDARD_LIBRARIES)
endif()
unset(_reset_standard_libraries)
# ----------------
# GCC -O3 HACK END
if(_reset_standard_cflags_rel)
string(REGEX REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
mark_as_advanced(CMAKE_C_FLAGS_RELEASE)
endif()
if(_reset_standard_cxxflags_rel)
string(REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "" FORCE)
mark_as_advanced(CMAKE_CXX_FLAGS_RELEASE)
endif()
unset(_reset_standard_cflags_rel)
unset(_reset_standard_cxxflags_rel)
endmacro()

@ -46,7 +46,7 @@ __all__ = (
import sys
import os
from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
from os.path import join, dirname, normpath, abspath, splitext, exists
SOURCE_DIR = join(dirname(__file__), "..", "..")
SOURCE_DIR = normpath(SOURCE_DIR)

@ -449,10 +449,16 @@ def WinPyBundle(target=None, source=None, env=None):
shutil.rmtree(py_target, False, printexception)
exclude_re=[re.compile('.*/test/.*'),
re.compile('^config/.*'),
re.compile('^config-*/.*'),
re.compile('^distutils/.*'),
re.compile('^idlelib/.*'),
re.compile('^lib2to3/.*'),
re.compile('^tkinter/.*')]
re.compile('^tkinter/.*'),
re.compile('^_tkinter_d.pyd'),
re.compile('^turtledemo'),
re.compile('^turtle.py'),
]
print "Unpacking '" + py_tar + "' to '" + py_target + "'"
untar_pybundle(py_tar,py_target,exclude_re)
@ -569,17 +575,17 @@ def UnixPyBundle(target=None, source=None, env=None):
run("cp -R '%s' '%s'" % (py_src, os.path.dirname(py_target)))
run("rm -rf '%s/distutils'" % py_target)
run("rm -rf '%s/lib2to3'" % py_target)
run("rm -rf '%s/idlelib'" % py_target)
run("rm -rf '%s/tkinter'" % py_target)
run("rm -rf '%s/config'" % py_target)
run("rm -rf '%s/config-*'" % py_target)
run("rm -rf '%s/site-packages'" % py_target)
run("mkdir '%s/site-packages'" % py_target) # python needs it.'
run("rm -rf '%s/idlelib'" % py_target)
run("rm -rf '%s/tkinter'" % py_target)
run("rm -rf '%s/turtledemo'" % py_target)
run("rm -r '%s/turtle.py'" % py_target)
run("rm -f '%s/lib-dynload/_tkinter.so'" % py_target)
run("find '%s' -type d -name 'test' -prune -exec rm -rf {} ';'" % py_target)
run("find '%s' -type d -name 'config-*' -prune -exec rm -rf {} ';'" % py_target)
run("find '%s' -type d -name 'turtledemo' -prune -exec rm -rf {} ';'" % py_target)
run("find '%s' -type d -name '__pycache__' -exec rm -rf {} ';'" % py_target)
run("find '%s' -name '*.py[co]' -exec rm -rf {} ';'" % py_target)
run("find '%s' -name '*.so' -exec strip -s {} ';'" % py_target)

@ -615,10 +615,7 @@ def NSIS_Installer(target=None, source=None, env=None):
else:
if len(df)>0:
dp_tmp = dp[l:]
if dp_tmp.find('python\\lib') > -1:
datafiles += "\n" +r'SetOutPath $INSTDIR'+dp[l:]+"\n\n"
else:
datafiles += "\n"+r'SetOutPath $BLENDERHOME'+dp[l:]+"\n\n"
datafiles += "\n" +r'SetOutPath $INSTDIR'+dp[l:]+"\n\n"
for f in df:
outfile = os.path.join(dp,f)

@ -21,3 +21,19 @@ with bpy.data.libraries.load(filepath, link=True) as (data_from, data_to):
with bpy.data.libraries.load(filepath) as (data_from, data_to):
for attr in dir(data_to):
setattr(data_to, attr, getattr(data_from, attr))
# the 'data_to' variables lists are
with bpy.data.libraries.load(filepath) as (data_from, data_to):
data_to.scenes = ["Scene"]
# the loaded objects can be accessed from 'data_to' outside of the context
# since loading the data replaces the strings for the datablocks or None
# if the datablock could not be loaded.
with bpy.data.libraries.load(filepath) as (data_from, data_to):
data_to.meshes = data_from.meshes
# now operate directly on the loaded data
for mesh in data_to.meshes:
if mesh is not None:
print(mesh.name)

@ -34,7 +34,8 @@ For HTML generation
- Generate html docs by running...
sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
cd doc/python_api
sphinx-build sphinx-in sphinx-out
assuming that you have sphinx 1.0.7 installed
@ -64,8 +65,9 @@ else:
"bpy.props",
"bpy.utils",
"bpy.context",
# "bpy.types", # supports filtering
"bpy.types", # supports filtering
"bpy.ops", # supports filtering
#"bpy_extras",
"bge",
"aud",
"bgl",
@ -204,10 +206,24 @@ def write_indented_lines(ident, fn, text, strip=True):
'''
if text is None:
return
for l in text.split("\n"):
if strip:
fn(ident + l.strip() + "\n")
else:
lines = text.split("\n")
# strip empty lines from the start/end
while lines and not lines[0].strip():
del lines[0]
while lines and not lines[-1].strip():
del lines[-1]
if strip:
ident_strip = 1000
for l in lines:
if l.strip():
ident_strip = min(ident_strip, len(l) - len(l.lstrip()))
for l in lines:
fn(ident + l[ident_strip:] + "\n")
else:
for l in lines:
fn(ident + l + "\n")
@ -252,7 +268,7 @@ def pyfunc2sphinx(ident, fw, identifier, py_func, is_class=True):
fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str))
if py_func.__doc__:
write_indented_lines(ident + " ", fw, py_func.__doc__.strip())
write_indented_lines(ident + " ", fw, py_func.__doc__)
fw("\n")
@ -267,8 +283,10 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):
if type(descr) == GetSetDescriptorType:
fw(ident + ".. attribute:: %s\n\n" % identifier)
write_indented_lines(ident + " ", fw, doc, False)
fw("\n")
elif type(descr) in (MethodDescriptorType, ClassMethodDescriptorType):
write_indented_lines(ident, fw, doc, False)
fw("\n")
else:
raise TypeError("type was not GetSetDescriptorType, MethodDescriptorType or ClassMethodDescriptorType")
@ -316,11 +334,17 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
attribute_set = set()
filepath = os.path.join(BASEPATH, module_name + ".rst")
module_all = getattr(module, "__all__", None)
module_dir = sorted(dir(module))
if module_all:
module_dir = module_all
file = open(filepath, "w")
fw = file.write
write_title(fw, title, "=")
write_title(fw, "%s (%s)" % (title, module_name), "=")
fw(".. module:: %s\n\n" % module_name)
@ -331,6 +355,35 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
write_example_ref("", fw, module_name)
# write submodules
# we could also scan files but this ensures __all__ is used correctly
if module_all is not None:
submod_name = None
submod = None
submod_ls = []
for submod_name in module_all:
ns = {}
exec_str = "from %s import %s as submod" % (module.__name__, submod_name)
exec(exec_str, ns, ns)
submod = ns["submod"]
if type(submod) == types.ModuleType:
submod_ls.append((submod_name, submod))
del submod_name
del submod
if submod_ls:
fw(".. toctree::\n")
fw(" :maxdepth: 1\n\n")
for submod_name, submod in submod_ls:
submod_name_full = "%s.%s" % (module_name, submod_name)
fw(" %s.rst\n\n" % submod_name_full)
pymodule2sphinx(BASEPATH, submod_name_full, submod, "%s submodule" % module_name)
del submod_ls
# done writing submodules!
# write members of the module
# only tested with PyStructs which are not exactly modules
for key, descr in sorted(type(module).__dict__.items()):
@ -348,15 +401,15 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
if descr.__doc__:
fw(".. data:: %s\n\n" % key)
write_indented_lines(" ", fw, descr.__doc__, False)
attribute_set.add(key)
fw("\n")
attribute_set.add(key)
del key, descr
classes = []
for attribute in sorted(dir(module)):
for attribute in module_dir:
if not attribute.startswith("_"):
if attribute in attribute_set:
continue
@ -972,6 +1025,8 @@ def rna2sphinx(BASEPATH):
fw(" blf.rst\n\n")
if "aud" not in EXCLUDE_MODULES:
fw(" aud.rst\n\n")
if "bpy_extras" not in EXCLUDE_MODULES:
fw(" bpy_extras.rst\n\n")
# game engine
if "bge" not in EXCLUDE_MODULES:
@ -1068,41 +1123,45 @@ def rna2sphinx(BASEPATH):
# python modules
if "bpy.utils" not in EXCLUDE_MODULES:
from bpy import utils as module
pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities")
if "bpy.path" not in EXCLUDE_MODULES:
from bpy import path as module
pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities (bpy.path)")
pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities")
if "bpy_extras" not in EXCLUDE_MODULES:
import bpy_extras as module
pymodule2sphinx(BASEPATH, "bpy_extras", module, "Extra Utilities")
# C modules
if "bpy.app" not in EXCLUDE_MODULES:
from bpy import app as module
pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data (bpy.app)")
pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data")
if "bpy.props" not in EXCLUDE_MODULES:
from bpy import props as module
pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions (bpy.props)")
pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions")
if "mathutils" not in EXCLUDE_MODULES:
import mathutils as module
pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)")
pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities")
if "mathutils.geometry" not in EXCLUDE_MODULES:
import mathutils.geometry as module
pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities (mathutils.geometry)")
pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities")
if "mathutils.geometry" not in EXCLUDE_MODULES:
import blf as module
pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing")
# XXX TODO
#import bgl as module
#pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper (bgl)")
#pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper")
#del module
if "aud" not in EXCLUDE_MODULES:
import aud as module
pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)")
pymodule2sphinx(BASEPATH, "aud", module, "Audio System")
del module
## game engine

@ -18,17 +18,21 @@
# All rights reserved.
#
set(INC
./include
)
set(INC_SYS
)
set(SRC
binreloc.c
include/binreloc.h
)
set(INC
./include
)
add_definitions(-DENABLE_BINRELOC)
blender_add_lib(extern_binreloc "${SRC}" "${INC}")
blender_add_lib(extern_binreloc "${SRC}" "${INC}" "${INC_SYS}")

@ -29,6 +29,10 @@ set(INC
src
)
set(INC_SYS
)
set(SRC
src/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp
src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp
@ -145,7 +149,6 @@ set(SRC
src/LinearMath/btGeometryUtil.cpp
src/LinearMath/btQuickprof.cpp
src/LinearMath/btSerializer.cpp
src/Bullet-C-Api.h
src/BulletCollision/BroadphaseCollision/btAxisSweep3.h
@ -330,4 +333,4 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
blender_add_lib(extern_bullet "${SRC}" "${INC}")
blender_add_lib(extern_bullet "${SRC}" "${INC}" "${INC_SYS}")

@ -1026,7 +1026,7 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMaxUp(int axis, BP_FP_INT_TYPE ed
/// The btAxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase.
/// It uses arrays rather then lists for storage of the 3 axis. Also it operates using 16 bit integer coordinates instead of floats.
/// It uses arrays rather than lists for storage of the 3 axis. Also it operates using 16 bit integer coordinates instead of floats.
/// For large worlds and many objects, use bt32BitAxisSweep3 or btDbvtBroadphase instead. bt32BitAxisSweep3 has higher precision and allows more then 16384 objects at the cost of more memory and bit of performance.
class btAxisSweep3 : public btAxisSweep3Internal<unsigned short int>
{
@ -1038,7 +1038,7 @@ public:
/// The bt32BitAxisSweep3 allows higher precision quantization and more objects compared to the btAxisSweep3 sweep and prune.
/// This comes at the cost of more memory per handle, and a bit slower performance.
/// It uses arrays rather then lists for storage of the 3 axis.
/// It uses arrays rather than lists for storage of the 3 axis.
class bt32BitAxisSweep3 : public btAxisSweep3Internal<unsigned int>
{
public:

@ -487,7 +487,7 @@ btScalar btConvexConvexAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,
{
(void)resultOut;
(void)dispatchInfo;
///Rather then checking ALL pairs, only calculate TOI when motion exceeds threshold
///rather than checking ALL pairs, only calculate TOI when motion exceeds threshold
///Linear motion for one of objects needs to exceed m_ccdSquareMotionThreshold
///col0->m_worldTransform,

@ -28,8 +28,12 @@ set(INC
./include
)
set(INC_SYS
)
if(UNIX)
list(APPEND INC ${X11_X11_INCLUDE_PATH})
list(APPEND INC_SYS ${X11_X11_INCLUDE_PATH})
endif()
set(SRC
@ -42,4 +46,4 @@ set(SRC
add_definitions(-DGLEW_STATIC)
blender_add_lib(extern_glew "${SRC}" "${INC}")
blender_add_lib(extern_glew "${SRC}" "${INC}" "${INC_SYS}")

@ -28,6 +28,10 @@ set(INC
.
)
set(INC_SYS
)
set(SRC
bio.c
cio.c
@ -73,4 +77,4 @@ set(SRC
tgt.h
)
blender_add_lib(extern_openjpeg "${SRC}" "${INC}")
blender_add_lib(extern_openjpeg "${SRC}" "${INC}" "${INC_SYS}")

@ -26,6 +26,9 @@
set(INC
.
)
set(INC_SYS
../libopenjpeg
)
@ -39,4 +42,4 @@ set(SRC
format.h
)
blender_add_lib(extern_redcode "${SRC}" "${INC}")
blender_add_lib(extern_redcode "${SRC}" "${INC}" "${INC_SYS}")

@ -28,6 +28,10 @@ set(INC
.
)
set(INC_SYS
)
set(SRC
Alloc.c
LzFind.c
@ -44,4 +48,4 @@ set(SRC
Types.h
)
blender_add_lib(extern_lzma "${SRC}" "${INC}")
blender_add_lib(extern_lzma "${SRC}" "${INC}" "${INC_SYS}")

@ -28,6 +28,10 @@ set(INC
include
)
set(INC_SYS
)
set(SRC
minilzo/minilzo.c
@ -36,4 +40,4 @@ set(SRC
minilzo/minilzo.h
)
blender_add_lib(extern_minilzo "${SRC}" "${INC}")
blender_add_lib(extern_minilzo "${SRC}" "${INC}" "${INC_SYS}")

@ -23,9 +23,13 @@
set(INC
.
intern
FX SRC
FX
SRC
../ffmpeg
)
set(INC_SYS
${PTHREADS_INC}
${LIBSAMPLERATE_INC}
)
set(SRC
@ -155,8 +159,9 @@ set(SRC
if(WITH_CODEC_FFMPEG)
add_definitions(-DWITH_FFMPEG)
list(APPEND INC ffmpeg ${FFMPEG_INC})
set(FFMPEGSRC
list(APPEND INC ffmpeg)
list(APPEND INC_SYS ${FFMPEG_INC})
list(APPEND SRC
ffmpeg/AUD_FFMPEGFactory.cpp
ffmpeg/AUD_FFMPEGReader.cpp
@ -167,8 +172,9 @@ endif()
if(WITH_SDL)
add_definitions(-DWITH_SDL)
list(APPEND INC SDL ${SDL_INCLUDE_DIR})
set(SDLSRC
list(APPEND INC SDL)
list(APPEND INC_SYS ${SDL_INCLUDE_DIR})
list(APPEND SRC
SDL/AUD_SDLDevice.cpp
SDL/AUD_SDLDevice.h
@ -177,18 +183,20 @@ endif()
if(WITH_OPENAL)
add_definitions(-DWITH_OPENAL)
list(APPEND INC OpenAL ${OPENAL_INCLUDE_DIR})
set(OPENALSRC
list(APPEND INC OpenAL)
list(APPEND INC_SYS ${OPENAL_INCLUDE_DIR})
list(APPEND SRC
OpenAL/AUD_OpenALDevice.cpp
OpenAL/AUD_OpenALDevice.h
)
)
endif()
if(WITH_JACK)
add_definitions(-DWITH_JACK)
list(APPEND INC jack ${JACK_INC})
set(JACKSRC
list(APPEND INC jack)
list(APPEND INC_SYS ${JACK_INC})
list(APPEND SRC
jack/AUD_JackDevice.cpp
jack/AUD_JackDevice.h
@ -197,8 +205,9 @@ endif()
if(WITH_CODEC_SNDFILE)
add_definitions(-DWITH_SNDFILE)
list(APPEND INC sndfile ${SNDFILE_INC})
set(SNDFILESRC
list(APPEND INC sndfile)
list(APPEND INC_SYS ${SNDFILE_INC})
list(APPEND SRC
sndfile/AUD_SndFileFactory.cpp
sndfile/AUD_SndFileReader.cpp
@ -209,7 +218,8 @@ endif()
if(WITH_SAMPLERATE)
add_definitions(-DWITH_SAMPLERATE)
set(SRCFILESRC
list(APPEND INC_SYS ${LIBSAMPLERATE_INC})
list(APPEND SRC
SRC/AUD_SRCResampleFactory.cpp
SRC/AUD_SRCResampleReader.cpp
@ -220,8 +230,9 @@ endif()
if(WITH_FFTW3 AND FALSE)
add_definitions(-DWITH_FFTW3)
list(APPEND INC fftw ${FFTW3_INC})
set(FFTW3SRC
list(APPEND INC fftw)
list(APPEND INC_SYS ${FFTW3_INC})
list(APPEND SRC
fftw/AUD_BandPassFactory.cpp
fftw/AUD_BandPassReader.cpp
@ -231,8 +242,9 @@ if(WITH_FFTW3 AND FALSE)
endif()
if(WITH_PYTHON)
list(APPEND INC Python ${PYTHON_INCLUDE_DIRS})
set(PYTHONSRC
list(APPEND INC Python)
list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS})
list(APPEND SRC
Python/AUD_PyAPI.cpp
Python/AUD_PyAPI.h
@ -240,16 +252,4 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
set(SRC
${SRC}
${FFMPEGSRC}
${SNDFILESRC}
${SRCFILESRC}
${FFTW3SRC}
${SDLSRC}
${OPENALSRC}
${JACKSRC}
${PYTHONSRC}
)
blender_add_lib(bf_intern_audaspace "${SRC}" "${INC}")
blender_add_lib(bf_intern_audaspace "${SRC}" "${INC}" "${INC_SYS}")

@ -8,7 +8,7 @@ defs = []
if env['WITH_BF_FFMPEG']:
sources += env.Glob('ffmpeg/*.cpp')
incs += ' ffmpeg ' + env['BF_FFMPEG_INC']
incs += ' ffmpeg #/intern/ffmpeg ' + env['BF_FFMPEG_INC']
defs.append('WITH_FFMPEG')
if env['WITH_BF_SDL']:

@ -39,6 +39,7 @@
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include "ffmpeg_compat.h"
}
int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
@ -52,6 +53,10 @@ int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
int read_length, data_size;
AVPacket tmp_pkt;
av_init_packet(&tmp_pkt);
// as long as there is still data in the package
while(audio_pkg_size > 0)
{
@ -64,15 +69,14 @@ int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
// read samples from the packet
data_size = buf_size - buf_pos;
/*read_length = avcodec_decode_audio3(m_codecCtx,
(int16_t*)(((data_t*)buffer.getBuffer())+buf_pos),
&data_size,
packet);*/
read_length = avcodec_decode_audio2(m_codecCtx,
(int16_t*)(((data_t*)buffer.getBuffer()) + buf_pos),
&data_size,
audio_pkg_data,
audio_pkg_size);
tmp_pkt.data = audio_pkg_data;
tmp_pkt.size = audio_pkg_size;
read_length = avcodec_decode_audio3(
m_codecCtx,
(int16_t*)(((data_t*)buffer.getBuffer()) + buf_pos),
&data_size, &tmp_pkt);
// read error, next packet!
if(read_length < 0)
@ -112,7 +116,7 @@ void AUD_FFMPEGReader::init()
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
{
if((m_formatCtx->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO)
if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
&& (m_stream < 0))
{
m_stream=i;

@ -36,6 +36,10 @@ set(INC
../../source/blender/makesdna
)
set(INC_SYS
)
set(SRC
intern/BOP_BBox.cpp
intern/BOP_BSPNode.cpp
@ -75,4 +79,4 @@ set(SRC
intern/BOP_Vertex.h
)
blender_add_lib(bf_intern_bop "${SRC}" "${INC}")
blender_add_lib(bf_intern_bop "${SRC}" "${INC}" "${INC_SYS}")

@ -27,10 +27,15 @@
set(INC
./intern
../container
../guardedalloc
../moto/include
../memutil
)
set(INC_SYS
)
set(SRC
intern/BSP_CSGMesh.cpp
intern/BSP_MeshPrimitives.cpp
@ -43,4 +48,4 @@ set(SRC
intern/BSP_MeshPrimitives.h
)
blender_add_lib(bf_intern_bsp "${SRC}" "${INC}")
blender_add_lib(bf_intern_bsp "${SRC}" "${INC}" "${INC_SYS}")

@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('intern/*.cpp')
incs = 'intern ../container ../moto/include ../memutil'
incs = 'intern ../container ../moto/include ../memutil ../guardedalloc'
env.BlenderLib ('bf_intern_bsp', sources, Split(incs), [], libtype=['core','player'], priority=[200,100] )

@ -29,6 +29,10 @@ set(INC
../guardedalloc
)
set(INC_SYS
)
set(SRC
intern/CTR_List.cpp
@ -40,4 +44,4 @@ set(SRC
CTR_UHeap.h
)
blender_add_lib(bf_intern_ctr "${SRC}" "${INC}")
blender_add_lib(bf_intern_ctr "${SRC}" "${INC}" "${INC_SYS}")

@ -52,6 +52,8 @@
#include <functional>
#include "MEM_sys_types.h"
enum {
empty_tag = 0x0,
@ -100,9 +102,9 @@ public:
#if defined(_WIN64)
CTR_TaggedIndex(
const unsigned __int64 val
const uint64_t val
) :
m_val ( ((unsigned __int64)val & index_mask)
m_val ( ((uint64_t)val & index_mask)
| ( (empty_tag << tag_shift)
& (~index_mask) ) ) {
}
@ -140,8 +142,8 @@ public:
}
#if defined(_WIN64)
operator unsigned __int64 () const {
return (unsigned __int64)(m_val & index_mask);
operator uint64_t () const {
return (uint64_t)(m_val & index_mask);
}
#endif

@ -27,10 +27,15 @@
set(INC
.
../container
../guardedalloc
../memutil
../moto/include
)
set(INC_SYS
)
set(SRC
intern/LOD_EdgeCollapser.cpp
intern/LOD_ExternNormalEditor.cpp
@ -56,4 +61,4 @@ set(SRC
intern/LOD_QuadricEditor.h
)
blender_add_lib(bf_intern_decimate "${SRC}" "${INC}")
blender_add_lib(bf_intern_decimate "${SRC}" "${INC}" "${INC_SYS}")

@ -3,6 +3,6 @@ Import ('env')
sources = env.Glob('intern/*.cpp')
incs = '. ../moto/include ../container ../memutil'
incs = '. ../moto/include ../container ../memutil ../guardedalloc'
env.BlenderLib ('bf_intern_decimate', sources, Split(incs) , [], libtype=['core', 'player'], priority = [200, 100] )

@ -26,6 +26,9 @@
set(INC
extern
)
set(INC_SYS
${PNG_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
)
@ -88,11 +91,11 @@ set(SRC
add_definitions(-DNOGUI -DELBEEM_BLENDER=1)
if(WINDOWS)
add_definitions(-DUSE_MSVC6FIXES)
add_definitions(-DUSE_MSVC6FIXES)
endif()
if(WITH_OPENMP)
add_definitions(-DPARALLEL=1)
add_definitions(-DPARALLEL=1)
endif()
blender_add_lib_nolist(bf_intern_elbeem "${SRC}" "${INC}")
blender_add_lib_nolist(bf_intern_elbeem "${SRC}" "${INC}" "${INC_SYS}")

@ -0,0 +1,133 @@
#ifndef __ffmpeg_compat_h_included__
#define __ffmpeg_compat_h_included__ 1
/*
* $Id$
*
* compatibility macros to make every ffmpeg installation appear
* like the most current installation (wrapping some functionality sometimes)
* it also includes all ffmpeg header files at once, no need to do it
* seperately.
*
* Copyright (c) 2011 Peter Schlaile
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/rational.h>
#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101))
#define FFMPEG_HAVE_PARSE_UTILS 1
#include <libavutil/parseutils.h>
#endif
#include <libswscale/swscale.h>
#include <libavcodec/opt.h>
#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 105))
#define FFMPEG_HAVE_AVIO 1
#endif
#if (LIBAVCODEC_VERSION_MAJOR > 53) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR > 1)) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR == 1) && (LIBAVCODEC_VERSION_MICRO >= 1))
#define FFMPEG_HAVE_DEFAULT_VAL_UNION 1
#endif
#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101))
#define FFMPEG_HAVE_AV_DUMP_FORMAT 1
#endif
#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 45))
#define FFMPEG_HAVE_AV_GUESS_FORMAT 1
#endif
#if (LIBAVCODEC_VERSION_MAJOR > 52) || ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 23))
#define FFMPEG_HAVE_DECODE_AUDIO3 1
#define FFMPEG_HAVE_DECODE_VIDEO2 1
#endif
#if (LIBAVCODEC_VERSION_MAJOR > 52) || ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 64))
#define FFMPEG_HAVE_AVMEDIA_TYPES 1
#endif
#if ((LIBAVCODEC_VERSION_MAJOR > 52) || (LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 29)) && \
((LIBSWSCALE_VERSION_MAJOR > 0) || (LIBSWSCALE_VERSION_MAJOR >= 0) && (LIBSWSCALE_VERSION_MINOR >= 10))
#define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
#endif
#ifndef FFMPEG_HAVE_AVIO
#define AVIO_FLAG_WRITE URL_WRONLY
#define avio_open url_fopen
#define avio_tell url_ftell
#define avio_close url_fclose
#endif
/* there are some version inbetween, which have avio_... functions but no
AVIO_FLAG_... */
#ifndef AVIO_FLAG_WRITE
#define AVIO_FLAG_WRITE URL_WRONLY
#endif
#ifndef AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
#endif
#ifndef FFMPEG_HAVE_AV_DUMP_FORMAT
#define av_dump_format dump_format
#endif
#ifndef FFMPEG_HAVE_AV_GUESS_FORMAT
#define av_guess_format guess_format
#endif
#ifndef FFMPEG_HAVE_PARSE_UTILS
#define av_parse_video_rate av_parse_video_frame_rate
#endif
#ifdef FFMPEG_HAVE_DEFAULT_VAL_UNION
#define FFMPEG_DEF_OPT_VAL_INT(OPT) OPT->default_val.i64
#define FFMPEG_DEF_OPT_VAL_DOUBLE(OPT) OPT->default_val.dbl
#else
#define FFMPEG_DEF_OPT_VAL_INT(OPT) OPT->default_val
#define FFMPEG_DEF_OPT_VAL_DOUBLE(OPT) OPT->default_val
#endif
#ifndef FFMPEG_HAVE_AVMEDIA_TYPES
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
#endif
#ifndef FFMPEG_HAVE_DECODE_AUDIO3
static inline
int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
int *frame_size_ptr, AVPacket *avpkt)
{
return avcodec_decode_audio2(avctx, samples,
frame_size_ptr, avpkt->data,
avpkt->size);
}
#endif
#ifndef FFMPEG_HAVE_DECODE_VIDEO2
static inline
int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
int *got_picture_ptr,
AVPacket *avpkt)
{
return avcodec_decode_video(avctx, picture, got_picture_ptr,
avpkt->data, avpkt->size);
}
#endif
#endif

@ -29,6 +29,9 @@ set(INC
../string
../../source/blender/imbuf
../../source/blender/makesdna
)
set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@ -123,7 +126,7 @@ elseif(UNIX)
add_definitions(-DWITH_X11_XINPUT)
endif()
list(APPEND INC ${X11_X11_INCLUDE_PATH})
list(APPEND INC_SYS ${X11_X11_INCLUDE_PATH})
list(APPEND SRC
intern/GHOST_DisplayManagerX11.cpp
@ -143,7 +146,7 @@ elseif(UNIX)
if(X11_XF86keysym_INCLUDE_PATH)
add_definitions(-DWITH_XF86KEYSYM)
list(APPEND INC ${X11_XF86keysym_INCLUDE_PATH})
list(APPEND INC_SYS ${X11_XF86keysym_INCLUDE_PATH})
endif()
elseif(WIN32)
@ -151,7 +154,7 @@ elseif(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
endif()
list(APPEND INC ${WINTAB_INC})
list(APPEND INC_SYS ${WINTAB_INC})
list(APPEND SRC
intern/GHOST_DisplayManagerWin32.cpp
@ -169,5 +172,5 @@ elseif(WIN32)
)
endif()
blender_add_lib(bf_intern_ghost "${SRC}" "${INC}")
blender_add_lib(bf_intern_ghost "${SRC}" "${INC}" "${INC_SYS}")

@ -795,6 +795,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
}
default: {
#ifdef WITH_X11_XINPUT
if(xe->type == window->GetXTablet().MotionEvent)
{
XDeviceMotionEvent* data = (XDeviceMotionEvent*)xe;
@ -818,7 +819,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
}
else if(xe->type == window->GetXTablet().ProxOutEvent)
window->GetXTablet().CommonData.Active= GHOST_kTabletModeNone;
#endif // WITH_X11_XINPUT
break;
}
}

@ -461,9 +461,13 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
GHOST_WindowCocoa::~GHOST_WindowCocoa()
{
if (m_customCursor) delete m_customCursor;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (m_customCursor) {
[m_customCursor release];
m_customCursor = nil;
}
[m_openGLView release];
if (m_window) {

@ -182,9 +182,12 @@ GHOST_WindowX11(
Atom atoms[2];
int natom;
int glxVersionMajor, glxVersionMinor; // As in GLX major.minor
#ifdef WITH_X11_XINPUT
/* initialize incase X11 fails to load */
memset(&m_xtablet, 0, sizeof(m_xtablet));
#endif
m_visual= NULL;
if (!glXQueryVersion(m_display, &glxVersionMajor, &glxVersionMinor)) {

@ -38,7 +38,9 @@
#include <X11/Xlib.h>
#include <GL/glx.h>
// For tablets
#include <X11/extensions/XInput.h>
#ifdef WITH_X11_XINPUT
# include <X11/extensions/XInput.h>
#endif
#include <map>
@ -190,7 +192,7 @@ public:
Window
getXWindow(
);
#ifdef WITH_X11_XINPUT
class XTablet
{
public:
@ -214,6 +216,10 @@ public:
const GHOST_TabletData* GetTabletData()
{ return &m_xtablet.CommonData; }
#else // WITH_X11_XINPUT
const GHOST_TabletData* GetTabletData()
{ return NULL; }
#endif // WITH_X11_XINPUT
/*
* Need this in case that we want start the window
@ -321,7 +327,9 @@ private :
getEmptyCursor(
);
#ifdef WITH_X11_XINPUT
void initXInputDevices();
#endif
GLXContext m_context;
Window m_window;
@ -350,8 +358,10 @@ private :
/** Cache of XC_* ID's to XCursor structures */
std::map<unsigned int, Cursor> m_standard_cursors;
#ifdef WITH_X11_XINPUT
/* Tablet devices */
XTablet m_xtablet;
#endif
void icccmSetState(int state);
int icccmGetState() const;

@ -24,7 +24,13 @@
#
# ***** END GPL LICENSE BLOCK *****
set(INC .)
set(INC
.
)
set(INC_SYS
)
set(SRC
./intern/mallocn.c
@ -41,12 +47,12 @@ if(WIN32 AND NOT UNIX)
)
endif()
blender_add_lib(bf_intern_guardedalloc "${SRC}" "${INC}")
blender_add_lib(bf_intern_guardedalloc "${SRC}" "${INC}" "${INC_SYS}")
# Override C++ alloc, optional.
if(WITH_CXX_GUARDEDALLOC)
set(SRC
cpp/mallocn.cpp
)
blender_add_lib(bf_intern_guardedalloc_cpp "${SRC}" "${INC}")
blender_add_lib(bf_intern_guardedalloc_cpp "${SRC}" "${INC}" "${INC_SYS}")
endif()

@ -30,6 +30,10 @@ set(INC
../moto/include
)
set(INC_SYS
)
set(SRC
intern/IK_QJacobian.cpp
intern/IK_QJacobianSolver.cpp
@ -70,4 +74,4 @@ set(SRC
intern/TNT/version.h
)
blender_add_lib(bf_intern_ik "${SRC}" "${INC}")
blender_add_lib(bf_intern_ik "${SRC}" "${INC}" "${INC_SYS}")

@ -28,6 +28,10 @@ set(INC
../../extern/Eigen2
)
set(INC_SYS
)
set(SRC
Armature.cpp
Cache.cpp
@ -222,4 +226,4 @@ set(SRC
../../extern/Eigen2/Eigen/src/Sparse/UmfPackSupport.h
)
blender_add_lib(bf_intern_itasc "${SRC}" "${INC}")
blender_add_lib(bf_intern_itasc "${SRC}" "${INC}" "${INC_SYS}")

@ -29,6 +29,10 @@ set(INC
..
)
set(INC_SYS
)
set(SRC
intern/MEM_CacheLimiterC-Api.cpp
intern/MEM_RefCountedC-Api.cpp
@ -43,4 +47,4 @@ set(SRC
MEM_SmartPtr.h
)
blender_add_lib(bf_intern_memutil "${SRC}" "${INC}")
blender_add_lib(bf_intern_memutil "${SRC}" "${INC}" "${INC_SYS}")

@ -28,11 +28,15 @@ set(INC
.
)
set(INC_SYS
)
set(SRC
mikktspace.c
mikktspace.h
)
blender_add_lib(bf_intern_mikktspace "${SRC}" "${INC}")
blender_add_lib(bf_intern_mikktspace "${SRC}" "${INC}" "${INC_SYS}")

@ -28,6 +28,10 @@ set(INC
include
)
set(INC_SYS
)
set(SRC
intern/MT_Assert.cpp
intern/MT_CmMatrix4x4.cpp
@ -67,4 +71,4 @@ set(SRC
include/NM_Scalar.h
)
blender_add_lib(bf_intern_moto "${SRC}" "${INC}")
blender_add_lib(bf_intern_moto "${SRC}" "${INC}" "${INC_SYS}")

@ -36,6 +36,10 @@ set(INC
superlu
)
set(INC_SYS
)
set(SRC
intern/opennl.c
superlu/colamd.c
@ -79,4 +83,4 @@ set(SRC
superlu/util.h
)
blender_add_lib(bf_intern_opennl "${SRC}" "${INC}")
blender_add_lib(bf_intern_opennl "${SRC}" "${INC}" "${INC_SYS}")

@ -28,6 +28,9 @@ set(INC
intern
../memutil
../../extern/bullet2/src
)
set(INC_SYS
${PNG_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
)
@ -89,5 +92,5 @@ if(WITH_FFTW3)
list(APPEND INC ${FFTW3_INC})
endif()
blender_add_lib(bf_intern_smoke "${SRC}" "${INC}")
blender_add_lib(bf_intern_smoke "${SRC}" "${INC}" "${INC_SYS}")

@ -28,6 +28,10 @@ set(INC
.
)
set(INC_SYS
)
set(SRC
intern/STR_String.cpp
@ -35,4 +39,4 @@ set(SRC
STR_String.h
)
blender_add_lib(bf_intern_string "${SRC}" "${INC}")
blender_add_lib(bf_intern_string "${SRC}" "${INC}" "${INC_SYS}")

@ -379,7 +379,9 @@ def preset_find(name, preset_path, display_name=False):
def keyconfig_set(filepath):
from os.path import basename, splitext
print("loading preset:", filepath)
if _bpy.app.debug:
print("loading preset:", filepath)
keyconfigs = _bpy.context.window_manager.keyconfigs
keyconfigs_old = keyconfigs[:]

@ -28,4 +28,4 @@ __all__ = (
"image_utils",
"mesh_utils",
"view3d_utils",
)
)

@ -18,10 +18,90 @@
# <pep8 compliant>
__all__ = (
"load_image",
)
def image_load(filepath, dirpath, place_holder=False, recursive=False, convert_callback=None):
# limited replacement for BPyImage.comprehensiveImageLoad
def load_image(imagepath,
dirname="",
place_holder=False,
recursive=False,
ncase_cmp=True,
convert_callback=None,
verbose=False,
):
"""
Return an image from the file path with options to search multiple paths and
return a placeholder if its not found.
:arg filepath: The image filename
If a path precedes it, this will be searched as well.
:type filepath: string
:arg dirname: is the directory where the image may be located - any file at
the end will be ignored.
:type dirname: string
:arg place_holder: if True a new place holder image will be created.
this is usefull so later you can relink the image to its original data.
:type place_holder: bool
:arg recursive: If True, directories will be recursivly searched.
Be carefull with this if you have files in your root directory because
it may take a long time.
:type recursive: bool
:arg ncase_cmp: on non windows systems, find the correct case for the file.
:type ncase_cmp: bool
:arg convert_callback: a function that takes an existing path and returns a new one.
Use this when loading image formats blender may not support, the CONVERT_CALLBACK
can take the path for a GIF (for example), convert it to a PNG and return the PNG's path.
For formats blender can read, simply return the path that is given.
:type convert_callback: function
:return: an image or None
:rtype: :class:`Image`
"""
import os
import bpy
try:
return bpy.data.images.load(filepath)
except RuntimeError:
return bpy.data.images.new("Untitled", 128, 128)
# TODO: recursive
def _image_load(path):
import bpy
if convert_callback:
path = convert_callback(path)
image = bpy.data.images.load(path)
if verbose:
print(" image loaded '%s'" % path)
return image
if verbose:
print("load_image('%s', '%s', ...)" % (imagepath, dirname))
if os.path.exists(imagepath):
return _image_load(imagepath)
variants = [imagepath]
if dirname:
variants += [os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
for filepath_test in variants:
if ncase_cmp:
ncase_variants = filepath_test, bpy.path.resolve_ncase(filepath)
else:
ncase_variants = (filepath_test, )
for nfilepath in ncase_variants:
if os.path.exists(nfilepath):
return _image_load(nfilepath)
if place_holder:
image = bpy.data.images.new(os.path.basename(filepath), 128, 128)
# allow the path to be resolved later
image.filepath = imagepath
return image
# TODO comprehensiveImageLoad also searched in bpy.config.textureDir
return None

@ -18,6 +18,19 @@
# <pep8 compliant>
__all__ = (
"ExportHelper",
"ImportHelper",
"axis_conversion",
"create_derived_objects",
"free_derived_objects",
"unpack_list",
"unpack_face_list",
"path_reference",
"path_reference_copy",
"path_reference_mode",
)
import bpy
from bpy.props import StringProperty, BoolProperty, EnumProperty
@ -101,29 +114,29 @@ _axis_convert_matrix = (
# where all 4 values are or'd into a single value...
# (i1<<0 | i1<<3 | i1<<6 | i1<<9)
_axis_convert_lut = (
{0x5c, 0x9a, 0x119, 0x15d, 0x20b, 0x2a2, 0x2c8, 0x365, 0x413, 0x46c, 0x4d0, 0x529, 0x644, 0x682, 0x701, 0x745, 0x823, 0x88a, 0x8e0, 0x94d, 0xa2b, 0xa54, 0xae8, 0xb11},
{0x9c, 0xac, 0x159, 0x169, 0x22b, 0x2e8, 0x40b, 0x465, 0x4c8, 0x522, 0x684, 0x694, 0x741, 0x751, 0x813, 0x8d0, 0xa23, 0xa4d, 0xae0, 0xb0a},
{0x99, 0xa9, 0x15c, 0x16c, 0x213, 0x2d0, 0x423, 0x44a, 0x4e0, 0x50d, 0x681, 0x691, 0x744, 0x754, 0x82b, 0x8e8, 0xa0b, 0xa62, 0xac8, 0xb25},
{0x59, 0x85, 0x11c, 0x142, 0x223, 0x28d, 0x2e0, 0x34a, 0x42b, 0x469, 0x4e8, 0x52c, 0x641, 0x69d, 0x704, 0x75a, 0x80b, 0x8a5, 0x8c8, 0x962, 0xa13, 0xa51, 0xad0, 0xb14},
{0xa5, 0x162, 0x21c, 0x285, 0x2d9, 0x342, 0x463, 0x46b, 0x520, 0x528, 0x68d, 0x74a, 0x804, 0x89d, 0x8c1, 0x95a, 0xa4b, 0xa53, 0xb08, 0xb10},
{0x4b, 0x53, 0x108, 0x110, 0x29c, 0x2ac, 0x359, 0x369, 0x41a, 0x422, 0x4dd, 0x4e5, 0x663, 0x66b, 0x720, 0x728, 0x884, 0x894, 0x941, 0x951, 0xa02, 0xa0a, 0xac5, 0xacd},
{0x63, 0x6b, 0x120, 0x128, 0x299, 0x2a9, 0x35c, 0x36c, 0x405, 0x40d, 0x4c2, 0x4ca, 0x64b, 0x653, 0x708, 0x710, 0x881, 0x891, 0x944, 0x954, 0xa1d, 0xa25, 0xada, 0xae2},
{0x8a, 0x14d, 0x219, 0x29a, 0x2dc, 0x35d, 0x44b, 0x453, 0x508, 0x510, 0x6a2, 0x765, 0x801, 0x882, 0x8c4, 0x945, 0xa63, 0xa6b, 0xb20, 0xb28},
{0x5a, 0x62, 0x8b, 0x11d, 0x125, 0x148, 0x22c, 0x28b, 0x293, 0x2e9, 0x348, 0x350, 0x41c, 0x42c, 0x45a, 0x4d9, 0x4e9, 0x51d, 0x642, 0x64a, 0x6a3, 0x705, 0x70d, 0x760, 0x814, 0x8a3, 0x8ab, 0x8d1, 0x960, 0x968, 0xa04, 0xa14, 0xa42, 0xac1, 0xad1, 0xb05},
{0x54, 0xab, 0x111, 0x168, 0x21d, 0x225, 0x2da, 0x2e2, 0x45c, 0x519, 0x66c, 0x693, 0x729, 0x750, 0x805, 0x80d, 0x8c2, 0x8ca, 0xa44, 0xb01},
{0x51, 0x93, 0x114, 0x150, 0x202, 0x20a, 0x2c5, 0x2cd, 0x459, 0x51c, 0x669, 0x6ab, 0x72c, 0x768, 0x81a, 0x822, 0x8dd, 0x8e5, 0xa41, 0xb04},
{0x45, 0x4d, 0xa3, 0x102, 0x10a, 0x160, 0x229, 0x2a3, 0x2ab, 0x2ec, 0x360, 0x368, 0x419, 0x429, 0x445, 0x4dc, 0x4ec, 0x502, 0x65d, 0x665, 0x68b, 0x71a, 0x722, 0x748, 0x811, 0x88b, 0x893, 0x8d4, 0x948, 0x950, 0xa01, 0xa11, 0xa5d, 0xac4, 0xad4, 0xb1a},
{0x5d, 0x65, 0xa0, 0x11a, 0x122, 0x163, 0x214, 0x2a0, 0x2a8, 0x2d1, 0x363, 0x36b, 0x404, 0x414, 0x45d, 0x4c1, 0x4d1, 0x51a, 0x645, 0x64d, 0x688, 0x702, 0x70a, 0x74b, 0x82c, 0x888, 0x890, 0x8e9, 0x94b, 0x953, 0xa1c, 0xa2c, 0xa45, 0xad9, 0xae9, 0xb02},
{0x6c, 0x90, 0x129, 0x153, 0x21a, 0x222, 0x2dd, 0x2e5, 0x444, 0x501, 0x654, 0x6a8, 0x711, 0x76b, 0x802, 0x80a, 0x8c5, 0x8cd, 0xa5c, 0xb19},
{0x69, 0xa8, 0x12c, 0x16b, 0x205, 0x20d, 0x2c2, 0x2ca, 0x441, 0x504, 0x651, 0x690, 0x714, 0x753, 0x81d, 0x825, 0x8da, 0x8e2, 0xa59, 0xb1c},
{0x42, 0x4a, 0x88, 0x105, 0x10d, 0x14b, 0x211, 0x288, 0x290, 0x2d4, 0x34b, 0x353, 0x401, 0x411, 0x442, 0x4c4, 0x4d4, 0x505, 0x65a, 0x662, 0x6a0, 0x71d, 0x725, 0x763, 0x829, 0x8a0, 0x8a8, 0x8ec, 0x963, 0x96b, 0xa19, 0xa29, 0xa5a, 0xadc, 0xaec, 0xb1d},
{0xa2, 0x165, 0x204, 0x282, 0x2c1, 0x345, 0x448, 0x450, 0x50b, 0x513, 0x68a, 0x74d, 0x81c, 0x89a, 0x8d9, 0x95d, 0xa60, 0xa68, 0xb23, 0xb2b},
{0x60, 0x68, 0x123, 0x12b, 0x284, 0x294, 0x341, 0x351, 0x41d, 0x425, 0x4da, 0x4e2, 0x648, 0x650, 0x70b, 0x713, 0x89c, 0x8ac, 0x959, 0x969, 0xa05, 0xa0d, 0xac2, 0xaca},
{0x48, 0x50, 0x10b, 0x113, 0x281, 0x291, 0x344, 0x354, 0x402, 0x40a, 0x4c5, 0x4cd, 0x660, 0x668, 0x723, 0x72b, 0x899, 0x8a9, 0x95c, 0x96c, 0xa1a, 0xa22, 0xadd, 0xae5},
{0x8d, 0x14a, 0x201, 0x29d, 0x2c4, 0x35a, 0x460, 0x468, 0x523, 0x52b, 0x6a5, 0x762, 0x819, 0x885, 0x8dc, 0x942, 0xa48, 0xa50, 0xb0b, 0xb13},
{0x44, 0x9d, 0x101, 0x15a, 0x220, 0x2a5, 0x2e3, 0x362, 0x428, 0x454, 0x4eb, 0x511, 0x65c, 0x685, 0x719, 0x742, 0x808, 0x88d, 0x8cb, 0x94a, 0xa10, 0xa6c, 0xad3, 0xb29},
{0x84, 0x94, 0x141, 0x151, 0x210, 0x2d3, 0x420, 0x462, 0x4e3, 0x525, 0x69c, 0x6ac, 0x759, 0x769, 0x828, 0x8eb, 0xa08, 0xa4a, 0xacb, 0xb0d},
{0x81, 0x91, 0x144, 0x154, 0x228, 0x2eb, 0x408, 0x44d, 0x4cb, 0x50a, 0x699, 0x6a9, 0x75c, 0x76c, 0x810, 0x8d3, 0xa20, 0xa65, 0xae3, 0xb22},
{0x8C8, 0x4D0, 0x2E0, 0xAE8, 0x701, 0x511, 0x119, 0xB29, 0x682, 0x88A, 0x09A, 0x2A2, 0x80B, 0x413, 0x223, 0xA2B, 0x644, 0x454, 0x05C, 0xA6C, 0x745, 0x94D, 0x15D, 0x365},
{0xAC8, 0x8D0, 0x4E0, 0x2E8, 0x741, 0x951, 0x159, 0x369, 0x702, 0xB0A, 0x11A, 0x522, 0xA0B, 0x813, 0x423, 0x22B, 0x684, 0x894, 0x09C, 0x2AC, 0x645, 0xA4D, 0x05D, 0x465},
{0x4C8, 0x2D0, 0xAE0, 0x8E8, 0x681, 0x291, 0x099, 0x8A9, 0x642, 0x44A, 0x05A, 0xA62, 0x40B, 0x213, 0xA23, 0x82B, 0x744, 0x354, 0x15C, 0x96C, 0x705, 0x50D, 0x11D, 0xB25},
{0x2C8, 0xAD0, 0x8E0, 0x4E8, 0x641, 0xA51, 0x059, 0x469, 0x742, 0x34A, 0x15A, 0x962, 0x20B, 0xA13, 0x823, 0x42B, 0x704, 0xB14, 0x11C, 0x52C, 0x685, 0x28D, 0x09D, 0x8A5},
{0x708, 0xB10, 0x120, 0x528, 0x8C1, 0xAD1, 0x2D9, 0x4E9, 0x942, 0x74A, 0x35A, 0x162, 0x64B, 0xA53, 0x063, 0x46B, 0x804, 0xA14, 0x21C, 0x42C, 0x885, 0x68D, 0x29D, 0x0A5},
{0xB08, 0x110, 0x520, 0x728, 0x941, 0x151, 0x359, 0x769, 0x802, 0xA0A, 0x21A, 0x422, 0xA4B, 0x053, 0x463, 0x66B, 0x884, 0x094, 0x29C, 0x6AC, 0x8C5, 0xACD, 0x2DD, 0x4E5},
{0x508, 0x710, 0xB20, 0x128, 0x881, 0x691, 0x299, 0x0A9, 0x8C2, 0x4CA, 0x2DA, 0xAE2, 0x44B, 0x653, 0xA63, 0x06B, 0x944, 0x754, 0x35C, 0x16C, 0x805, 0x40D, 0x21D, 0xA25},
{0x108, 0x510, 0x720, 0xB28, 0x801, 0x411, 0x219, 0xA29, 0x882, 0x08A, 0x29A, 0x6A2, 0x04B, 0x453, 0x663, 0xA6B, 0x8C4, 0x4D4, 0x2DC, 0xAEC, 0x945, 0x14D, 0x35D, 0x765},
{0x748, 0x350, 0x160, 0x968, 0xAC1, 0x2D1, 0x4D9, 0x8E9, 0xA42, 0x64A, 0x45A, 0x062, 0x68B, 0x293, 0x0A3, 0x8AB, 0xA04, 0x214, 0x41C, 0x82C, 0xB05, 0x70D, 0x51D, 0x125},
{0x948, 0x750, 0x360, 0x168, 0xB01, 0x711, 0x519, 0x129, 0xAC2, 0x8CA, 0x4DA, 0x2E2, 0x88B, 0x693, 0x2A3, 0x0AB, 0xA44, 0x654, 0x45C, 0x06C, 0xA05, 0x80D, 0x41D, 0x225},
{0x348, 0x150, 0x960, 0x768, 0xA41, 0x051, 0x459, 0x669, 0xA02, 0x20A, 0x41A, 0x822, 0x28B, 0x093, 0x8A3, 0x6AB, 0xB04, 0x114, 0x51C, 0x72C, 0xAC5, 0x2CD, 0x4DD, 0x8E5},
{0x148, 0x950, 0x760, 0x368, 0xA01, 0x811, 0x419, 0x229, 0xB02, 0x10A, 0x51A, 0x722, 0x08B, 0x893, 0x6A3, 0x2AB, 0xAC4, 0x8D4, 0x4DC, 0x2EC, 0xA45, 0x04D, 0x45D, 0x665},
{0x688, 0x890, 0x0A0, 0x2A8, 0x4C1, 0x8D1, 0xAD9, 0x2E9, 0x502, 0x70A, 0xB1A, 0x122, 0x74B, 0x953, 0x163, 0x36B, 0x404, 0x814, 0xA1C, 0x22C, 0x445, 0x64D, 0xA5D, 0x065},
{0x888, 0x090, 0x2A0, 0x6A8, 0x501, 0x111, 0xB19, 0x729, 0x402, 0x80A, 0xA1A, 0x222, 0x94B, 0x153, 0x363, 0x76B, 0x444, 0x054, 0xA5C, 0x66C, 0x4C5, 0x8CD, 0xADD, 0x2E5},
{0x288, 0x690, 0x8A0, 0x0A8, 0x441, 0x651, 0xA59, 0x069, 0x4C2, 0x2CA, 0xADA, 0x8E2, 0x34B, 0x753, 0x963, 0x16B, 0x504, 0x714, 0xB1C, 0x12C, 0x405, 0x20D, 0xA1D, 0x825},
{0x088, 0x290, 0x6A0, 0x8A8, 0x401, 0x211, 0xA19, 0x829, 0x442, 0x04A, 0xA5A, 0x662, 0x14B, 0x353, 0x763, 0x96B, 0x4C4, 0x2D4, 0xADC, 0x8EC, 0x505, 0x10D, 0xB1D, 0x725},
{0x648, 0x450, 0x060, 0xA68, 0x2C1, 0x4D1, 0x8D9, 0xAE9, 0x282, 0x68A, 0x89A, 0x0A2, 0x70B, 0x513, 0x123, 0xB2B, 0x204, 0x414, 0x81C, 0xA2C, 0x345, 0x74D, 0x95D, 0x165},
{0xA48, 0x650, 0x460, 0x068, 0x341, 0x751, 0x959, 0x169, 0x2C2, 0xACA, 0x8DA, 0x4E2, 0xB0B, 0x713, 0x523, 0x12B, 0x284, 0x694, 0x89C, 0x0AC, 0x205, 0xA0D, 0x81D, 0x425},
{0x448, 0x050, 0xA60, 0x668, 0x281, 0x091, 0x899, 0x6A9, 0x202, 0x40A, 0x81A, 0xA22, 0x50B, 0x113, 0xB23, 0x72B, 0x344, 0x154, 0x95C, 0x76C, 0x2C5, 0x4CD, 0x8DD, 0xAE5},
{0x048, 0xA50, 0x660, 0x468, 0x201, 0xA11, 0x819, 0x429, 0x342, 0x14A, 0x95A, 0x762, 0x10B, 0xB13, 0x723, 0x52B, 0x2C4, 0xAD4, 0x8DC, 0x4EC, 0x285, 0x08D, 0x89D, 0x6A5},
{0x808, 0xA10, 0x220, 0x428, 0x101, 0xB11, 0x719, 0x529, 0x142, 0x94A, 0x75A, 0x362, 0x8CB, 0xAD3, 0x2E3, 0x4EB, 0x044, 0xA54, 0x65C, 0x46C, 0x085, 0x88D, 0x69D, 0x2A5},
{0xA08, 0x210, 0x420, 0x828, 0x141, 0x351, 0x759, 0x969, 0x042, 0xA4A, 0x65A, 0x462, 0xACB, 0x2D3, 0x4E3, 0x8EB, 0x084, 0x294, 0x69C, 0x8AC, 0x105, 0xB0D, 0x71D, 0x525},
{0x408, 0x810, 0xA20, 0x228, 0x081, 0x891, 0x699, 0x2A9, 0x102, 0x50A, 0x71A, 0xB22, 0x4CB, 0x8D3, 0xAE3, 0x2EB, 0x144, 0x954, 0x75C, 0x36C, 0x045, 0x44D, 0x65D, 0xA65},
)
_axis_convert_num = {'X': 0, 'Y': 1, 'Z': 2, '-X': 3, '-Y': 4, '-Z': 5}
@ -141,30 +154,13 @@ def axis_conversion(from_forward='Y', from_up='Z', to_forward='Y', to_up='Z'):
return Matrix().to_3x3()
value = reduce(int.__or__, (_axis_convert_num[a] << (i * 3) for i, a in enumerate((from_forward, from_up, to_forward, to_up))))
for i, axis_lut in enumerate(_axis_convert_lut):
if value in axis_lut:
return Matrix(_axis_convert_matrix[i])
assert("internal error")
# limited replacement for BPyImage.comprehensiveImageLoad
def load_image(imagepath, dirname):
import os
if os.path.exists(imagepath):
return bpy.data.images.load(imagepath)
variants = [imagepath, os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
for filepath in variants:
for nfilepath in (filepath, bpy.path.resolve_ncase(filepath)):
if os.path.exists(nfilepath):
return bpy.data.images.load(nfilepath)
# TODO comprehensiveImageLoad also searched in bpy.config.textureDir
return None
# return a tuple (free, object list), free is True if memory should be freed later with free_derived_objects()
def create_derived_objects(scene, ob):
if ob.parent and ob.parent.dupli_type != 'NONE':

@ -18,13 +18,25 @@
# <pep8 compliant>
__all__ = (
"mesh_linked_faces",
"edge_face_count_dict",
"edge_face_count",
"edge_loops_from_faces",
"edge_loops_from_edges",
"ngon_tesselate",
)
def mesh_linked_faces(mesh):
'''
Splits the mesh into connected parts,
these parts are returned as lists of faces.
used for seperating cubes from other mesh elements in the 1 mesh
'''
"""
Splits the mesh into connected faces, use this for seperating cubes from
other mesh elements within 1 mesh datablock.
:arg mesh: the mesh used to group with.
:type mesh: :class:`Mesh`
:return: lists of lists containing faces.
:rtype: list
"""
# Build vert face connectivity
vert_faces = [[] for i in range(len(mesh.vertices))]
@ -67,3 +79,357 @@ def mesh_linked_faces(mesh):
# return all face groups that are not null
# this is all the faces that are connected in their own lists.
return [fg for fg in face_groups if fg]
def edge_face_count_dict(mesh):
"""
:return: dict of edge keys with their value set to the number of
faces using each edge.
:rtype: dict
"""
face_edge_keys = [face.edge_keys for face in mesh.faces]
face_edge_count = {}
for face_keys in face_edge_keys:
for key in face_keys:
try:
face_edge_count[key] += 1
except:
face_edge_count[key] = 1
return face_edge_count
def edge_face_count(mesh):
"""
:return: list face users for each item in mesh.edges.
:rtype: list
"""
edge_face_count_dict = edge_face_count_dict(mesh)
get = dict.get
return [get(edge_face_count_dict, ed.key, 0) for ed in mesh.edges]
def edge_loops_from_faces(mesh, faces=None, seams=()):
"""
Edge loops defined by faces
Takes me.faces or a list of faces and returns the edge loops
These edge loops are the edges that sit between quads, so they dont touch
1 quad, note: not connected will make 2 edge loops,
both only containing 2 edges.
return a list of edge key lists
[[(0, 1), (4, 8), (3, 8)], ...]
:arg mesh: the mesh used to get edge loops from.
:type mesh: :class:`Mesh`
:arg faces: optional face list to only use some of the meshes faces.
:type faces: :class:`MeshFaces`, sequence or or NoneType
:return: return a list of edge vertex index lists.
:rtype: list
"""
OTHER_INDEX = 2, 3, 0, 1 # opposite face index
if faces is None:
faces = mesh.faces
edges = {}
for f in faces:
# if len(f) == 4:
if f.vertices_raw[3] != 0:
edge_keys = f.edge_keys
for i, edkey in enumerate(f.edge_keys):
edges.setdefault(edkey, []).append(edge_keys[OTHER_INDEX[i]])
for edkey in seams:
edges[edkey] = []
# Collect edge loops here
edge_loops = []
for edkey, ed_adj in edges.items():
if 0 < len(ed_adj) < 3: # 1 or 2
# Seek the first edge
context_loop = [edkey, ed_adj[0]]
edge_loops.append(context_loop)
if len(ed_adj) == 2:
other_dir = ed_adj[1]
else:
other_dir = None
ed_adj[:] = []
flipped = False
while 1:
# from knowing the last 2, look for th next.
ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2:
if other_dir and flipped == False: # the original edge had 2 other edges
flipped = True # only flip the list once
context_loop.reverse()
ed_adj[:] = []
context_loop.append(other_dir) # save 1 lookiup
ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2:
ed_adj[:] = []
break
else:
ed_adj[:] = []
break
i = ed_adj.index(context_loop[-2])
context_loop.append(ed_adj[not i])
# Dont look at this again
ed_adj[:] = []
return edge_loops
def edge_loops_from_edges(mesh, edges=None):
"""
Edge loops defined by edges
Takes me.edges or a list of edges and returns the edge loops
return a list of vertex indices.
[ [1, 6, 7, 2], ...]
closed loops have matching start and end values.
"""
line_polys = []
# Get edges not used by a face
if edges is None:
edges = mesh.edges
if not hasattr(edges, "pop"):
edges = edges[:]
edge_dict = {ed.key: ed for ed in mesh.edges if ed.select}
while edges:
current_edge = edges.pop()
vert_end, vert_start = current_edge.vertices[:]
line_poly = [vert_start, vert_end]
ok = True
while ok:
ok = False
#for i, ed in enumerate(edges):
i = len(edges)
while i:
i -= 1
ed = edges[i]
v1, v2 = ed.vertices
if v1 == vert_end:
line_poly.append(v2)
vert_end = line_poly[-1]
ok = 1
del edges[i]
# break
elif v2 == vert_end:
line_poly.append(v1)
vert_end = line_poly[-1]
ok = 1
del edges[i]
#break
elif v1 == vert_start:
line_poly.insert(0, v2)
vert_start = line_poly[0]
ok = 1
del edges[i]
# break
elif v2 == vert_start:
line_poly.insert(0, v1)
vert_start = line_poly[0]
ok = 1
del edges[i]
#break
line_polys.append(line_poly)
return line_polys
def ngon_tesselate(from_data, indices, fix_loops=True):
'''
Takes a polyline of indices (fgon)
and returns a list of face indicie lists.
Designed to be used for importers that need indices for an fgon to create from existing verts.
from_data: either a mesh, or a list/tuple of vectors.
indices: a list of indices to use this list is the ordered closed polyline to fill, and can be a subset of the data given.
fix_loops: If this is enabled polylines that use loops to make multiple polylines are delt with correctly.
'''
from mathutils import Vector
vector_to_tuple = Vector.to_tuple
if not indices:
return []
def mlen(co):
return abs(co[0]) + abs(co[1]) + abs(co[2]) # manhatten length of a vector, faster then length
def vert_treplet(v, i):
return v, vector_to_tuple(v, 6), i, mlen(v)
def ed_key_mlen(v1, v2):
if v1[3] > v2[3]:
return v2[1], v1[1]
else:
return v1[1], v2[1]
if not PREF_FIX_LOOPS:
'''
Normal single concave loop filling
'''
if type(from_data) in (tuple, list):
verts = [Vector(from_data[i]) for ii, i in enumerate(indices)]
else:
verts = [from_data.vertices[i].co for ii, i in enumerate(indices)]
for i in range(len(verts) - 1, 0, -1): # same as reversed(xrange(1, len(verts))):
if verts[i][1] == verts[i - 1][0]:
verts.pop(i - 1)
fill = fill_polygon([verts])
else:
'''
Seperate this loop into multiple loops be finding edges that are used twice
This is used by lightwave LWO files a lot
'''
if type(from_data) in (tuple, list):
verts = [vert_treplet(Vector(from_data[i]), ii) for ii, i in enumerate(indices)]
else:
verts = [vert_treplet(from_data.vertices[i].co, ii) for ii, i in enumerate(indices)]
edges = [(i, i - 1) for i in range(len(verts))]
if edges:
edges[0] = (0, len(verts) - 1)
if not verts:
return []
edges_used = set()
edges_doubles = set()
# We need to check if any edges are used twice location based.
for ed in edges:
edkey = ed_key_mlen(verts[ed[0]], verts[ed[1]])
if edkey in edges_used:
edges_doubles.add(edkey)
else:
edges_used.add(edkey)
# Store a list of unconnected loop segments split by double edges.
# will join later
loop_segments = []
v_prev = verts[0]
context_loop = [v_prev]
loop_segments = [context_loop]
for v in verts:
if v != v_prev:
# Are we crossing an edge we removed?
if ed_key_mlen(v, v_prev) in edges_doubles:
context_loop = [v]
loop_segments.append(context_loop)
else:
if context_loop and context_loop[-1][1] == v[1]:
#raise "as"
pass
else:
context_loop.append(v)
v_prev = v
# Now join loop segments
def join_seg(s1, s2):
if s2[-1][1] == s1[0][1]:
s1, s2 = s2, s1
elif s1[-1][1] == s2[0][1]:
pass
else:
return False
# If were stuill here s1 and s2 are 2 segments in the same polyline
s1.pop() # remove the last vert from s1
s1.extend(s2) # add segment 2 to segment 1
if s1[0][1] == s1[-1][1]: # remove endpoints double
s1.pop()
s2[:] = [] # Empty this segment s2 so we dont use it again.
return True
joining_segments = True
while joining_segments:
joining_segments = False
segcount = len(loop_segments)
for j in range(segcount - 1, -1, -1): # reversed(range(segcount)):
seg_j = loop_segments[j]
if seg_j:
for k in range(j - 1, -1, -1): # reversed(range(j)):
if not seg_j:
break
seg_k = loop_segments[k]
if seg_k and join_seg(seg_j, seg_k):
joining_segments = True
loop_list = loop_segments
for verts in loop_list:
while verts and verts[0][1] == verts[-1][1]:
verts.pop()
loop_list = [verts for verts in loop_list if len(verts) > 2]
# DONE DEALING WITH LOOP FIXING
# vert mapping
vert_map = [None] * len(indices)
ii = 0
for verts in loop_list:
if len(verts) > 2:
for i, vert in enumerate(verts):
vert_map[i + ii] = vert[2]
ii += len(verts)
fill = tesselate_polygon([[v[0] for v in loop] for loop in loop_list])
#draw_loops(loop_list)
#raise 'done loop'
# map to original indices
fill = [[vert_map[i] for i in reversed(f)] for f in fill]
if not fill:
print('Warning Cannot scanfill, fallback on a triangle fan.')
fill = [[0, i - 1, i] for i in range(2, len(indices))]
else:
# Use real scanfill.
# See if its flipped the wrong way.
flip = None
for fi in fill:
if flip != None:
break
for i, vi in enumerate(fi):
if vi == 0 and fi[i - 1] == 1:
flip = False
break
elif vi == 1 and fi[i - 1] == 0:
flip = True
break
if not flip:
for i, fi in enumerate(fill):
fill[i] = tuple([ii for ii in reversed(fi)])
return fill

@ -18,11 +18,27 @@
# <pep8 compliant>
__all__ = (
"add_object_align_init",
"object_data_add",
)
import bpy
import mathutils
def add_object_align_init(context, operator):
"""
Return a matrix using the operator settings and view context.
:arg context: The context to use.
:type context: :class:`Context`
:arg operator: The operator, checked for location and rotation properties.
:type operator: :class:`Operator`
:return: the matrix from the context and settings.
:rtype: :class:`Matrix`
"""
space_data = context.space_data
if space_data.type != 'VIEW_3D':
space_data = None
@ -64,7 +80,19 @@ def add_object_align_init(context, operator):
def object_data_add(context, obdata, operator=None):
"""
Add an object using the view context and preference to to initialize the
location, rotation and layer.
:arg context: The context to use.
:type context: :class:`Context`
:arg obdata: the data used for the new object.
:type obdata: valid object data type or None.
:arg operator: The operator, checked for location and rotation properties.
:type operator: :class:`Operator`
:return: the newly created object in the scene.
:rtype: :class:`ObjectBase`
"""
scene = context.scene
# ugh, could be made nicer

@ -18,6 +18,12 @@
# <pep8 compliant>
__all__ = (
"region_2d_to_vector_3d",
"region_2d_to_location_3d",
"location_3d_to_region_2d",
"location_3d_to_region_2d",
)
def region_2d_to_vector_3d(region, rv3d, coord):
"""
@ -28,7 +34,7 @@ def region_2d_to_vector_3d(region, rv3d, coord):
:type region: :class:`Region`
:arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
:type rv3d: :class:`RegionView3D`
:arg coord: 2d coordinates relative to the region;
:arg coord: 2d coordinates relative to the region:
(event.mouse_region_x, event.mouse_region_y) for example.
:type coord: 2d vector
:return: normalized 3d vector.
@ -36,17 +42,21 @@ def region_2d_to_vector_3d(region, rv3d, coord):
"""
from mathutils import Vector
viewvec = rv3d.view_matrix.inverted()[2].xyz.normalized()
if rv3d.is_perspective:
dx = (2.0 * coord[0] / region.width) - 1.0
dy = (2.0 * coord[1] / region.height) - 1.0
persinv = rv3d.perspective_matrix.inverted()
persmat = rv3d.perspective_matrix.copy()
perspinv_x, perspinv_y = persmat.inverted().to_3x3()[0:2]
return ((perspinv_x * dx + perspinv_y * dy) - viewvec).normalized()
out = Vector(((2.0 * coord[0] / region.width) - 1.0,
(2.0 * coord[1] / region.height) - 1.0,
-0.5
))
w = (out[0] * persinv[0][3]) + \
(out[1] * persinv[1][3]) + \
(out[2] * persinv[2][3]) + persinv[3][3]
return ((out * persinv) / w) - rv3d.view_matrix.inverted()[3].xyz
else:
return viewvec
return rv3d.view_matrix.inverted()[2].xyz.normalized()
def region_2d_to_location_3d(region, rv3d, coord, depth_location):

@ -356,163 +356,6 @@ class Mesh(bpy_types.ID):
def edge_keys(self):
return [edge_key for face in self.faces for edge_key in face.edge_keys]
@property
def edge_face_count_dict(self):
face_edge_keys = [face.edge_keys for face in self.faces]
face_edge_count = {}
for face_keys in face_edge_keys:
for key in face_keys:
try:
face_edge_count[key] += 1
except:
face_edge_count[key] = 1
return face_edge_count
@property
def edge_face_count(self):
edge_face_count_dict = self.edge_face_count_dict
return [edge_face_count_dict.get(ed.key, 0) for ed in self.edges]
def edge_loops_from_faces(self, faces=None, seams=()):
"""
Edge loops defined by faces
Takes me.faces or a list of faces and returns the edge loops
These edge loops are the edges that sit between quads, so they dont touch
1 quad, note: not connected will make 2 edge loops, both only containing 2 edges.
return a list of edge key lists
[ [(0,1), (4, 8), (3,8)], ...]
return a list of edge vertex index lists
"""
OTHER_INDEX = 2, 3, 0, 1 # opposite face index
if faces is None:
faces = self.faces
edges = {}
for f in faces:
# if len(f) == 4:
if f.vertices_raw[3] != 0:
edge_keys = f.edge_keys
for i, edkey in enumerate(f.edge_keys):
edges.setdefault(edkey, []).append(edge_keys[OTHER_INDEX[i]])
for edkey in seams:
edges[edkey] = []
# Collect edge loops here
edge_loops = []
for edkey, ed_adj in edges.items():
if 0 < len(ed_adj) < 3: # 1 or 2
# Seek the first edge
context_loop = [edkey, ed_adj[0]]
edge_loops.append(context_loop)
if len(ed_adj) == 2:
other_dir = ed_adj[1]
else:
other_dir = None
ed_adj[:] = []
flipped = False
while 1:
# from knowing the last 2, look for th next.
ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2:
if other_dir and flipped == False: # the original edge had 2 other edges
flipped = True # only flip the list once
context_loop.reverse()
ed_adj[:] = []
context_loop.append(other_dir) # save 1 lookiup
ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2:
ed_adj[:] = []
break
else:
ed_adj[:] = []
break
i = ed_adj.index(context_loop[-2])
context_loop.append(ed_adj[not i])
# Dont look at this again
ed_adj[:] = []
return edge_loops
def edge_loops_from_edges(self, edges=None):
"""
Edge loops defined by edges
Takes me.edges or a list of edges and returns the edge loops
return a list of vertex indices.
[ [1, 6, 7, 2], ...]
closed loops have matching start and end values.
"""
line_polys = []
# Get edges not used by a face
if edges is None:
edges = self.edges
if not hasattr(edges, "pop"):
edges = edges[:]
edge_dict = {ed.key: ed for ed in self.edges if ed.select}
while edges:
current_edge = edges.pop()
vert_end, vert_start = current_edge.vertices[:]
line_poly = [vert_start, vert_end]
ok = True
while ok:
ok = False
#for i, ed in enumerate(edges):
i = len(edges)
while i:
i -= 1
ed = edges[i]
v1, v2 = ed.vertices
if v1 == vert_end:
line_poly.append(v2)
vert_end = line_poly[-1]
ok = 1
del edges[i]
# break
elif v2 == vert_end:
line_poly.append(v1)
vert_end = line_poly[-1]
ok = 1
del edges[i]
#break
elif v1 == vert_start:
line_poly.insert(0, v2)
vert_start = line_poly[0]
ok = 1
del edges[i]
# break
elif v2 == vert_start:
line_poly.insert(0, v1)
vert_start = line_poly[0]
ok = 1
del edges[i]
#break
line_polys.append(line_poly)
return line_polys
class MeshEdge(StructRNA):
__slots__ = ()

@ -36,6 +36,7 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
return (ob and ob.type == 'MESH')
def execute(self, context):
from bpy_extras import mesh_utils
ob = context.active_object
context.tool_settings.mesh_select_mode = False, False, True
is_editmode = (ob.mode == 'EDIT')
@ -47,7 +48,7 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
face_list = mesh.faces[:]
face_edge_keys = [face.edge_keys for face in face_list]
edge_face_count = mesh.edge_face_count_dict
edge_face_count = mesh_utils.edge_face_count_dict(mesh)
def test_interior(index):
for key in face_edge_keys[index]:

@ -25,6 +25,8 @@ import bpy
def extend(obj, operator, EXTEND_MODE):
from bpy_extras import mesh_utils
me = obj.data
me_verts = me.vertices
# script will fail without UVs
@ -170,7 +172,7 @@ def extend(obj, operator, EXTEND_MODE):
edge_faces[edkey] = [i]
if EXTEND_MODE == 'LENGTH':
edge_loops = me.edge_loops_from_faces(face_sel, [ed.key for ed in me.edges if ed.use_seam])
edge_loops = mesh_utils.edge_loops_from_faces(me, face_sel, [ed.key for ed in me.edges if ed.use_seam])
me_verts = me.vertices
for loop in edge_loops:
looplen = [0.0]

@ -940,6 +940,14 @@ class WM_OT_copy_prev_settings(bpy.types.Operator):
self.report({'ERROR'}, "Source path %r exists" % path_src)
else:
shutil.copytree(path_src, path_dst)
# in 2.57 and earlier windows installers, system scripts were copied
# into the configuration directory, don't want to copy those
system_script = os.path.join(path_dst, 'scripts/modules/bpy_types.py')
if os.path.isfile(system_script):
shutil.rmtree(os.path.join(path_dst, 'scripts'))
shutil.rmtree(os.path.join(path_dst, 'plugins'))
# dont loose users work if they open the splash later.
if bpy.data.is_saved is bpy.data.is_dirty is False:
bpy.ops.wm.read_homefile()

@ -85,26 +85,26 @@ def register():
from bpy.props import StringProperty, EnumProperty
WindowManager = bpy.types.WindowManager
def addon_filter_items(self, context):
import addon_utils
items = [('All', "All", ""),
('Enabled', "Enabled", ""),
('Disabled', "Disabled", ""),
]
items_unique = set()
for mod in addon_utils.modules(space_userpref.USERPREF_PT_addons._addons_fake_modules):
info = addon_utils.module_bl_info(mod)
items_unique.add(info["category"])
items.extend([(cat, cat, "") for cat in sorted(items_unique)])
return items
WindowManager.addon_search = StringProperty(name="Search", description="Search within the selected filter")
WindowManager.addon_filter = EnumProperty(
items=[('All', "All", ""),
('Enabled', "Enabled", ""),
('Disabled', "Disabled", ""),
('3D View', "3D View", ""),
('Add Curve', "Add Curve", ""),
('Add Mesh', "Add Mesh", ""),
('Animation', "Animation", ""),
('Development', "Development", ""),
('Game Engine', "Game Engine", ""),
('Import-Export', "Import-Export", ""),
('Mesh', "Mesh", ""),
('Object', "Object", ""),
('Render', "Render", ""),
('Rigging', "Rigging", ""),
('Text Editor', "Text Editor", ""),
('System', "System", ""),
('Other', "Other", ""),
],
items=addon_filter_items,
name="Category",
description="Filter add-ons by category",
)

@ -44,9 +44,9 @@ class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel):
# layout.template_image(ob, "data", None)
layout.template_ID(ob, "data", open="image.open", unlink="image.unlink")
row = layout.row(align = True)
row = layout.row(align=True)
row.prop(ob, "color", text="Transparency", index=3, slider=True)
row = layout.row(align = True)
row = layout.row(align=True)
row.prop(ob, "empty_image_offset", text="Offset X", index=0)
row.prop(ob, "empty_image_offset", text="Offset Y", index=1)

@ -651,6 +651,22 @@ class ConstraintButtonsPanel():
sub.prop(con, "from_min_z", text="Min")
sub.prop(con, "from_max_z", text="Max")
col = layout.column()
row = col.row()
row.label(text="Source to Destination Mapping:")
row = col.row()
row.prop(con, "map_to_x_from", expand=False, text="")
row.label(text=" -> X")
row = col.row()
row.prop(con, "map_to_y_from", expand=False, text="")
row.label(text=" -> Y")
row = col.row()
row.prop(con, "map_to_z_from", expand=False, text="")
row.label(text=" -> Z")
split = layout.split()
col = split.column()
@ -661,7 +677,6 @@ class ConstraintButtonsPanel():
col = split.column()
col.label(text="X:")
col.row().prop(con, "map_to_x_from", expand=True)
sub = col.column(align=True)
sub.prop(con, "to_min_x", text="Min")
@ -669,7 +684,6 @@ class ConstraintButtonsPanel():
col = split.column()
col.label(text="Y:")
col.row().prop(con, "map_to_y_from", expand=True)
sub = col.column(align=True)
sub.prop(con, "to_min_y", text="Min")
@ -677,7 +691,6 @@ class ConstraintButtonsPanel():
col = split.column()
col.label(text="Z:")
col.row().prop(con, "map_to_z_from", expand=True)
sub = col.column(align=True)
sub.prop(con, "to_min_z", text="Min")

@ -167,10 +167,8 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
if psys != None and psys.is_edited:
if psys.is_global_hair:
layout.operator("particle.connect_hair")
layout.label(text="Hair is disconnected.")
else:
layout.operator("particle.disconnect_hair")
layout.label(text="")
elif psys != None and part.type == 'REACTOR':
split.enabled = particle_panel_enabled(context, psys)
split.prop(psys, "reactor_target_object")

@ -437,7 +437,7 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
rd = context.scene.render
sima = context.space_data
# display even when not in game mode because these settings effect the 3d view
return (sima and sima.image) # and (rd.engine == 'BLENDER_GAME')
return (sima and sima.image) # and (rd.engine == 'BLENDER_GAME')
def draw(self, context):
layout = self.layout

@ -199,6 +199,7 @@ class USERPREF_PT_interface(bpy.types.Panel):
col.prop(view, "use_zoom_to_mouse")
col.prop(view, "use_rotate_around_active")
col.prop(view, "use_global_pivot")
col.prop(view, "use_camera_lock_parent")
col.separator()
@ -888,7 +889,8 @@ class USERPREF_PT_addons(bpy.types.Panel):
split = layout.split(percentage=0.2)
col = split.column()
col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
col.prop(context.window_manager, "addon_filter", expand=True)
col.label(text="Categories")
col.prop(context.window_manager, "addon_filter", text="") # , expand=True, too slow with dynamic enum.
col.label(text="Supported Level")
col.prop(context.window_manager, "addon_support", expand=True)

@ -2319,7 +2319,8 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
col.prop(toolsettings, "use_etch_autoname")
col.prop(toolsettings, "etch_number")
col.prop(toolsettings, "etch_side")
col.operator("sketch.convert", text="Convert")
col.operator("sketch.convert", text="Convert")
class VIEW3D_PT_context_properties(bpy.types.Panel):

@ -1245,7 +1245,7 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel):
if pe.type == 'PARTICLES':
if ob.particle_systems:
if len(ob.particle_systems) > 1:
layout.template_list(ob, "particle_systems", ob.particle_systems, "active_index", type='ICONS')
layout.template_list(ob, "particle_systems", ob.particle_systems, "active_index", rows=2, maxrows=3)
ptcache = ob.particle_systems.active.point_cache
else:
@ -1254,7 +1254,7 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel):
ptcache = md.point_cache
if ptcache and len(ptcache.point_caches) > 1:
layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", type='ICONS')
layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", rows=2, maxrows=3)
if not pe.is_editable:
layout.label(text="Point cache must be baked")

@ -33,11 +33,11 @@ RequestExecutionLevel admin
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
Page custom DataLocation DataLocationOnLeave
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
UninstPage custom un.OptionalRemoveConfig un.OptionalRemoveConfigOnLeave
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
@ -62,7 +62,6 @@ UninstallIcon "[RELDIR]\00.installer.ico"
LangString DESC_StartMenu ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)"
LangString DESC_DesktopShortcut ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop."
LangString DESC_BlendRegister ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc."
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Specify User Data Location"
;--------------------------------
;Data
@ -76,15 +75,15 @@ DirText "Use the field below to specify the folder where you want Blender to be
SilentUnInstall normal
Var BLENDERHOME
Var SHORTVERSION ; This is blender_version_decimal() from path_util.c
Var BLENDERCONFIG
Var REMOVECONFIG
; Custom controls
Var HWND
Var HWND_APPDATA
Var HWND_INSTDIR
Var HWND_HOMEDIR
Var HWND_KEEPCONFIG
Var HWND_REMOVECONFIG
Function .onInit
ClearErrors
@ -103,9 +102,12 @@ Function .onInit
FunctionEnd
Function un.onInit
SetShellVarContext current
StrCpy $BLENDERCONFIG "$APPDATA\Blender Foundation\Blender"
SetShellVarContext all
FunctionEnd
Function DataLocation
Function un.OptionalRemoveConfig
nsDialogs::Create /NOUNLOAD 1018
Pop $HWND
@ -113,45 +115,27 @@ Function DataLocation
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 24u "Please specify where you wish to install Blender's user data files. Be aware that if you choose to use your Application Data directory, your preferences and scripts will only be accessible by the current user account."
${NSD_CreateRadioButton} 0 50 100% 12u "Use Application Data directory (recommended)"
Pop $HWND_APPDATA
${NSD_CreateRadioButton} 0 80 100% 12u "Use installation directory"
Pop $HWND_INSTDIR
${NSD_CreateRadioButton} 0 110 100% 12u "I have defined a %HOME% variable, please install files there"
Pop $HWND_HOMEDIR
${If} ${AtMostWinME}
GetDlgItem $0 $HWND $HWND_APPDATA
EnableWindow $0 0
SendMessage $HWND_INSTDIR ${BM_SETCHECK} 1 0
${Else}
SendMessage $HWND_APPDATA ${BM_SETCHECK} 1 0
${EndIf}
${NSD_CreateRadioButton} 0 50 100% 12u "Keep configuration files, autosaved .blend files and installed addons (recommended)"
Pop $HWND_KEEPCONFIG
${NSD_CreateRadioButton} 0 80 100% 12u "Remove all files, including configuration files, autosaved .blend files and installed addons"
Pop $HWND_REMOVECONFIG
SendMessage $HWND_KEEPCONFIG ${BM_SETCHECK} 1 0
nsDialogs::Show
FunctionEnd
Function DataLocationOnLeave
${NSD_GetState} $HWND_APPDATA $R0
Function un.OptionalRemoveConfigOnLeave
${NSD_GetState} $HWND_REMOVECONFIG $R0
${If} $R0 == "1"
SetShellVarContext current
StrCpy $BLENDERHOME "$APPDATA\Blender Foundation\Blender"
SetShellVarContext all
StrCpy $REMOVECONFIG "1"
${Else}
${NSD_GetState} $HWND_INSTDIR $R0
${If} $R0 == "1"
StrCpy $BLENDERHOME $INSTDIR
${Else}
${NSD_GetState} $HWND_HOMEDIR $R0
${If} $R0 == "1"
ReadEnvStr $BLENDERHOME "HOME"
${EndIf}
${EndIf}
StrCpy $REMOVECONFIG "0"
${EndIf}
FunctionEnd
Section "Blender [VERSION] (required)" InstallFiles
SectionIn RO
@ -160,7 +144,7 @@ Section "Blender [VERSION] (required)" InstallFiles
; The contents of Blender installation root dir
[ROOTDIRCONTS]
; All datafiles (python, scripts, config)
; All datafiles (python, scripts, datafiles)
[DODATAFILES]
SetOutPath $INSTDIR
@ -169,7 +153,6 @@ Section "Blender [VERSION] (required)" InstallFiles
${EndIf}
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir" "$BLENDERHOME"
WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ShortVersion" "[SHORTVERSION]"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender"
@ -204,7 +187,7 @@ Section "Open .blend files with Blender" BlendRegister
ExecWait '"$INSTDIR\blender.exe" -r'
SectionEnd
UninstallText "This will uninstall Blender [VERSION], and all installed files. Before continuing make sure you have created backup of all the files you may want to keep: startup.blend, bookmarks.txt, recent-files.txt. Hit 'Uninstall' to continue."
UninstallText "This will uninstall Blender [VERSION], and all installed files. Hit 'Uninstall' to continue."
Section "Uninstall"
; Remove registry keys
@ -212,7 +195,6 @@ Section "Uninstall"
SetRegView 64
${EndIf}
ReadRegStr $BLENDERHOME HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir"
ReadRegStr $SHORTVERSION HKLM "SOFTWARE\BlenderFoundation" "ShortVersion"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Blender"
DeleteRegKey HKLM "SOFTWARE\BlenderFoundation"
@ -226,21 +208,10 @@ Section "Uninstall"
Delete "$INSTDIR\uninstall.exe"
MessageBox MB_YESNO "Recursively erase contents of $BLENDERHOME\$SHORTVERSION\scripts? NOTE: This includes all installed scripts and *any* file and directory you have manually created, installed later or copied. This also including .blend files." IDNO NextNoScriptRemove
RMDir /r "$BLENDERHOME\$SHORTVERSION\scripts"
NextNoScriptRemove:
MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\config? NOTE: This includes your startup.blend, bookmarks and any other file and directory you may have created in that directory" IDNO NextNoConfigRemove
RMDir /r "$BLENDERHOME\$SHORTVERSION\config"
NextNoConfigRemove:
MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\plugins? NOTE: This includes files and subdirectories in this directory" IDNO NextNoPluginRemove
RMDir /r "$BLENDERHOME\$SHORTVERSION\plugins"
NextNoPluginRemove:
; Try to remove dirs, but leave them if they contain anything
RMDir "$BLENDERHOME\$SHORTVERSION\plugins"
RMDir "$BLENDERHOME\$SHORTVERSION\config"
RMDir "$BLENDERHOME\$SHORTVERSION\scripts"
RMDir "$BLENDERHOME\$SHORTVERSION"
RMDir "$BLENDERHOME"
${If} $REMOVECONFIG == "1"
RMDir /r "$BLENDERCONFIG\$SHORTVERSION"
${Endif}
; Remove shortcuts
Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*"
Delete "$DESKTOP\Blender.lnk"

@ -27,6 +27,9 @@
set(INC
.
../../../intern/guardedalloc
)
set(INC_SYS
${JPEG_INCLUDE_DIR}
)
@ -47,4 +50,4 @@ set(SRC
intern/rgb32.h
)
blender_add_lib(bf_avi "${SRC}" "${INC}")
blender_add_lib(bf_avi "${SRC}" "${INC}" "${INC_SYS}")

@ -29,6 +29,9 @@ set(INC
../editors/include
../blenkernel
../../../intern/guardedalloc
)
set(INC_SYS
${GLEW_INCLUDE_PATH}
${FREETYPE_INCLUDE_DIRS}
)
@ -47,7 +50,7 @@ set(SRC
)
if(WITH_INTERNATIONAL)
list(APPEND INC ${GETTEXT_INC})
list(APPEND INC_SYS ${GETTEXT_INC})
add_definitions(-DINTERNATIONAL)
endif()
@ -55,5 +58,5 @@ if(WIN32 AND NOT UNIX)
add_definitions(-DUSE_GETTEXT_DLL)
endif()
blender_add_lib(bf_blenfont "${SRC}" "${INC}")
blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}")

@ -42,7 +42,7 @@ extern "C" {
/* these lines are grep'd, watch out for our not-so-awesome regex
* and keep comment above the defines.
* Use STRINGIFY() rather then defining with quotes */
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 257
#define BLENDER_SUBVERSION 1

@ -246,6 +246,9 @@ void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene);
void BKE_screen_view3d_scene_sync(struct bScreen *sc);
void BKE_screen_view3d_main_sync(ListBase *screen_lb, struct Scene *scene);
/* zoom factor conversion */
float BKE_screen_view3d_zoom_to_fac(float camzoom);
float BKE_screen_view3d_zoom_from_fac(float zoomfac);
/* screen */
void free_screen(struct bScreen *sc);

@ -279,7 +279,7 @@ int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene);
int seqbase_isolated_sel_check(struct ListBase *seqbase);
void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage, int keep_file_handles);
struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, struct Sequence * seq, int dupe_flag);
int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b);
int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str);
void seq_update_sound(struct Scene* scene, struct Sequence *seq);
void seq_update_muting(struct Scene* scene, struct Editing *ed);

@ -91,12 +91,12 @@ void txt_backspace_word (struct Text *text);
int txt_add_char (struct Text *text, char add);
int txt_add_raw_char (struct Text *text, char add);
int txt_replace_char (struct Text *text, char add);
void txt_export_to_object (struct Text *text);
void txt_export_to_object(struct Text *text);
void txt_export_to_objects(struct Text *text);
void unindent (struct Text *text);
void comment (struct Text *text);
void indent (struct Text *text);
void uncomment (struct Text *text);
void txt_unindent (struct Text *text);
void txt_comment (struct Text *text);
void txt_indent (struct Text *text);
void txt_uncomment (struct Text *text);
int setcurr_tab_spaces (struct Text *text, int space);
void txt_add_marker (struct Text *text, struct TextLine *line, int start, int end, const unsigned char color[4], int group, int flags);

@ -44,6 +44,7 @@ set(INC
../editors/include
../render/extern/include
../../../intern/audaspace/intern
../../../intern/ffmpeg
../../../intern/bsp/extern ../blenfont
../../../intern/decimation/extern
../../../intern/elbeem/extern
@ -54,6 +55,9 @@ set(INC
../../../intern/smoke/extern
../../../intern/mikktspace
../../../source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h
)
set(INC_SYS
${GLEW_INCLUDE_PATH}
${ZLIB_INCLUDE_DIRS}
)
@ -268,17 +272,19 @@ if(WITH_IMAGE_HDR)
endif()
if(WITH_CODEC_QUICKTIME)
list(APPEND INC ../quicktime ${QUICKTIME_INC})
list(APPEND INC ../quicktime)
list(APPEND INC_SYS ${QUICKTIME_INC})
add_definitions(-DWITH_QUICKTIME)
endif()
if(WITH_CODEC_FFMPEG)
list(APPEND INC ${FFMPEG_INC})
list(APPEND INC_SYS ${FFMPEG_INC})
add_definitions(-DWITH_FFMPEG)
endif()
if(WITH_PYTHON)
list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS})
list(APPEND INC ../python)
list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS})
add_definitions(-DWITH_PYTHON)
if(WITH_PYTHON_SECURITY)
@ -299,12 +305,12 @@ if(WITH_JACK)
endif()
if(WITH_LZO)
list(APPEND INC ../../../extern/lzo/minilzo)
list(APPEND INC_SYS ../../../extern/lzo/minilzo)
add_definitions(-DWITH_LZO)
endif()
if(WITH_LZMA)
list(APPEND INC ../../../extern/lzma)
list(APPEND INC_SYS ../../../extern/lzma)
add_definitions(-DWITH_LZMA)
endif()
@ -312,4 +318,4 @@ if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
endif()
blender_add_lib(bf_blenkernel "${SRC}" "${INC}")
blender_add_lib(bf_blenkernel "${SRC}" "${INC}" "${INC_SYS}")

@ -14,6 +14,7 @@ incs += ' ../gpu #/extern/glew/include'
incs += ' #/intern/smoke/extern'
incs += ' #/intern/mikktspace'
incs += ' #/intern/audaspace/intern'
incs += ' #/intern/ffmpeg'
incs += ' ' + env['BF_OPENGL_INC']
incs += ' ' + env['BF_ZLIB_INC']

@ -1206,7 +1206,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
float tmat[4][4], mat[4][4], pamat[4][4], vec[3], size=0.0;
float (*obmat)[4], (*oldobmat)[4];
int a, b, counter, hair = 0;
int totpart, totchild, totgroup=0, pa_num;
int totpart, totchild, totgroup=0 /*, pa_num */;
int no_draw_flag = PARS_UNEXIST;
@ -1323,7 +1323,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
if(pa->flag & no_draw_flag)
continue;
pa_num = pa->num;
/* pa_num = pa->num; */ /* UNUSED */
pa_time = pa->time;
size = pa->size;
}
@ -1331,7 +1331,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
/* handle child particle */
cpa = &psys->child[a - totpart];
pa_num = a;
/* pa_num = a; */ /* UNUSED */
pa_time = psys->particles[cpa->parent].time;
size = psys_get_child_size(psys, cpa, ctime, NULL);
}

@ -1045,6 +1045,9 @@ static short animsys_remap_path (AnimMapper *UNUSED(remap), char *path, char **d
}
/* less then 1.0 evaluates to false, use epsilon to avoid float error */
#define ANIMSYS_FLOAT_AS_BOOL(value) ((value) > ((1.0f-FLT_EPSILON)))
/* Write the given value to a setting using RNA, and return success */
static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value)
{
@ -1076,9 +1079,9 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
{
case PROP_BOOLEAN:
if (array_len)
RNA_property_boolean_set_index(&new_ptr, prop, array_index, (int)value);
RNA_property_boolean_set_index(&new_ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
else
RNA_property_boolean_set(&new_ptr, prop, (int)value);
RNA_property_boolean_set(&new_ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
break;
case PROP_INT:
if (array_len)
@ -1869,9 +1872,9 @@ void nladata_flush_channels (ListBase *channels)
{
case PROP_BOOLEAN:
if (RNA_property_array_length(ptr, prop))
RNA_property_boolean_set_index(ptr, prop, array_index, (int)value);
RNA_property_boolean_set_index(ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
else
RNA_property_boolean_set(ptr, prop, (int)value);
RNA_property_boolean_set(ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
break;
case PROP_INT:
if (RNA_property_array_length(ptr, prop))

@ -1251,6 +1251,19 @@ static short unified_settings(Brush *brush)
return 0;
}
// XXX: be careful about setting size and unprojected radius
// because they depend on one another
// these functions do not set the other corresponding value
// this can lead to odd behavior if size and unprojected
// radius become inconsistent.
// the biggest problem is that it isn't possible to change
// unprojected radius because a view context is not
// available. my ussual solution to this is to use the
// ratio of change of the size to change the unprojected
// radius. Not completely convinced that is correct.
// In anycase, a better solution is needed to prevent
// inconsistency.
static void set_unified_size(Brush *brush, int value)
{
Scene *sce;

@ -1859,7 +1859,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
* do this by calculating the tilt angle difference, then apply
* the rotation gradually over the entire curve
*
* note that the split is between last and second last, rather then first/last as youd expect.
* note that the split is between last and second last, rather than first/last as youd expect.
*
* real order is like this
* 0,1,2,3,4 --> 1,2,3,4,0

@ -1189,7 +1189,7 @@ DagNodeQueue * graph_dfs(void)
int skip = 0;
int minheight;
int maxpos=0;
int is_cycle = 0;
/* int is_cycle = 0; */ /* UNUSED */
/*
*fprintf(stderr,"starting DFS \n ------------\n");
*/
@ -1245,7 +1245,7 @@ DagNodeQueue * graph_dfs(void)
} else {
if (itA->node->color == DAG_GRAY) { // back edge
fprintf(stderr,"dfs back edge :%15s %15s \n",((ID *) node->ob)->name, ((ID *) itA->node->ob)->name);
is_cycle = 1;
/* is_cycle = 1; */ /* UNUSED */
} else if (itA->node->color == DAG_BLACK) {
;
/* already processed node but we may want later to change distance either to shorter to longer.

@ -332,19 +332,12 @@ void fastshade_free_render(void)
}
}
static int fastshade_customdata_layer_num(int n, int active)
{
/* make the active layer the first */
if (n == active) return 0;
else if (n < active) return n+1;
else return n;
}
static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma)
{
CustomDataLayer *layer;
MTFace *mtface;
int index, n, needuv= ma->texco & TEXCO_UV;
int index, needuv= ma->texco & TEXCO_UV;
char *vertcol;
shi.totuv= 0;
@ -354,7 +347,6 @@ static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma)
layer= &fdata->layers[index];
if(needuv && layer->type == CD_MTFACE && shi.totuv < MAX_MTFACE) {
n= fastshade_customdata_layer_num(shi.totuv, layer->active_rnd);
mtface= &((MTFace*)layer->data)[a];
shi.uv[shi.totuv].uv[0]= 2.0f*mtface->uv[j][0]-1.0f;
@ -365,7 +357,6 @@ static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma)
shi.totuv++;
}
else if(layer->type == CD_MCOL && shi.totcol < MAX_MCOL) {
n= fastshade_customdata_layer_num(shi.totcol, layer->active_rnd);
vertcol= (char*)&((MCol*)layer->data)[a*4 + j];
shi.col[shi.totcol].col[0]= ((float)vertcol[3])/255.0f;

@ -2039,7 +2039,7 @@ float evaluate_fcurve (FCurve *fcu, float evaltime)
* here so that the curve can be sampled correctly
*/
if (fcu->flag & FCURVE_INT_VALUES)
cvalue= (float)((int)cvalue);
cvalue= floorf(cvalue + 0.5f);
/* return evaluated value */
return cvalue;

@ -381,9 +381,7 @@ Image *BKE_add_image_file(const char *name)
ima= image_alloc(libname, IMA_SRC_FILE, IMA_TYPE_IMAGE);
BLI_strncpy(ima->name, name, sizeof(ima->name));
/* do a wild guess! */
if(BLI_testextensie(name, ".avi") || BLI_testextensie(name, ".mov")
|| BLI_testextensie(name, ".mpg") || BLI_testextensie(name, ".mp4"))
if(BLI_testextensie_array(name, imb_ext_movie))
ima->source= IMA_SRC_MOVIE;
return ima;
@ -1031,7 +1029,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
BLF_buffer_col(mono, scene->r.fg_stamp[0], scene->r.fg_stamp[1], scene->r.fg_stamp[2], 1.0);
pad= BLF_width_max(mono);
/* use 'h_fixed' rather then 'h', aligns better */
/* use 'h_fixed' rather than 'h', aligns better */
h_fixed= BLF_height_max(mono);
y_ofs = -BLF_descender(mono);

@ -607,7 +607,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C
if(cd->no_rot_axis) { /* set by caller */
/* this is not exactly the same as 2.4x, since the axis is having rotation removed rather then
/* this is not exactly the same as 2.4x, since the axis is having rotation removed rather than
* changing the axis before calculating the tilt but serves much the same purpose */
float dir_flat[3]={0,0,0}, q[4];
copy_v3_v3(dir_flat, dir);

@ -1661,12 +1661,6 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
/* there is also a timing calculation in drawobject() */
static int no_speed_curve= 0;
void disable_speed_curve(int val)
{
no_speed_curve= val;
}
// XXX THIS CRUFT NEEDS SERIOUS RECODING ASAP!
/* ob can be NULL */
@ -1783,7 +1777,7 @@ void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const
mul_m4_m4m4(rmat, mat, imat); /* get the parent relative matrix */
object_apply_mat4(ob, rmat, use_compat, FALSE);
/* same as below, use rmat rather then mat */
/* same as below, use rmat rather than mat */
mat4_to_loc_rot_size(ob->loc, rot, ob->size, rmat);
object_mat3_to_rot(ob, rot, use_compat);
}
@ -3056,9 +3050,14 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
if(newkey || from_mix==FALSE) {
kb= add_keyblock(key, name);
/* create from lattice */
latt_to_key(lt, kb);
if (!newkey) {
KeyBlock *basekb= (KeyBlock *)key->block.first;
kb->data= MEM_dupallocN(basekb->data);
kb->totelem= basekb->totelem;
}
else {
latt_to_key(lt, kb);
}
}
else {
/* copy from current values */
@ -3094,7 +3093,10 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
KeyBlock *basekb= (KeyBlock *)key->block.first;
kb->data= MEM_dupallocN(basekb->data);
kb->totelem= basekb->totelem;
} else curve_to_key(cu, kb, lb);
}
else {
curve_to_key(cu, kb, lb);
}
}
else {
/* copy from current values */

@ -3057,7 +3057,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
ParticleKey result;
float birthtime = 0.0f, dietime = 0.0f;
float t, time = 0.0f, keytime = 0.0f, frs_sec;
float t, time = 0.0f, keytime = 0.0f /*, frs_sec */;
float hairmat[4][4], rotmat[3][3], prev_tangent[3] = {0.0f, 0.0f, 0.0f};
int k, i;
int steps = (int)pow(2.0, (double)pset->draw_step);
@ -3078,7 +3078,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
recalc_set = 1;
}
frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f;
/* frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f; */ /* UNUSED */
if(pset->brushtype == PE_BRUSH_WEIGHT) {
;/* use weight painting colors now... */

@ -890,7 +890,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
if(ctx->tree){
KDTreeNearest ptn[10];
int w,maxw;//, do_seams;
float maxd,mind,/*dd,*/totw= 0.0f;
float maxd /*, mind,dd */, totw= 0.0f;
int parent[10];
float pweight[10];
@ -899,7 +899,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
maxw = BLI_kdtree_find_n_nearest(ctx->tree,4,orco1,NULL,ptn);
maxd=ptn[maxw-1].dist;
mind=ptn[0].dist;
/* mind=ptn[0].dist; */ /* UNUSED */
/* the weights here could be done better */
for(w=0; w<maxw; w++){

@ -468,6 +468,7 @@ Scene *add_scene(const char *name)
sce->r.ffcodecdata.audio_mixrate = 44100;
sce->r.ffcodecdata.audio_volume = 1.0f;
sce->r.ffcodecdata.audio_bitrate = 192;
BLI_strncpy(sce->r.engine, "BLENDER_RENDER", sizeof(sce->r.engine));

@ -31,6 +31,7 @@
* \ingroup bke
*/
#include "BLI_winstuff.h"
#include <string.h>
#include <stdio.h>
@ -416,3 +417,20 @@ void BKE_screen_view3d_main_sync(ListBase *screen_lb, Scene *scene)
}
}
/* magic zoom calculation, no idea what
* it signifies, if you find out, tell me! -zr
*/
/* simple, its magic dude!
* well, to be honest, this gives a natural feeling zooming
* with multiple keypad presses (ton)
*/
float BKE_screen_view3d_zoom_to_fac(float camzoom)
{
return powf(((float)M_SQRT2 + camzoom/50.0f), 2.0f) / 4.0f;
}
float BKE_screen_view3d_zoom_from_fac(float zoomfac)
{
return ((sqrtf(4.0f * zoomfac) - (float)M_SQRT2) * 50.0f);
}

@ -3207,26 +3207,30 @@ Sequence *seq_metastrip(ListBase * seqbase, Sequence * meta, Sequence *seq)
return NULL;
}
int seq_swap(Sequence *seq_a, Sequence *seq_b)
int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
{
char name[sizeof(seq_a->name)];
if(seq_a->len != seq_b->len)
*error_str= "Strips must be the same length";
return 0;
/* type checking, could be more advanced but disalow sound vs non-sound copy */
if(seq_a->type != seq_b->type) {
if(seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) {
*error_str= "Strips were not compatible";
return 0;
}
/* disallow effects to swap with non-effects strips */
if((seq_a->type & SEQ_EFFECT) != (seq_b->type & SEQ_EFFECT)) {
*error_str= "Strips were not compatible";
return 0;
}
if((seq_a->type & SEQ_EFFECT) && (seq_b->type & SEQ_EFFECT)) {
if(get_sequence_effect_num_inputs(seq_a->type) != get_sequence_effect_num_inputs(seq_b->type)) {
*error_str= "Strips must have the same number of inputs";
return 0;
}
}

@ -640,7 +640,7 @@ static void add_mesh_quad_diag_springs(Object *ob)
{
Mesh *me= ob->data;
MFace *mface= me->mface;
BodyPoint *bp;
/*BodyPoint *bp;*/ /*UNUSED*/
BodySpring *bs, *bs_new;
int a ;
@ -661,7 +661,7 @@ static void add_mesh_quad_diag_springs(Object *ob)
/* fill the tail */
a = 0;
bs = bs_new+ob->soft->totspring;
bp= ob->soft->bpoint;
/*bp= ob->soft->bpoint; */ /*UNUSED*/
if(mface ) {
for(a=me->totface; a>0; a--, mface++) {
if(mface->v4) {
@ -1042,7 +1042,10 @@ static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int
GHash *hash;
GHashIterator *ihash;
float aabbmin[3],aabbmax[3];
int a, deflected=0;
int deflected=0;
#if 0
int a;
#endif
if ((sb == NULL) || (sb->scratch ==NULL)) return 0;
VECCOPY(aabbmin,sb->scratch->aabbmin);
@ -1056,17 +1059,20 @@ static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int
ob = BLI_ghashIterator_getKey (ihash);
/* only with deflecting set */
if(ob->pd && ob->pd->deflect) {
#if 0 /* UNUSED */
MFace *mface= NULL;
MVert *mvert= NULL;
MVert *mprevvert= NULL;
ccdf_minmax *mima= NULL;
#endif
if(ccdm){
#if 0 /* UNUSED */
mface= ccdm->mface;
mvert= ccdm->mvert;
mprevvert= ccdm->mprevvert;
mima= ccdm->mima;
a = ccdm->totface;
#endif
if ((aabbmax[0] < ccdm->bbmin[0]) ||
(aabbmax[1] < ccdm->bbmin[1]) ||
(aabbmax[2] < ccdm->bbmin[2]) ||
@ -2095,19 +2101,25 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
float dir[3],dvel[3];
float distance,forcefactor,kd,absvel,projvel,kw;
#if 0 /* UNUSED */
int ia,ic;
#endif
/* prepare depending on which side of the spring we are on */
if (bpi == bs->v1){
bp1 = &sb->bpoint[bs->v1];
bp2 = &sb->bpoint[bs->v2];
#if 0 /* UNUSED */
ia =3*bs->v1;
ic =3*bs->v2;
#endif
}
else if (bpi == bs->v2){
bp1 = &sb->bpoint[bs->v2];
bp2 = &sb->bpoint[bs->v1];
#if 0 /* UNUSED */
ia =3*bs->v2;
ic =3*bs->v1;
#endif
}
else{
/* TODO make this debug option */
@ -2454,23 +2466,23 @@ static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, fl
* this will ruin adaptive stepsize AKA heun! (BM)
*/
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bproot;
/*BodyPoint *bproot;*/ /* UNUSED */
ListBase *do_effector = NULL;
float gravity;
/* float gravity; */ /* UNUSED */
/* float iks; */
float fieldfactor = -1.0f, windfactor = 0.25;
int do_deflector,do_selfcollision,do_springcollision,do_aero;
int do_deflector /*,do_selfcollision*/ ,do_springcollision,do_aero;
gravity = sb->grav * sb_grav_force_scale(ob);
/* gravity = sb->grav * sb_grav_force_scale(ob); */ /* UNUSED */
/* check conditions for various options */
do_deflector= query_external_colliders(scene, ob);
do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF));
/* do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF)); */ /* UNUSED */
do_springcollision=do_deflector && (ob->softflag & OB_SB_EDGES) &&(ob->softflag & OB_SB_EDGECOLL);
do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES));
/* iks = 1.0f/(1.0f-sb->inspring)-1.0f; */ /* inner spring constants function */ /* UNUSED */
bproot= sb->bpoint; /* need this for proper spring addressing */
/* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */
if (do_springcollision || do_aero)
sb_sfesf_threads_run(scene, ob, timenow,sb->totspring,NULL);
@ -2516,7 +2528,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
*/
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp;
BodyPoint *bproot;
/* BodyPoint *bproot; */ /* UNUSED */
BodySpring *bs;
ListBase *do_effector = NULL;
float iks, ks, kd, gravity[3] = {0.0f,0.0f,0.0f};
@ -2547,7 +2559,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES));
iks = 1.0f/(1.0f-sb->inspring)-1.0f ;/* inner spring constants function */
bproot= sb->bpoint; /* need this for proper spring addressing */
/* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */
if (do_springcollision || do_aero) scan_for_ext_spring_forces(scene, ob, timenow);
/* after spring scan because it uses Effoctors too */

@ -238,7 +238,7 @@ static void cleanup_textline(TextLine * tl)
int reopen_text(Text *text)
{
FILE *fp;
int i, llen, len, res;
int i, llen, len;
unsigned char *buffer;
TextLine *tmp;
char str[FILE_MAXDIR+FILE_MAXFILE];
@ -281,7 +281,7 @@ int reopen_text(Text *text)
fclose(fp);
res= stat(str, &st);
stat(str, &st);
text->mtime= st.st_mtime;
text->nlines=0;
@ -334,7 +334,7 @@ Text *add_text(const char *file, const char *relpath)
{
Main *bmain= G.main;
FILE *fp;
int i, llen, len, res;
int i, llen, len;
unsigned char *buffer;
TextLine *tmp;
Text *ta;
@ -374,7 +374,7 @@ Text *add_text(const char *file, const char *relpath)
fclose(fp);
res= stat(str, &st);
stat(str, &st);
ta->mtime= st.st_mtime;
ta->nlines=0;
@ -1236,14 +1236,11 @@ int txt_find_string(Text *text, char *findstr, int wrap, int match_case)
{
TextLine *tl, *startl;
char *s= NULL;
int oldcl, oldsl;
if (!text || !text->curl || !text->sell) return 0;
txt_order_cursors(text);
oldcl= txt_get_span(text->lines.first, text->curl);
oldsl= txt_get_span(text->lines.first, text->sell);
tl= startl= text->sell;
if(match_case) s= strstr(&tl->line[text->selc], findstr);
@ -1894,13 +1891,13 @@ void txt_do_undo(Text *text)
if (op==UNDO_INDENT) {
unindent(text);
txt_unindent(text);
} else if (op== UNDO_UNINDENT) {
indent(text);
txt_indent(text);
} else if (op == UNDO_COMMENT) {
uncomment(text);
txt_uncomment(text);
} else if (op == UNDO_UNCOMMENT) {
comment(text);
txt_comment(text);
}
text->undo_pos--;
@ -2110,13 +2107,13 @@ void txt_do_redo(Text *text)
}
if (op==UNDO_INDENT) {
indent(text);
txt_indent(text);
} else if (op== UNDO_UNINDENT) {
unindent(text);
txt_unindent(text);
} else if (op == UNDO_COMMENT) {
comment(text);
txt_comment(text);
} else if (op == UNDO_UNCOMMENT) {
uncomment(text);
txt_uncomment(text);
}
break;
default:
@ -2414,7 +2411,7 @@ static int txt_add_char_intern (Text *text, char add, int replace_tabs)
return 1;
}
/* insert spaces rather then tabs */
/* insert spaces rather than tabs */
if (add == '\t' && replace_tabs) {
txt_convert_tab_to_spaces(text);
return 1;
@ -2501,7 +2498,7 @@ int txt_replace_char (Text *text, char add)
return 1;
}
void indent(Text *text)
void txt_indent(Text *text)
{
int len, num;
char *tmp;
@ -2512,7 +2509,7 @@ void indent(Text *text)
/* hardcoded: TXT_TABSIZE = 4 spaces: */
int spaceslen = TXT_TABSIZE;
/* insert spaces rather then tabs */
/* insert spaces rather than tabs */
if (text->flags & TXT_TABSTOSPACES){
add = tab_to_spaces;
indentlen = spaceslen;
@ -2564,7 +2561,7 @@ void indent(Text *text)
}
}
void unindent(Text *text)
void txt_unindent(Text *text)
{
int num = 0;
const char *remove = "\t";
@ -2573,7 +2570,7 @@ void unindent(Text *text)
/* hardcoded: TXT_TABSIZE = 4 spaces: */
int spaceslen = TXT_TABSIZE;
/* insert spaces rather then tabs */
/* insert spaces rather than tabs */
if (text->flags & TXT_TABSTOSPACES){
remove = tab_to_spaces;
indent = spaceslen;
@ -2622,7 +2619,7 @@ void unindent(Text *text)
}
}
void comment(Text *text)
void txt_comment(Text *text)
{
int len, num;
char *tmp;
@ -2674,7 +2671,7 @@ void comment(Text *text)
}
}
void uncomment(Text *text)
void txt_uncomment(Text *text)
{
int num = 0;
char remove = '#';
@ -2751,19 +2748,19 @@ int setcurr_tab_spaces (Text *text, int space)
* 2) within an identifier
* 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414]
*/
int a, indent = 0;
int a, is_indent = 0;
for(a=0; (a < text->curc) && (text->curl->line[a] != '\0'); a++)
{
char ch= text->curl->line[a];
if (ch=='#') {
break;
} else if (ch==':') {
indent = 1;
} else if (ch==']' || ch=='}' || ch=='"' || ch=='\'') {
indent = 0;
is_indent = 1;
} else if (ch!=' ' && ch!='\t') {
is_indent = 0;
}
}
if (indent) {
if (is_indent) {
i += space;
}
}

@ -39,19 +39,6 @@
#include <libswscale/swscale.h>
#include <libavcodec/opt.h>
#if LIBAVFORMAT_VERSION_INT < (49 << 16)
#define FFMPEG_OLD_FRAME_RATE 1
#else
#define FFMPEG_CODEC_IS_POINTER 1
#define FFMPEG_CODEC_TIME_BASE 1
#endif
#if LIBAVFORMAT_VERSION_INT >= (52 << 16)
#define OUTFILE_PB (outfile->pb)
#else
#define OUTFILE_PB (&outfile->pb)
#endif
#if defined(WIN32) && (!(defined snprintf))
#define snprintf _snprintf
#endif
@ -74,6 +61,8 @@
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "ffmpeg_compat.h"
extern void do_init_ffmpeg(void);
static int ffmpeg_type = 0;
@ -114,24 +103,12 @@ static void delete_picture(AVFrame* f)
}
}
#ifdef FFMPEG_CODEC_IS_POINTER
static AVCodecContext* get_codec_from_stream(AVStream* stream)
{
return stream->codec;
}
#else
static AVCodecContext* get_codec_from_stream(AVStream* stream)
{
return &stream->codec;
}
#endif
static int write_audio_frame(void)
{
AVCodecContext* c = NULL;
AVPacket pkt;
c = get_codec_from_stream(audio_stream);
c = audio_stream->codec;
av_init_packet(&pkt);
pkt.size = 0;
@ -153,17 +130,15 @@ static int write_audio_frame(void)
if(c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE)
{
#ifdef FFMPEG_CODEC_TIME_BASE
pkt.pts = av_rescale_q(c->coded_frame->pts,
c->time_base, audio_stream->time_base);
#else
pkt.pts = c->coded_frame->pts;
#endif
c->time_base, audio_stream->time_base);
fprintf(stderr, "Audio Frame PTS: %d\n", (int)pkt.pts);
}
pkt.stream_index = audio_stream->index;
pkt.flags |= PKT_FLAG_KEY;
pkt.flags |= AV_PKT_FLAG_KEY;
if (av_interleaved_write_frame(outfile, &pkt) != 0) {
fprintf(stderr, "Error writing audio packet!\n");
return -1;
@ -263,10 +238,10 @@ static int write_video_frame(RenderData *rd, AVFrame* frame, ReportList *reports
{
int outsize = 0;
int ret, success= 1;
AVCodecContext* c = get_codec_from_stream(video_stream);
#ifdef FFMPEG_CODEC_TIME_BASE
AVCodecContext* c = video_stream->codec;
frame->pts = rd->cfra - rd->sfra;
#endif
if (rd->mode & R_FIELDS) {
frame->top_field_first = ((rd->mode & R_ODDFIELD) != 0);
}
@ -278,19 +253,15 @@ static int write_video_frame(RenderData *rd, AVFrame* frame, ReportList *reports
av_init_packet(&packet);
if (c->coded_frame->pts != AV_NOPTS_VALUE) {
#ifdef FFMPEG_CODEC_TIME_BASE
packet.pts = av_rescale_q(c->coded_frame->pts,
c->time_base,
video_stream->time_base);
#else
packet.pts = c->coded_frame->pts;
#endif
fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
} else {
fprintf(stderr, "Video Frame PTS: not set\n");
}
if (c->coded_frame->key_frame)
packet.flags |= PKT_FLAG_KEY;
packet.flags |= AV_PKT_FLAG_KEY;
packet.stream_index = video_stream->index;
packet.data = video_buffer;
packet.size = outsize;
@ -312,7 +283,7 @@ static AVFrame* generate_video_frame(uint8_t* pixels, ReportList *reports)
{
uint8_t* rendered_frame;
AVCodecContext* c = get_codec_from_stream(video_stream);
AVCodecContext* c = video_stream->codec;
int width = c->width;
int height = c->height;
AVFrame* rgb_frame;
@ -396,7 +367,7 @@ static void set_ffmpeg_property_option(AVCodecContext* c, IDProperty * prop)
switch(prop->type) {
case IDP_STRING:
fprintf(stderr, "%s.\n", IDP_String(prop));
rv = av_set_string(c, prop->name, IDP_String(prop));
av_set_string3(c, prop->name, IDP_String(prop), 1, &rv);
break;
case IDP_FLOAT:
fprintf(stderr, "%g.\n", IDP_Float(prop));
@ -407,7 +378,7 @@ static void set_ffmpeg_property_option(AVCodecContext* c, IDProperty * prop)
if (param) {
if (IDP_Int(prop)) {
rv = av_set_string(c, name, param);
av_set_string3(c, name, param, 1, &rv);
} else {
return;
}
@ -459,9 +430,9 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
/* Set up the codec context */
c = get_codec_from_stream(st);
c = st->codec;
c->codec_id = codec_id;
c->codec_type = CODEC_TYPE_VIDEO;
c->codec_type = AVMEDIA_TYPE_VIDEO;
/* Get some values from the current render settings */
@ -469,7 +440,6 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
c->width = rectx;
c->height = recty;
#ifdef FFMPEG_CODEC_TIME_BASE
/* FIXME: Really bad hack (tm) for NTSC support */
if (ffmpeg_type == FFMPEG_DV && rd->frs_sec != 25) {
c->time_base.den = 2997;
@ -482,20 +452,6 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
c->time_base.den = rd->frs_sec * 100000;
c->time_base.num = ((double) rd->frs_sec_base) * 100000;
}
#else
/* FIXME: Really bad hack (tm) for NTSC support */
if (ffmpeg_type == FFMPEG_DV && rd->frs_sec != 25) {
c->frame_rate = 2997;
c->frame_rate_base = 100;
} else if ((double) ((int) rd->frs_sec_base) ==
rd->frs_sec_base) {
c->frame_rate = rd->frs_sec;
c->frame_rate_base = rd->frs_sec_base;
} else {
c->frame_rate = rd->frs_sec * 100000;
c->frame_rate_base = ((double) rd->frs_sec_base)*100000;
}
#endif
c->gop_size = ffmpeg_gop_size;
c->bit_rate = ffmpeg_video_bitrate*1000;
@ -519,7 +475,7 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
c->pix_fmt = PIX_FMT_YUV422P;
}
if (codec_id == CODEC_ID_XVID) {
if (ffmpeg_type == FFMPEG_XVID) {
/* arghhhh ... */
c->pix_fmt = PIX_FMT_YUV420P;
c->codec_tag = (('D'<<24) + ('I'<<16) + ('V'<<8) + 'X');
@ -586,9 +542,9 @@ static AVStream* alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
st = av_new_stream(of, 1);
if (!st) return NULL;
c = get_codec_from_stream(st);
c = st->codec;
c->codec_id = codec_id;
c->codec_type = CODEC_TYPE_AUDIO;
c->codec_type = AVMEDIA_TYPE_AUDIO;
c->sample_rate = rd->ffcodecdata.audio_mixrate;
c->bit_rate = ffmpeg_audio_bitrate*1000;
@ -666,13 +622,13 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
BKE_report(reports, RPT_ERROR, "No valid formats found.");
return 0;
}
fmt = guess_format(NULL, exts[0], NULL);
fmt = av_guess_format(NULL, exts[0], NULL);
if (!fmt) {
BKE_report(reports, RPT_ERROR, "No valid formats found.");
return 0;
}
of = av_alloc_format_context();
of = avformat_alloc_context();
if (!of) {
BKE_report(reports, RPT_ERROR, "Error opening output file");
return 0;
@ -713,7 +669,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
fmt->video_codec = CODEC_ID_H264;
break;
case FFMPEG_XVID:
fmt->video_codec = CODEC_ID_XVID;
fmt->video_codec = CODEC_ID_MPEG4;
break;
case FFMPEG_FLV:
fmt->video_codec = CODEC_ID_FLV1;
@ -772,7 +728,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
return 0;
}
if (!(fmt->flags & AVFMT_NOFILE)) {
if (url_fopen(&of->pb, name, URL_WRONLY) < 0) {
if (avio_open(&of->pb, name, AVIO_FLAG_WRITE) < 0) {
BKE_report(reports, RPT_ERROR, "Could not open file for writing.");
return 0;
}
@ -780,7 +736,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
av_write_header(of);
outfile = of;
dump_format(of, 0, name, 1);
av_dump_format(of, 0, name, 1);
return 1;
}
@ -807,7 +763,7 @@ void flush_ffmpeg(void)
int outsize = 0;
int ret = 0;
AVCodecContext* c = get_codec_from_stream(video_stream);
AVCodecContext* c = video_stream->codec;
/* get the delayed frames */
while (1) {
AVPacket packet;
@ -822,19 +778,15 @@ void flush_ffmpeg(void)
break;
}
if (c->coded_frame->pts != AV_NOPTS_VALUE) {
#ifdef FFMPEG_CODEC_TIME_BASE
packet.pts = av_rescale_q(c->coded_frame->pts,
c->time_base,
video_stream->time_base);
#else
packet.pts = c->coded_frame->pts;
#endif
fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
} else {
fprintf(stderr, "Video Frame PTS: not set\n");
}
if (c->coded_frame->key_frame) {
packet.flags |= PKT_FLAG_KEY;
packet.flags |= AV_PKT_FLAG_KEY;
}
packet.stream_index = video_stream->index;
packet.data = video_buffer;
@ -845,7 +797,7 @@ void flush_ffmpeg(void)
break;
}
}
avcodec_flush_buffers(get_codec_from_stream(video_stream));
avcodec_flush_buffers(video_stream->codec);
}
/* **********************************************************************
@ -902,7 +854,7 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
if(audio_stream)
{
AVCodecContext* c = get_codec_from_stream(audio_stream);
AVCodecContext* c = audio_stream->codec;
AUD_DeviceSpecs specs;
specs.channels = c->channels;
specs.format = AUD_FORMAT_S16;
@ -945,7 +897,7 @@ int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty,
success= (avframe && write_video_frame(rd, avframe, reports));
if (ffmpeg_autosplit) {
if (url_ftell(OUTFILE_PB) > FFMPEG_AUTOSPLIT_SIZE) {
if (avio_tell(outfile->pb) > FFMPEG_AUTOSPLIT_SIZE) {
end_ffmpeg();
ffmpeg_autosplit_count++;
success &= start_ffmpeg_impl(rd, rectx, recty, reports);
@ -974,7 +926,7 @@ void end_ffmpeg(void)
audio_mixdown_device = 0;
}
if (video_stream && get_codec_from_stream(video_stream)) {
if (video_stream && video_stream->codec) {
fprintf(stderr, "Flushing delayed frames...\n");
flush_ffmpeg ();
}
@ -985,8 +937,8 @@ void end_ffmpeg(void)
/* Close the video codec */
if (video_stream && get_codec_from_stream(video_stream)) {
avcodec_close(get_codec_from_stream(video_stream));
if (video_stream && video_stream->codec) {
avcodec_close(video_stream->codec);
printf("zero video stream %p\n", video_stream);
video_stream = 0;
}
@ -1007,7 +959,7 @@ void end_ffmpeg(void)
}
if (outfile && outfile->oformat) {
if (!(outfile->oformat->flags & AVFMT_NOFILE)) {
url_fclose(OUTFILE_PB);
avio_close(outfile->pb);
}
}
if (outfile) {
@ -1101,12 +1053,12 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int
switch (o->type) {
case FF_OPT_TYPE_INT:
case FF_OPT_TYPE_INT64:
val.i = o->default_val;
val.i = FFMPEG_DEF_OPT_VAL_INT(o);
idp_type = IDP_INT;
break;
case FF_OPT_TYPE_DOUBLE:
case FF_OPT_TYPE_FLOAT:
val.f = o->default_val;
val.f = FFMPEG_DEF_OPT_VAL_DOUBLE(o);
idp_type = IDP_FLOAT;
break;
case FF_OPT_TYPE_STRING:
@ -1314,7 +1266,7 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
case FFMPEG_PRESET_XVID:
if(preset == FFMPEG_PRESET_XVID) {
rd->ffcodecdata.type = FFMPEG_AVI;
rd->ffcodecdata.codec = CODEC_ID_XVID;
rd->ffcodecdata.codec = CODEC_ID_MPEG4;
}
else if(preset == FFMPEG_PRESET_THEORA) {
rd->ffcodecdata.type = FFMPEG_OGG; // XXX broken
@ -1357,7 +1309,7 @@ void ffmpeg_verify_image_type(RenderData *rd)
}
}
else if(rd->imtype == R_XVID) {
if(rd->ffcodecdata.codec != CODEC_ID_XVID) {
if(rd->ffcodecdata.codec != CODEC_ID_MPEG4) {
ffmpeg_set_preset(rd, FFMPEG_PRESET_XVID);
audio= 1;
}

@ -84,7 +84,7 @@ void mul_v3_m4v3(float r[3], float M[4][4], float v[3]);
void mul_mat3_m4_v3(float M[4][4], float r[3]);
void mul_m4_v4(float M[4][4], float r[4]);
void mul_v4_m4v4(float r[4], float M[4][4], float v[4]);
void mul_project_m4_v4(float M[4][4], float r[3]);
void mul_project_m4_v3(float M[4][4], float vec[3]);
void mul_m3_v3(float M[3][3], float r[3]);
void mul_v3_m3v3(float r[3], float M[3][3], float a[3]);

@ -50,11 +50,7 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check);
/* folder_id */
/* general, will find based on user/local/system priority */
#define BLENDER_CONFIG 1
#define BLENDER_DATAFILES 2
#define BLENDER_SCRIPTS 3
#define BLENDER_PLUGINS 4
#define BLENDER_PYTHON 5
/* user-specific */
#define BLENDER_USER_CONFIG 31
@ -64,7 +60,6 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check);
#define BLENDER_USER_AUTOSAVE 35
/* system */
#define BLENDER_SYSTEM_CONFIG 51 /* optional */
#define BLENDER_SYSTEM_DATAFILES 52
#define BLENDER_SYSTEM_SCRIPTS 53
#define BLENDER_SYSTEM_PLUGINS 54
@ -86,7 +81,7 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check);
#ifdef WIN32
#define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s"
#define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s"
#elif __APPLE__
#elif defined(__APPLE__)
#define BLENDER_USER_FORMAT "%s/Blender/%s"
#define BLENDER_SYSTEM_FORMAT "%s/Blender/%s"
#else

@ -122,13 +122,6 @@ __attribute__ ((format (printf, 1, 2)))
#endif
;
/**
* Compare two strings
*
* @retval True if the strings are equal, false otherwise.
*/
int BLI_streq(const char *a, const char *b);
/**
* Compare two strings without regard to case.
*
@ -147,6 +140,9 @@ void BLI_timestr(double _time, char *str); /* time var is global */
int BLI_utf8_invalid_byte(const char *str, int length);
int BLI_utf8_invalid_strip(char *str, int length);
void BLI_ascii_strtolower(char *str, int len);
void BLI_ascii_strtoupper(char *str, int len);
#ifdef __cplusplus
}
#endif

@ -32,6 +32,9 @@ set(INC
../gpu
../../../intern/ghost
../../../intern/guardedalloc
)
set(INC_SYS
${ZLIB_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
)
@ -134,12 +137,12 @@ set(SRC
)
if(WITH_BINRELOC)
list(APPEND INC_SYS "${BINRELOC_INC}")
add_definitions(-DWITH_BINRELOC)
list(APPEND INC "${BINRELOC_INC}")
endif()
if(WITH_OPENMP)
add_definitions(-DPARALLEL=1)
endif()
blender_add_lib(bf_blenlib "${SRC}" "${INC}")
blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}")

@ -1687,13 +1687,13 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
{
if(node->totnode == 0)
{
#if 0 /*UNUSED*/
//Calculate the node min-coords (if the node was a point then this is the point coordinates)
float co[3];
co[0] = node->bv[0];
co[1] = node->bv[2];
co[2] = node->bv[4];
#endif
}
else
{

@ -68,21 +68,16 @@
#include "BKE_utildefines.h"
#include "BKE_report.h"
//XXX #include "BIF_screen.h" /* only for wait cursor */
//
/* for sequence */
//XXX #include "BSE_sequence.h"
//XXX define below from BSE_sequence.h - otherwise potentially odd behaviour
typedef struct BPathIteratorSeqData {
typedef struct BPathIteratorSeqData
{
int totseq;
int seq;
struct Sequence **seqar; /* Sequence */
struct Scene *scene; /* Current scene */
struct Sequence **seqar; /* Sequence */
struct Scene *scene; /* Current scene */
} BPathIteratorSeqData;
typedef struct BPathIterator {
typedef struct BPathIterator
{
char* _path; /* never access directly, use BLI_bpathIterator_getPath */
const char* _lib;
const char* _name;
@ -94,7 +89,7 @@ typedef struct BPathIterator {
void (*setpath_callback)(struct BPathIterator *, const char *);
void (*getpath_callback)(struct BPathIterator *, char *);
const char* base_path; /* base path, the directry the blend file is in - normally bmain->name */
const char* base_path; /* base path, the directory the blend file is in - normally bmain->name */
Main *bmain;
@ -116,7 +111,7 @@ enum BPathTypes {
BPATH_SEQ,
BPATH_CDATA,
BPATH_DONE
BPATH_DONE
};
void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const char *basedir, const int flag)
@ -128,10 +123,10 @@ void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const ch
bpi->type= BPATH_IMAGE;
bpi->data= NULL;
bpi->getpath_callback= NULL;
bpi->setpath_callback= NULL;
/* Sequencer specific */
bpi->seqdata.totseq= 0;
bpi->seqdata.seq= 0;
@ -147,62 +142,75 @@ void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const ch
}
#if 0
static void BLI_bpathIterator_alloc(struct BPathIterator **bpi) {
static void BLI_bpathIterator_alloc(struct BPathIterator **bpi)
{
*bpi= MEM_mallocN(sizeof(BPathIterator), "BLI_bpathIterator_alloc");
}
#endif
void BLI_bpathIterator_free(struct BPathIterator *bpi) {
void BLI_bpathIterator_free(struct BPathIterator *bpi)
{
if (bpi->seqdata.seqar)
MEM_freeN((void *)bpi->seqdata.seqar);
bpi->seqdata.seqar= NULL;
bpi->seqdata.scene= NULL;
MEM_freeN(bpi);
}
void BLI_bpathIterator_getPath(struct BPathIterator *bpi, char *path) {
void BLI_bpathIterator_getPath(struct BPathIterator *bpi, char *path)
{
if (bpi->getpath_callback) {
bpi->getpath_callback(bpi, path);
} else {
}
else {
strcpy(path, bpi->_path); /* warning, we assume 'path' are long enough */
}
}
void BLI_bpathIterator_setPath(struct BPathIterator *bpi, const char *path) {
void BLI_bpathIterator_setPath(struct BPathIterator *bpi, const char *path)
{
if (bpi->setpath_callback) {
bpi->setpath_callback(bpi, path);
} else {
}
else {
strcpy(bpi->_path, path); /* warning, we assume 'path' are long enough */
}
}
void BLI_bpathIterator_getPathExpanded(struct BPathIterator *bpi, char *path_expanded) {
void BLI_bpathIterator_getPathExpanded(struct BPathIterator *bpi, char *path_expanded)
{
const char *libpath;
BLI_bpathIterator_getPath(bpi, path_expanded);
libpath= BLI_bpathIterator_getLib(bpi);
if (libpath) { /* check the files location relative to its library path */
BLI_path_abs(path_expanded, libpath);
} else { /* local data, use the blend files path */
}
else { /* local data, use the blend files path */
BLI_path_abs(path_expanded, bpi->base_path);
}
BLI_cleanup_file(NULL, path_expanded);
}
const char* BLI_bpathIterator_getLib(struct BPathIterator *bpi) {
const char* BLI_bpathIterator_getLib(struct BPathIterator *bpi)
{
return bpi->_lib;
}
const char* BLI_bpathIterator_getName(struct BPathIterator *bpi) {
const char* BLI_bpathIterator_getName(struct BPathIterator *bpi)
{
return bpi->_name;
}
int BLI_bpathIterator_getType(struct BPathIterator *bpi) {
int BLI_bpathIterator_getType(struct BPathIterator *bpi)
{
return bpi->type;
}
unsigned int BLI_bpathIterator_getPathMaxLen(struct BPathIterator *bpi) {
unsigned int BLI_bpathIterator_getPathMaxLen(struct BPathIterator *bpi)
{
return bpi->len;
}
const char* BLI_bpathIterator_getBasePath(struct BPathIterator *bpi) {
const char* BLI_bpathIterator_getBasePath(struct BPathIterator *bpi)
{
return bpi->base_path;
}
@ -211,10 +219,10 @@ static struct Image *ima_stepdata__internal(struct Image *ima, const int step_ne
{
if (ima==NULL)
return NULL;
if (step_next)
ima= ima->id.next;
while (ima) {
if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
if(ima->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
@ -223,7 +231,7 @@ static struct Image *ima_stepdata__internal(struct Image *ima, const int step_ne
}
/* image is not a image with a path, skip it */
ima= ima->id.next;
}
}
return ima;
}
@ -240,7 +248,7 @@ static struct Tex *tex_stepdata__internal(struct Tex *tex, const int step_next,
break;
/* image is not a image with a path, skip it */
tex= tex->id.next;
}
}
return tex;
}
@ -257,7 +265,7 @@ static struct Text *text_stepdata__internal(struct Text *text, const int step_ne
break;
/* image is not a image with a path, skip it */
text= text->id.next;
}
}
return text;
}
@ -265,20 +273,20 @@ static struct VFont *vf_stepdata__internal(struct VFont *vf, const int step_next
{
if (vf==NULL)
return NULL;
if (step_next)
vf= vf->id.next;
while (vf) {
if (strcmp(vf->name, FO_BUILTIN_NAME)!=0) {
if(vf->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
break;
}
}
/* font with no path, skip it */
vf= vf->id.next;
}
}
return vf;
}
@ -286,10 +294,10 @@ static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next,
{
if (snd==NULL)
return NULL;
if (step_next)
snd= snd->id.next;
while (snd) {
if(snd->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
break;
@ -297,7 +305,7 @@ static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next,
/* font with no path, skip it */
snd= snd->id.next;
}
}
return snd;
}
@ -305,16 +313,16 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
{
Editing *ed;
Sequence *seq;
/* Initializing */
if (bpi->seqdata.scene==NULL) {
bpi->seqdata.scene= bpi->bmain->scene.first;
}
if (step_next) {
bpi->seqdata.seq++;
}
while (bpi->seqdata.scene) {
ed= seq_give_editing(bpi->seqdata.scene, 0);
if (ed) {
@ -323,10 +331,11 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
seq_array(ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0);
bpi->seqdata.seq= 0;
}
if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
seq= NULL;
} else {
}
else {
seq= bpi->seqdata.seqar[bpi->seqdata.seq];
while (!SEQ_HAS_PATH(seq) && seq->plugin==NULL) {
bpi->seqdata.seq++;
@ -339,7 +348,8 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
}
if (seq) {
return seq;
} else {
}
else {
/* keep looking through the next scene, reallocate seq array */
if (bpi->seqdata.seqar) {
MEM_freeN((void *)bpi->seqdata.seqar);
@ -347,19 +357,21 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
}
bpi->seqdata.scene= bpi->seqdata.scene->id.next;
}
} else {
}
else {
/* no seq data in this scene, next */
bpi->seqdata.scene= bpi->seqdata.scene->id.next;
}
}
return NULL;
}
static void seq_getpath(struct BPathIterator *bpi, char *path) {
static void seq_getpath(struct BPathIterator *bpi, char *path)
{
Sequence *seq= (Sequence *)bpi->data;
path[0]= '\0'; /* incase we cant get the path */
if (seq==NULL) return;
if (SEQ_HAS_PATH(seq)) {
@ -369,7 +381,7 @@ static void seq_getpath(struct BPathIterator *bpi, char *path) {
if (seq->strip->stripdata) { /* should always be true! */
/* Using the first image is weak for image sequences */
strcat(path, seq->strip->stripdata->name);
}
}
}
else {
/* simple case */
@ -381,10 +393,11 @@ static void seq_getpath(struct BPathIterator *bpi, char *path) {
}
}
static void seq_setpath(struct BPathIterator *bpi, const char *path) {
static void seq_setpath(struct BPathIterator *bpi, const char *path)
{
Sequence *seq= (Sequence *)bpi->data;
if (seq==NULL) return;
if (seq==NULL) return;
if (SEQ_HAS_PATH(seq)) {
if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) {
BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name);
@ -399,7 +412,8 @@ static void seq_setpath(struct BPathIterator *bpi, const char *path) {
}
}
static void text_getpath(struct BPathIterator *bpi, char *path) {
static void text_getpath(struct BPathIterator *bpi, char *path)
{
Text *text= (Text *)bpi->data;
path[0]= '\0'; /* incase we cant get the path */
if(text->name) {
@ -407,9 +421,10 @@ static void text_getpath(struct BPathIterator *bpi, char *path) {
}
}
static void text_setpath(struct BPathIterator *bpi, const char *path) {
static void text_setpath(struct BPathIterator *bpi, const char *path)
{
Text *text= (Text *)bpi->data;
if (text==NULL) return;
if (text==NULL) return;
if(text->name) {
MEM_freeN(text->name);
@ -418,27 +433,29 @@ static void text_setpath(struct BPathIterator *bpi, const char *path) {
text->name= BLI_strdup(path);
}
static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next) {
static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next)
{
if (me==NULL)
return NULL;
if (step_next)
me= me->id.next;
while (me) {
if (me->fdata.external) {
break;
}
me= me->id.next;
}
}
return me;
}
static void bpi_type_step__internal(struct BPathIterator *bpi) {
static void bpi_type_step__internal(struct BPathIterator *bpi)
{
bpi->type++; /* advance to the next type */
bpi->data= NULL;
switch (bpi->type) {
case BPATH_SEQ:
bpi->getpath_callback= seq_getpath;
@ -455,27 +472,29 @@ static void bpi_type_step__internal(struct BPathIterator *bpi) {
}
}
void BLI_bpathIterator_step(struct BPathIterator *bpi) {
void BLI_bpathIterator_step(struct BPathIterator *bpi)
{
while (bpi->type != BPATH_DONE) {
if ((bpi->type) == BPATH_IMAGE) {
/*if (bpi->data) bpi->data= ((ID *)bpi->data)->next;*/
if (bpi->data) bpi->data= ima_stepdata__internal((Image *)bpi->data, 1, bpi->flag); /* must skip images that have no path */
else bpi->data= ima_stepdata__internal(bpi->bmain->image.first, 0, bpi->flag);
if (bpi->data) {
/* get the path info from this datatype */
Image *ima= (Image *)bpi->data;
bpi->_lib= ima->id.lib ? ima->id.lib->filepath : NULL;
bpi->_path= ima->name;
bpi->_name= ima->id.name+2;
bpi->len= sizeof(ima->name);
/* we are done, advancing to the next item, this type worked fine */
break;
} else {
}
else {
bpi_type_step__internal(bpi);
}
}
@ -502,7 +521,8 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
/* we are done, advancing to the next item, this type worked fine */
break;
} else {
}
else {
bpi_type_step__internal(bpi);
}
}
@ -524,11 +544,11 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
/* we are done, advancing to the next item, this type worked fine */
break;
} else {
}
else {
bpi_type_step__internal(bpi);
}
}
else if ((bpi->type) == BPATH_SOUND) {
if (bpi->data) bpi->data= snd_stepdata__internal((bSound *)bpi->data, 1, bpi->flag); /* must skip images that have no path */
else bpi->data= snd_stepdata__internal(bpi->bmain->sound.first, 0, bpi->flag);
@ -544,16 +564,16 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
/* we are done, advancing to the next item, this type worked fine */
break;
} else {
}
else {
bpi_type_step__internal(bpi);
}
} else if ((bpi->type) == BPATH_FONT) {
}
else if ((bpi->type) == BPATH_FONT) {
if (bpi->data) bpi->data= vf_stepdata__internal((VFont *)bpi->data, 1, bpi->flag);
else bpi->data= vf_stepdata__internal(bpi->bmain->vfont.first, 0, bpi->flag);
if (bpi->data) {
/* get the path info from this datatype */
VFont *vf= (VFont *)bpi->data;
@ -565,29 +585,33 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
/* we are done, advancing to the next item, this type worked fine */
break;
} else {
}
else {
bpi_type_step__internal(bpi);
}
} else if ((bpi->type) == BPATH_LIB) {
}
else if ((bpi->type) == BPATH_LIB) {
if (bpi->data) bpi->data= ((ID *)bpi->data)->next;
else bpi->data= bpi->bmain->library.first;
if (bpi->data) {
/* get the path info from this datatype */
Library *lib= (Library *)bpi->data;
bpi->_lib= NULL;
bpi->_path= lib->name;
bpi->_name= NULL;
bpi->len= sizeof(lib->name);
/* we are done, advancing to the next item, this type worked fine */
break;
} else {
}
else {
bpi_type_step__internal(bpi);
}
} else if ((bpi->type) == BPATH_SEQ) {
}
else if ((bpi->type) == BPATH_SEQ) {
if (bpi->data) bpi->data= seq_stepdata__internal( bpi, 1 );
else bpi->data= seq_stepdata__internal( bpi, 0 );
if (bpi->data) {
@ -596,10 +620,12 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
bpi->_name= seq->name+2;
bpi->len= seq->plugin ? sizeof(seq->plugin->name) : sizeof(seq->strip->dir) + sizeof(seq->strip->stripdata->name);
break;
} else {
}
else {
bpi_type_step__internal(bpi);
}
} else if ((bpi->type) == BPATH_CDATA) {
}
else if ((bpi->type) == BPATH_CDATA) {
if (bpi->data) bpi->data= cdata_stepdata__internal( bpi->data, 1 );
else bpi->data= cdata_stepdata__internal( bpi->bmain->mesh.first, 0 );
@ -610,7 +636,8 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
bpi->_name= me->id.name+2;
bpi->len= sizeof(me->fdata.external->filename);
break;
} else {
}
else {
bpi_type_step__internal(bpi);
}
}
@ -627,7 +654,7 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
const char *prefix;
const char *name;
char path_expanded[FILE_MAXDIR*2];
if(reports==NULL)
return;
@ -660,7 +687,7 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
prefix= "Unknown";
break;
}
name= BLI_bpathIterator_getName(bpi);
BLI_bpathIterator_getPathExpanded(bpi, path_expanded);
@ -674,14 +701,14 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
/* high level function */
void checkMissingFiles(Main *bmain, ReportList *reports) {
struct BPathIterator *bpi;
/* be sure there is low chance of the path being too short */
char filepath_expanded[FILE_MAXDIR*2];
char filepath_expanded[FILE_MAXDIR*2];
BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0);
while (!BLI_bpathIterator_isDone(bpi)) {
BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
if (!BLI_exists(filepath_expanded))
bpath_as_report(bpi, "file not found", reports);
@ -696,7 +723,7 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) {
struct BPathIterator *bpi;
char filepath[FILE_MAX];
const char *libpath;
/* be sure there is low chance of the path being too short */
char filepath_relative[(FILE_MAXDIR * 2) + FILE_MAXFILE];
@ -709,25 +736,28 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) {
while (!BLI_bpathIterator_isDone(bpi)) {
BLI_bpathIterator_getPath(bpi, filepath);
libpath= BLI_bpathIterator_getLib(bpi);
if(strncmp(filepath, "//", 2)) {
if (libpath) { /* cant make relative if we are library - TODO, LOG THIS */
linked++;
} else { /* local data, use the blend files path */
}
else { /* local data, use the blend files path */
BLI_strncpy(filepath_relative, filepath, sizeof(filepath_relative));
/* Important BLI_cleanup_dir runs before the path is made relative
* because it wont work for paths that start with "//../" */
* because it wont work for paths that start with "//../" */
BLI_cleanup_file(bpi->base_path, filepath_relative); /* fix any /foo/../foo/ */
BLI_path_rel(filepath_relative, bpi->base_path);
/* be safe and check the length */
if (BLI_bpathIterator_getPathMaxLen(bpi) <= strlen(filepath_relative)) {
bpath_as_report(bpi, "couldn't make path relative (too long)", reports);
failed++;
} else {
}
else {
if(strncmp(filepath_relative, "//", 2)==0) {
BLI_bpathIterator_setPath(bpi, filepath_relative);
changed++;
} else {
}
else {
bpath_as_report(bpi, "couldn't make path relative", reports);
failed++;
}
@ -752,7 +782,7 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
struct BPathIterator *bpi;
char filepath[FILE_MAX];
const char *libpath;
/* be sure there is low chance of the path being too short */
char filepath_absolute[(FILE_MAXDIR * 2) + FILE_MAXFILE];
@ -765,22 +795,25 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
while (!BLI_bpathIterator_isDone(bpi)) {
BLI_bpathIterator_getPath(bpi, filepath);
libpath= BLI_bpathIterator_getLib(bpi);
if(strncmp(filepath, "//", 2)==0) {
if (libpath) { /* cant make absolute if we are library - TODO, LOG THIS */
linked++;
} else { /* get the expanded path and check it is relative or too long */
}
else { /* get the expanded path and check it is relative or too long */
BLI_bpathIterator_getPathExpanded(bpi, filepath_absolute);
BLI_cleanup_file(bpi->base_path, filepath_absolute); /* fix any /foo/../foo/ */
/* to be safe, check the length */
if (BLI_bpathIterator_getPathMaxLen(bpi) <= strlen(filepath_absolute)) {
bpath_as_report(bpi, "couldn't make absolute (too long)", reports);
failed++;
} else {
}
else {
if(strncmp(filepath_absolute, "//", 2)) {
BLI_bpathIterator_setPath(bpi, filepath_absolute);
changed++;
} else {
}
else {
bpath_as_report(bpi, "couldn't make absolute", reports);
failed++;
}
@ -811,25 +844,25 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
struct stat status;
char path[FILE_MAX];
int size;
dir= opendir(dirname);
if (dir==NULL)
return 0;
if (*filesize == -1)
*filesize= 0; /* dir opened fine */
while ((de= readdir(dir)) != NULL) {
if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0)
continue;
BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
if (stat(path, &status) != 0)
continue; /* cant stat, dont bother with this file, could print debug info here */
if (S_ISREG(status.st_mode)) { /* is file */
if (strncmp(filename, de->d_name, FILE_MAX)==0) { /* name matches */
/* open the file to read its size */
@ -839,7 +872,8 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
BLI_strncpy(filename_new, path, FILE_MAX);
}
}
} else if (S_ISDIR(status.st_mode)) { /* is subdir */
}
else if (S_ISDIR(status.st_mode)) { /* is subdir */
if (*recur_depth <= MAX_RECUR) {
(*recur_depth)++;
findFileRecursive(filename_new, path, filename, filesize, recur_depth);
@ -854,54 +888,55 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
/* high level function - call from fileselector */
void findMissingFiles(Main *bmain, const char *str) {
struct BPathIterator *bpi;
/* be sure there is low chance of the path being too short */
char filepath_expanded[FILE_MAXDIR*2];
char filepath_expanded[FILE_MAXDIR*2];
char filepath[FILE_MAX];
const char *libpath;
int filesize, recur_depth;
char dirname[FILE_MAX], filename_new[FILE_MAX];
//XXX waitcursor( 1 );
BLI_split_dirfile(str, dirname, NULL);
BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0);
while (!BLI_bpathIterator_isDone(bpi)) {
BLI_bpathIterator_getPath(bpi, filepath);
libpath= BLI_bpathIterator_getLib(bpi);
/* Check if esc was pressed because searching files can be slow */
/*XXX if (blender_test_break()) {
break;
}*/
if (libpath==NULL) {
BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
if (!BLI_exists(filepath_expanded)) {
/* can the dir be opened? */
filesize= -1;
recur_depth= 0;
findFileRecursive(filename_new, dirname, BLI_path_basename(filepath), &filesize, &recur_depth);
if (filesize == -1) { /* could not open dir */
printf("Could not open dir \"%s\"\n", dirname);
return;
}
if (filesize > 0) {
if (BLI_bpathIterator_getPathMaxLen(bpi) < strlen(filename_new)) {
if (BLI_bpathIterator_getPathMaxLen(bpi) < strlen(filename_new)) {
printf("cannot set path \"%s\" too long!", filename_new);
} else {
}
else {
/* copy the found path into the old one */
if (G.relbase_valid)
BLI_path_rel(filename_new, bpi->base_path);
BLI_bpathIterator_setPath(bpi, filename_new);
}
}
@ -910,6 +945,6 @@ void findMissingFiles(Main *bmain, const char *str) {
BLI_bpathIterator_step(bpi);
}
BLI_bpathIterator_free(bpi);
//XXX waitcursor( 0 );
}

@ -96,7 +96,7 @@ void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) {
eh->buckets[hash]= e;
if (++eh->nentries>eh->nbuckets*3) {
Entry *e, **old= eh->buckets;
Entry **old= eh->buckets;
int i, nold= eh->nbuckets;
eh->nbuckets= hashsizes[++eh->cursize];

@ -34,7 +34,7 @@
#include "BLI_math.h"
/* WARNING: MSVC compiling hack for double_round() */
#if (WIN32 || WIN64) && !(FREE_WINDOWS)
#if (defined(WIN32) || defined(WIN64)) && !(defined(FREE_WINDOWS))
/* from python 3.1 pymath.c */
double copysign(double x, double y)

Some files were not shown because too many files have changed in this diff Show More