diff options
188 files changed, 1835 insertions, 702 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ca7085c107..0230fb34d0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,6 +158,8 @@ endif() if(UNIX AND NOT APPLE) option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON) option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON) + option(WITH_XDG_USER_DIRS "Build with XDG Base Directory Specification (only config and documents for now)" OFF) + mark_as_advanced(WITH_XDG_USER_DIRS) else() # not an option for other OS's set(WITH_BUILTIN_GLEW ON) diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake index fd5d20920da..8c3ff64d3f3 100644 --- a/build_files/cmake/Modules/FindPythonLibsUnix.cmake +++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake @@ -44,8 +44,19 @@ SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for p MARK_AS_ADVANCED(PYTHON_LINKFLAGS) +# if the user passes these defines as args, we dont want to overwrite +SET(_IS_INC_DEF OFF) +SET(_IS_LIB_DEF OFF) +IF(DEFINED PYTHON_INCLUDE_DIR) + SET(_IS_INC_DEF ON) +ENDIF() +IF(DEFINED PYTHON_LIBRARY) + SET(_IS_LIB_DEF ON) +ENDIF() + + # only search for the dirs if we havn't already -IF((NOT DEFINED PYTHON_INCLUDE_DIR) OR (NOT DEFINED PYTHON_LIBRARY)) +IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF)) SET(_python_ABI_FLAGS "m;mu;u; " # release @@ -66,30 +77,38 @@ IF((NOT DEFINED PYTHON_INCLUDE_DIR) OR (NOT DEFINED PYTHON_LIBRARY)) #ENDIF() STRING(REPLACE " " "" _CURRENT_ABI_FLAGS ${_CURRENT_ABI_FLAGS}) - FIND_PATH(PYTHON_INCLUDE_DIR - NAMES - Python.h - HINTS - ${_python_SEARCH_DIRS} - PATH_SUFFIXES - include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS} - ) - - FIND_LIBRARY(PYTHON_LIBRARY - NAMES - "python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}" - HINTS - ${_python_SEARCH_DIRS} - PATH_SUFFIXES - lib64 lib - ) + IF(NOT DEFINED PYTHON_INCLUDE_DIR) + FIND_PATH(PYTHON_INCLUDE_DIR + NAMES + Python.h + HINTS + ${_python_SEARCH_DIRS} + PATH_SUFFIXES + include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS} + ) + ENDIF() + + IF(NOT DEFINED PYTHON_LIBRARY) + FIND_LIBRARY(PYTHON_LIBRARY + NAMES + "python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}" + HINTS + ${_python_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + ENDIF() IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR) break() ELSE() # ensure we dont find values from 2 different ABI versions - UNSET(PYTHON_INCLUDE_DIR CACHE) - UNSET(PYTHON_LIBRARY CACHE) + IF(NOT _IS_INC_DEF) + UNSET(PYTHON_INCLUDE_DIR CACHE) + ENDIF() + IF(NOT _IS_LIB_DEF) + UNSET(PYTHON_LIBRARY CACHE) + ENDIF() ENDIF() ENDFOREACH() @@ -100,6 +119,9 @@ IF((NOT DEFINED PYTHON_INCLUDE_DIR) OR (NOT DEFINED PYTHON_LIBRARY)) UNSET(_python_SEARCH_DIRS) ENDIF() +UNSET(_IS_INC_DEF) +UNSET(_IS_LIB_DEF) + # handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py index da1f2087f4f..eed002ce7ba 100755 --- a/build_files/cmake/project_info.py +++ b/build_files/cmake/project_info.py @@ -234,4 +234,3 @@ def project_name_get(path, fallback="Blender", prefix="Blender_"): if "/branches/" in l: return prefix + l.rsplit("/branches/", 1)[-1].split("/", 1)[0] return fallback - diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index ec37b3046c8..1e4821180d6 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -149,6 +149,20 @@ WITH_BF_3DMOUSE = True WITH_BF_OPENMP = True +''' +WITH_BF_OIIO = True +BF_OIIO = LIBDIR + '/openimageio' +BF_OIIO_INC = '${BF_OIIO}/include' +BF_OIIO_LIB = 'OpenImageIO' +BF_OIIO_LIBPATH = '${BF_OIIO}/lib' + +WITH_BF_BOOST = True +BF_BOOST = LIBDIR + '/boost' +BF_BOOST_INC = '${BF_BOOST}/include' +BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_46_1 libboost_filesystem-vc90-mt-s-1_46_1 libboost_regex-vc90-mt-s-1_46_1 libboost_system-vc90-mt-s-1_46_1 libboost_thread-vc90-mt-s-1_46_1' +BF_BOOST_LIBPATH = '${BF_BOOST}/lib' +''' + #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE'] diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index afa64e03e80..0920d9375ae 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -153,6 +153,20 @@ WITH_BF_3DMOUSE = True WITH_BF_OPENMP = True +''' +WITH_BF_OIIO = True +BF_OIIO = LIBDIR + '/openimageio' +BF_OIIO_INC = '${BF_OIIO}/include' +BF_OIIO_LIB = 'OpenImageIO' +BF_OIIO_LIBPATH = '${BF_OIIO}/lib' + +WITH_BF_BOOST = True +BF_BOOST = LIBDIR + '/boost' +BF_BOOST_INC = '${BF_BOOST}/include' +BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_45 libboost_filesystem-vc90-mt-s-1_45 libboost_regex-vc90-mt-s-1_45 libboost_system-vc90-mt-s-1_45 libboost_thread-vc90-mt-s-1_45' +BF_BOOST_LIBPATH = '${BF_BOOST}/lib' +''' + #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2'] diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 875d8f7388b..44f9a4c8062 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -192,6 +192,11 @@ def setup_staticlibs(lenv): if lenv['WITH_BF_OPENMP']: if lenv['OURPLATFORM'] == 'linuxcross': libincs += Split(lenv['BF_OPENMP_LIBPATH']) + + if lenv['WITH_BF_OIIO']: + libincs += Split(lenv['BF_OIIO_LIBPATH']) + if lenv['WITH_BF_BOOST']: + libincs += Split(lenv['BF_BOOST_LIBPATH']) # setting this last so any overriding of manually libs could be handled if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): @@ -275,6 +280,11 @@ def setup_syslibs(lenv): if not lenv['WITH_BF_STATIC3DMOUSE']: syslibs += Split(lenv['BF_3DMOUSE_LIB']) + if lenv['WITH_BF_OIIO']: + syslibs += Split(lenv['BF_OIIO_LIB']) + if lenv['WITH_BF_BOOST']: + syslibs += Split(lenv['BF_BOOST_LIB']) + syslibs += lenv['LLIBS'] return syslibs diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index a678bc68f54..68054fe485e 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -116,7 +116,9 @@ def validate_arguments(args, bc): 'WITH_BF_INTERNATIONAL', 'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'WITH_BF_GETTEXT_STATIC', 'BF_GETTEXT_LIB_STATIC', 'BF_GETTEXT_LIBPATH', 'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH', - 'WITH_BF_GAMEENGINE', 'WITH_BF_BULLET', 'WITH_BF_ELTOPO', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB', + 'WITH_BF_GAMEENGINE', + 'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB', + 'WITH_BF_ELTOPO', 'BF_WINTAB', 'BF_WINTAB_INC', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', 'BF_FREETYPE_LIB_STATIC', 'WITH_BF_FREETYPE_STATIC', 'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH', @@ -133,12 +135,10 @@ def validate_arguments(args, bc): 'WITHOUT_BF_INSTALL', 'WITHOUT_BF_PYTHON_INSTALL', 'WITHOUT_BF_OVERWRITE_INSTALL', - 'WITH_BF_OPENMP', - 'BF_OPENMP', - 'BF_OPENMP_INC', - 'BF_OPENMP_LIBPATH', + 'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH', 'WITH_GHOST_COCOA', 'WITH_GHOST_SDL', + 'BF_GHOST_DEBUG', 'USE_QTKIT', 'BF_FANCY', 'BF_QUIET', 'BF_LINE_OVERWRITE', 'BF_X264_CONFIG', @@ -147,7 +147,6 @@ def validate_arguments(args, bc): 'BF_NUMJOBS', 'BF_MSVS', 'BF_VERSION', - 'BF_GHOST_DEBUG', 'WITH_BF_RAYOPTIMIZATION', 'BF_RAYOPTIMIZATION_SSE_FLAGS', 'WITH_BF_FLUID', @@ -155,7 +154,10 @@ def validate_arguments(args, bc): 'WITH_BF_BOOLEAN', 'WITH_BF_CXX_GUARDEDALLOC', 'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC', - 'BUILDBOT_BRANCH', 'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC' + 'BUILDBOT_BRANCH', + 'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC', + 'WITH_BF_OIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIBPATH', + 'WITH_BF_BOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIBPATH' ] # Have options here that scons expects to be lists @@ -239,9 +241,9 @@ def read_opts(env, cfg, args): ('LCGDIR', 'location of cvs lib dir'), (BoolVariable('WITH_BF_PYTHON', 'Compile with python', True)), (BoolVariable('WITH_BF_PYTHON_SAFETY', 'Internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency)', False)), - ('BF_PYTHON', 'base path for python', ''), + ('BF_PYTHON', 'Base path for python', ''), ('BF_PYTHON_VERSION', 'Python version to use', ''), - ('BF_PYTHON_INC', 'include path for Python headers', ''), + ('BF_PYTHON_INC', 'Include path for Python headers', ''), ('BF_PYTHON_BINARY', 'Path to the Python interpreter', ''), ('BF_PYTHON_LIB', 'Python library', ''), ('BF_PYTHON_DLL', 'Python dll - used on Windows only', ''), @@ -257,8 +259,8 @@ def read_opts(env, cfg, args): (BoolVariable('WITH_BF_BOOLEAN', 'Build with boolean modifier', True)), ('BF_PROFILE_FLAGS', 'Profiling compiler flags', ''), (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)), - ('BF_OPENAL', 'base path for OpenAL', ''), - ('BF_OPENAL_INC', 'include path for python headers', ''), + ('BF_OPENAL', 'Base path for OpenAL', ''), + ('BF_OPENAL_INC', 'Include path for python headers', ''), ('BF_OPENAL_LIB', 'Path to OpenAL library', ''), ('BF_OPENAL_LIB_STATIC', 'Path to OpenAL static library', ''), ('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''), @@ -532,6 +534,16 @@ def read_opts(env, cfg, args): (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)), ('BUILDBOT_BRANCH', 'Buildbot branch name', ''), + + (BoolVariable('WITH_BF_OIIO', 'Build with OpenImageIO', False)), + ('BF_OIIO_INC', 'OIIO include path', ''), + ('BF_OIIO_LIB', 'OIIO library', ''), + ('BF_OIIO_LIBPATH', 'OIIO library path', ''), + + (BoolVariable('WITH_BF_BOOST', 'Build with Boost', False)), + ('BF_BOOST_INC', 'Boost include path', ''), + ('BF_BOOST_LIB', 'Boost library', ''), + ('BF_BOOST_LIBPATH', 'Boost library path', '') ) # end of opts.AddOptions() return localopts diff --git a/doc/python_api/examples/bpy.app.handlers.1.py b/doc/python_api/examples/bpy.app.handlers.1.py new file mode 100644 index 00000000000..a6591f6b83f --- /dev/null +++ b/doc/python_api/examples/bpy.app.handlers.1.py @@ -0,0 +1,20 @@ +""" +Persistent Handler Example +++++++++++++++++++++++++++ + +By default handlers are freed when loading new files, in some cases you may +wan't the handler stay running across multiple files (when the handler is +part of an addon for example). + +For this the :data:`bpy.app.handlers.persistent` decorator needs to be used. +""" + +import bpy +from bpy.app.handlers import persistent + + +@persistent +def load_handler(dummy): + print("Load Handler:", bpy.data.filepath) + +bpy.app.handlers.load_post.append(load_handler) diff --git a/doc/python_api/examples/bpy.app.handlers.py b/doc/python_api/examples/bpy.app.handlers.py new file mode 100644 index 00000000000..7c176063b7c --- /dev/null +++ b/doc/python_api/examples/bpy.app.handlers.py @@ -0,0 +1,12 @@ +""" +Basic Handler Example ++++++++++++++++++++++ +This script shows the most simple example of adding a handler. +""" + +import bpy + +def my_handler(scene): + print("Frame Change", scene.frame_current) + +bpy.app.handlers.frame_change_pre.append(my_handler)
\ No newline at end of file diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 5843e5ddb6c..3c43b5bc4da 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -50,7 +50,7 @@ For PDF generation # Check we're running in blender if __import__("sys").modules.get("bpy") is None: - print("\nError, this script must run from inside blender2.5") + print("\nError, this script must run from inside blender") print(script_help_msg) import sys @@ -70,13 +70,14 @@ else: # for testing so doc-builds dont take so long. EXCLUDE_MODULES = ( "bpy.context", - "bpy.app", + #"bpy.app", + #"bpy.app.handlers", "bpy.path", "bpy.data", "bpy.props", "bpy.utils", "bpy.context", - # "bpy.types", # supports filtering + "bpy.types", # supports filtering "bpy.ops", # supports filtering "bpy_extras", "bge", @@ -109,8 +110,18 @@ INFO_DOCS = ( ("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"), ) -# import rpdb2; rpdb2.start_embedded_debugger('test') +# ----------------------------------------------------------------------------- +# configure compile time options + +try: + __import__("aud") +except ImportError: + print("Warning: Built without 'aud' module, docs incomplete...") + EXCLUDE_MODULES = EXCLUDE_MODULES + ("aud", ) + + +# import rpdb2; rpdb2.start_embedded_debugger('test') import os import inspect import bpy @@ -120,6 +131,7 @@ import rna_info ClassMethodDescriptorType = type(dict.__dict__['fromkeys']) MethodDescriptorType = type(dict.get) GetSetDescriptorType = type(int.real) +from types import MemberDescriptorType EXAMPLE_SET = set() EXAMPLE_SET_USED = set() @@ -134,6 +146,14 @@ else: _BPY_PROP_COLLECTION_ID = "collection" +def is_struct_seq(value): + return isinstance(value, tuple) and type(tuple) != tuple and hasattr(value, "n_fields") + + +def module_id_as_ref(name): + return "mod_" + name.replace(".", "__") + + def undocumented_message(module_name, type_name, identifier): if str(type_name).startswith('<module'): preloadtitle = '%s.%s' % (module_name, identifier) @@ -305,6 +325,10 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier): fw(ident + ".. attribute:: %s\n\n" % identifier) write_indented_lines(ident + " ", fw, doc, False) fw("\n") + elif type(descr) == MemberDescriptorType: # same as above but use 'data' + fw(ident + ".. data:: %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") @@ -367,6 +391,10 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): write_title(fw, "%s (%s)" % (title, module_name), "=") + # write reference, annoying since we should be able to direct reference the + # modules but we cant always! + fw(".. _%s:\n\n" % module_id_as_ref(module_name)) + fw(".. module:: %s\n\n" % module_name) if module.__doc__: @@ -411,59 +439,91 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): if key.startswith("__"): continue # naughty, we also add getset's into PyStructs, this is not typical py but also not incorrect. - if type(descr) == types.GetSetDescriptorType: # 'bpy_app_type' name is only used for examples and messages - py_descr2sphinx("", fw, descr, module_name, "bpy_app_type", key) + + # type_name is only used for examples and messages + type_name = str(type(module)).strip("<>").split(" ", 1)[-1][1:-1] # "<class 'bpy.app.handlers'>" --> bpy.app.handlers + if type(descr) == types.GetSetDescriptorType: + py_descr2sphinx("", fw, descr, module_name, type_name, key) attribute_set.add(key) + descr_sorted = [] for key, descr in sorted(type(module).__dict__.items()): if key.startswith("__"): continue - if type(descr) == types.MemberDescriptorType: + if type(descr) == MemberDescriptorType: if descr.__doc__: - fw(".. data:: %s\n\n" % key) - write_indented_lines(" ", fw, descr.__doc__, False) - fw("\n") - attribute_set.add(key) - - del key, descr + value = getattr(module, key, None) + value_type = type(value) + descr_sorted.append((key, descr, value, type(value))) + # sort by the valye type + descr_sorted.sort(key=lambda descr_data: str(descr_data[3])) + for key, descr, value, value_type in descr_sorted: + type_name = value_type.__name__ + py_descr2sphinx("", fw, descr, module_name, type_name, key) + + if is_struct_seq(value): + # ack, cant use typical reference because we double up once here + # and one fort he module! + full_name = "%s.%s" % (module_name, type_name) + fw(" :ref:`%s submodule details <%s>`\n\n\n" % (full_name, module_id_as_ref(full_name))) + del full_name + + attribute_set.add(key) + + del key, descr, descr_sorted classes = [] submodules = [] + # use this list so we can sort by type + module_dir_value_type = [] + for attribute in module_dir: - if not attribute.startswith("_"): - if attribute in attribute_set: - continue + if attribute.startswith("_"): + continue - if attribute.startswith("n_"): # annoying exception, needed for bpy.app - continue + if attribute in attribute_set: + continue - value = getattr(module, attribute) - - value_type = type(value) - - if value_type == types.FunctionType: - pyfunc2sphinx("", fw, attribute, value, is_class=False) - elif value_type in (types.BuiltinMethodType, types.BuiltinFunctionType): # both the same at the moment but to be future proof - # note: can't get args from these, so dump the string as is - # this means any module used like this must have fully formatted docstrings. - py_c_func2sphinx("", fw, module_name, None, attribute, value, is_class=False) - elif value_type == type: - classes.append((attribute, value)) - elif issubclass(value_type, types.ModuleType): - submodules.append((attribute, value)) - elif value_type in (bool, int, float, str, tuple): - # constant, not much fun we can do here except to list it. - # TODO, figure out some way to document these! - fw(".. data:: %s\n\n" % attribute) - write_indented_lines(" ", fw, "constant value %s" % repr(value), False) - fw("\n") - else: - print("\tnot documenting %s.%s of %r type" % (module_name, attribute, value_type.__name__)) - continue + if attribute.startswith("n_"): # annoying exception, needed for bpy.app + continue + + # workaround for bpy.app documenting .index() and .count() + if isinstance(module, tuple) and hasattr(tuple, attribute): + continue + + value = getattr(module, attribute) + + module_dir_value_type.append((attribute, value, type(value))) + + # sort by str of each type + # this way lists, functions etc are grouped. + module_dir_value_type.sort(key=lambda triple: str(triple[2])) + + for attribute, value, value_type in module_dir_value_type: + if value_type == types.FunctionType: + pyfunc2sphinx("", fw, attribute, value, is_class=False) + elif value_type in (types.BuiltinMethodType, types.BuiltinFunctionType): # both the same at the moment but to be future proof + # note: can't get args from these, so dump the string as is + # this means any module used like this must have fully formatted docstrings. + py_c_func2sphinx("", fw, module_name, None, attribute, value, is_class=False) + elif value_type == type: + classes.append((attribute, value)) + elif issubclass(value_type, types.ModuleType): + submodules.append((attribute, value)) + elif value_type in (bool, int, float, str, tuple): + # constant, not much fun we can do here except to list it. + # TODO, figure out some way to document these! + #fw(".. data:: %s\n\n" % attribute) + write_indented_lines(" ", fw, "constant value %s" % repr(value), False) + fw("\n") + else: + print("\tnot documenting %s.%s of %r type" % (module_name, attribute, value_type.__name__)) + continue - attribute_set.add(attribute) - # TODO, more types... + attribute_set.add(attribute) + # TODO, more types... + del module_dir_value_type # TODO, bpy_extras does this already, mathutils not. """ @@ -1103,6 +1163,8 @@ def rna2sphinx(BASEPATH): fw(" bpy.path.rst\n\n") if "bpy.app" not in EXCLUDE_MODULES: fw(" bpy.app.rst\n\n") + if "bpy.app.handlers" not in EXCLUDE_MODULES: + fw(" bpy.app.handlers.rst\n\n") # C modules if "bpy.props" not in EXCLUDE_MODULES: @@ -1242,6 +1304,10 @@ def rna2sphinx(BASEPATH): from bpy import app as module pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data") + if "bpy.app.handlers" not in EXCLUDE_MODULES: + from bpy.app import handlers as module + pymodule2sphinx(BASEPATH, "bpy.app.handlers", module, "Application Handlers") + if "bpy.props" not in EXCLUDE_MODULES: from bpy import props as module pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions") diff --git a/intern/audaspace/Python/AUD_PyAPI.cpp b/intern/audaspace/Python/AUD_PyAPI.cpp index 0dfa39de66c..bbc7a0ca52e 100644 --- a/intern/audaspace/Python/AUD_PyAPI.cpp +++ b/intern/audaspace/Python/AUD_PyAPI.cpp @@ -226,7 +226,7 @@ Factory_lowpass(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "f|f:lowpass", &frequency, &Q)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -267,7 +267,7 @@ Factory_delay(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "f:delay", &delay)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -303,7 +303,7 @@ PyDoc_STRVAR(M_aud_Factory_join_doc, static PyObject * Factory_join(Factory* self, PyObject* object) { - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); if(!PyObject_TypeCheck(object, type)) { @@ -354,7 +354,7 @@ Factory_highpass(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "f|f:highpass", &frequency, &Q)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -395,7 +395,7 @@ Factory_limit(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "ff:limit", &start, &end)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -439,7 +439,7 @@ Factory_pitch(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "f:pitch", &factor)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -481,7 +481,7 @@ Factory_volume(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "f:volume", &volume)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -524,7 +524,7 @@ Factory_fadein(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "ff:fadein", &start, &length)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -568,7 +568,7 @@ Factory_fadeout(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "ff:fadeout", &start, &length)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -610,7 +610,7 @@ Factory_loop(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "i:loop", &loop)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -646,7 +646,7 @@ PyDoc_STRVAR(M_aud_Factory_mix_doc, static PyObject * Factory_mix(Factory* self, PyObject* object) { - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); if(!PyObject_TypeCheck(object, type)) { @@ -686,7 +686,7 @@ PyDoc_STRVAR(M_aud_Factory_pingpong_doc, static PyObject * Factory_pingpong(Factory* self) { - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -725,7 +725,7 @@ PyDoc_STRVAR(M_aud_Factory_reverse_doc, static PyObject * Factory_reverse(Factory* self) { - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -763,7 +763,7 @@ PyDoc_STRVAR(M_aud_Factory_buffer_doc, static PyObject * Factory_buffer(Factory* self) { - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -802,7 +802,7 @@ Factory_square(Factory* self, PyObject* args) if(!PyArg_ParseTuple(args, "|f:square", &threshold)) return NULL; - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) @@ -905,7 +905,7 @@ Factory_filter(Factory* self, PyObject* args) else a.push_back(1); - PyTypeObject* type = ((PyObject*)self)->ob_type; + PyTypeObject* type = Py_TYPE(self); Factory *parent = (Factory*)type->tp_alloc(type, 0); if(parent != NULL) diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 4446426098a..a84ff5825a9 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -108,6 +108,10 @@ if(WITH_INPUT_NDOF) ) endif() +if(WITH_XDG_USER_DIRS) + add_definitions(-DWITH_XDG_USER_DIRS) +endif() + if(WITH_HEADLESS OR WITH_GHOST_SDL) if(WITH_HEADLESS) list(APPEND SRC diff --git a/intern/ghost/intern/GHOST_SystemPathsX11.cpp b/intern/ghost/intern/GHOST_SystemPathsX11.cpp index 1456bdef543..726149138ed 100644 --- a/intern/ghost/intern/GHOST_SystemPathsX11.cpp +++ b/intern/ghost/intern/GHOST_SystemPathsX11.cpp @@ -41,6 +41,11 @@ #include <stdio.h> // for fprintf only #include <cstdlib> // for exit +#ifdef WITH_XDG_USER_DIRS +# include <pwd.h> // for get home without use getenv() +# include <limits.h> // for PATH_MAX +#endif + #ifdef PREFIX static const char *static_path= PREFIX "/share" ; #else @@ -63,7 +68,27 @@ const GHOST_TUns8* GHOST_SystemPathsX11::getSystemDir() const const GHOST_TUns8* GHOST_SystemPathsX11::getUserDir() const { +#ifndef WITH_XDG_USER_DIRS return (const GHOST_TUns8 *)getenv("HOME"); +#else /* WITH_XDG_USER_DIRS */ + const char *home= getenv("XDG_CONFIG_HOME"); + + if (home) { + return (const GHOST_TUns8 *)home; + } + else { + static char user_path[PATH_MAX]; + + home= getenv("HOME"); + + if (home == NULL) { + home= getpwuid(getuid())->pw_dir; + } + + snprintf(user_path, sizeof(user_path), "%s/.config", home); + return (const GHOST_TUns8 *)user_path; + } +#endif /* WITH_XDG_USER_DIRS */ } const GHOST_TUns8* GHOST_SystemPathsX11::getBinaryDir() const diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index 5fe5cfd7cf4..75572a6294e 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -54,6 +54,8 @@ def main(): # fake module to allow: # from bpy.types import Panel + sys.modules["bpy.app"] = app + sys.modules["bpy.app.handlers"] = app.handlers sys.modules["bpy.types"] = types #~ if "-d" in sys.argv: # Enable this to measure start up speed diff --git a/release/scripts/presets/camera/APS-C_DSLR.py b/release/scripts/presets/camera/APS-C_DSLR.py new file mode 100644 index 00000000000..829e03cc5cf --- /dev/null +++ b/release/scripts/presets/camera/APS-C_DSLR.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 22.3 +bpy.context.object.data.sensor_height = 14.9 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Blender.py b/release/scripts/presets/camera/Blender.py new file mode 100644 index 00000000000..9fa4ab752e3 --- /dev/null +++ b/release/scripts/presets/camera/Blender.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 32 +bpy.context.object.data.sensor_height = 18 +bpy.context.object.data.sensor_fit = 'AUTO' diff --git a/release/scripts/presets/camera/Canon_1100D.py b/release/scripts/presets/camera/Canon_1100D.py new file mode 100644 index 00000000000..54f2cf75b54 --- /dev/null +++ b/release/scripts/presets/camera/Canon_1100D.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 22.2 +bpy.context.object.data.sensor_height = 14.7 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Canon_1D.py b/release/scripts/presets/camera/Canon_1D.py new file mode 100644 index 00000000000..0bb0e910377 --- /dev/null +++ b/release/scripts/presets/camera/Canon_1D.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 27.9 +bpy.context.object.data.sensor_height = 18.6 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Canon_1DS.py b/release/scripts/presets/camera/Canon_1DS.py new file mode 100644 index 00000000000..158a6235f32 --- /dev/null +++ b/release/scripts/presets/camera/Canon_1DS.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 36.0 +bpy.context.object.data.sensor_height = 24.0 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Canon_500D.py b/release/scripts/presets/camera/Canon_500D.py new file mode 100644 index 00000000000..829e03cc5cf --- /dev/null +++ b/release/scripts/presets/camera/Canon_500D.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 22.3 +bpy.context.object.data.sensor_height = 14.9 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Canon_550D.py b/release/scripts/presets/camera/Canon_550D.py new file mode 100644 index 00000000000..829e03cc5cf --- /dev/null +++ b/release/scripts/presets/camera/Canon_550D.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 22.3 +bpy.context.object.data.sensor_height = 14.9 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Canon_5D.py b/release/scripts/presets/camera/Canon_5D.py new file mode 100644 index 00000000000..158a6235f32 --- /dev/null +++ b/release/scripts/presets/camera/Canon_5D.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 36.0 +bpy.context.object.data.sensor_height = 24.0 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Canon_600D.py b/release/scripts/presets/camera/Canon_600D.py new file mode 100644 index 00000000000..829e03cc5cf --- /dev/null +++ b/release/scripts/presets/camera/Canon_600D.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 22.3 +bpy.context.object.data.sensor_height = 14.9 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Canon_60D.py b/release/scripts/presets/camera/Canon_60D.py new file mode 100644 index 00000000000..829e03cc5cf --- /dev/null +++ b/release/scripts/presets/camera/Canon_60D.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 22.3 +bpy.context.object.data.sensor_height = 14.9 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Canon_7D.py b/release/scripts/presets/camera/Canon_7D.py new file mode 100644 index 00000000000..829e03cc5cf --- /dev/null +++ b/release/scripts/presets/camera/Canon_7D.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 22.3 +bpy.context.object.data.sensor_height = 14.9 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Nikon_D300S.py b/release/scripts/presets/camera/Nikon_D300S.py new file mode 100644 index 00000000000..a0505bf9b9c --- /dev/null +++ b/release/scripts/presets/camera/Nikon_D300S.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 23.6 +bpy.context.object.data.sensor_height = 15.8 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Nikon_D3100.py b/release/scripts/presets/camera/Nikon_D3100.py new file mode 100644 index 00000000000..238d9c22d12 --- /dev/null +++ b/release/scripts/presets/camera/Nikon_D3100.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 23.1 +bpy.context.object.data.sensor_height = 15.4 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Nikon_D35.py b/release/scripts/presets/camera/Nikon_D35.py new file mode 100644 index 00000000000..e6dc62dc100 --- /dev/null +++ b/release/scripts/presets/camera/Nikon_D35.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 36.0 +bpy.context.object.data.sensor_height = 23.9 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Nikon_D5000.py b/release/scripts/presets/camera/Nikon_D5000.py new file mode 100644 index 00000000000..a0505bf9b9c --- /dev/null +++ b/release/scripts/presets/camera/Nikon_D5000.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 23.6 +bpy.context.object.data.sensor_height = 15.8 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Nikon_D5100.py b/release/scripts/presets/camera/Nikon_D5100.py new file mode 100644 index 00000000000..1d819cce65b --- /dev/null +++ b/release/scripts/presets/camera/Nikon_D5100.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 23.6 +bpy.context.object.data.sensor_height = 15.6 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Nikon_D7000.py b/release/scripts/presets/camera/Nikon_D7000.py new file mode 100644 index 00000000000..1d819cce65b --- /dev/null +++ b/release/scripts/presets/camera/Nikon_D7000.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 23.6 +bpy.context.object.data.sensor_height = 15.6 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Nikon_D90.py b/release/scripts/presets/camera/Nikon_D90.py new file mode 100644 index 00000000000..a0505bf9b9c --- /dev/null +++ b/release/scripts/presets/camera/Nikon_D90.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 23.6 +bpy.context.object.data.sensor_height = 15.8 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Red_Epic.py b/release/scripts/presets/camera/Red_Epic.py new file mode 100644 index 00000000000..14f4abaee90 --- /dev/null +++ b/release/scripts/presets/camera/Red_Epic.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 30.0 +bpy.context.object.data.sensor_height = 15.0 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Red_One_2K.py b/release/scripts/presets/camera/Red_One_2K.py new file mode 100644 index 00000000000..ef2708f75b2 --- /dev/null +++ b/release/scripts/presets/camera/Red_One_2K.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 11.1 +bpy.context.object.data.sensor_height = 6.24 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Red_One_3K.py b/release/scripts/presets/camera/Red_One_3K.py new file mode 100644 index 00000000000..5ddff2746eb --- /dev/null +++ b/release/scripts/presets/camera/Red_One_3K.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 16.65 +bpy.context.object.data.sensor_height = 9.36 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/Red_One_4K.py b/release/scripts/presets/camera/Red_One_4K.py new file mode 100644 index 00000000000..8ab9b38cbd5 --- /dev/null +++ b/release/scripts/presets/camera/Red_One_4K.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 22.2 +bpy.context.object.data.sensor_height = 12.6 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/full_frame_35mm_film.py b/release/scripts/presets/camera/full_frame_35mm_film.py new file mode 100644 index 00000000000..d3e141ba4d9 --- /dev/null +++ b/release/scripts/presets/camera/full_frame_35mm_film.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 36 +bpy.context.object.data.sensor_height = 24 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/micro_four_thirds.py b/release/scripts/presets/camera/micro_four_thirds.py new file mode 100644 index 00000000000..36fb0aac391 --- /dev/null +++ b/release/scripts/presets/camera/micro_four_thirds.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 17.3 +bpy.context.object.data.sensor_height = 13.0 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/super_16_film.py b/release/scripts/presets/camera/super_16_film.py new file mode 100644 index 00000000000..1e42953bf05 --- /dev/null +++ b/release/scripts/presets/camera/super_16_film.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 12.52 +bpy.context.object.data.sensor_height = 7.41 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/presets/camera/super_35_film.py b/release/scripts/presets/camera/super_35_film.py new file mode 100644 index 00000000000..65ccb0f216c --- /dev/null +++ b/release/scripts/presets/camera/super_35_film.py @@ -0,0 +1,4 @@ +import bpy +bpy.context.object.data.sensor_width = 24.89 +bpy.context.object.data.sensor_height = 18.66 +bpy.context.object.data.sensor_fit = 'HORIZONTAL' diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 2e42105fbf0..21ac128f177 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -195,6 +195,25 @@ class AddPresetRender(AddPresetBase, Operator): preset_subdir = "render" +class AddPresetCamera(AddPresetBase, Operator): + '''Add a Camera Preset''' + bl_idname = "camera.preset_add" + bl_label = "Add Camera Preset" + preset_menu = "CAMERA_MT_presets" + + preset_defines = [ + "cam = bpy.context.object.data" + ] + + preset_values = [ + "cam.sensor_width", + "cam.sensor_height", + "cam.sensor_fit" + ] + + preset_subdir = "camera" + + class AddPresetSSS(AddPresetBase, Operator): '''Add a Subsurface Scattering Preset''' bl_idname = "material.sss_preset_add" diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index 77877731777..0abbf281754 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -33,6 +33,14 @@ class CameraButtonsPanel(): return context.camera and (engine in cls.COMPAT_ENGINES) +class CAMERA_MT_presets(bpy.types.Menu): + bl_label = "Camera Presets" + preset_subdir = "camera" + preset_operator = "script.execute_preset" + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + draw = bpy.types.Menu.draw_preset + + class DATA_PT_context_camera(CameraButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -54,7 +62,7 @@ class DATA_PT_context_camera(CameraButtonsPanel, Panel): split.separator() -class DATA_PT_camera(CameraButtonsPanel, Panel): +class DATA_PT_lens(CameraButtonsPanel, Panel): bl_label = "Lens" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -69,12 +77,12 @@ class DATA_PT_camera(CameraButtonsPanel, Panel): col = split.column() if cam.type == 'PERSP': + row = col.row() if cam.lens_unit == 'MILLIMETERS': - col.prop(cam, "lens") + row.prop(cam, "lens") elif cam.lens_unit == 'DEGREES': - col.prop(cam, "angle") - col = split.column() - col.prop(cam, "lens_unit", text="") + row.prop(cam, "angle") + row.prop(cam, "lens_unit", text="") elif cam.type == 'ORTHO': col.prop(cam, "ortho_scale") @@ -100,6 +108,35 @@ class DATA_PT_camera(CameraButtonsPanel, Panel): col.prop(cam, "clip_start", text="Start") col.prop(cam, "clip_end", text="End") +class DATA_PT_camera(CameraButtonsPanel, Panel): + bl_label = "Camera" + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + + def draw(self, context): + layout = self.layout + + cam = context.camera + + row = layout.row(align=True) + + row.menu("CAMERA_MT_presets", text=bpy.types.CAMERA_MT_presets.bl_label) + row.operator("camera.preset_add", text="", icon="ZOOMIN") + row.operator("camera.preset_add", text="", icon="ZOOMOUT").remove_active = True + + layout.label(text="Sensor:") + + split = layout.split() + + col = split.column(align=True) + if cam.sensor_fit == 'AUTO': + col.prop(cam, "sensor_width", text="Size") + else: + col.prop(cam, "sensor_width", text="Width") + col.prop(cam, "sensor_height", text="Height") + + col = split.column(align=True) + col.prop(cam, "sensor_fit", text="") + class DATA_PT_camera_dof(CameraButtonsPanel, Panel): bl_label = "Depth of Field" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -109,6 +146,8 @@ class DATA_PT_camera_dof(CameraButtonsPanel, Panel): cam = context.camera + layout.label(text="Focus:") + split = layout.split() split.prop(cam, "dof_object", text="") @@ -132,10 +171,12 @@ class DATA_PT_camera_display(CameraButtonsPanel, Panel): col.prop(cam, "show_limits", text="Limits") col.prop(cam, "show_mist", text="Mist") col.prop(cam, "show_title_safe", text="Title Safe") + col.prop(cam, "show_sensor", text="Sensor") col.prop(cam, "show_name", text="Name") - col.prop_menu_enum(cam, "show_guide") col = split.column() + col.prop_menu_enum(cam, "show_guide") + col.separator() col.prop(cam, "draw_size", text="Size") col.separator() col.prop(cam, "show_passepartout", text="Passepartout") diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 90dcc99e6d7..106bbd85717 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -213,18 +213,10 @@ class DOPESHEET_MT_marker(Menu): def draw(self, context): layout = self.layout - st = context.space_data - - #layout.operator_context = 'EXEC_REGION_WIN' - - layout.operator("marker.add", "Add Marker") - layout.operator("marker.duplicate", text="Duplicate Marker") - layout.operator("marker.delete", text="Delete Marker") + from .space_time import marker_menu_generic + marker_menu_generic(layout) - layout.separator() - - layout.operator("marker.rename", text="Rename Marker") - layout.operator("marker.move", text="Grab/Move Marker") + st = context.space_data if st.mode in {'ACTION', 'SHAPEKEY'} and st.action: layout.separator() diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index d4b8c415a7f..b57d421dfaf 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -144,16 +144,8 @@ class GRAPH_MT_marker(Menu): def draw(self, context): layout = self.layout - #layout.operator_context = 'EXEC_REGION_WIN' - - layout.operator("marker.add", "Add Marker") - layout.operator("marker.duplicate", text="Duplicate Marker") - layout.operator("marker.delete", text="Delete Marker") - - layout.separator() - - layout.operator("marker.rename", text="Rename Marker") - layout.operator("marker.move", text="Grab/Move Marker") + from .space_time import marker_menu_generic + marker_menu_generic(layout) # TODO: pose markers for action edit mode only? diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py index ffead81c507..c878c20c8a7 100644 --- a/release/scripts/startup/bl_ui/space_nla.py +++ b/release/scripts/startup/bl_ui/space_nla.py @@ -104,16 +104,8 @@ class NLA_MT_marker(Menu): def draw(self, context): layout = self.layout - #layout.operator_context = 'EXEC_REGION_WIN' - - layout.operator("marker.add", "Add Marker") - layout.operator("marker.duplicate", text="Duplicate Marker") - layout.operator("marker.delete", text="Delete Marker") - - layout.separator() - - layout.operator("marker.rename", text="Rename Marker") - layout.operator("marker.move", text="Grab/Move Marker") + from .space_time import marker_menu_generic + marker_menu_generic(layout) class NLA_MT_edit(Menu): diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 2e957effccd..a4dcf64b679 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -158,18 +158,8 @@ class SEQUENCER_MT_marker(Menu): def draw(self, context): layout = self.layout - #layout.operator_context = 'EXEC_REGION_WIN' - - layout.operator("marker.add", "Add Marker") - layout.operator("marker.duplicate", text="Duplicate Marker") - layout.operator("marker.delete", text="Delete Marker") - - layout.separator() - - layout.operator("marker.rename", text="Rename Marker") - layout.operator("marker.move", text="Grab/Move Marker") - - #layout.operator("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS) + from .space_time import marker_menu_generic + marker_menu_generic(layout) class SEQUENCER_MT_change(Menu): diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py index db009fe43c2..6f8e6a574ec 100644 --- a/release/scripts/startup/bl_ui/space_time.py +++ b/release/scripts/startup/bl_ui/space_time.py @@ -36,6 +36,7 @@ class TIME_HT_header(Header): if context.area.show_menus: row.menu("TIME_MT_view") + row.menu("TIME_MT_marker") row.menu("TIME_MT_frame") row.menu("TIME_MT_playback") @@ -91,6 +92,15 @@ class TIME_HT_header(Header): row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT') +class TIME_MT_marker(bpy.types.Menu): + bl_label = "Marker" + + def draw(self, context): + layout = self.layout + + marker_menu_generic(layout) + + class TIME_MT_view(Menu): bl_label = "View" @@ -142,17 +152,6 @@ class TIME_MT_frame(Menu): def draw(self, context): layout = self.layout - layout.operator("marker.add", text="Add Marker") - layout.operator("marker.duplicate", text="Duplicate Marker") - layout.operator("marker.delete", text="Delete Marker") - - layout.separator() - - layout.operator("marker.rename", text="Rename Marker") - layout.operator("marker.move", text="Grab/Move Marker") - - layout.separator() - layout.operator("time.start_frame_set") layout.operator("time.end_frame_set") @@ -197,5 +196,28 @@ class TIME_MT_autokey(Menu): layout.prop_enum(tools, "auto_keying_mode", 'ADD_REPLACE_KEYS') layout.prop_enum(tools, "auto_keying_mode", 'REPLACE_KEYS') + +def marker_menu_generic(layout): + + #layout.operator_context = 'EXEC_REGION_WIN' + + layout.column() + layout.operator("marker.add", "Add Marker") + layout.operator("marker.duplicate", text="Duplicate Marker") + + if(len(bpy.data.scenes) > 10): + layout.operator_context = 'INVOKE_DEFAULT' + layout.operator("marker.make_links_scene", text="Duplicate Marker to Scene...", icon='OUTLINER_OB_EMPTY') + else: + layout.operator_menu_enum("marker.make_links_scene", "scene", text="Duplicate Marker to Scene...") + + layout.operator("marker.delete", text="Delete Marker") + + layout.separator() + + layout.operator("marker.rename", text="Rename Marker") + layout.operator("marker.move", text="Grab/Move Marker") + + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 07c860fca31..3f5b7b86e89 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -976,10 +976,8 @@ class VIEW3D_MT_make_links(Menu): if(len(bpy.data.scenes) > 10): layout.operator_context = 'INVOKE_DEFAULT' layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY') - layout.operator("object.make_links_scene", text="Markers to Scene...", icon='OUTLINER_OB_EMPTY') else: layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...") - layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...") layout.operator_enum("object.make_links_data", "type") # inline diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 9518ccb5f80..96201a4b960 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -481,12 +481,9 @@ class VIEW3D_PT_tools_brush(PaintPanel, Panel): col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8) # Particle Mode # - - # XXX This needs a check if psys is editable. if context.particle_edit_object: tool = settings.tool - # XXX Select Particle System layout.column().prop(settings, "tool", expand=True) if tool != 'NONE': @@ -825,13 +822,11 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, Panel): if brush.use_anchor: col.separator() - row = col.row() - row.prop(brush, "use_edge_to_edge", "Edge To Edge") + col.prop(brush, "use_edge_to_edge", "Edge To Edge") if brush.use_airbrush: col.separator() - row = col.row() - row.prop(brush, "rate", text="Rate", slider=True) + col.prop(brush, "rate", text="Rate", slider=True) if brush.use_space: col.separator() @@ -857,8 +852,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, Panel): row.prop(brush, "use_pressure_jitter", toggle=True, text="") else: - row = col.row() - row.prop(brush, "use_airbrush") + col.prop(brush, "use_airbrush") row = col.row() row.active = brush.use_airbrush and (not brush.use_space) and (not brush.use_anchor) @@ -867,8 +861,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, Panel): col.separator() if not image_paint: - row = col.row() - row.prop(brush, "use_smooth_stroke") + col.prop(brush, "use_smooth_stroke") col = layout.column() col.active = brush.use_smooth_stroke @@ -879,9 +872,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, Panel): col = layout.column() col.active = (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'THUMB', 'ROTATE', 'SNAKE_HOOK'}) - - row = col.row() - row.prop(brush, "use_space") + col.prop(brush, "use_space") row = col.row() row.active = brush.use_space @@ -1011,14 +1002,10 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, Panel): else: col.prop(brush, "cursor_color_add", text="Color") - col = layout.column() - col.label(text="Icon:") - - row = col.row(align=True) - row.prop(brush, "use_custom_icon") + col = layout.column(align=True) + col.prop(brush, "use_custom_icon") if brush.use_custom_icon: - row = col.row(align=True) - row.prop(brush, "icon_filepath", text="") + col.prop(brush, "icon_filepath", text="") # ********** default tools for weight-paint **************** @@ -1133,53 +1120,46 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel): use_projection = ipaint.use_projection col = layout.column() - sub = col.column() - sub.active = use_projection - sub.prop(ipaint, "use_occlude") - sub.prop(ipaint, "use_backface_culling") + col.active = use_projection + col.prop(ipaint, "use_occlude") + col.prop(ipaint, "use_backface_culling") - split = layout.split() + row = layout.row() + row.active = (use_projection) + row.prop(ipaint, "use_normal_falloff") - col = split.column() - col.active = (use_projection) - col.prop(ipaint, "use_normal_falloff") + sub = row.row() + sub.active = (ipaint.use_normal_falloff) + sub.prop(ipaint, "normal_angle", text="") - col = split.column() - col.active = (ipaint.use_normal_falloff and use_projection) - col.prop(ipaint, "normal_angle", text="") + split = layout.split() - col = layout.column(align=False) - row = col.row() - row.active = (use_projection) - row.prop(ipaint, "use_stencil_layer", text="Stencil") + split.active = (use_projection) + split.prop(ipaint, "use_stencil_layer", text="Stencil") - row2 = row.row(align=False) - row2.active = (use_projection and ipaint.use_stencil_layer) - row2.menu("VIEW3D_MT_tools_projectpaint_stencil", text=mesh.uv_texture_stencil.name) - row2.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA') + row = split.row() + row.active = (ipaint.use_stencil_layer) + row.menu("VIEW3D_MT_tools_projectpaint_stencil", text=mesh.uv_texture_stencil.name) + row.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA') - col = layout.column() - sub = col.column() - row = sub.row() + row = layout.row() row.active = (settings.brush.image_tool == 'CLONE') - row.prop(ipaint, "use_clone_layer", text="Layer") row.menu("VIEW3D_MT_tools_projectpaint_clone", text=mesh.uv_texture_clone.name) - sub = col.column() - sub.prop(ipaint, "seam_bleed") + layout.prop(ipaint, "seam_bleed") + + col = layout.column() + col.label(text="External Editing:") - col.label(text="External Editing") row = col.split(align=True, percentage=0.55) row.operator("image.project_edit", text="Quick Edit") row.operator("image.project_apply", text="Apply") - row = col.row(align=True) - row.prop(ipaint, "screen_grab_size", text="") - sub = col.column() - sub.operator("paint.project_image", text="Apply Camera Image") + col.row().prop(ipaint, "screen_grab_size", text="") - sub.operator("image.save_dirty", text="Save All Edited") + col.operator("paint.project_image", text="Apply Camera Image") + col.operator("image.save_dirty", text="Save All Edited") class VIEW3D_PT_imagepaint_options(PaintPanel): diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index bebc87cc5d4..7ec7e2357dd 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -122,36 +122,37 @@ static void blf_font_ensure_ascii_table(FontBLF *font) /* Note, * blf_font_ensure_ascii_table(font); must be called before this macro */ -#define BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table) \ - if(((c)= (str)[i]) < 0x80) { \ - g= (glyph_ascii_table)[c]; \ - i++; \ +#define BLF_UTF8_NEXT_FAST(_font, _g, _str, _i, _c, _glyph_ascii_table) \ + if(((_c)= (_str)[_i]) < 0x80) { \ + _g= (_glyph_ascii_table)[_c]; \ + _i++; \ } \ - else if ((c= BLI_str_utf8_as_unicode_step((str), &(i))) != BLI_UTF8_ERR) { \ - if ((g= blf_glyph_search((font)->glyph_cache, c)) == NULL) { \ - g= blf_glyph_add(font, FT_Get_Char_Index((font)->face, c), c); \ + else if ((_c= BLI_str_utf8_as_unicode_step(_str, &(_i)))!=BLI_UTF8_ERR) { \ + if ((_g= blf_glyph_search((_font)->glyph_cache, _c)) == NULL) { \ + _g= blf_glyph_add(_font, \ + FT_Get_Char_Index((_font)->face, _c), _c); \ } \ } \ #define BLF_KERNING_VARS(_font, _has_kerning, _kern_mode) \ - const short has_kerning= FT_HAS_KERNING((_font)->face); \ - const FT_UInt kern_mode= (has_kerning == 0) ? 0 : \ + const short _has_kerning= FT_HAS_KERNING((_font)->face); \ + const FT_UInt _kern_mode= (_has_kerning == 0) ? 0 : \ (((_font)->flags & BLF_KERNING_DEFAULT) ? \ ft_kerning_default : FT_KERNING_UNFITTED) \ -#define BLF_KERNING_STEP(_font, kern_mode, g_prev, g, delta, pen_x) \ +#define BLF_KERNING_STEP(_font, _kern_mode, _g_prev, _g, _delta, _pen_x) \ { \ - if (g_prev) { \ - delta.x= delta.y= 0; \ + if (_g_prev) { \ + _delta.x= _delta.y= 0; \ if (FT_Get_Kerning((_font)->face, \ - (g_prev)->idx, \ - (g)->idx, \ - kern_mode, \ - &(delta)) == 0) \ + (_g_prev)->idx, \ + (_g)->idx, \ + _kern_mode, \ + &(_delta)) == 0) \ { \ - pen_x += delta.x >> 6; \ + _pen_x += delta.x >> 6; \ } \ } \ } \ diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 71771b6077d..9b28f083a24 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 260 -#define BLENDER_SUBVERSION 0 +#define BLENDER_SUBVERSION 1 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 9282f0ef29a..f0704741ebb 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -65,6 +65,7 @@ void make_local_curve( struct Curve *cu); struct ListBase *curve_editnurbs(struct Curve *cu); short curve_type( struct Curve *cu); void test_curve_type( struct Object *ob); +void update_curve_dimension( struct Curve *cu ); void tex_space_curve( struct Curve *cu); int count_curveverts( struct ListBase *nurb); int count_curveverts_without_handles( struct ListBase *nurb); diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index 0b0637fb42a..e0b8e40d731 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -133,6 +133,9 @@ void DAG_pose_sort(struct Object *ob); /* callback for editors module to do updates */ void DAG_editors_update_cb(void (*func)(struct Main *bmain, struct ID *id)); + /* debugging */ +void DAG_print_dependencies(struct Main *bmain, struct Scene *scene, struct Object *ob); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index bc9134b40b8..5ccdd7c04af 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -58,7 +58,7 @@ typedef struct Global { /* flag: if != 0 G.main->name contains valid relative base path */ int relbase_valid; - /* strings of recent opend files */ + /* strings of recent opened files */ struct ListBase recent_files; short afbreek, moving, file_loaded; diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 393568c6b60..c5a24c1e5e9 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -139,9 +139,12 @@ struct KeyBlock *object_insert_shape_key(struct Scene *scene, struct Object *ob, int object_is_modified(struct Scene *scene, struct Object *ob); void object_camera_mode(struct RenderData *rd, struct Object *camera); +void object_camera_intrinsics(struct Object *camera, struct Camera **cam_r, short *is_ortho, float *shiftx, float *shifty, + float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit); void object_camera_matrix( struct RenderData *rd, struct Object *camera, int winx, int winy, short field_second, - float winmat[][4], struct rctf *viewplane, float *clipsta, float *clipend, float *lens, float *ycor, + float winmat[][4], struct rctf *viewplane, float *clipsta, float *clipend, float *lens, + float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor, float *viewdx, float *viewdy); void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3], diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 5b6d7e3cd96..77a351d534e 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -34,22 +34,23 @@ */ struct ARegion; -struct bContext; -struct bContextDataResult; -struct bScreen; -struct ListBase; -struct Panel; struct Header; +struct ListBase; struct Menu; +struct Panel; +struct Scene; struct ScrArea; struct SpaceType; -struct Scene; +struct View3D; +struct bContext; +struct bContextDataResult; +struct bScreen; +struct uiLayout; +struct uiMenuItem; +struct wmKeyConfig; struct wmNotifier; struct wmWindow; struct wmWindowManager; -struct wmKeyConfig; -struct uiLayout; -struct uiMenuItem; #include "RNA_types.h" @@ -239,6 +240,7 @@ void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar); void BKE_screen_area_free(struct ScrArea *sa); struct ARegion *BKE_area_find_region_type(struct ScrArea *sa, int type); +struct ScrArea *BKE_screen_find_big_area(struct bScreen *sc, const int spacetype, const short min); void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene); void BKE_screen_view3d_scene_sync(struct bScreen *sc); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 2ef13318af4..f939c168f51 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -753,6 +753,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, extern int enable_cu_speed; /* object.c */ Object copyob = {{NULL}}; int cfrao = scene->r.cfra; + int dupend = ob->dupend; /* simple prevention of too deep nested groups */ if (level > MAX_DUPLI_RECUR) return; @@ -773,7 +774,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, /* duplicate over the required range */ if (ob->transflag & OB_DUPLINOSPEED) enable_cu_speed= 0; - for (scene->r.cfra= ob->dupsta; scene->r.cfra<=ob->dupend; scene->r.cfra++) { + for (scene->r.cfra= ob->dupsta; scene->r.cfra<=dupend; scene->r.cfra++) { short ok= 1; /* - dupoff = how often a frames within the range shouldn't be made into duplis diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index aebf3198cf4..8b5cf3bd196 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -447,7 +447,8 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat } else { /* when not in EditMode, use the 'final' derived mesh, depsgraph - * ensures we build with CD_MDEFORMVERT layer */ + * ensures we build with CD_MDEFORMVERT layer + */ dm = (DerivedMesh *)ob->derivedFinal; } @@ -1256,10 +1257,7 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr float quat[4]; if ((data->followflag & FOLLOWPATH_STATIC) == 0) { /* animated position along curve depending on time */ - if (cob->scene) - curvetime= bsystem_time(cob->scene, ct->tar, cu->ctime, 0.0) - data->offset; - else - curvetime= cu->ctime - data->offset; + curvetime= cu->ctime - data->offset; /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated, * but this will only work if it actually is animated... diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 5d2180fe702..adc08f5cd9f 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -315,9 +315,34 @@ short curve_type(Curve *cu) return OB_CURVE; } +void update_curve_dimension(Curve *cu) +{ + ListBase *nurbs= BKE_curve_nurbs(cu); + Nurb *nu= nurbs->first; + + if(cu->flag&CU_3D) { + for( ; nu; nu= nu->next) { + nu->flag &= ~CU_2D; + } + } + else { + for( ; nu; nu= nu->next) { + nu->flag |= CU_2D; + test2DNurb(nu); + + /* since the handles are moved they need to be auto-located again */ + if(nu->type == CU_BEZIER) + calchandlesNurb(nu); + } + } +} + void test_curve_type(Object *ob) -{ - ob->type = curve_type(ob->data); +{ + ob->type= curve_type(ob->data); + + if(ob->type==OB_CURVE) + update_curve_dimension((Curve *)ob->data); } void tex_space_curve(Curve *cu) diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 9d51571346f..51edee9ea71 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -591,9 +591,9 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O if(part->ren_as == PART_DRAW_OB && part->dup_ob) { node2 = dag_get_node(dag, part->dup_ob); - dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualisation"); + dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Particle Object Visualisation"); if(part->dup_ob->type == OB_MBALL) - dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA, "Particle Object Visualisation"); + dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Object Visualisation"); } if(part->ren_as == PART_DRAW_GR && part->dup_group) { @@ -799,6 +799,7 @@ DagNode * dag_find_node (DagForest *forest,void * fob) } static int ugly_hack_sorry= 1; // prevent type check +static int dag_print_dependencies= 0; // debugging /* no checking of existence, use dag_find_node first or dag_get_node */ DagNode * dag_add_node (DagForest *forest, void * fob) @@ -926,7 +927,6 @@ static const char *dag_node_name(DagNode *node) return ((bPoseChannel*)(node->ob))->name; } -#if 0 static void dag_node_print_dependencies(DagNode *node) { DagAdjList *itA; @@ -937,7 +937,6 @@ static void dag_node_print_dependencies(DagNode *node) printf(" %s through %s\n", dag_node_name(itA->node), itA->name); printf("\n"); } -#endif static int dag_node_print_dependency_recurs(DagNode *node, DagNode *endnode) { @@ -998,6 +997,11 @@ static void dag_check_cycle(DagForest *dag) DagNode *node; DagAdjList *itA; + /* debugging print */ + if(dag_print_dependencies) + for(node = dag->DagNode.first; node; node= node->next) + dag_node_print_dependencies(node); + /* tag nodes unchecked */ for(node = dag->DagNode.first; node; node= node->next) node->color= DAG_WHITE; @@ -2834,5 +2838,22 @@ void DAG_pose_sort(Object *ob) ugly_hack_sorry= 1; } +/* ************************ DAG DEBUGGING ********************* */ +void DAG_print_dependencies(Main *bmain, Scene *scene, Object *ob) +{ + /* utility for debugging dependencies */ + dag_print_dependencies= 1; + + if(ob && (ob->mode & OB_MODE_POSE)) { + printf("\nDEPENDENCY RELATIONS for %s\n\n", ob->id.name+2); + DAG_pose_sort(ob); + } + else { + printf("\nDEPENDENCY RELATIONS for %s\n\n", scene->id.name+2); + DAG_scene_sort(bmain, scene); + } + + dag_print_dependencies= 0; +} diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index ce53ec3ac9b..4f87c194790 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1325,7 +1325,7 @@ void nodeSetActive(bNodeTree *ntree, bNode *node) node->flag |= NODE_ACTIVE_TEXTURE; } -/* use flags are not persistant yet, groups might need different tagging, so we do it each time +/* use flags are not persistent yet, groups might need different tagging, so we do it each time when we need to get this info */ void ntreeSocketUseFlags(bNodeTree *ntree) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index a5edd569bc2..9a0dbd2a2eb 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -724,6 +724,7 @@ void *add_camera(const char *name) cam= alloc_libblock(&G.main->camera, ID_CA, name); cam->lens= 35.0f; + cam->sensor_x = 32.f; cam->clipsta= 0.1f; cam->clipend= 100.0f; cam->drawsize= 0.5f; @@ -2954,27 +2955,23 @@ void object_camera_mode(RenderData *rd, Object *camera) } } -/* 'lens' may be set for envmap only */ -void object_camera_matrix( - RenderData *rd, Object *camera, int winx, int winy, short field_second, - float winmat[][4], rctf *viewplane, float *clipsta, float *clipend, float *lens, float *ycor, - float *viewdx, float *viewdy -) { - Camera *cam=NULL; - float pixsize; - float shiftx=0.0, shifty=0.0, winside, viewfac; - short is_ortho= FALSE; +void object_camera_intrinsics(Object *camera, Camera **cam_r, short *is_ortho, float *shiftx, float *shifty, + float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit) +{ + Camera *cam= NULL; - /* question mark */ - (*ycor)= rd->yasp / rd->xasp; - if(rd->mode & R_FIELDS) - (*ycor) *= 2.0f; + (*shiftx)= 0.0f; + (*shifty)= 0.0f; + + (*sensor_x)= DEFAULT_SENSOR_WIDTH; + (*sensor_y)= DEFAULT_SENSOR_HEIGHT; + (*sensor_fit)= CAMERA_SENSOR_FIT_AUTO; if(camera->type==OB_CAMERA) { cam= camera->data; if(cam->type == CAM_ORTHO) { - is_ortho= TRUE; + *is_ortho= TRUE; } /* solve this too... all time depending stuff is in convertblender.c? @@ -2987,11 +2984,14 @@ void object_camera_matrix( execute_ipo(&cam->id, cam->ipo); } #endif // XXX old animation system - shiftx=cam->shiftx; - shifty=cam->shifty; + (*shiftx)=cam->shiftx; + (*shifty)=cam->shifty; (*lens)= cam->lens; + (*sensor_x)= cam->sensor_x; + (*sensor_y)= cam->sensor_y; (*clipsta)= cam->clipsta; (*clipend)= cam->clipend; + (*sensor_fit)= cam->sensor_fit; } else if(camera->type==OB_LAMP) { Lamp *la= camera->data; @@ -3005,7 +3005,7 @@ void object_camera_matrix( (*clipend)= la->clipend; } else { /* envmap exception... */; - if((*lens)==0.0f) + if((*lens)==0.0f) /* is this needed anymore? */ (*lens)= 16.0f; if((*clipsta)==0.0f || (*clipend)==0.0f) { @@ -3014,25 +3014,69 @@ void object_camera_matrix( } } + (*cam_r)= cam; +} + +/* 'lens' may be set for envmap only */ +void object_camera_matrix( + RenderData *rd, Object *camera, int winx, int winy, short field_second, + float winmat[][4], rctf *viewplane, float *clipsta, float *clipend, float *lens, + float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor, + float *viewdx, float *viewdy) +{ + Camera *cam=NULL; + float pixsize; + float shiftx=0.0, shifty=0.0, winside, viewfac; + short is_ortho= FALSE; + + /* question mark */ + (*ycor)= rd->yasp / rd->xasp; + if(rd->mode & R_FIELDS) + (*ycor) *= 2.0f; + + object_camera_intrinsics(camera, &cam, &is_ortho, &shiftx, &shifty, clipsta, clipend, lens, sensor_x, sensor_y, sensor_fit); + /* ortho only with camera available */ if(cam && is_ortho) { - if(rd->xasp*winx >= rd->yasp*winy) { + if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) { + if(rd->xasp*winx >= rd->yasp*winy) viewfac= winx; + else viewfac= (*ycor) * winy; + } + else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) { viewfac= winx; } - else { + else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */ viewfac= (*ycor) * winy; } + /* ortho_scale == 1.0 means exact 1 to 1 mapping */ pixsize= cam->ortho_scale/viewfac; } else { - if(rd->xasp*winx >= rd->yasp*winy) viewfac= ((*lens) * winx)/32.0f; - else viewfac= (*ycor) * ((*lens) * winy)/32.0f; + if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) { + if(rd->xasp*winx >= rd->yasp*winy) viewfac= ((*lens) * winx) / (*sensor_x); + else viewfac= (*ycor) * ((*lens) * winy) / (*sensor_x); + } + else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) { + viewfac= ((*lens) * winx) / (*sensor_x); + } + else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */ + viewfac= ((*lens) * winy) / (*sensor_y); + } + pixsize= (*clipsta) / viewfac; } /* viewplane fully centered, zbuffer fills in jittered between -.5 and +.5 */ winside= MAX2(winx, winy); + + if(cam) { + if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) + winside= winx; + else if(cam->sensor_fit==CAMERA_SENSOR_FIT_VERT) + winside= winy; + } + viewplane->xmin= -0.5f*(float)winx + shiftx*winside; viewplane->ymin= -0.5f*(*ycor)*(float)winy + shifty*winside; viewplane->xmax= 0.5f*(float)winx + shiftx*winside; @@ -3076,7 +3120,17 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh float aspx= (float) scene->r.xsch*scene->r.xasp; float aspy= (float) scene->r.ysch*scene->r.yasp; - if(aspx < aspy) { + if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + if(aspx < aspy) { + r_asp[0]= aspx / aspy; + r_asp[1]= 1.0; + } + else { + r_asp[0]= 1.0; + r_asp[1]= aspy / aspx; + } + } + else if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) { r_asp[0]= aspx / aspy; r_asp[1]= 1.0; } @@ -3102,16 +3156,18 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh else { /* that way it's always visible - clipsta+0.1 */ float fac; + float half_sensor= 0.5f*((camera->sensor_fit==CAMERA_SENSOR_FIT_VERT) ? (camera->sensor_y) : (camera->sensor_x)); + *r_drawsize= drawsize / ((scale[0] + scale[1] + scale[2]) / 3.0f); if(do_clip) { /* fixed depth, variable size (avoids exceeding clipping range) */ depth = -(camera->clipsta + 0.1f); - fac = depth / (camera->lens/-16.0f * scale[2]); + fac = depth / (camera->lens/(-half_sensor) * scale[2]); } else { /* fixed size, variable depth (stays a reasonable size in the 3D view) */ - depth= *r_drawsize * camera->lens/-16.0f * scale[2]; + depth= *r_drawsize * camera->lens/(-half_sensor) * scale[2]; fac= *r_drawsize; } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 7ba0a642cdd..93ff8ee08fc 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -990,6 +990,10 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen /* this is called in main loop, doing tagged updates before redraw */ void scene_update_tagged(Main *bmain, Scene *scene) { + /* keep this first */ + BLI_exec_cb(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_PRE); + + /* flush recalc flags to dependencies */ DAG_ids_flush_tagged(bmain); BLI_exec_cb(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_PRE); @@ -997,11 +1001,13 @@ void scene_update_tagged(Main *bmain, Scene *scene) scene->physics_settings.quick_cache_step= 0; /* update all objects: drivers, matrices, displists, etc. flags set - by depgraph or manual, no layer check here, gets correct flushed */ + by depgraph or manual, no layer check here, gets correct flushed + in the future this should handle updates for all datablocks, not + only objects and scenes. - brecht */ scene_update_tagged_recursive(bmain, scene, scene); - /* recalc scene animation data here (for sequencer) */ + /* extra call here to recalc scene animation (for sequencer) */ { AnimData *adt= BKE_animdata_from_id(&scene->id); float ctime = BKE_curframe(scene); @@ -1010,15 +1016,15 @@ void scene_update_tagged(Main *bmain, Scene *scene) BKE_animsys_evaluate_animdata(scene, &scene->id, adt, ctime, 0); } + /* quick point cache updates */ if (scene->physics_settings.quick_cache_step) BKE_ptcache_quick_cache_all(bmain, scene); + /* notify editors about recalc */ DAG_ids_check_recalc(bmain); + /* keep this last */ BLI_exec_cb(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_POST); - - /* in the future this should handle updates for all datablocks, not - only objects and scenes. - brecht */ } void scene_clear_tagged(Main *bmain, Scene *UNUSED(scene)) @@ -1033,7 +1039,8 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) Scene *sce_iter; /* keep this first */ - BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_PRE); + BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_PRE); + BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_PRE); sound_set_cfra(sce->r.cfra); @@ -1045,6 +1052,10 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) DAG_scene_sort(bmain, sce_iter); } + /* flush recalc flags to dependencies, if we were only changing a frame + this would not be necessary, but if a user or a script has modified + some datablock before scene_update_tagged was called, we need the flush */ + DAG_ids_flush_tagged(bmain); /* Following 2 functions are recursive * so dont call within 'scene_update_tagged_recursive' */ @@ -1065,8 +1076,8 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) scene_update_tagged_recursive(bmain, sce, sce); /* keep this last */ - BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_SCENE_UPDATE_POST); - BLI_exec_cb(bmain, (ID *)sce, BLI_CB_EVT_FRAME_CHANGE_POST); + BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_POST); + BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_POST); DAG_ids_clear_recalc(bmain); } diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 02e6fe945f3..3d28e45f6b7 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -351,6 +351,29 @@ ARegion *BKE_area_find_region_type(ScrArea *sa, int type) return NULL; } +/* note, using this function is generally a last resort, you really want to be + * using the context when you can - campbell + * -1 for any type */ +struct ScrArea *BKE_screen_find_big_area(struct bScreen *sc, const int spacetype, const short min) +{ + ScrArea *sa, *big= NULL; + int size, maxsize= 0; + + for(sa= sc->areabase.first; sa; sa= sa->next) { + if ((spacetype == -1) || sa->spacetype == spacetype) { + if (min <= sa->winx && min <= sa->winy) { + size= sa->winx*sa->winy; + if (size > maxsize) { + maxsize= size; + big= sa; + } + } + } + } + + return big; +} + void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene) { int bit; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index c8b6c030d61..b6a371707bb 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1747,6 +1747,9 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, if(!mcol) mcol = dm->getFaceDataArray(dm, CD_MCOL); + if(!mcol) + mcol = dm->getFaceDataArray(dm, CD_TEXTURE_MCOL); + totface = ccgSubSurf_getNumFaces(ss); for(i = 0; i < totface; i++) { CCGFace *f = ccgdm->faceMap[i].face; diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index aef1c4bb46c..fca7c3469a1 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -179,8 +179,8 @@ void dquat_to_mat4(float R[4][4], DualQuat *dq); void quat_apply_track(float quat[4], short axis, short upflag); void vec_apply_track(float vec[3], short axis); -float lens_to_angle(float lens); -float angle_to_lens(float angle); +float focallength_to_fov(float focal_length, float sensor); +float fov_to_focallength(float fov, float sensor); float angle_wrap_rad(float angle); float angle_wrap_deg(float angle); diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 4711acbb600..5d54ffbeb36 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -148,4 +148,8 @@ if(WITH_OPENMP) add_definitions(-DPARALLEL=1) endif() +if(WITH_XDG_USER_DIRS) + add_definitions(-DWITH_XDG_USER_DIRS) +endif() + blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 0ca8b72c1e3..7fecbae8229 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1688,14 +1688,14 @@ void vec_apply_track(float vec[3], short axis) } /* lens/angle conversion (radians) */ -float lens_to_angle(float lens) +float focallength_to_fov(float focal_length, float sensor) { - return 2.0f * atanf(16.0f/lens); + return 2.0f * atanf((sensor/2.0f) / focal_length); } -float angle_to_lens(float angle) +float fov_to_focallength(float hfov, float sensor) { - return 16.0f / tanf(angle * 0.5f); + return (sensor/2.0f) / tanf(hfov * 0.5f); } /* 'mod_inline(-3,4)= 1', 'fmod(-3,4)= -3' */ diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index bbb62db58f2..7aa84523e9d 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -52,7 +52,7 @@ #include "GHOST_Path-api.h" #if defined WIN32 && !defined _LIBC -# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */ +# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */ #else # ifndef _GNU_SOURCE # define _GNU_SOURCE @@ -61,35 +61,34 @@ #endif #ifdef WIN32 -#include <io.h> - -#ifdef _WIN32_IE -#undef _WIN32_IE -#endif -#define _WIN32_IE 0x0501 -#include <windows.h> -#include <shlobj.h> - -#include "BLI_winstuff.h" - +# include <io.h> +# ifdef _WIN32_IE +# undef _WIN32_IE +# endif +# define _WIN32_IE 0x0501 +# include <windows.h> +# include <shlobj.h> +# include "BLI_winstuff.h" #else /* non windows */ - -#ifdef WITH_BINRELOC -#include "binreloc.h" -#endif - +# ifdef WITH_BINRELOC +# include "binreloc.h" +# endif #endif /* WIN32 */ /* standard paths */ #ifdef WIN32 -#define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s" -#define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s" +# define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s" +# define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s" #elif defined(__APPLE__) -#define BLENDER_USER_FORMAT "%s/Blender/%s" -#define BLENDER_SYSTEM_FORMAT "%s/Blender/%s" -#else -#define BLENDER_USER_FORMAT "%s/.blender/%s" -#define BLENDER_SYSTEM_FORMAT "%s/blender/%s" +# define BLENDER_USER_FORMAT "%s/Blender/%s" +# define BLENDER_SYSTEM_FORMAT "%s/Blender/%s" +#else /* UNIX */ +# ifndef WITH_XDG_USER_DIRS /* oldschool unix ~/.blender/ */ +# define BLENDER_USER_FORMAT "%s/.blender/%s" +# else /* new XDG ~/blender/.config/ */ +# define BLENDER_USER_FORMAT "%s/blender/%s" +# endif // WITH_XDG_USER_DIRS +# define BLENDER_SYSTEM_FORMAT "%s/blender/%s" #endif /* local */ @@ -797,10 +796,18 @@ void BLI_getlastdir(const char* dir, char *last, const size_t maxlen) as default location to save documents */ const char *BLI_getDefaultDocumentFolder(void) { - #if !defined(WIN32) +#ifndef WIN32 + +#ifdef WITH_XDG_USER_DIRS + const char *xdg_documents_dir= getenv("XDG_DOCUMENTS_DIR"); + if (xdg_documents_dir) { + return xdg_documents_dir; + } +#endif + return getenv("HOME"); - #else /* Windows */ +#else /* Windows */ const char * ret; static char documentfolder[MAXPATHLEN]; HRESULT hResult; @@ -825,7 +832,7 @@ const char *BLI_getDefaultDocumentFolder(void) } return NULL; - #endif +#endif /* WIN32 */ } /* NEW stuff, to be cleaned up when fully migrated */ diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c index 30625e7b34e..8b00d8e48a6 100644 --- a/source/blender/blenlib/intern/uvproject.c +++ b/source/blender/blenlib/intern/uvproject.c @@ -141,7 +141,7 @@ UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, fl uci.do_pano = (camera->flag & CAM_PANORAMA); uci.do_persp = (camera->type==CAM_PERSP); - uci.camangle= lens_to_angle(camera->lens) / 2.0f; + uci.camangle= focallength_to_fov(camera->lens, camera->sensor_x) / 2.0f; uci.camsize= uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale; /* account for scaled cameras */ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 5c59ae20c7b..c0d52747d56 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -12286,8 +12286,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ntree_tmp_cycles_emission_version_patch(fd, lib, ma->nodetree); } - /* put compatibility code here until next subversion bump */ - { + if (main->versionfile < 260){ { /* set default alpha value of Image outputs in image and render layer nodes to 0 */ Scene *sce; @@ -12320,6 +12319,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } + + } + + if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 1)){ + Object *ob; + + for (ob= main->object.first; ob; ob= ob->id.next) { + ob->collision_boundtype= ob->boundtype; + } + + { + Camera *cam; + for(cam= main->camera.first; cam; cam= cam->id.next) { + if (cam->sensor_x < 0.01) + cam->sensor_x = DEFAULT_SENSOR_WIDTH; + + if (cam->sensor_y < 0.01) + cam->sensor_y = DEFAULT_SENSOR_HEIGHT; + } + } + } + + /* put compatibility code here until next subversion bump */ + { + } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp index 6fa2c8763e0..fcb98cc7c32 100644 --- a/source/blender/collada/CameraExporter.cpp +++ b/source/blender/collada/CameraExporter.cpp @@ -71,7 +71,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) if (cam->type == CAM_PERSP) { COLLADASW::PerspectiveOptic persp(mSW); - persp.setXFov(RAD2DEGF(lens_to_angle(cam->lens)), "xfov"); + persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov"); persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch),false,"aspect_ratio"); persp.setZFar(cam->clipend, false , "zfar"); persp.setZNear(cam->clipsta,false , "znear"); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 8d133979fa4..8cdb1065699 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -814,7 +814,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) double aspect = camera->getAspectRatio().getValue(); double xfov = aspect*yfov; // xfov is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens(DEG2RADF(xfov)); + cam->lens = fov_to_focallength(DEG2RADF(xfov), cam->sensor_x); } break; } @@ -835,7 +835,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) { double x = camera->getXFov().getValue(); // x is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens(DEG2RADF(x)); + cam->lens = fov_to_focallength(DEG2RADF(x), cam->sensor_x); } break; } @@ -852,7 +852,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) { double yfov = camera->getYFov().getValue(); // yfov is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens(DEG2RADF(yfov)); + cam->lens = fov_to_focallength(DEG2RADF(yfov), cam->sensor_x); } break; } diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index 8c0fa3a89a3..7461f5e9e9f 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -56,7 +56,7 @@ typedef struct RenderInfo { short curtile, tottile, status; rcti disprect; /* storage for view3d preview rect */ unsigned int* rect; - struct Render *re; /* persistant render */ + struct Render *re; /* persistent render */ } RenderInfo; /* ri->status */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a6316dc0e9e..eff4d1f6397 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2569,10 +2569,12 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, if(block->curlayout) ui_layout_add_but(block->curlayout, but); +#ifdef WITH_PYTHON /* if the 'UI_OT_editsource' is running, extract the source info from the button */ if (UI_editsource_enable_check()) { UI_editsource_active_but_test(but); } +#endif return but; } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index e49cb4898d9..0ba141163b3 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3216,6 +3216,63 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, return changed; } +static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, int shift) +{ + float *hsv= ui_block_hsv_get(but->block); + float rgb[3]; + float sensitivity = (shift?0.15:0.3) * ndof->dt; + + int color_profile = but->block->color_profile; + + if (but->rnaprop) { + if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) + color_profile = BLI_PR_NONE; + } + + ui_get_but_vectorf(but, rgb); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + + switch((int)but->a1) { + case UI_GRAD_SV: + hsv[2] += ndof->ry * sensitivity; + hsv[1] += ndof->rx * sensitivity; + break; + case UI_GRAD_HV: + hsv[0] += ndof->ry * sensitivity; + hsv[2] += ndof->rx * sensitivity; + break; + case UI_GRAD_HS: + hsv[0] += ndof->ry * sensitivity; + hsv[1] += ndof->rx * sensitivity; + break; + case UI_GRAD_H: + hsv[0] += ndof->ry * sensitivity; + break; + case UI_GRAD_S: + hsv[1] += ndof->ry * sensitivity; + break; + case UI_GRAD_V: + hsv[2] += ndof->ry * sensitivity; + break; + case UI_GRAD_V_ALT: + /* vertical 'value' strip */ + + /* exception only for value strip - use the range set in but->min/max */ + hsv[2] += ndof->rx * sensitivity; + + if (color_profile) + hsv[2] = srgb_to_linearrgb(hsv[2]); + + CLAMP(hsv[2], but->softmin, but->softmax); + default: + assert(!"invalid hsv type"); + } + + hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2); + copy_v3_v3(data->vec, rgb); + ui_set_but_vectorf(but, data->vec); +} + static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) { int mx, my; @@ -3238,8 +3295,18 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu return WM_UI_HANDLER_BREAK; } + else if (event->type == NDOF_MOTION) { + wmNDOFMotionData *ndof = (wmNDOFMotionData*) event->customdata; + + ui_ndofedit_but_HSVCUBE(but, data, ndof, event->shift); + + button_activate_state(C, but, BUTTON_STATE_EXIT); + ui_apply_button(C, but->block, but, data, 1); + + return WM_UI_HANDLER_BREAK; + } /* XXX hardcoded keymap check.... */ - else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) { + else if (event->type == DELKEY && event->val == KM_PRESS) { if (but->a1==UI_GRAD_V_ALT){ int len; @@ -3337,11 +3404,62 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx return changed; } +static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, int shift) +{ + float *hsv= ui_block_hsv_get(but->block); + float rgb[3]; + float phi, r /*, sqr */ /* UNUSED */, v[2]; + float sensitivity = (shift ? 0.15f : 0.3f) * ndof->dt; + + ui_get_but_vectorf(but, rgb); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + + /* Convert current colour on hue/sat disc to circular coordinates phi, r */ + phi = fmodf(hsv[0]+0.25f, 1.0f) * -2.0f*M_PI; + r = hsv[1]; + /* sqr= r>0.f?sqrtf(r):1; */ /* UNUSED */ + + /* Convert to 2d vectors */ + v[0] = r * cosf(phi); + v[1] = r * sinf(phi); + + /* Use ndof device y and x rotation to move the vector in 2d space */ + v[0] += ndof->ry * sensitivity; + v[1] += ndof->rx * sensitivity; + + /* convert back to polar coords on circle */ + phi = atan2(v[0], v[1])/(2.0f*(float)M_PI) + 0.5f; + + /* use ndof z rotation to additionally rotate hue */ + phi -= ndof->rz * sensitivity * 0.5f; + + r = len_v2(v); + CLAMP(r, 0.0f, 1.0f); + + /* convert back to hsv values, in range [0,1] */ + hsv[0] = fmodf(phi, 1.0f); + hsv[1] = r; + + /* exception, when using color wheel in 'locked' value state: + * allow choosing a hue for black values, by giving a tiny increment */ + if (but->flag & UI_BUT_COLOR_LOCK) { // lock + if (hsv[2] == 0.0f) hsv[2] = 0.0001f; + } + + hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2); + + if((but->flag & UI_BUT_VEC_SIZE_LOCK) && (data->vec[0] || data->vec[1] || data->vec[2])) { + normalize_v3(data->vec); + mul_v3_fl(data->vec, but->a2); + } + + ui_set_but_vectorf(but, data->vec); +} + static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) { int mx, my; - mx= event->x; my= event->y; ui_window_to_block(data->region, block, &mx, &my); @@ -3360,8 +3478,18 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle return WM_UI_HANDLER_BREAK; } + else if (event->type == NDOF_MOTION) { + wmNDOFMotionData *ndof = (wmNDOFMotionData*) event->customdata; + + ui_ndofedit_but_HSVCIRCLE(but, data, ndof, event->shift); + + button_activate_state(C, but, BUTTON_STATE_EXIT); + ui_apply_button(C, but->block, but, data, 1); + + return WM_UI_HANDLER_BREAK; + } /* XXX hardcoded keymap check.... */ - else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) { + else if (event->type == DELKEY && event->val == KM_PRESS) { int len; /* reset only saturation */ @@ -3810,7 +3938,7 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle return WM_UI_HANDLER_BREAK; } /* XXX hardcoded keymap check.... */ - else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) { + else if (event->type == DELKEY && event->val == KM_PRESS) { Histogram *hist = (Histogram *)but->poin; hist->ymax = 1.f; @@ -3893,7 +4021,7 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB return WM_UI_HANDLER_BREAK; } /* XXX hardcoded keymap check.... */ - else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) { + else if (event->type == DELKEY && event->val == KM_PRESS) { Scopes *scopes = (Scopes *)but->poin; scopes->wavefrm_yfac = 1.f; diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 27f94ae8e49..5803054caa7 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -43,6 +43,7 @@ #include "BLI_utildefines.h" #include "BKE_context.h" +#include "BKE_screen.h" #include "BKE_global.h" #include "BKE_text.h" /* for UI_OT_reports_to_text */ #include "BKE_report.h" @@ -476,6 +477,7 @@ static void UI_OT_reports_to_textblock(wmOperatorType *ot) ot->exec= reports_to_text_exec; } +#ifdef WITH_PYTHON /* ------------------------------------------------------------------------- */ /* EditSource Utility funcs and operator, @@ -576,24 +578,6 @@ void UI_editsource_active_but_test(uiBut *but) /* editsource operator component */ -static ScrArea *biggest_text_view(bContext *C) -{ - bScreen *sc= CTX_wm_screen(C); - ScrArea *sa, *big= NULL; - int size, maxsize= 0; - - for(sa= sc->areabase.first; sa; sa= sa->next) { - if(sa->spacetype==SPACE_TEXT) { - size= sa->winx * sa->winy; - if(size > maxsize) { - maxsize= size; - big= sa; - } - } - } - return big; -} - static int editsource_text_edit(bContext *C, wmOperator *op, char filepath[240], int line) { @@ -618,7 +602,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op, else { /* naughty!, find text area to set, not good behavior * but since this is a dev tool lets allow it - campbell */ - ScrArea *sa= biggest_text_view(C); + ScrArea *sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0); if(sa) { SpaceText *st= sa->spacedata.first; st->text= text; @@ -711,6 +695,7 @@ static void UI_OT_editsource(wmOperatorType *ot) ot->exec= editsource_exec; } +#endif /* WITH_PYTHON */ /* ********************************************************* */ /* Registration */ @@ -723,6 +708,9 @@ void UI_buttons_operatortypes(void) WM_operatortype_append(UI_OT_reset_default_button); WM_operatortype_append(UI_OT_copy_to_selected_button); WM_operatortype_append(UI_OT_reports_to_textblock); // XXX: temp? + +#ifdef WITH_PYTHON WM_operatortype_append(UI_OT_editsource); +#endif } diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index e29dfaa0a23..5487cbdadb2 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -54,6 +54,7 @@ #include "BLI_math_geom.h" #include "BKE_blender.h" +#include "BKE_screen.h" #include "BKE_context.h" #include "BKE_global.h" #include "BKE_image.h" @@ -1202,24 +1203,6 @@ static int thread_break(void *UNUSED(arg)) return G.afbreek; } -static ScrArea *biggest_image_area(bScreen *screen) -{ - ScrArea *sa, *big= NULL; - int size, maxsize= 0; - - for(sa= screen->areabase.first; sa; sa= sa->next) { - if(sa->spacetype==SPACE_IMAGE) { - size= sa->winx*sa->winy; - if(sa->winx > 10 && sa->winy > 10 && size > maxsize) { - maxsize= size; - big= sa; - } - } - } - return big; -} - - typedef struct BakeRender { Render *re; Main *main; @@ -1270,7 +1253,7 @@ static void init_bake_internal(BakeRender *bkr, bContext *C) /* get editmode results */ ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */ - bkr->sa= biggest_image_area(CTX_wm_screen(C)); /* can be NULL */ + bkr->sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_IMAGE, 10); /* can be NULL */ bkr->main= CTX_data_main(C); bkr->scene= scene; bkr->actob= (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 1efe79fff9e..a82ed95079f 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -645,7 +645,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) /* get the view settings if 'around' isnt set and the view is available */ View3D *v3d= CTX_wm_view3d(C); copy_v3_v3(cursor, give_cursor(scene, v3d)); - if(v3d && !RNA_property_is_set(op->ptr, "around")) + if(v3d && !RNA_property_is_set(op->ptr, "center")) around= v3d->around; } diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 9c38b1ce98f..cc1c8843015 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -503,6 +503,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) const short is_animation= RNA_boolean_get(op->ptr, "animation"); const short is_write_still= RNA_boolean_get(op->ptr, "write_still"); struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL; + const char *name; /* only one render job at a time */ if(WM_jobs_test(CTX_wm_manager(C), scene)) @@ -577,7 +578,10 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) rj->reports= op->reports; /* setup job */ - steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Render", jobflag); + if(RE_seq_render_active(scene, &scene->r)) name= "Sequence Render"; + else name= "Render"; + + steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag); WM_jobs_customdata(steve, rj, render_freejob); WM_jobs_timer(steve, 0.2, NC_SCENE|ND_RENDER_RESULT, 0); WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob); diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index 47957c0bb5a..d8719c7d7cd 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -58,6 +58,7 @@ /* returns biggest area that is not uv/image editor. Note that it uses buttons */ /* window as the last possible alternative. */ +/* would use BKE_screen_find_big_area(...) but this is too specific */ static ScrArea *biggest_non_image_area(bContext *C) { bScreen *sc= CTX_wm_screen(C); @@ -85,22 +86,6 @@ static ScrArea *biggest_non_image_area(bContext *C) return big; } -static ScrArea *biggest_area(bContext *C) -{ - bScreen *sc= CTX_wm_screen(C); - ScrArea *sa, *big= NULL; - int size, maxsize= 0; - - for(sa= sc->areabase.first; sa; sa= sa->next) { - size= sa->winx*sa->winy; - if(size > maxsize) { - maxsize= size; - big= sa; - } - } - return big; -} - static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win) { wmWindowManager *wm= CTX_wm_manager(C); @@ -206,7 +191,7 @@ void render_view_open(bContext *C, int mx, int my) } else { /* use any area of decent size */ - sa= biggest_area(C); + sa= BKE_screen_find_big_area(CTX_wm_screen(C), -1, 0); if(sa->spacetype!=SPACE_IMAGE) { // XXX newspace(sa, SPACE_IMAGE); sima= sa->spacedata.first; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 99412853ab9..dc6a647cada 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -57,6 +57,7 @@ #include "IMB_imbuf_types.h" #include "DNA_brush_types.h" +#include "DNA_camera_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_node_types.h" @@ -3040,7 +3041,8 @@ static void project_paint_begin(ProjPaintState *ps) Object *camera= ps->scene->camera; /* dont actually use these */ - float _viewdx, _viewdy, _ycor, _lens=0.0f; + float _viewdx, _viewdy, _ycor, _lens=0.0f, _sensor_x=DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT; + short _sensor_fit= CAMERA_SENSOR_FIT_AUTO; rctf _viewplane; /* viewmat & viewinv */ @@ -3052,7 +3054,7 @@ static void project_paint_begin(ProjPaintState *ps) object_camera_mode(&ps->scene->r, camera); object_camera_matrix(&ps->scene->r, camera, ps->winx, ps->winy, 0, winmat, &_viewplane, &ps->clipsta, &ps->clipend, - &_lens, &_ycor, &_viewdx, &_viewdy); + &_lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_ycor, &_viewdx, &_viewdy); ps->is_ortho= (ps->scene->r.mode & R_ORTHO) ? 1 : 0; } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 0b009dba651..c26a4d52a9e 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -208,7 +208,8 @@ typedef struct StrokeCache { int first_time; /* Beginning of stroke may do some things special */ - bglMats *mats; + /* from ED_view3d_ob_project_mat_get() */ + float projection_mat[4][4]; /* Clean this up! */ ViewContext *vc; @@ -405,7 +406,8 @@ static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float loca } } -static float frontface(Brush *brush, float sculpt_normal[3], short no[3], float fno[3]) +static float frontface(Brush *brush, const float sculpt_normal[3], + const short no[3], const float fno[3]) { if (brush->flag & BRUSH_FRONTFACE) { float dot; @@ -655,7 +657,11 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather) } /* Return a multiplier for brush strength on a particular vertex. */ -static float tex_strength(SculptSession *ss, Brush *br, float *point, const float len) +static float tex_strength(SculptSession *ss, Brush *br, float point[3], + const float len, + const float sculpt_normal[3], + const short vno[3], + const float fno[3]) { MTex *mtex = &br->mtex; float avg= 1; @@ -673,7 +679,8 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa } else if(ss->texcache) { float rotation = -mtex->rot; - float x, y, point_2d[3]; + float symm_point[3], point_2d[2]; + float x, y; float radius; /* if the active area is being applied for symmetry, flip it @@ -681,12 +688,13 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa position in order to project it. This insures that the brush texture will be oriented correctly. */ - flip_coord(point_2d, point, ss->cache->mirror_symmetry_pass); + flip_coord(symm_point, point, ss->cache->mirror_symmetry_pass); if (ss->cache->radial_symmetry_pass) - mul_m4_v3(ss->cache->symm_rot_mat_inv, point_2d); + mul_m4_v3(ss->cache->symm_rot_mat_inv, symm_point); - projectf(ss->cache->mats, point_2d, point_2d); + ED_view3d_project_float(ss->cache->vc->ar, symm_point, point_2d, + ss->cache->projection_mat); /* if fixed mode, keep coordinates relative to mouse */ if(mtex->brush_map_mode == MTEX_MAP_MODE_FIXED) { @@ -742,7 +750,10 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa avg += br->texture_sample_bias; - avg *= brush_curve_strength(br, len, ss->cache->radius); /* Falloff curve */ + /* Falloff curve */ + avg *= brush_curve_strength(br, len, ss->cache->radius); + + avg *= frontface(br, sculpt_normal, vno, fno); return avg; } @@ -980,7 +991,8 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node, BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, vd.co)) { - const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, ss->cache->view_normal, vd.no, vd.fno); + const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist, + ss->cache->view_normal, vd.no, vd.fno); float avg[3], val[3]; neighbor_average(ss, avg, vd.vert_indices[vd.i]); @@ -1073,7 +1085,8 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no fno= data[index].no; if(sculpt_brush_test(&test, co)) { - const float fade = bstrength*tex_strength(ss, brush, co, test.dist)*frontface(brush, ss->cache->view_normal, NULL, fno); + const float fade = bstrength*tex_strength(ss, brush, co, test.dist, + ss->cache->view_normal, NULL, fno); float *avg, val[3]; float n; @@ -1169,9 +1182,9 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if (sculpt_brush_test(&test, vd.co)) { - //if(sculpt_brush_test_cyl(&test, vd.co, ss->cache->location, area_normal)) { /* offset vertex */ - float fade = tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, area_normal, vd.no, vd.fno); + float fade = tex_strength(ss, brush, vd.co, test.dist, + area_normal, vd.no, vd.fno); mul_v3_v3fl(proxy[vd.i], offset, fade); @@ -1225,7 +1238,8 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, vd.co)) { /* offset vertex */ - const float fade = tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, area_normal, vd.no, vd.fno); + const float fade = tex_strength(ss, brush, vd.co, test.dist, + area_normal, vd.no, vd.fno); float val1[3]; float val2[3]; @@ -1266,7 +1280,8 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, vd.co)) { - float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, ss->cache->view_normal, vd.no, vd.fno); + float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist, + ss->cache->view_normal, vd.no, vd.fno); float val[3]; sub_v3_v3v3(val, test.location, vd.co); @@ -1326,7 +1341,8 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, origco[vd.i])) { - const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist)*frontface(brush, an, origno[vd.i], NULL); + const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist, + an, origno[vd.i], NULL); mul_v3_v3fl(proxy[vd.i], grab_delta, fade); @@ -1367,7 +1383,8 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, vd.co)) { - const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, an, vd.no, vd.fno); + const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist, + an, vd.no, vd.fno); mul_v3_v3fl(proxy[vd.i], cono, fade); @@ -1416,7 +1433,8 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, vd.co)) { - const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, an, vd.no, vd.fno); + const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist, + an, vd.no, vd.fno); mul_v3_v3fl(proxy[vd.i], grab_delta, fade); @@ -1464,7 +1482,8 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, origco[vd.i])) { - const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist)*frontface(brush, an, origno[vd.i], NULL); + const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist, + an, origno[vd.i], NULL); mul_v3_v3fl(proxy[vd.i], cono, fade); @@ -1510,7 +1529,8 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, origco[vd.i])) { - const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist)*frontface(brush, an, origno[vd.i], NULL); + const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist, + an, origno[vd.i], NULL); mul_v3_m3v3(proxy[vd.i], m, origco[vd.i]); sub_v3_v3(proxy[vd.i], origco[vd.i]); @@ -1564,7 +1584,8 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, origco[vd.i])) { - const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, area_normal, vd.no, vd.fno); + const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist, + area_normal, vd.no, vd.fno); float *disp= &layer_disp[vd.i]; float val[3]; @@ -1615,7 +1636,8 @@ static void do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, vd.co)) { - const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, ss->cache->view_normal, vd.no, vd.fno); + const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist, + ss->cache->view_normal, vd.no, vd.fno); float val[3]; if(vd.fno) copy_v3_v3(val, vd.fno); @@ -1947,7 +1969,8 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist))*frontface(brush, an, vd.no, vd.fno); + const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist), + an, vd.no, vd.fno); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2020,7 +2043,9 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist))*frontface(brush, an, vd.no, vd.fno); + const float fade = bstrength*tex_strength(ss, brush, vd.co, + sqrt(test.dist), + an, vd.no, vd.fno); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2111,7 +2136,9 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength*tex_strength(ss, brush, vd.co, ss->cache->radius*test.dist)*frontface(brush, an, vd.no, vd.fno); + const float fade = bstrength*tex_strength(ss, brush, vd.co, + ss->cache->radius*test.dist, + an, vd.no, vd.fno); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2172,7 +2199,9 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist))*frontface(brush, an, vd.no, vd.fno); + const float fade = bstrength*tex_strength(ss, brush, vd.co, + sqrt(test.dist), + an, vd.no, vd.fno); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2233,7 +2262,9 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist))*frontface(brush, an, vd.no, vd.fno); + const float fade = bstrength*tex_strength(ss, brush, vd.co, + sqrt(test.dist), + an, vd.no, vd.fno); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2782,8 +2813,6 @@ static void sculpt_cache_free(StrokeCache *cache) { if(cache->face_norms) MEM_freeN(cache->face_norms); - if(cache->mats) - MEM_freeN(cache->mats); MEM_freeN(cache); } @@ -2882,8 +2911,8 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio cache->brush = brush; - cache->mats = MEM_callocN(sizeof(bglMats), "sculpt bglMats"); - view3d_get_transformation(vc->ar, vc->rv3d, vc->obact, cache->mats); + /* cache projection matrix */ + ED_view3d_ob_project_mat_get(cache->vc->rv3d, ob, cache->projection_mat); ED_view3d_global_to_vector(cache->vc->rv3d, cache->vc->rv3d->twmat[3], cache->true_view_normal); /* Initialize layer brush displacements and persistent coords */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index c83baf24c1c..7121e4872eb 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1009,11 +1009,17 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, return (ibuf != NULL); } -static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op) +static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op, Scene *evil_scene) { if (RNA_property_is_set(op->ptr, "color_mode")) simopts->planes= RNA_enum_get(op->ptr, "color_mode"); if (RNA_property_is_set(op->ptr, "file_format")) simopts->imtype= RNA_enum_get(op->ptr, "file_format"); - // if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX + +#if 0 + if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX +#else + simopts->subimtype= evil_scene->r.subimtype; +#endif + if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality"); if (RNA_property_is_set(op->ptr, "filepath")) { @@ -1141,7 +1147,7 @@ static int image_save_as_exec(bContext *C, wmOperator *op) /* just incase to initialize values, * these should be set on invoke or by the caller. */ save_image_options_defaults(&simopts); - save_image_options_from_op(&simopts, op); + save_image_options_from_op(&simopts, op, CTX_data_scene(C)); save_image_doit(C, sima, op, &simopts, TRUE); @@ -1225,7 +1231,7 @@ static int image_save_exec(bContext *C, wmOperator *op) if (save_image_options_init(&simopts, sima, scene, FALSE) == 0) return OPERATOR_CANCELLED; - save_image_options_from_op(&simopts, op); + save_image_options_from_op(&simopts, op, scene); if (BLI_exists(simopts.filepath) && BLI_file_is_writable(simopts.filepath)) { save_image_doit(C, sima, op, &simopts, FALSE); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index d2b97597cb8..533d2555b26 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -850,6 +850,11 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN } } +void node_uifunc_group(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, NULL); +} + static void node_common_buts_whileloop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "max_iterations", 0, NULL, 0); @@ -875,7 +880,7 @@ static void node_common_set_butfunc(bNodeType *ntype) { switch(ntype->type) { case NODE_GROUP: -// ntype->uifunc= node_common_buts_group; + ntype->uifunc= node_uifunc_group; ntype->drawfunc= node_draw_group; ntype->drawupdatefunc= node_update_group; break; diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 925c4571a66..794f898a1fc 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -109,7 +109,7 @@ #define TS_CHUNK 128 /* ********************************************************* */ -/* Persistant Data */ +/* Persistent Data */ static void outliner_storage_cleanup(SpaceOops *soops) { @@ -156,7 +156,7 @@ static void outliner_storage_cleanup(SpaceOops *soops) } } -static void check_persistant(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr) +static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr) { TreeStore *ts; TreeStoreElem *tselem; @@ -818,7 +818,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i /* add to the visual tree */ BLI_addtail(lb, te); /* add to the storage */ - check_persistant(soops, te, id, type, index); + check_persistent(soops, te, id, type, index); tselem= TREESTORE(te); /* if we are searching for something expand to see child elements */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 832c4795f15..41c48a1af58 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -108,7 +108,7 @@ ((ELEM(vd->drawtype, OB_TEXTURE, OB_MATERIAL) && dt>OB_SOLID) || \ (vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX)) -static void draw_bounding_volume(Scene *scene, Object *ob); +static void draw_bounding_volume(Scene *scene, Object *ob, short type); static void drawcube_size(float size); static void drawcircle_size(float size); @@ -2706,7 +2706,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D if(dt==OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) - draw_bounding_volume(scene, ob); + draw_bounding_volume(scene, ob, ob->boundtype); } else if(hasHaloMat || (totface==0 && totedge==0)) { glPointSize(1.5); @@ -5511,7 +5511,7 @@ static void draw_bb_quadric(BoundBox *bb, short type) gluDeleteQuadric(qobj); } -static void draw_bounding_volume(Scene *scene, Object *ob) +static void draw_bounding_volume(Scene *scene, Object *ob, short type) { BoundBox *bb= NULL; @@ -5537,8 +5537,8 @@ static void draw_bounding_volume(Scene *scene, Object *ob) if(bb==NULL) return; - if(ob->boundtype==OB_BOUND_BOX) draw_box(bb->vec); - else draw_bb_quadric(bb, ob->boundtype); + if(type==OB_BOUND_BOX) draw_box(bb->vec); + else draw_bb_quadric(bb, type); } @@ -6104,7 +6104,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } else if(dt==OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) - draw_bounding_volume(scene, ob); + draw_bounding_volume(scene, ob, ob->boundtype); } else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) empty_object= drawDispList(scene, v3d, rv3d, base, dt); @@ -6120,7 +6120,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } else if(dt==OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) - draw_bounding_volume(scene, ob); + draw_bounding_volume(scene, ob, ob->boundtype); } else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { empty_object= drawDispList(scene, v3d, rv3d, base, dt); @@ -6137,7 +6137,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) drawmball(scene, v3d, rv3d, base, dt); else if(dt==OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) - draw_bounding_volume(scene, ob); + draw_bounding_volume(scene, ob, ob->boundtype); } else empty_object= drawmball(scene, v3d, rv3d, base, dt); @@ -6379,6 +6379,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } } + if(ob->gameflag & OB_BOUNDS) { + if(ob->boundtype!=ob->collision_boundtype || (dtx & OB_BOUNDBOX)==0) { + setlinestyle(2); + draw_bounding_volume(scene, ob, ob->collision_boundtype); + setlinestyle(0); + } + } + /* draw extra: after normal draw because of makeDispList */ if(dtx && (G.f & G_RENDER_OGL)==0) { @@ -6386,8 +6394,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) drawaxes(1.0f, OB_ARROWS); } if(dtx & OB_BOUNDBOX) { - if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) - draw_bounding_volume(scene, ob); + draw_bounding_volume(scene, ob, ob->boundtype); } if(dtx & OB_TEXSPACE) drawtexspace(ob); if(dtx & OB_DRAWNAME) { diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 63b0f68f158..70cf113384b 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -139,6 +139,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float float median[7], ve_median[7]; int tot, totw, totweight, totedge, totradius; char defstr[320]; + PointerRNA radius_ptr; median[0]= median[1]= median[2]= median[3]= median[4]= median[5]= median[6]= 0.0; tot= totw= totweight= totedge= totradius= 0; @@ -210,6 +211,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float BezTriple *bezt; int a; ListBase *nurbs= curve_editnurbs(cu); + StructRNA *seltype= NULL; + void *selp= NULL; nu= nurbs->first; while(nu) { @@ -224,6 +227,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float totweight++; median[5]+= bezt->radius; totradius++; + selp= bezt; + seltype= &RNA_BezierSplinePoint; } else { if(bezt->f1 & SELECT) { @@ -251,12 +256,17 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float totweight++; median[5]+= bp->radius; totradius++; + selp= bp; + seltype= &RNA_SplinePoint; } bp++; } } nu= nu->next; } + + if(totradius==1) + RNA_pointer_create(&cu->id, seltype, selp, &radius_ptr); } else if(ob->type==OB_LATTICE) { Lattice *lt= ob->data; @@ -319,9 +329,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float uiBlockEndAlign(block); if(totweight) uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, ""); - if(totradius) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); + if(totradius) { + if(totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 20, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL); + else uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); } + } else { uiBlockBeginAlign(block); uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); @@ -329,8 +341,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float uiBlockEndAlign(block); if(totweight) uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, ""); - if(totradius) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 40, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); + if(totradius) { + if(totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 40, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL); + else uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 40, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); + } } } else { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 3d2558699ef..a8cb436a942 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -921,17 +921,34 @@ static void draw_selected_name(Scene *scene, Object *ob) BLF_draw_default(offset, 10, 0.0f, info, sizeof(info)-1); } -void view3d_viewborder_size_get(Scene *scene, ARegion *ar, float size_r[2]) +void view3d_viewborder_size_get(Scene *scene, Object *camob, ARegion *ar, float size_r[2]) { - float winmax= MAX2(ar->winx, ar->winy); float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp); - - if(aspect > 1.0f) { - size_r[0]= winmax; - size_r[1]= winmax/aspect; - } else { - size_r[0]= winmax*aspect; - size_r[1]= winmax; + short sensor_fit= CAMERA_SENSOR_FIT_AUTO; + + if(camob && camob->type==OB_CAMERA) { + Camera *cam= (Camera *)camob->data; + sensor_fit= cam->sensor_fit; + } + + if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + float winmax= MAX2(ar->winx, ar->winy); + + if(aspect > 1.0f) { + size_r[0]= winmax; + size_r[1]= winmax/aspect; + } else { + size_r[0]= winmax*aspect; + size_r[1]= winmax; + } + } + else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { + size_r[0]= ar->winx; + size_r[1]= ar->winx/aspect; + } + else { + size_r[0]= ar->winy*aspect; + size_r[1]= ar->winy; } } @@ -941,7 +958,7 @@ void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, Region float size[2]; float dx= 0.0f, dy= 0.0f; - view3d_viewborder_size_get(scene, ar, size); + view3d_viewborder_size_get(scene, v3d->camera, ar, size); size[0]= size[0]*zoomfac; size[1]= size[1]*zoomfac; @@ -1208,6 +1225,21 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); } + if (ca && (ca->flag & CAM_SHOWSENSOR)) { + /* assume fixed sensor width for now */ + + /* float sensor_aspect = ca->sensor_x / ca->sensor_y; */ /* UNUSED */ + float sensor_scale = (x2i-x1i) / ca->sensor_x; + float sensor_height = sensor_scale * ca->sensor_y; + + float ymid = y1i + (y2i-y1i)/2.f; + float sy1= ymid - sensor_height/2.f; + float sy2= ymid + sensor_height/2.f; + + UI_ThemeColorShade(TH_WIRE, 100); + + uiDrawBox(GL_LINE_LOOP, x1i, sy1, x2i, sy2, 2.0f); + } } setlinestyle(0); @@ -2403,10 +2435,12 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in /* render 3d view */ if(rv3d->persp==RV3D_CAMOB && v3d->camera) { float winmat[4][4]; - float _clipsta, _clipend, _lens, _yco, _dx, _dy; + float _clipsta, _clipend, _lens, _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT; + short _sensor_fit= CAMERA_SENSOR_FIT_AUTO; rctf _viewplane; - object_camera_matrix(&scene->r, v3d->camera, sizex, sizey, 0, winmat, &_viewplane, &_clipsta, &_clipend, &_lens, &_yco, &_dx, &_dy); + object_camera_matrix(&scene->r, v3d->camera, sizex, sizey, 0, winmat, &_viewplane, &_clipsta, &_clipend, &_lens, + &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy); ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat); } @@ -2461,9 +2495,10 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w invert_m4_m4(rv3d.viewmat, rv3d.viewinv); { - float _yco, _dx, _dy; + float _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT; + short _sensor_fit= CAMERA_SENSOR_FIT_AUTO; rctf _viewplane; - object_camera_matrix(&scene->r, v3d.camera, width, height, 0, rv3d.winmat, &_viewplane, &v3d.near, &v3d.far, &v3d.lens, &_yco, &_dx, &_dy); + object_camera_matrix(&scene->r, v3d.camera, width, height, 0, rv3d.winmat, &_viewplane, &v3d.near, &v3d.far, &v3d.lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy); } mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index ea8db17daf0..e7fbdaf1deb 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2255,13 +2255,14 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was { ARegion *ar= CTX_wm_region(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); + View3D *v3d= CTX_wm_view3d(C); Scene *scene= CTX_data_scene(C); float xfac, yfac; float size[2]; rv3d->camdx= rv3d->camdy= 0.0f; - view3d_viewborder_size_get(scene, ar, size); + view3d_viewborder_size_get(scene, v3d->camera, ar, size); /* 4px is just a little room from the edge of the area */ xfac= (float)ar->winx / (float)(size[0] + 4); @@ -2523,13 +2524,13 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot) } /* sets the view to 1:1 camera/render-pixel */ -static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar) +static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar, View3D *v3d) { RegionView3D *rv3d= ar->regiondata; float size[2]; int im_width= (scene->r.size*scene->r.xsch)/100; - view3d_viewborder_size_get(scene, ar, size); + view3d_viewborder_size_get(scene, v3d->camera, ar, size); rv3d->camzoom= BKE_screen_view3d_zoom_from_fac((float)im_width/size[0]); CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX); @@ -2540,7 +2541,7 @@ static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); - view3d_set_1_to_1_viewborder(scene, ar); + view3d_set_1_to_1_viewborder(scene, ar, CTX_wm_view3d(C)); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index b087c7ac873..b07d2d1ca73 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -135,7 +135,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d); void view3d_clr_clipping(void); void view3d_set_clipping(RegionView3D *rv3d); void add_view3d_after(ListBase *lb, Base *base, int flag); -void view3d_viewborder_size_get(struct Scene *scene, struct ARegion *ar, float size_r[2]); +void view3d_viewborder_size_get(struct Scene *scene, struct Object *camob, struct ARegion *ar, float size_r[2]); void circf(float x, float y, float rad); void circ(float x, float y, float rad); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 93c577619de..7de1f2a85bb 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -966,10 +966,14 @@ int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, fl int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize) { Camera *cam=NULL; - float lens, fac, x1, y1, x2, y2; + float lens, sensor_x =DEFAULT_SENSOR_WIDTH, sensor_y= DEFAULT_SENSOR_HEIGHT, fac, x1, y1, x2, y2; float winx= (float)winxi, winy= (float)winyi; int orth= 0; - + short sensor_fit= CAMERA_SENSOR_FIT_AUTO; + + /* currnetly using sensor size (depends on fov calculating method) */ + float sensor= DEFAULT_SENSOR_WIDTH; + lens= v3d->lens; *clipsta= v3d->near; @@ -992,8 +996,13 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy else if(v3d->camera->type==OB_CAMERA) { cam= v3d->camera->data; lens= cam->lens; + sensor_x= cam->sensor_x; + sensor_y= cam->sensor_y; *clipsta= cam->clipsta; *clipend= cam->clipend; + sensor_fit= cam->sensor_fit; + + sensor= (cam->sensor_fit==CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : (cam->sensor_x); } } } @@ -1024,21 +1033,44 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy if(cam && cam->type==CAM_ORTHO) { /* ortho_scale == 1 means exact 1 to 1 mapping */ float dfac= 2.0f*cam->ortho_scale/fac; - - if(winx>winy) x1= -dfac; - else x1= -winx*dfac/winy; + + if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + if(winx>winy) { + x1= -dfac; + y1= -winy*dfac/winx; + } + else { + x1= -winx*dfac/winy; + y1= -dfac; + } + } + else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { + x1= -dfac; + y1= -winy*dfac/winx; + } + else { + x1= -winx*dfac/winy; + y1= -dfac; + } + x2= -x1; - - if(winx>winy) y1= -winy*dfac/winx; - else y1= -dfac; y2= -y1; + orth= 1; } else { float dfac; - if(winx>winy) dfac= 64.0f/(fac*winx*lens); - else dfac= 64.0f/(fac*winy*lens); + if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + if(winx>winy) dfac= (sensor_x * 2.0) / (fac*winx*lens); + else dfac= (sensor_x * 2.0) / (fac*winy*lens); + } + else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { + dfac= (sensor_x * 2.0) / (fac*winx*lens); + } + else { + dfac= (sensor_y * 2.0) / (fac*winy*lens); + } x1= - *clipsta * winx*dfac; x2= -x1; @@ -1057,8 +1089,8 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy dy += cam->shifty * cam->ortho_scale; } else { - dx += cam->shiftx * (cam->clipsta / cam->lens) * 32.0f; - dy += cam->shifty * (cam->clipsta / cam->lens) * 32.0f; + dx += cam->shiftx * (cam->clipsta / cam->lens) * sensor; + dy += cam->shifty * (cam->clipsta / cam->lens) * sensor; } x1+= dx; @@ -1076,7 +1108,14 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy *pixsize= 1.0f/viewfac; } else { - viewfac= (((winx >= winy)? winx: winy)*lens)/32.0f; + float size= ((winx >= winy)? winx: winy); + + if(sensor_fit==CAMERA_SENSOR_FIT_HOR) + size= winx; + else if(sensor_fit==CAMERA_SENSOR_FIT_VERT) + size= winy; + + viewfac= (size*lens)/sensor; *pixsize= *clipsta/viewfac; } } diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c index 7492b6aec44..1d752fe9c6d 100644 --- a/source/blender/imbuf/intern/moviecache.c +++ b/source/blender/imbuf/intern/moviecache.c @@ -230,7 +230,7 @@ void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf) key= BLI_mempool_alloc(cache->keys_pool); key->cache_owner= cache; - key->userkey= BLI_mempool_alloc(cache->userkeys_pool);; + key->userkey= BLI_mempool_alloc(cache->userkeys_pool); memcpy(key->userkey, userkey, cache->keysize); item= BLI_mempool_alloc(cache->items_pool); diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h index 8ad6821702a..292f920da66 100644 --- a/source/blender/makesdna/DNA_camera_types.h +++ b/source/blender/makesdna/DNA_camera_types.h @@ -51,6 +51,7 @@ typedef struct Camera { float passepartalpha; float clipsta, clipend; float lens, ortho_scale, drawsize; + float sensor_x, sensor_y; float shiftx, shifty; /* yafray: dof params */ @@ -61,6 +62,9 @@ typedef struct Camera { struct Ipo *ipo; // XXX depreceated... old animation system struct Object *dof_ob; + + char sensor_fit; + char pad[7]; } Camera; /* **************** CAMERA ********************* */ @@ -88,10 +92,18 @@ typedef struct Camera { #define CAM_ANGLETOGGLE 32 #define CAM_DS_EXPAND 64 #define CAM_PANORAMA 128 +#define CAM_SHOWSENSOR 256 /* yafray: dof sampling switch */ /* #define CAM_YF_NO_QMC 512 */ /* depreceated */ +/* Sensor fit */ +#define CAMERA_SENSOR_FIT_AUTO 0 +#define CAMERA_SENSOR_FIT_HOR 1 +#define CAMERA_SENSOR_FIT_VERT 2 + +#define DEFAULT_SENSOR_WIDTH 32.0f +#define DEFAULT_SENSOR_HEIGHT 18.0f #ifdef __cplusplus } diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 3e17d7f4942..d158f227df5 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -265,7 +265,9 @@ typedef struct Object { ListBase *duplilist; /* for temporary dupli list storage, only for use by RNA API */ float ima_ofs[2]; /* offset for image empties */ - char pad3[8]; + + short collision_boundtype; /* bounding box type used for collision */ + char pad3[6]; } Object; /* Warning, this is not used anymore because hooks are now modifiers */ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index cf593555bc7..204f7b0b0ec 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -70,6 +70,7 @@ extern StructRNA RNA_ArmatureSensor; extern StructRNA RNA_ArrayModifier; extern StructRNA RNA_BackgroundImage; extern StructRNA RNA_BevelModifier; +extern StructRNA RNA_SplinePoint; extern StructRNA RNA_BezierSplinePoint; extern StructRNA RNA_BlendData; extern StructRNA RNA_BlendTexture; diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 596e1a7f357..db71dee26ce 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -109,6 +109,18 @@ static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr) } } +void rna_Actuator_name_set(PointerRNA *ptr, const char *value) +{ + bActuator *act= (bActuator *)ptr->data; + + BLI_strncpy_utf8(act->name, value, sizeof(act->name)); + + if (ptr->id.data) { + Object *ob= (Object *)ptr->id.data; + BLI_uniquename(&ob->actuators, act, "Actuator", '.', offsetof(bActuator, name), sizeof(act->name)); + } +} + static void rna_Actuator_type_set(struct PointerRNA *ptr, int value) { bActuator *act= (bActuator *)ptr->data; @@ -525,6 +537,7 @@ void rna_def_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Actuator_name_set"); RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 9e89c4aaab0..1e7a969caaa 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -40,19 +40,65 @@ #ifdef RNA_RUNTIME #include "BKE_object.h" +#include "BKE_depsgraph.h" /* only for rad/deg conversion! can remove later */ +static float get_camera_sensor(Camera *cam) +{ + if(cam->sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + return cam->sensor_x; + } + else if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) { + return cam->sensor_x; + } + else { + return cam->sensor_y; + } +} + static float rna_Camera_angle_get(PointerRNA *ptr) { Camera *cam= ptr->id.data; - - return lens_to_angle(cam->lens); + float sensor= get_camera_sensor(cam); + return focallength_to_fov(cam->lens, sensor); } static void rna_Camera_angle_set(PointerRNA *ptr, float value) { Camera *cam= ptr->id.data; - cam->lens= angle_to_lens(value); + float sensor= get_camera_sensor(cam); + cam->lens= fov_to_focallength(value, sensor); +} + +static float rna_Camera_angle_x_get(PointerRNA *ptr) +{ + Camera *cam= ptr->id.data; + return focallength_to_fov(cam->lens, cam->sensor_x); +} + +static void rna_Camera_angle_x_set(PointerRNA *ptr, float value) +{ + Camera *cam= ptr->id.data; + cam->lens= fov_to_focallength(value, cam->sensor_x); +} + +static float rna_Camera_angle_y_get(PointerRNA *ptr) +{ + Camera *cam= ptr->id.data; + return focallength_to_fov(cam->lens, cam->sensor_y); +} + +static void rna_Camera_angle_y_set(PointerRNA *ptr, float value) +{ + Camera *cam= ptr->id.data; + cam->lens= fov_to_focallength(value, cam->sensor_y); +} + +static void rna_Camera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + Camera *camera= (Camera*)ptr->id.data; + + DAG_id_tag_update(&camera->id, 0); } #else @@ -79,6 +125,11 @@ void RNA_def_camera(BlenderRNA *brna) {0, "MILLIMETERS", 0, "Millimeters", ""}, {CAM_ANGLETOGGLE, "DEGREES", 0, "Degrees", ""}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem sensor_fit_items[] = { + {CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Calculate field of view using sensor size, with direction depending on image resolution"}, + {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Calculate field of view using sensor width"}, + {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Calculate field of view using sensor height"}, + {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Camera", "ID"); RNA_def_struct_ui_text(srna, "Camera", "Camera datablock for storing camera settings"); @@ -88,7 +139,7 @@ void RNA_def_camera(BlenderRNA *brna) prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Type", "Camera types"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); prop= RNA_def_property(srna, "show_guide", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "dtx"); @@ -96,7 +147,13 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_ENUM_FLAG); RNA_def_property_ui_text(prop, "Composition Guides", "Draw overlay"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); - + + prop= RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "sensor_fit"); + RNA_def_property_enum_items(prop, sensor_fit_items); + RNA_def_property_ui_text(prop, "Sensor Fit", "Mode of calculating field of view from sensor dimensions and focal length"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + /* Number values */ prop= RNA_def_property(srna, "passepartout_alpha", PROP_FLOAT, PROP_FACTOR); @@ -104,6 +161,27 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Passepartout Alpha", "Opacity (alpha) of the darkened overlay in Camera view"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + prop= RNA_def_property(srna, "angle_x", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0)); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Horizontal FOV", "Camera lens horizontal field of view in degrees"); + RNA_def_property_float_funcs(prop, "rna_Camera_angle_x_get", "rna_Camera_angle_x_set", NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + + prop= RNA_def_property(srna, "angle_y", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0)); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Vertical FOV", "Camera lens vertical field of view in degrees"); + RNA_def_property_float_funcs(prop, "rna_Camera_angle_y_get", "rna_Camera_angle_y_set", NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + + prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0)); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Field of View", "Camera lens field of view in degrees"); + RNA_def_property_float_funcs(prop, "rna_Camera_angle_get", "rna_Camera_angle_set", NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "clipsta"); RNA_def_property_range(prop, 0.001f, FLT_MAX); @@ -120,20 +198,27 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "lens"); RNA_def_property_range(prop, 1.0f, 5000.0f); RNA_def_property_ui_text(prop, "Focal Length", "Perspective Camera lens value in millimeters"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); - - prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0)); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Angle", "Perspective Camera lens field of view in degrees"); - RNA_def_property_float_funcs(prop, "rna_Camera_angle_get", "rna_Camera_angle_set", NULL); /* only for deg/rad conversion */ - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + + prop= RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "sensor_x"); + RNA_def_property_range(prop, 1.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 1.0f, 100.f, 1, 2); + RNA_def_property_ui_text(prop, "Sensor Width", "Horizontal size of the image sensor area in millimeters"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); + + prop= RNA_def_property(srna, "sensor_height", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "sensor_y"); + RNA_def_property_range(prop, 1.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 1.0f, 100.f, 1, 2); + RNA_def_property_ui_text(prop, "Sensor Height", "Vertical size of the image sensor area in millimeters"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); prop= RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "ortho_scale"); RNA_def_property_range(prop, 0.01f, 4000.0f); RNA_def_property_ui_text(prop, "Orthographic Scale", "Orthographic Camera scale (similar to zoom)"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); prop= RNA_def_property(srna, "draw_size", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "drawsize"); @@ -147,14 +232,14 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3); RNA_def_property_ui_text(prop, "Shift X", "Perspective Camera horizontal shift"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); prop= RNA_def_property(srna, "shift_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "shifty"); RNA_def_property_range(prop, -10.0f, 10.0f); RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3); RNA_def_property_ui_text(prop, "Shift Y", "Perspective Camera vertical shift"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update"); prop= RNA_def_property(srna, "dof_distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "YF_dofdist"); @@ -188,6 +273,11 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Name", "Show the active Camera's name in Camera view"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + prop= RNA_def_property(srna, "show_sensor", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWSENSOR); + RNA_def_property_ui_text(prop, "Show Sensor Size", "Show sensor size (film gate) in Camera view"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + prop= RNA_def_property(srna, "lens_unit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_lens_unit_items); diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index fe899f99ed2..89239c10ffd 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -75,6 +75,18 @@ static struct StructRNA* rna_Controller_refine(struct PointerRNA *ptr) } } +void rna_Constroller_name_set(PointerRNA *ptr, const char *value) +{ + bController *cont= (bController *)ptr->data; + + BLI_strncpy_utf8(cont->name, value, sizeof(cont->name)); + + if (ptr->id.data) { + Object *ob= (Object *)ptr->id.data; + BLI_uniquename(&ob->controllers, cont, "Controller", '.', offsetof(bController, name), sizeof(cont->name)); + } +} + static void rna_Controller_type_set(struct PointerRNA *ptr, int value) { bController *cont= (bController *)ptr->data; @@ -177,6 +189,7 @@ void RNA_def_controller(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Constroller_name_set"); RNA_def_struct_name_property(srna, prop); RNA_def_property_update(prop, NC_LOGIC, NULL); diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index cbac594a80f..93fdc2b2136 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -268,26 +268,10 @@ static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int static void rna_Curve_dimension_set(PointerRNA *ptr, int value) { Curve *cu= (Curve*)ptr->id.data; - ListBase *nurbs= BKE_curve_nurbs(cu); - Nurb *nu= nurbs->first; + if(value==CU_3D) cu->flag |= CU_3D; + else cu->flag &= ~CU_3D; - if(value==CU_3D) { - cu->flag |= CU_3D; - for( ; nu; nu= nu->next) { - nu->flag &= ~CU_2D; - } - } - else { - cu->flag &= ~CU_3D; - for( ; nu; nu= nu->next) { - nu->flag |= CU_2D; - test2DNurb(nu); - - /* since the handles are moved they need to be auto-located again */ - if(nu->type == CU_BEZIER) - calchandlesNurb(nu); - } - } + update_curve_dimension(cu); } static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 92c84da165b..076bdfe1964 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -324,7 +324,7 @@ void RNA_def_main(BlenderRNA *brna) prop= RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL); - RNA_def_property_ui_text(prop, "File is Saved", "Have recent edits been saved to disk"); + RNA_def_property_ui_text(prop, "File Has Unsaved Changes", "Have recent edits been saved to disk"); prop= RNA_def_property(srna, "is_saved", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index a0402ed3593..1b80e33b40c 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -568,7 +568,6 @@ static int rna_Main_textures_is_updated_get(PointerRNA *ptr) { return DAG_id_typ static int rna_Main_brushes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_BR); } static int rna_Main_worlds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_WO); } static int rna_Main_groups_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GR); } -static int rna_Main_shape_keys_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_KE); } static int rna_Main_texts_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_TXT); } static int rna_Main_speakers_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SPK); } static int rna_Main_sounds_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SO); } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 0fa63671951..7e2700629ad 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -948,10 +948,10 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) if (ob->type == OB_MESH) { /* this is needed to refresh the derived meshes draw func */ DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA); - WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data); } } + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data); } static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr) @@ -1532,9 +1532,10 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS); RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a collision bounds type other than the default"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "collision_bounds_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "boundtype"); + RNA_def_property_enum_sdna(prop, NULL, "collision_boundtype"); RNA_def_property_enum_items(prop, collision_bounds_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_collision_bounds_itemf"); RNA_def_property_ui_text(prop, "Collision Bounds", "Select the collision type"); @@ -1803,8 +1804,6 @@ static void rna_def_object(BlenderRNA *brna) {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as sphere"}, {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as cylinder"}, {OB_BOUND_CONE, "CONE", 0, "Cone", "Draw bounds as cone"}, - {OB_BOUND_TRIANGLE_MESH, "POLYHEDRON", 0, "Polyhedron", "Draw bounds as polyhedron"}, - {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Draw bounds as capsule"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem dupli_items[] = { @@ -2226,7 +2225,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "use_dupli_frames_speed", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED); - RNA_def_property_ui_text(prop, "Dupli Frames Speed", "Set dupliframes to use the frame"); // TODO, better descriptio! + RNA_def_property_ui_text(prop, "Dupli Frames Speed", "Set dupliframes to use the current frame instead of parent curve's evaluation time"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); prop= RNA_def_property(srna, "use_dupli_vertices_rotation", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 217b50b38e5..ba58a66a2d6 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -102,6 +102,18 @@ static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr) } } +void rna_Sensor_name_set(PointerRNA *ptr, const char *value) +{ + bSensor *sens= (bSensor *)ptr->data; + + BLI_strncpy_utf8(sens->name, value, sizeof(sens->name)); + + if (ptr->id.data) { + Object *ob= (Object *)ptr->id.data; + BLI_uniquename(&ob->sensors, sens, "Sensor", '.', offsetof(bSensor, name), sizeof(sens->name)); + } +} + static void rna_Sensor_type_set(struct PointerRNA *ptr, int value) { bSensor *sens= (bSensor *)ptr->data; @@ -260,6 +272,7 @@ static void rna_def_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Sensor name"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Sensor_name_set"); RNA_def_struct_name_property(srna, prop); RNA_def_property_update(prop, NC_LOGIC, NULL); diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 36d773ad605..d5dd0078a80 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -38,6 +38,7 @@ #include "DNA_meshdata_types.h" #include "DNA_camera_types.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "BLI_math.h" #include "BLI_string.h" @@ -159,7 +160,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, float scax= umd->scalex ? umd->scalex : 1.0f; float scay= umd->scaley ? umd->scaley : 1.0f; int free_uci= 0; - + aspect = aspx / aspy; for(i = 0; i < umd->num_projectors; ++i) @@ -194,16 +195,28 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, free_uci= 1; } else { - float scale= (cam->type == CAM_PERSP) ? cam->clipsta * 32.0f / cam->lens : cam->ortho_scale; + float sensor= (cam->sensor_fit == CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : cam->sensor_x; + float scale= (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale; float xmax, xmin, ymax, ymin; - if(aspect > 1.0f) { + if(cam->sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + if(aspect > 1.0f) { + xmax = 0.5f * scale; + ymax = xmax / aspect; + } else { + ymax = 0.5f * scale; + xmax = ymax * aspect; + } + } + else if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) { xmax = 0.5f * scale; ymax = xmax / aspect; - } else { + } + else { ymax = 0.5f * scale; xmax = ymax * aspect; } + xmin = -xmax; ymin = -ymax; diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c index d9774453d3e..b542954948a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c @@ -35,8 +35,8 @@ /* **************** ALPHAOVER ******************** */ static bNodeSocketTemplate cmp_node_alphaover_in[]= { { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_alphaover_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c index fe04e69993f..166eae9d1bc 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c @@ -33,8 +33,8 @@ /* **************** BILATERALBLUR ******************** */ static bNodeSocketTemplate cmp_node_bilateralblur_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, - { SOCK_RGBA, 1, "Determinator", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, + { SOCK_RGBA, 1, "Determinator", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index 2db80385951..188ac653506 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -35,7 +35,7 @@ /* **************** BLUR ******************** */ static bNodeSocketTemplate cmp_node_blur_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, "Size", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c index 95099e7adfb..9153e3899fc 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.c +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c @@ -37,7 +37,7 @@ /* **************** Brigh and contrsast ******************** */ static bNodeSocketTemplate cmp_node_brightcontrast_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, "Bright", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, { SOCK_FLOAT, 1, "Contrast", 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, { -1, 0, "" } diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c index dbdfc6712dc..10f0afb6cf6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c @@ -35,7 +35,7 @@ /* ******************* Channel Matte Node ********************************* */ static bNodeSocketTemplate cmp_node_channel_matte_in[]={ - {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f}, + {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f}, {-1,0,""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c index 71bb7c35d01..25891aeaa68 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c @@ -34,8 +34,8 @@ /* ******************* Chroma Key ********************************************************** */ static bNodeSocketTemplate cmp_node_chroma_in[]={ - {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f}, - {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f}, + {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA,1,"Key Color", 1.0f, 1.0f, 1.0f, 1.0f}, {-1,0,""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c index a82d8cf1f41..3dfc3a193a8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c @@ -34,8 +34,8 @@ /* ******************* Color Key ********************************************************** */ static bNodeSocketTemplate cmp_node_color_in[]={ - {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f}, - {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f}, + {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA,1,"Key Color", 1.0f, 1.0f, 1.0f, 1.0f}, {-1,0,""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c index 6b833d44f72..c85a81b9bdb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c @@ -37,7 +37,7 @@ /* ******************* Color Spill Supression ********************************* */ static bNodeSocketTemplate cmp_node_color_spill_in[]={ - {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f}, + {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f}, {SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, {-1,0,""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c index e9176db4c0d..eb75802c0a6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c @@ -37,7 +37,7 @@ /* ******************* Color Balance ********************************* */ static bNodeSocketTemplate cmp_node_colorbalance_in[]={ {SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f}, + {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f}, {-1,0,""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c index c20593726cc..7847726c68e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.c +++ b/source/blender/nodes/composite/nodes/node_composite_crop.c @@ -35,7 +35,7 @@ /* **************** Crop ******************** */ static bNodeSocketTemplate cmp_node_crop_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_crop_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c index c796a01f5a8..675710942fb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.c +++ b/source/blender/nodes/composite/nodes/node_composite_curves.c @@ -121,7 +121,7 @@ void register_node_type_cmp_curve_vec(ListBase *lb) /* **************** CURVE RGB ******************** */ static bNodeSocketTemplate cmp_node_curve_rgb_in[]= { { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR}, - { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, "Black Level", 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, "White Level", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index 72a9897188c..2232c4a489e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -34,8 +34,8 @@ /* ************ qdn: Defocus node ****************** */ static bNodeSocketTemplate cmp_node_defocus_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, - { SOCK_FLOAT, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, + { SOCK_FLOAT, 1, "Z", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_defocus_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index 8b1647414da..c621d524044 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -34,8 +34,8 @@ /* ******************* channel Difference Matte ********************************* */ static bNodeSocketTemplate cmp_node_diff_matte_in[]={ - {SOCK_RGBA,1,"Image 1", 0.8f, 0.8f, 0.8f, 1.0f}, - {SOCK_RGBA,1,"Image 2", 0.8f, 0.8f, 0.8f, 1.0f}, + {SOCK_RGBA,1,"Image 1", 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA,1,"Image 2", 1.0f, 1.0f, 1.0f, 1.0f}, {-1,0,""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index c77dc16bbf3..591870d0911 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -33,7 +33,7 @@ #include "node_composite_util.h" static bNodeSocketTemplate cmp_node_dblur_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c index 8242acb6d49..02a1d203bef 100644 --- a/source/blender/nodes/composite/nodes/node_composite_displace.c +++ b/source/blender/nodes/composite/nodes/node_composite_displace.c @@ -36,7 +36,7 @@ /* **************** Displace ******************** */ static bNodeSocketTemplate cmp_node_displace_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_VECTOR, 1, "Vector", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION}, { SOCK_FLOAT, 1, "X Scale", 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, "Y Scale", 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR}, diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c index c4c6abbd718..401b143aac3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c @@ -34,8 +34,8 @@ /* ******************* channel Distance Matte ********************************* */ static bNodeSocketTemplate cmp_node_distance_matte_in[]={ - {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f}, - {SOCK_RGBA,1,"Key Color", 0.8f, 0.8f, 0.8f, 1.0f}, + {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f}, + {SOCK_RGBA,1,"Key Color", 1.0f, 1.0f, 1.0f, 1.0f}, {-1,0,""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c index 717942a0ec9..071ee84377c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.c +++ b/source/blender/nodes/composite/nodes/node_composite_filter.c @@ -34,8 +34,8 @@ /* **************** FILTER ******************** */ static bNodeSocketTemplate cmp_node_filter_in[]= { - { SOCK_FLOAT, 1, "Fac", 1.0f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_FLOAT, 1, "Fac", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_filter_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c index ba1b72a1fb4..01f58182227 100644 --- a/source/blender/nodes/composite/nodes/node_composite_flip.c +++ b/source/blender/nodes/composite/nodes/node_composite_flip.c @@ -34,7 +34,7 @@ /* **************** Flip ******************** */ static bNodeSocketTemplate cmp_node_flip_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c index 1f8f934b1ba..2bb600db99d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_gamma.c +++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c @@ -36,7 +36,7 @@ /* **************** Gamma Tools ******************** */ static bNodeSocketTemplate cmp_node_gamma_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, "Gamma", 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c index 8660a4d612f..f4391a1af77 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ b/source/blender/nodes/composite/nodes/node_composite_glare.c @@ -33,7 +33,7 @@ #include "node_composite_util.h" static bNodeSocketTemplate cmp_node_glare_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_glare_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index a1c17abfdf6..c2304b37c0d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -36,7 +36,7 @@ /* **************** Hue Saturation ******************** */ static bNodeSocketTemplate cmp_node_hue_sat_in[]= { { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_hue_sat_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c index 6b9196d58dc..f18eca3dfcc 100644 --- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c +++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c @@ -34,7 +34,7 @@ static bNodeSocketTemplate cmp_node_huecorrect_in[]= { { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c index cf21efb000e..914483bc52f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_idMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c @@ -36,7 +36,7 @@ /* **************** ID Mask ******************** */ static bNodeSocketTemplate cmp_node_idmask_in[]= { - { SOCK_FLOAT, 1, "ID value", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + { SOCK_FLOAT, 1, "ID value", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_idmask_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c index 25ac24cf185..c428e37bd35 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.c +++ b/source/blender/nodes/composite/nodes/node_composite_invert.c @@ -34,7 +34,7 @@ /* **************** INVERT ******************** */ static bNodeSocketTemplate cmp_node_invert_in[]= { { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_RGBA, 1, "Color", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.c b/source/blender/nodes/composite/nodes/node_composite_lensdist.c index 4d2794d844d..e57f405ed68 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.c +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.c @@ -33,7 +33,7 @@ #include "node_composite_util.h" static bNodeSocketTemplate cmp_node_lensdist_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, "Distort", 0.f, 0.f, 0.f, 0.f, -0.999f, 1.f, PROP_NONE}, { SOCK_FLOAT, 1, "Dispersion", 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, PROP_NONE}, { -1, 0, "" } diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c index 8c37b3dd90f..8573849b069 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c @@ -35,7 +35,7 @@ /* ******************* Luma Matte Node ********************************* */ static bNodeSocketTemplate cmp_node_luma_matte_in[]={ - {SOCK_RGBA,1,"Image", 0.8f, 0.8f, 0.8f, 1.0f}, + {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f}, {-1,0,""} }; diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c index f4daf49f55d..5dc6d1c3aaa 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c @@ -35,7 +35,7 @@ /* **************** Map UV ******************** */ static bNodeSocketTemplate cmp_node_mapuv_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_VECTOR, 1, "UV", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c index 30eb0b8640b..81e963d4790 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c +++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c @@ -34,7 +34,7 @@ /* **************** MAP VALUE ******************** */ static bNodeSocketTemplate cmp_node_map_value_in[]= { - { SOCK_FLOAT, 1, "Value", 1.0f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + { SOCK_FLOAT, 1, "Value", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_map_value_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c index a119a0b7de3..36206d82d0b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_normalize.c +++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c @@ -35,7 +35,7 @@ /* **************** NORMALIZE single channel, useful for Z buffer ******************** */ static bNodeSocketTemplate cmp_node_normalize_in[]= { - { SOCK_FLOAT, 1, "Value", 1.0f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f, PROP_NONE}, + { SOCK_FLOAT, 1, "Value", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_normalize_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c index 7ce2f80e580..b188b0dd323 100644 --- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c +++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c @@ -36,7 +36,7 @@ /* **************** Premul and Key Alpha Convert ******************** */ static bNodeSocketTemplate cmp_node_premulkey_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_premulkey_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c index e86de3c7839..a7c820ddce6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_rgb.c @@ -35,7 +35,7 @@ /* **************** RGB ******************** */ static bNodeSocketTemplate cmp_node_rgb_out[]= { - { SOCK_RGBA, 0, "RGBA", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 0, "RGBA", 0.5f, 0.5f, 0.5f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index 74ab33eb093..96712baf8b0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -35,7 +35,7 @@ /* **************** Rotate ******************** */ static bNodeSocketTemplate cmp_node_rotate_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, "Degr", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_ANGLE}, { -1, 0, "" } }; @@ -60,6 +60,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac rad= (M_PI*in[1]->vec[0])/180.0f; + s= sin(rad); c= cos(rad); centx= cbuf->x/2; diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c index 48631a18dcb..5eb789ae0c9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.c +++ b/source/blender/nodes/composite/nodes/node_composite_scale.c @@ -37,7 +37,7 @@ #define CMP_SCALE_MAX 12000 static bNodeSocketTemplate cmp_node_scale_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, "X", 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_FACTOR}, { SOCK_FLOAT, 1, "Y", 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_FACTOR}, { -1, 0, "" } diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c index 4a5036a6a7f..bf58d443aec 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c @@ -35,7 +35,7 @@ /* **************** SEPARATE HSVA ******************** */ static bNodeSocketTemplate cmp_node_sephsva_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_sephsva_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c index 143c67d099a..ade2b22bf35 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c @@ -34,7 +34,7 @@ /* **************** SEPARATE RGBA ******************** */ static bNodeSocketTemplate cmp_node_seprgba_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_seprgba_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c index 502d1999101..3b3d57bf442 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c @@ -35,7 +35,7 @@ /* **************** SEPARATE YCCA ******************** */ static bNodeSocketTemplate cmp_node_sepycca_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_sepycca_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c index 5a766df29ed..aedb5652e61 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c +++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c @@ -35,7 +35,7 @@ /* **************** SEPARATE YUVA ******************** */ static bNodeSocketTemplate cmp_node_sepyuva_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_sepyuva_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c index c243c104774..36e583a77ff 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c @@ -33,7 +33,7 @@ #include "node_composite_util.h" static bNodeSocketTemplate cmp_node_tonemap_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_tonemap_out[]= { diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c index 1865d6fc3d4..2b25ef92a1e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.c +++ b/source/blender/nodes/composite/nodes/node_composite_translate.c @@ -36,7 +36,7 @@ /* **************** Translate ******************** */ static bNodeSocketTemplate cmp_node_translate_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, "X", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE}, { SOCK_FLOAT, 1, "Y", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f, PROP_NONE}, { -1, 0, "" } diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c index cdf56c230d8..a0fbcec198a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c +++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c @@ -35,7 +35,7 @@ /* **************** VECTOR BLUR ******************** */ static bNodeSocketTemplate cmp_node_vecblur_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_FLOAT, 1, "Z", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_VECTOR, 1, "Speed", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY}, { -1, 0, "" } diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c index 46a66957eac..7aac3539960 100644 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c @@ -36,10 +36,10 @@ /* **************** Z COMBINE ******************** */ /* lazy coder note: node->custom2 is abused to send signal */ static bNodeSocketTemplate cmp_node_zcombine_in[]= { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, - { SOCK_FLOAT, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, - { SOCK_FLOAT, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, + { SOCK_FLOAT, 1, "Z", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, + { SOCK_FLOAT, 1, "Z", 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_zcombine_out[]= { diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c index be8fe64c753..88fbdc99f82 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geom.c +++ b/source/blender/nodes/shader/nodes/node_shader_geom.c @@ -140,6 +140,7 @@ void register_node_type_sh_geom(ListBase *lb) node_type_base(&ntype, SH_NODE_GEOM, "Geometry", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_OLD_SHADING); + node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_socket_templates(&ntype, NULL, sh_node_geom_out); node_type_size(&ntype, 120, 80, 160); node_type_init(&ntype, node_shader_init_geometry); diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index d8ddcd593a8..29e0185c2f2 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -71,7 +71,7 @@ void BPY_text_free_code(struct Text *text); void BPY_modules_update(struct bContext *C); // XXX - annoying, need this for pointers that get out of date void BPY_modules_load_user(struct bContext *C); -void BPY_app_handlers_reset(void); +void BPY_app_handlers_reset(const short do_all); void BPY_driver_reset(void); float BPY_driver_exec(struct ChannelDriver *driver); diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 076b4811d07..6d869a7eb1f 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -195,19 +195,22 @@ static PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *UNUSED(closure) static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUSED(closure)) { - char *st; + const char *name; + Py_ssize_t name_size; + if (!PyUnicode_Check(value)) { PyErr_SetString(PyExc_TypeError, "expected a string!"); return -1; } - st = _PyUnicode_AsString(value); - if (BLI_strnlen(st, MAX_IDPROP_NAME) == MAX_IDPROP_NAME) { + name = _PyUnicode_AsStringAndSize(value, &name_size); + + if (name_size > MAX_IDPROP_NAME) { PyErr_SetString(PyExc_TypeError, "string length cannot exceed 31 characters!"); return -1; } - BLI_strncpy(self->prop->name, st, sizeof(self->prop->name)); + memcpy(self->prop->name, name, name_size); return 0; } @@ -236,7 +239,7 @@ static Py_ssize_t BPy_IDGroup_Map_Len(BPy_IDProperty *self) static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item) { IDProperty *idprop; - char *name; + const char *name; if (self->prop->type != IDP_GROUP) { PyErr_SetString(PyExc_TypeError, "unsubscriptable object"); @@ -301,14 +304,22 @@ static int idp_sequence_type(PyObject *seq) return type; } -/* note: group can be a pointer array or a group */ -const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *group, PyObject *ob) +/* note: group can be a pointer array or a group. + * assume we already checked key is a string. */ +const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty *group, PyObject *ob) { IDProperty *prop = NULL; IDPropertyTemplate val = {0}; - if (strlen(name) >= sizeof(group->name)) - return "the length of IDProperty names is limited to 31 characters"; + const char *name= ""; + + if (name_obj) { + Py_ssize_t name_size; + name = _PyUnicode_AsStringAndSize(name_obj, &name_size); + if (name_size > MAX_IDPROP_NAME) { + return "the length of IDProperty names is limited to 31 characters"; + } + } if (PyFloat_Check(ob)) { val.d = PyFloat_AsDouble(ob); @@ -364,7 +375,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g for (i=0; i<val.array.len; i++) { const char *error; item = PySequence_GetItem(ob, i); - error= BPy_IDProperty_Map_ValidateAndCreate("", prop, item); + error= BPy_IDProperty_Map_ValidateAndCreate(NULL, prop, item); Py_DECREF(item); if (error) @@ -396,7 +407,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g Py_XDECREF(pval); return "invalid element in subgroup dict template!"; } - if (BPy_IDProperty_Map_ValidateAndCreate(_PyUnicode_AsString(key), prop, pval)) { + if (BPy_IDProperty_Map_ValidateAndCreate(key, prop, pval)) { IDP_FreeProperty(prop); MEM_freeN(prop); Py_XDECREF(keys); @@ -453,7 +464,7 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val) return -1; } - err = BPy_IDProperty_Map_ValidateAndCreate(_PyUnicode_AsString(key), prop, val); + err = BPy_IDProperty_Map_ValidateAndCreate(key, prop, val); if (err) { PyErr_SetString(PyExc_KeyError, err ); return -1; @@ -587,7 +598,7 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value) { IDProperty *idprop; PyObject *pyform; - char *name = _PyUnicode_AsString(value); + const char *name = _PyUnicode_AsString(value); if (!name) { PyErr_SetString(PyExc_TypeError, "pop expected at least 1 argument, got 0"); @@ -724,7 +735,7 @@ static PyObject *BPy_IDGroup_GetItems(BPy_IDProperty *self) static int BPy_IDGroup_Contains(BPy_IDProperty *self, PyObject *value) { - char *name = _PyUnicode_AsString(value); + const char *name = _PyUnicode_AsString(value); if (!name) { PyErr_SetString(PyExc_TypeError, "expected a string"); diff --git a/source/blender/python/generic/IDProp.h b/source/blender/python/generic/IDProp.h index f71514f9df0..36cb4c76a5c 100644 --- a/source/blender/python/generic/IDProp.h +++ b/source/blender/python/generic/IDProp.h @@ -61,7 +61,7 @@ int BPy_Wrap_SetMapItem(struct IDProperty *prop, PyObject *key, PyObject *val); PyObject *BPy_IDGroup_WrapData(struct ID *id, struct IDProperty *prop ); -const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, struct IDProperty *group, PyObject *ob); +const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *key, struct IDProperty *group, PyObject *ob); void IDProp_Init_Types(void); diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index c6fb5133e33..eb4ecf79941 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -363,7 +363,7 @@ error_cleanup: /* string conversion, escape non-unicode chars, coerce must be set to NULL */ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) { - char *result; + const char *result; result= _PyUnicode_AsString(py_str); diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index e7f74569f1a..f130a4bcc5c 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -38,17 +38,22 @@ void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg); static PyTypeObject BlenderAppCbType; static PyStructSequence_Field app_cb_info_fields[]= { - {(char *)"frame_change_pre", NULL}, - {(char *)"frame_change_post", NULL}, - {(char *)"render_pre", NULL}, - {(char *)"render_post", NULL}, - {(char *)"render_stats", NULL}, - {(char *)"load_pre", NULL}, - {(char *)"load_post", NULL}, - {(char *)"save_pre", NULL}, - {(char *)"save_post", NULL}, - {(char *)"scene_update_pre", NULL}, - {(char *)"scene_update_post", NULL}, + {(char *)"frame_change_pre", (char *)"Callback list - on frame change for playback and rendering (before)"}, + {(char *)"frame_change_post", (char *)"Callback list - on frame change for playback and rendering (after)"}, + {(char *)"render_pre", (char *)"Callback list - on render (before)"}, + {(char *)"render_post", (char *)"Callback list - on render (after)"}, + {(char *)"render_stats", (char *)"Callback list - on printing render statistics"}, + {(char *)"load_pre", (char *)"Callback list - on loading a new blend file (before)"}, + {(char *)"load_post", (char *)"Callback list - on loading a new blend file (after)"}, + {(char *)"save_pre", (char *)"Callback list - on saving a blend file (before)"}, + {(char *)"save_post", (char *)"Callback list - on saving a blend file (after)"}, + {(char *)"scene_update_pre", (char *)"Callback list - on updating the scenes data (before)"}, + {(char *)"scene_update_post", (char *)"Callback list - on updating the scenes data (after)"}, + + /* sets the permanent tag */ +# define APP_CB_OTHER_FIELDS 1 + {(char *)"persistent", (char *)"Function decorator for callback functions not to be removed when loading new files"}, + {NULL} }; @@ -65,6 +70,95 @@ static PyStructSequence_Desc app_cb_info_desc= { #endif */ +/* --------------------------------------------------------------------------*/ +/* permanent tagging code */ +#define PERMINENT_CB_ID "_bpy_persistent" + +static PyObject *bpy_app_handlers_persistent_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *UNUSED(kwds)) +{ + PyObject *value; + + if(!PyArg_ParseTuple(args, "O:bpy.app.handlers.persistent", &value)) + return NULL; + + if (PyFunction_Check(value)) { + PyObject **dict_ptr= _PyObject_GetDictPtr(value); + if (dict_ptr == NULL) { + PyErr_SetString(PyExc_ValueError, + "bpy.app.handlers.persistent wasn't able to " + "get the dictionary from the function passed"); + return NULL; + } + else { + /* set id */ + if (*dict_ptr == NULL) { + *dict_ptr= PyDict_New(); + } + + PyDict_SetItemString(*dict_ptr, PERMINENT_CB_ID, Py_None); + } + + Py_INCREF(value); + return value; + } + else { + PyErr_SetString(PyExc_ValueError, + "bpy.app.handlers.persistent expected a function"); + return NULL; + } +} + +/* dummy type because decorators can't be PyCFunctions */ +static PyTypeObject BPyPersistent_Type = { + +#if defined(_MSC_VER) || defined(FREE_WINDOWS) + PyVarObject_HEAD_INIT(NULL, 0) +#else + PyVarObject_HEAD_INIT(&PyType_Type, 0) +#endif + + "persistent", /* tp_name */ + 0, /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | + Py_TPFLAGS_BASETYPE, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + bpy_app_handlers_persistent_new, /* tp_new */ + 0, /* tp_free */ +}; + static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {NULL}; static PyObject *make_app_cb_info(void) @@ -83,10 +177,13 @@ static PyObject *make_app_cb_info(void) } PyStructSequence_SET_ITEM(app_cb_info, pos, (py_cb_array[pos]= PyList_New(0))); } - if (app_cb_info_fields[pos].name != NULL) { + if (app_cb_info_fields[pos + APP_CB_OTHER_FIELDS].name != NULL) { Py_FatalError("invalid callback slots 2"); } + /* custom function */ + PyStructSequence_SET_ITEM(app_cb_info, pos++, (PyObject *)&BPyPersistent_Type); + return app_cb_info; } @@ -94,6 +191,14 @@ PyObject *BPY_app_handlers_struct(void) { PyObject *ret; +#if defined(_MSC_VER) || defined(FREE_WINDOWS) + BPyPersistent_Type.ob_base.ob_base.ob_type= &PyType_Type; +#endif + + if (PyType_Ready(&BPyPersistent_Type) < 0) { + BLI_assert(!"error initializing 'bpy.app.handlers.persistent'"); + } + PyStructSequence_InitType(&BlenderAppCbType, &app_cb_info_desc); ret= make_app_cb_info(); @@ -120,12 +225,46 @@ PyObject *BPY_app_handlers_struct(void) return ret; } -void BPY_app_handlers_reset(void) +void BPY_app_handlers_reset(const short do_all) { int pos= 0; + if (do_all) { for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) { - PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, NULL); + /* clear list */ + PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, NULL); + } + } + else { + /* save string conversion thrashing */ + PyObject *perm_id_str= PyUnicode_FromString(PERMINENT_CB_ID); + + for (pos= 0; pos < BLI_CB_EVT_TOT; pos++) { + /* clear only items without PERMINENT_CB_ID */ + PyObject *ls= py_cb_array[pos]; + Py_ssize_t i; + + PyObject *item; + PyObject **dict_ptr; + + for(i= PyList_GET_SIZE(ls) - 1; i >= 0; i--) { + + if ( (PyFunction_Check((item= PyList_GET_ITEM(ls, i)))) && + (dict_ptr= _PyObject_GetDictPtr(item)) && + (*dict_ptr) && + (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL)) + { + /* keep */ + } + else { + /* remove */ + /* PySequence_DelItem(ls, i); */ /* more obvious buw slower */ + PyList_SetSlice(ls, i, i + 1, NULL); + } + } + } + + Py_DECREF(perm_id_str); } } diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 6f23c1e604f..70a5d79e9ac 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -380,7 +380,7 @@ static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value) { wmOperatorType *ot; PointerRNA ptr; - char *opname= _PyUnicode_AsString(value); + const char *opname= _PyUnicode_AsString(value); BPy_StructRNA *pyrna= NULL; if (opname==NULL) { @@ -413,7 +413,7 @@ static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value) wmOperatorType *ot; wmOperator *op; PointerRNA ptr; - char *opname= _PyUnicode_AsString(value); + const char *opname= _PyUnicode_AsString(value); BPy_StructRNA *pyrna= NULL; if (opname==NULL) { diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 4b30b4705f4..b10223207bf 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -1211,7 +1211,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix if (!srna) { if (PyErr_Occurred()) { PyObject *msg= PyC_ExceptionBuffer(); - char *msg_char= _PyUnicode_AsString(msg); + const char *msg_char= _PyUnicode_AsString(msg); PyErr_Format(PyExc_TypeError, "%.200s expected an RNA type derived from PropertyGroup, failed with: %s", error_prefix, msg_char); diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m index 979dd1e3c60..279192e9692 100644 --- a/source/blender/quicktime/apple/qtkit_import.m +++ b/source/blender/quicktime/apple/qtkit_import.m @@ -31,7 +31,9 @@ #include "IMB_anim.h" #include "BLO_sys_types.h" #include "BKE_global.h" + #include "BLI_dynstr.h" +#include "BLI_path_util.h" #import <Cocoa/Cocoa.h> #import <QTKit/QTKit.h> diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index cbb2f17043c..fac3329bae0 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -249,6 +249,8 @@ float RE_filter_value(int type, float x); /* vector blur zbuffer method */ void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect); +int RE_seq_render_active(struct Scene *scene, struct RenderData *rd); + /* shaded view or baking options */ #define RE_BAKE_LIGHT 0 /* not listed in rna_scene.c -> can't be enabled! */ #define RE_BAKE_ALL 1 diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index ae4e55b9b88..7cad8c36df4 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -153,7 +153,9 @@ struct Render /* values for viewing */ float lens; + float sensor_x, sensor_y; /* image sensor size, same variable in camera */ float ycor; /* (scene->xasp / scene->yasp), multiplied with 'winy' */ + short sensor_fit; float panophi, panosi, panoco, panodxp, panodxv; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 5968a6e64f8..7ef726a5330 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -2391,7 +2391,7 @@ static void do_displacement(Render *re, ObjectRen *obr, float mat[][4], float im /* Object Size with parenting */ obt=obr->ob; while(obt){ - add_v3_v3v3(temp, obt->size, obt->dsize); + mul_v3_v3v3(temp, obt->size, obt->dsize); scale[0]*=temp[0]; scale[1]*=temp[1]; scale[2]*=temp[2]; obt=obt->parent; } diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index e285b9b1ed9..2f20c328405 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -157,6 +157,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env) /* view stuff in env render */ envre->lens= 16.0f; + envre->sensor_x= 32.0f; if(env->type==ENV_PLANE) envre->lens*= env->viewscale; envre->ycor= 1.0f; diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index da935d0415d..f8e4ee8f6a7 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -451,14 +451,14 @@ struct Object *RE_GetCamera(Render *re) } /* call this after InitState() */ -/* per render, there's one persistant viewplane. Parts will set their own viewplanes */ +/* per render, there's one persistent viewplane. Parts will set their own viewplanes */ void RE_SetCamera(Render *re, Object *camera) { object_camera_mode(&re->r, camera); object_camera_matrix(&re->r, camera, re->winx, re->winy, re->flag & R_SEC_FIELD, re->winmat, &re->viewplane, &re->clipsta, &re->clipend, - &re->lens, &re->ycor, &re->viewdx, &re->viewdy); + &re->lens, &re->sensor_x, &re->sensor_y, &re->sensor_fit, &re->ycor, &re->viewdx, &re->viewdy); } void RE_SetPixelSize(Render *re, float pixsize) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 8d72be1684c..de5d037675e 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2517,14 +2517,14 @@ static void renderresult_stampinfo(Render *re) RE_ReleaseResultImage(re); } -static int seq_render_active(Render *re) +int RE_seq_render_active(Scene *scene, RenderData *rd) { Editing *ed; Sequence *seq; - ed = re->scene->ed; + ed = scene->ed; - if (!(re->r.scemode & R_DOSEQ) || !ed || !ed->seqbase.first) + if (!(rd->scemode & R_DOSEQ) || !ed || !ed->seqbase.first) return 0; for (seq= ed->seqbase.first; seq; seq= seq->next) { @@ -2632,6 +2632,12 @@ static void do_render_seq(Render * re) /* just in case this flag went missing at some point */ re->r.scemode |= R_DOSEQ; + + /* set overall progress of sequence rendering */ + if(re->r.efra!=re->r.sfra) + re->progress(re->prh, (float)(cfra-re->r.sfra) / (re->r.efra-re->r.sfra)); + else + re->progress(re->prh, 1.0f); } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ @@ -2649,7 +2655,7 @@ static void do_render_all_options(Render *re) if(RE_engine_render(re, 1)) { /* in this case external render overrides all */ } - else if(seq_render_active(re)) { + else if(RE_seq_render_active(re->scene, &re->r)) { /* note: do_render_seq() frees rect32 when sequencer returns float images */ if(!re->test_break(re->tbh)) do_render_seq(re); diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index a4bf6c6b5e1..274fa4469e0 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -2156,7 +2156,7 @@ static int isb_add_samples(RenderPart *pa, ISBBranch *root, MemArena *memarena, int xi, yi, *xcos, *ycos; int sample, bsp_err= 0; - /* bsp split doesn't like to handle regular sequenes */ + /* bsp split doesn't like to handle regular sequences */ xcos= MEM_mallocN( pa->rectx*sizeof(int), "xcos"); ycos= MEM_mallocN( pa->recty*sizeof(int), "ycos"); for(xi=0; xi<pa->rectx; xi++) @@ -2301,7 +2301,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar) isb_bsp_fillfaces(&R, lar, &root); /* shb->persmat should have been calculated */ - /* copy shadow samples to persistant buffer, reduce memory overhead */ + /* copy shadow samples to persistent buffer, reduce memory overhead */ if(R.osa) { ISBShadfacA **isbsa= isbdata->shadfaca= MEM_callocN(pa->rectx*pa->recty*sizeof(void *), "isb shadfacs"); @@ -2360,7 +2360,7 @@ static int isb_add_samples_transp(RenderPart *pa, ISBBranch *root, MemArena *mem int xi, yi, *xcos, *ycos; int sample, bsp_err= 0; - /* bsp split doesn't like to handle regular sequenes */ + /* bsp split doesn't like to handle regular sequences */ xcos= MEM_mallocN( pa->rectx*sizeof(int), "xcos"); ycos= MEM_mallocN( pa->recty*sizeof(int), "ycos"); for(xi=0; xi<pa->rectx; xi++) @@ -2505,7 +2505,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la /* go over all faces and fill in shadow values */ isb_bsp_fillfaces(&R, lar, &root); /* shb->persmat should have been calculated */ - /* copy shadow samples to persistant buffer, reduce memory overhead */ + /* copy shadow samples to persistent buffer, reduce memory overhead */ isbsa= isbdata->shadfaca= MEM_callocN(pa->rectx*pa->recty*sizeof(void *), "isb shadfacs"); isbdata->memarena = BLI_memarena_new(0x8000 * sizeof(ISBSampleA), "isb arena"); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 2bd3ed34b69..83e4681251f 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -359,7 +359,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE); /* first try to append data from exotic file formats... */ - /* it throws error box when file doesnt exist and returns -1 */ + /* it throws error box when file doesn't exist and returns -1 */ /* note; it should set some error message somewhere... (ton) */ retval= wm_read_exotic(CTX_data_scene(C), filepath); @@ -368,7 +368,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) int G_f= G.f; ListBase wmbase; - /* put aside screens to match with persistant windows later */ + /* put aside screens to match with persistent windows later */ /* also exit screens and editors */ wm_window_match_init(C, &wmbase); @@ -408,7 +408,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) #ifdef WITH_PYTHON /* run any texts that were loaded in and flagged as modules */ BPY_driver_reset(); - BPY_app_handlers_reset(); + BPY_app_handlers_reset(FALSE); BPY_modules_load_user(C); #endif @@ -480,7 +480,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory /* prevent loading no UI */ G.fileflags &= ~G_FILE_NO_UI; - /* put aside screens to match with persistant windows later */ + /* put aside screens to match with persistent windows later */ wm_window_match_init(C, &wmbase); if (!from_memory && BLI_exists(tstr)) { @@ -538,7 +538,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory BPY_string_exec(C, "__import__('addon_utils').reset_all()"); BPY_driver_reset(); - BPY_app_handlers_reset(); + BPY_app_handlers_reset(FALSE); BPY_modules_load_user(C); } #endif @@ -576,7 +576,7 @@ void WM_read_history(void) G.recent_files.first = G.recent_files.last = NULL; - /* read list of recent opend files from recent-files.txt to memory */ + /* read list of recent opened files from recent-files.txt to memory */ for (l= lines, num= 0; l && (num<U.recent_files); l= l->next) { line = l->link; if (line[0] && BLI_exists(line)) { diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index b0be4bb9720..0795bc8deee 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -61,8 +61,9 @@ #include "BKE_sequencer.h" /* free seq clipboard */ #include "BKE_material.h" /* clear_matcopybuf */ -#include "BLI_blenlib.h" -#include "BLI_winstuff.h" +#include "BLI_listbase.h" +#include "BLI_string.h" +#include "BLI_utildefines.h" #include "RE_engine.h" #include "RE_pipeline.h" /* RE_ free stuff */ @@ -158,7 +159,7 @@ void WM_init(bContext *C, int argc, const char **argv) BPY_python_start(argc, argv); BPY_driver_reset(); - BPY_app_handlers_reset(); /* causes addon callbacks to be freed [#28068], + BPY_app_handlers_reset(FALSE); /* causes addon callbacks to be freed [#28068], * but this is actually what we want. */ BPY_modules_load_user(C); #else @@ -211,24 +212,6 @@ void WM_init_splash(bContext *C) } } -static ScrArea *biggest_view3d(bContext *C) -{ - bScreen *sc= CTX_wm_screen(C); - ScrArea *sa, *big= NULL; - int size, maxsize= 0; - - for(sa= sc->areabase.first; sa; sa= sa->next) { - if(sa->spacetype==SPACE_VIEW3D) { - size= sa->winx * sa->winy; - if(size > maxsize) { - maxsize= size; - big= sa; - } - } - } - return big; -} - int WM_init_game(bContext *C) { wmWindowManager *wm= CTX_wm_manager(C); @@ -251,7 +234,7 @@ int WM_init_game(bContext *C) if(win) CTX_wm_window_set(C, win); - sa = biggest_view3d(C); + sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0); ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); // if we have a valid 3D view diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index acd5df79982..933066513e2 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3450,6 +3450,28 @@ static void WM_OT_memory_statistics(wmOperatorType *ot) ot->exec= memory_statistics_exec; } +/* ************************** memory statistics for testing ***************** */ + +static int dependency_relations_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); + Object *ob= CTX_data_active_object(C); + + DAG_print_dependencies(bmain, scene, ob); + + return OPERATOR_FINISHED; +} + +static void WM_OT_dependency_relations(wmOperatorType *ot) +{ + ot->name= "Dependency Relations"; + ot->idname= "WM_OT_dependency_relations"; + ot->description= "Print dependency graph relations to the console"; + + ot->exec= dependency_relations_exec; +} + /* ******************************************************* */ static int wm_ndof_sensitivity_exec(bContext *UNUSED(C), wmOperator *op) @@ -3532,6 +3554,7 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_save_mainfile); WM_operatortype_append(WM_OT_redraw_timer); WM_operatortype_append(WM_OT_memory_statistics); + WM_operatortype_append(WM_OT_dependency_relations); WM_operatortype_append(WM_OT_debug_menu); WM_operatortype_append(WM_OT_splash); WM_operatortype_append(WM_OT_search_menu); diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 80a49ed5ff5..a478affe518 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -394,7 +394,7 @@ void RE_engines_exit() {} void RE_engine_report(struct RenderEngine *engine, int type, const char *msg) {} ListBase R_engines = {NULL, NULL}; void RE_engine_free(struct RenderEngine *engine) {} -struct RenderEngineType *RE_engines_find(const char *idname) {} +struct RenderEngineType *RE_engines_find(const char *idname) { return NULL; } /* python */ struct wmOperatorType *WM_operatortype_find(const char *idname, int quiet){return (struct wmOperatorType *) NULL;} diff --git a/source/creator/creator.c b/source/creator/creator.c index 1d083af7d07..2204ab85a2e 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -971,7 +971,7 @@ static int load_file(int UNUSED(argc), const char **argv, void *data) #ifdef WITH_PYTHON /* run any texts that were loaded in and flagged as modules */ BPY_driver_reset(); - BPY_app_handlers_reset(); + BPY_app_handlers_reset(FALSE); BPY_modules_load_user(C); #endif diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 6f2ca28c135..a6d02db8cea 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -344,8 +344,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame) /* Python functions */ /* ------------------------------------------------------------------------- */ -PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) { - char *string= _PyUnicode_AsString(value); +PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) +{ + const char *string= _PyUnicode_AsString(value); if (!string) { PyErr_SetString(PyExc_TypeError, "expected a single string"); diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 77bd6e0f374..779d794cc10 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1579,7 +1579,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, my_get_local_bounds(blenderobject,dm,objprop.m_boundobject.box.m_center,bb.m_extends); if (blenderobject->gameflag & OB_BOUNDS) { - switch (blenderobject->boundtype) + switch (blenderobject->collision_boundtype) { case OB_BOUND_BOX: objprop.m_boundclass = KX_BOUNDBOX; @@ -1724,7 +1724,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l static KX_Camera *gamecamera_from_bcamera(Object *ob, KX_Scene *kxscene, KX_BlenderSceneConverter *converter) { Camera* ca = static_cast<Camera*>(ob->data); - RAS_CameraData camdata(ca->lens, ca->ortho_scale, ca->clipsta, ca->clipend, ca->type == CAM_PERSP, ca->YF_dofdist); + RAS_CameraData camdata(ca->lens, ca->ortho_scale, ca->sensor_x, ca->sensor_y, ca->sensor_fit, ca->clipsta, ca->clipend, ca->type == CAM_PERSP, ca->YF_dofdist); KX_Camera *gamecamera; gamecamera= new KX_Camera(kxscene, KX_Scene::m_callbacks, camdata); diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index ade54f6d924..cdd87235fd2 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -339,10 +339,9 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex) int index = PyLong_AsSsize_t(pyindex); return listvalue_buffer_item(self, index); /* wont add a ref */ } - - PyObject *pyindex_str = PyObject_Repr(pyindex); /* new ref */ - PyErr_Format(PyExc_KeyError, "CList[key]: '%s' key not in list", _PyUnicode_AsString(pyindex_str)); - Py_DECREF(pyindex_str); + + PyErr_Format(PyExc_KeyError, + "CList[key]: '%R' key not in list", pyindex); return NULL; } diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index 33aa6b8d177..87f776a726e 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -1012,8 +1012,8 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt { if (PyUnicode_Check(value)) { - Py_ssize_t val_len; - char *val = _PyUnicode_AsStringAndSize(value, &val_len); + Py_ssize_t val_size; + const char *val = _PyUnicode_AsStringAndSize(value, &val_size); strncpy(ptr, val, attrdef->m_size); ptr[attrdef->m_size-1] = 0; } @@ -1030,7 +1030,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt if (PyUnicode_Check(value)) { Py_ssize_t val_len; - char *val = _PyUnicode_AsStringAndSize(value, &val_len); + const char *val = _PyUnicode_AsStringAndSize(value, &val_len); /* XXX, should be 'const' but we do a silly trick to have a shorter string */ if (attrdef->m_clamp) { if (val_len < attrdef->m_imin) @@ -1042,10 +1042,8 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt else if (val_len > attrdef->m_imax) { // trim the string - char c = val[attrdef->m_imax]; - val[attrdef->m_imax] = 0; - *var = val; - val[attrdef->m_imax] = c; + var->SetLength(attrdef->m_imax); + memcpy(var->Ptr(), val, attrdef->m_imax - 1); break; } } else if (val_len < attrdef->m_imin || val_len > attrdef->m_imax) diff --git a/source/gameengine/Expressions/StringValue.h b/source/gameengine/Expressions/StringValue.h index d0f74a6eed8..e5a892ff82d 100644 --- a/source/gameengine/Expressions/StringValue.h +++ b/source/gameengine/Expressions/StringValue.h @@ -31,8 +31,7 @@ public: CStringValue(); CStringValue (const char *txt, const char *name , AllocationTYPE alloctype = CValue::HEAPVALUE); - virtual ~CStringValue() { - }; + virtual ~CStringValue() {} /// CValue implementation virtual bool IsEqual(const STR_String & other); virtual const STR_String & GetText(); @@ -40,7 +39,7 @@ public: virtual CValue* Calc(VALUE_OPERATOR op, CValue *val); virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - virtual void SetValue(CValue* newval) { m_strString = newval->GetText(); SetModified(true); }; + virtual void SetValue(CValue* newval) { m_strString = newval->GetText(); SetModified(true); } virtual CValue* GetReplica(); #ifdef WITH_PYTHON virtual PyObject* ConvertValueToPython() { diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 303b3e9529e..d69358928e6 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -199,7 +199,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value) if (PyUnicode_Check(value)) { /* get the actuator from the name */ - char *name= _PyUnicode_AsString(value); + const char *name= _PyUnicode_AsString(value); for(it = lacts.begin(); it!= lacts.end(); ++it) { if( name == (*it)->GetName() ) { return *it; @@ -214,12 +214,11 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value) } } } - + /* set the exception */ - PyObject *value_str = PyObject_Repr(value); /* new ref */ - PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str)); - Py_DECREF(value_str); - + PyErr_Format(PyExc_ValueError, + "%R not in this python controllers actuator list", value); + return NULL; } @@ -500,7 +499,7 @@ int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_D { SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v); - char *scriptArg = _PyUnicode_AsString(value); + const char *scriptArg = _PyUnicode_AsString(value); if (scriptArg==NULL) { PyErr_SetString(PyExc_TypeError, "controller.script = string: Python Controller, expected a string script text"); diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 3b777031831..14a307794db 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -200,7 +200,26 @@ float KX_Camera::GetScale() const return m_camdata.m_scale; } +/* +* Gets the horizontal size of the sensor - for camera matching. +*/ +float KX_Camera::GetSensorWidth() const +{ + return m_camdata.m_sensor_x; +} +/* +* Gets the vertical size of the sensor - for camera matching. +*/ +float KX_Camera::GetSensorHeight() const +{ + return m_camdata.m_sensor_y; +} +/** Gets the mode FOV is calculating from sensor dimensions */ +short KX_Camera::GetSensorFit() const +{ + return m_camdata.m_sensor_fit; +} float KX_Camera::GetCameraNear() const { @@ -883,7 +902,9 @@ bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok if (*object) { return true; } else { - PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_Camera in this scene", error_prefix, _PyUnicode_AsString(value)); + PyErr_Format(PyExc_ValueError, + "%s, requested name \"%s\" did not match any KX_Camera in this scene", + error_prefix, _PyUnicode_AsString(value)); return false; } } diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h index 4c8cf21a7bf..236e914b9e5 100644 --- a/source/gameengine/Ketsji/KX_Camera.h +++ b/source/gameengine/Ketsji/KX_Camera.h @@ -199,6 +199,12 @@ public: float GetLens() const; /** Gets the ortho scale. */ float GetScale() const; + /** Gets the horizontal size of the sensor - for camera matching */ + float GetSensorWidth() const; + /** Gets the vertical size of the sensor - for camera matching */ + float GetSensorHeight() const; + /** Gets the mode FOV is calculating from sensor dimensions */ + short GetSensorFit() const; /** Gets the near clip distance. */ float GetCameraNear() const; /** Gets the far clip distance. */ diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 5de6adc5af4..a9be588e6b2 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1251,6 +1251,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) cam->GetScale(), nearfrust, farfrust, + cam->GetSensorFit(), frustum ); if (!cam->GetViewport()) { @@ -1268,6 +1269,9 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) area, viewport, cam->GetLens(), + cam->GetSensorWidth(), + cam->GetSensorHeight(), + cam->GetSensorFit(), nearfrust, farfrust, frustum diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 25145e87b78..02e6ebea71b 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -705,7 +705,7 @@ static PyObject *gLibNew(PyObject*, PyObject* args) KX_Scene *kx_scene= gp_KetsjiScene; char *path; char *group; - char *name; + const char *name; PyObject *names; int idcode; @@ -815,7 +815,7 @@ static struct PyMethodDef game_methods[] = { {"getAverageFrameRate", (PyCFunction) gPyGetAverageFrameRate, METH_NOARGS, (const char *)"Gets the estimated average frame rate"}, {"getBlendFileList", (PyCFunction)gPyGetBlendFileList, METH_VARARGS, (const char *)"Gets a list of blend files in the same directory as the current blend file"}, {"PrintGLInfo", (PyCFunction)pyPrintExt, METH_NOARGS, (const char *)"Prints GL Extension Info"}, - {"PrintMemInfo", (PyCFunction)pyPrintStats, METH_NOARGS, (const char *)"Print engine stastics"}, + {"PrintMemInfo", (PyCFunction)pyPrintStats, METH_NOARGS, (const char *)"Print engine statistics"}, /* library functions */ {"LibLoad", (PyCFunction)gLibLoad, METH_VARARGS|METH_KEYWORDS, (const char *)""}, diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index 7d7dc39ba32..430dcdbd153 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -189,7 +189,7 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index) return NULL; } -static PyObjectPlus * KX_PythonSeq_subscript__internal(PyObject *self, char *key) +static PyObjectPlus * KX_PythonSeq_subscript__internal(PyObject *self, const char *key) { PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); @@ -277,7 +277,7 @@ static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key) return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t( key )); } else if ( PyUnicode_Check(key) ) { - char *name = _PyUnicode_AsString(key); + const char *name = _PyUnicode_AsString(key); PyObjectPlus *ret = KX_PythonSeq_subscript__internal(self, name); if(ret) { diff --git a/source/gameengine/Ketsji/KX_PythonSeq.h b/source/gameengine/Ketsji/KX_PythonSeq.h index 6e9cf9a36aa..1c2d2869be0 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.h +++ b/source/gameengine/Ketsji/KX_PythonSeq.h @@ -51,8 +51,8 @@ enum KX_PYGENSEQ_TYPE { /* The Main PyType Object defined in Main.c */ extern PyTypeObject KX_PythonSeq_Type; -#define BPy_KX_PythonSeq_Check(v) \ - ((v)->ob_type == &KX_PythonSeq_Type) +#define BPy_KX_PythonSeq_Check(obj) \ + (Py_TYPE(obj) == &KX_PythonSeq_Type) typedef struct { PyObject_VAR_HEAD diff --git a/source/gameengine/Rasterizer/RAS_CameraData.h b/source/gameengine/Rasterizer/RAS_CameraData.h index 2056068a2ad..2120a18f139 100644 --- a/source/gameengine/Rasterizer/RAS_CameraData.h +++ b/source/gameengine/Rasterizer/RAS_CameraData.h @@ -36,6 +36,9 @@ struct RAS_CameraData { float m_lens; float m_scale; + float m_sensor_x; + float m_sensor_y; + short m_sensor_fit; float m_clipstart; float m_clipend; bool m_perspective; @@ -46,11 +49,15 @@ struct RAS_CameraData int m_viewporttop; float m_focallength; - RAS_CameraData(float lens = 35.0, float scale = 6.0, float clipstart = 0.1, float clipend = 5000.0, bool perspective = true, + RAS_CameraData(float lens = 35.0, float scale = 6.0, float sensor_x = 32.0, float sensor_y = 18.0, short sensor_fit = 0, + float clipstart = 0.1, float clipend = 5000.0, bool perspective = true, float focallength = 3.0, bool viewport = false, int viewportleft = 0, int viewportbottom = 0, int viewportright = 0, int viewporttop = 0) : m_lens(lens), m_scale(scale), + m_sensor_x(sensor_x), + m_sensor_y(sensor_y), + m_sensor_fit(sensor_fit), m_clipstart(clipstart), m_clipend(clipend), m_perspective(perspective), diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp index da6c230ffc1..8a5c10b3a3b 100644 --- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp +++ b/source/gameengine/Rasterizer/RAS_FramingManager.cpp @@ -39,25 +39,35 @@ ComputeDefaultFrustum( const float camnear, const float camfar, const float lens, + const float sensor_x, const float sensor_y, + const short sensor_fit, const float design_aspect_ratio, RAS_FrameFrustum & frustum -){ - - /* - * Magic Blender calculation. - * Blender does not give a Field of View as lens but a size - * at 16 units away from the lens. - */ - float halfSize = 16.f * camnear / lens; +){ + float halfSize; float sizeX; float sizeY; - if (design_aspect_ratio > 1.f) { - // halfsize defines the width + if(sensor_fit==RAS_SENSORFIT_AUTO) { + halfSize = (sensor_x / 2.f) * camnear / lens; + + if (design_aspect_ratio > 1.f) { + // halfsize defines the width + sizeX = halfSize; + sizeY = halfSize/design_aspect_ratio; + } else { + // halfsize defines the height + sizeX = halfSize * design_aspect_ratio; + sizeY = halfSize; + } + } + else if(sensor_fit==RAS_SENSORFIT_HOR) { + halfSize = (sensor_x / 2.f) * camnear / lens; sizeX = halfSize; sizeY = halfSize/design_aspect_ratio; - } else { - // halfsize defines the height + } + else { + halfSize = (sensor_y / 2.f) * camnear / lens; sizeX = halfSize * design_aspect_ratio; sizeY = halfSize; } @@ -77,6 +87,7 @@ ComputeDefaultOrtho( const float camfar, const float scale, const float design_aspect_ratio, + const short sensor_fit, RAS_FrameFrustum & frustum ) { @@ -84,12 +95,22 @@ ComputeDefaultOrtho( float sizeX; float sizeY; - if (design_aspect_ratio > 1.f) { - // halfsize defines the width + if(sensor_fit==RAS_SENSORFIT_AUTO) { + if (design_aspect_ratio > 1.f) { + // halfsize defines the width + sizeX = halfSize; + sizeY = halfSize/design_aspect_ratio; + } else { + // halfsize defines the height + sizeX = halfSize * design_aspect_ratio; + sizeY = halfSize; + } + } + else if(sensor_fit==RAS_SENSORFIT_HOR) { sizeX = halfSize; sizeY = halfSize/design_aspect_ratio; - } else { - // halfsize defines the height + } + else { sizeX = halfSize * design_aspect_ratio; sizeY = halfSize; } @@ -199,6 +220,7 @@ ComputeFrustum( const RAS_Rect &availableViewport, const RAS_Rect &viewport, const float lens, + const float sensor_x, const float sensor_y, const short sensor_fit, const float camnear, const float camfar, RAS_FrameFrustum &frustum @@ -224,6 +246,9 @@ ComputeFrustum( camnear, camfar, lens, + sensor_x, + sensor_y, + sensor_fit, design_aspect_ratio, frustum ); @@ -269,6 +294,7 @@ RAS_FramingManager:: const float scale, const float camnear, const float camfar, + const short sensor_fit, RAS_FrameFrustum &frustum ) { @@ -293,6 +319,7 @@ RAS_FramingManager:: camfar, scale, design_aspect_ratio, + sensor_fit, frustum ); diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.h b/source/gameengine/Rasterizer/RAS_FramingManager.h index 38ea8f4e07a..612142234e3 100644 --- a/source/gameengine/Rasterizer/RAS_FramingManager.h +++ b/source/gameengine/Rasterizer/RAS_FramingManager.h @@ -184,6 +184,14 @@ enum RAS_CullingMode RAS_CULLING_NONE }; +/* Should match CAMERA_SENSOR_FIT... from DNA_camera_types.h */ +enum RAS_SensorFit +{ + RAS_SENSORFIT_AUTO = 0, + RAS_SENSORFIT_HOR, + RAS_SENSORFIT_VERT +}; + /** * @section RAS_FramingManager * This class helps to compute a view frustum @@ -229,6 +237,7 @@ public : const float scale, const float camnear, const float camfar, + const short sensor_fit, RAS_FrameFrustum &frustum ); @@ -239,6 +248,7 @@ public : const RAS_Rect &availableViewport, const RAS_Rect &viewport, const float lens, + const float sensor_x, const float sensor_y, const short sensor_fit, const float camnear, const float camfar, RAS_FrameFrustum &frustum @@ -250,6 +260,8 @@ public : const float camnear, const float camfar, const float lens, + const float sensor_x, const float sensor_y, + const short sensor_fit, const float design_aspect_ratio, RAS_FrameFrustum & frustum ); @@ -261,6 +273,7 @@ public : const float camfar, const float scale, const float design_aspect_ratio, + const short sensor_fit, RAS_FrameFrustum & frustum ); diff --git a/source/gameengine/VideoTexture/BlendType.h b/source/gameengine/VideoTexture/BlendType.h index 4d63031a363..fad23af922e 100644 --- a/source/gameengine/VideoTexture/BlendType.h +++ b/source/gameengine/VideoTexture/BlendType.h @@ -43,15 +43,15 @@ public: if (m_objType == NULL) { // compare names of type - if (strcmp(obj->ob_type->tp_name, m_name) == 0) + if (strcmp(Py_TYPE(obj)->tp_name, m_name) == 0) // if name of type match, save pointer to type - m_objType = obj->ob_type; + m_objType = Py_TYPE(obj); else // if names of type don't match, return NULL return NULL; } // if pointer to type is set and don't match to type of provided object, return NULL - else if (obj->ob_type != m_objType) + else if (Py_TYPE(obj) != m_objType) return NULL; // return pointer to object, this class can only be used for KX object => // the Py object is actually a proxy diff --git a/source/gameengine/VideoTexture/FilterBase.cpp b/source/gameengine/VideoTexture/FilterBase.cpp index 28e36cf80e0..6fa249ff00a 100644 --- a/source/gameengine/VideoTexture/FilterBase.cpp +++ b/source/gameengine/VideoTexture/FilterBase.cpp @@ -141,7 +141,7 @@ int Filter_setPrevious (PyFilter * self, PyObject * value, void * closure) if (self->m_filter != NULL) { // check new value - if (value == NULL || !pyFilterTypes.in(value->ob_type)) + if (value == NULL || !pyFilterTypes.in(Py_TYPE(value))) { // report value error PyErr_SetString(PyExc_TypeError, "Invalid type of value"); diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp index 0fe71dd8024..b1d77d8807f 100644 --- a/source/gameengine/VideoTexture/ImageBase.cpp +++ b/source/gameengine/VideoTexture/ImageBase.cpp @@ -567,7 +567,7 @@ PyObject * Image_setSource (PyImage * self, PyObject * args) if (self->m_image != NULL) { // check type of object - if (pyImageTypes.in(obj->ob_type)) + if (pyImageTypes.in(Py_TYPE(obj))) { // convert to image struct PyImage * img = reinterpret_cast<PyImage*>(obj); @@ -619,7 +619,7 @@ int Image_setFilter (PyImage * self, PyObject * value, void * closure) if (self->m_image != NULL) { // check new value - if (value == NULL || !pyFilterTypes.in(value->ob_type)) + if (value == NULL || !pyFilterTypes.in(Py_TYPE(value))) { // report value error PyErr_SetString(PyExc_TypeError, "Invalid type of value"); diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index 912d5864560..a349b45e403 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -214,6 +214,8 @@ void ImageRender::Render() } else { float lens = m_camera->GetLens(); + float sensor_x = m_camera->GetSensorWidth(); + float sensor_y = m_camera->GetSensorHeight(); bool orthographic = !m_camera->GetCameraData()->m_perspective; float nearfrust = m_camera->GetCameraNear(); float farfrust = m_camera->GetCameraFar(); @@ -233,6 +235,7 @@ void ImageRender::Render() farfrust, m_camera->GetScale(), aspect_ratio, + m_camera->GetSensorFit(), frustrum ); @@ -244,6 +247,9 @@ void ImageRender::Render() nearfrust, farfrust, lens, + sensor_x, + sensor_y, + RAS_SENSORFIT_AUTO, aspect_ratio, frustrum); diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp index ba9922d455f..e1ddd7fce1e 100644 --- a/source/gameengine/VideoTexture/Texture.cpp +++ b/source/gameengine/VideoTexture/Texture.cpp @@ -171,7 +171,7 @@ void Texture_dealloc (Texture * self) // release scaled image buffer delete [] self->m_scaledImg; // release object - ((PyObject *)self)->ob_type->tp_free((PyObject*)self); + Py_TYPE((PyObject *)self)->tp_free((PyObject*)self); } @@ -410,7 +410,7 @@ PyObject * Texture_getSource (Texture * self, PyObject * value, void * closure) int Texture_setSource (Texture * self, PyObject * value, void * closure) { // check new value - if (value == NULL || !pyImageTypes.in(value->ob_type)) + if (value == NULL || !pyImageTypes.in(Py_TYPE(value))) { // report value error PyErr_SetString(PyExc_TypeError, "Invalid type of value"); diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp index c93fadada77..abfd0ed49b7 100644 --- a/source/gameengine/VideoTexture/blendVideoTex.cpp +++ b/source/gameengine/VideoTexture/blendVideoTex.cpp @@ -91,7 +91,7 @@ static PyObject * imageToArray (PyObject * self, PyObject *args) // parameter is Image object PyObject * pyImg; char *mode = NULL; - if (!PyArg_ParseTuple(args, "O|s:imageToArray", &pyImg, &mode) || !pyImageTypes.in(pyImg->ob_type)) + if (!PyArg_ParseTuple(args, "O|s:imageToArray", &pyImg, &mode) || !pyImageTypes.in(Py_TYPE(pyImg))) { // if object is incorect, report error PyErr_SetString(PyExc_TypeError, "VideoTexture.imageToArray(image): The value must be a image source object"); |