diff options
76 files changed, 1185 insertions, 949 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 926d5b2cf0c..c88db32f1ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,8 +214,10 @@ endif() option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON) # Cycles -option(WITH_CYCLES "Enable Cycles Render Engine" OFF) -OPTION(WITH_CYCLES_TEST "Build cycles test application" OFF) +option(WITH_CYCLES "Enable cycles Render Engine" OFF) +option(WITH_CYCLES_TEST "Build cycles test application" OFF) +option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF) +set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build binaries for") # disable for now, but plan to support on all platforms eventually option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF) diff --git a/SConstruct b/SConstruct index 5bc76c57091..161bbbc0378 100644 --- a/SConstruct +++ b/SConstruct @@ -162,7 +162,7 @@ if cxx: if sys.platform=='win32': if env['CC'] in ['cl', 'cl.exe']: - platform = 'win64-vc' if bitness == 64 else 'win32-vc' + platform = 'win64-vc' if bitness == 64 else 'win32-vc' elif env['CC'] in ['gcc']: platform = 'win32-mingw' diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py index 9e2352c51fc..1ac1db62a28 100644 --- a/build_files/scons/config/linux-config.py +++ b/build_files/scons/config/linux-config.py @@ -180,6 +180,18 @@ BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a' WITH_BF_CYCLES = False +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 = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt' +BF_BOOST_LIBPATH = BF_BOOST + '/lib' + WITH_BF_OPENMP = True #Ray trace optimization diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index 7de1649fd62..417bbcc48ba 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -156,7 +156,7 @@ def validate_arguments(args, bc): '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', - 'WITH_BF_CYCLES', + 'WITH_BF_CYCLES', 'WITH_BF_CYCLES_BINARIES' 'BF_CYCLES_BINARIES_ARCH', 'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH', 'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH' ] diff --git a/build_files/scons/tools/mstoolkit.py b/build_files/scons/tools/mstoolkit.py index 4eeefa5ed9d..68e8c4b6475 100644 --- a/build_files/scons/tools/mstoolkit.py +++ b/build_files/scons/tools/mstoolkit.py @@ -49,198 +49,198 @@ CSuffixes = ['.c', '.C'] CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] def get_msvctoolkit_paths(): - """Return a 4-tuple of (INCLUDE, LIB, PATH, TOOLKIT) as the values of those - three environment variables that should be set in order to execute - the MSVC .NET tools properly, if the information wasn't available - from the registry.""" - - MSToolkitDir = None - paths = {} - exe_path = '' - lib_path = '' - include_path = '' - - # First, we get the shell folder for this user: - if not SCons.Util.can_read_reg: - raise SCons.Errors.InternalError, "No Windows registry module was found" - - # look for toolkit - if os.environ.has_key('VCToolkitInstallDir'): - MSToolkitDir = os.path.normpath(os.environ['VCToolkitInstallDir']) - else: - # last resort -- default install location - MSToolkitDir = r'C:\Program Files\Microsoft Visual C++ Toolkit 2003' - - # look for platform sdk - if os.environ.has_key('MSSdk'): - PlatformSDKDir = os.path.normpath(os.environ['MSSdk']) - else: - try: - PlatformSDKDir = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MicrosoftSDK\Directories\Install Dir')[0] - PlatformSDKDir = str(PlatformSDKDir) - except SCons.Util.RegError: - raise SCons.Errors.InternalError, "The Platform SDK directory was not found in the registry or in the `MSSdk` environment variable." - - # look for DX Sdk (expecting DX9) - # dxsdk docs have a directory key, look for it, extract path - #dxsdkdocs = "" - DXsdkDir = "" - #try: - # dxsdkdocs = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\DirectX SDK\DX9SDK Doc Path') - #except SCons.Util.RegError: - # raise SCons.Errors.InternalError, "The DXSDK directory was not found in the registry." - if os.environ.has_key('DXSDK_DIR'): - DXsdkDir = os.path.normpath(os.environ['DXSDK_DIR']) - - #DXsdkDir = os.path.split(dxsdkdocs[0])[0] - DXsdkDir = os.path.split(DXsdkDir)[0] - - include_path = r'%s\include;%s\include;%s\include' % (MSToolkitDir, PlatformSDKDir, DXsdkDir) - lib_path = r'%s\lib;%s\lib;%s\lib' % (MSToolkitDir, PlatformSDKDir, DXsdkDir) - exe_path = r'%s\bin;%s\bin\win95;%s\bin' % (MSToolkitDir, PlatformSDKDir, PlatformSDKDir) - return (include_path, lib_path, exe_path, PlatformSDKDir) + """Return a 4-tuple of (INCLUDE, LIB, PATH, TOOLKIT) as the values of those + three environment variables that should be set in order to execute + the MSVC .NET tools properly, if the information wasn't available + from the registry.""" + + MSToolkitDir = None + paths = {} + exe_path = '' + lib_path = '' + include_path = '' + + # First, we get the shell folder for this user: + if not SCons.Util.can_read_reg: + raise SCons.Errors.InternalError, "No Windows registry module was found" + + # look for toolkit + if os.environ.has_key('VCToolkitInstallDir'): + MSToolkitDir = os.path.normpath(os.environ['VCToolkitInstallDir']) + else: + # last resort -- default install location + MSToolkitDir = r'C:\Program Files\Microsoft Visual C++ Toolkit 2003' + + # look for platform sdk + if os.environ.has_key('MSSdk'): + PlatformSDKDir = os.path.normpath(os.environ['MSSdk']) + else: + try: + PlatformSDKDir = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MicrosoftSDK\Directories\Install Dir')[0] + PlatformSDKDir = str(PlatformSDKDir) + except SCons.Util.RegError: + raise SCons.Errors.InternalError, "The Platform SDK directory was not found in the registry or in the `MSSdk` environment variable." + + # look for DX Sdk (expecting DX9) + # dxsdk docs have a directory key, look for it, extract path + #dxsdkdocs = "" + DXsdkDir = "" + #try: + # dxsdkdocs = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\DirectX SDK\DX9SDK Doc Path') + #except SCons.Util.RegError: + # raise SCons.Errors.InternalError, "The DXSDK directory was not found in the registry." + if os.environ.has_key('DXSDK_DIR'): + DXsdkDir = os.path.normpath(os.environ['DXSDK_DIR']) + + #DXsdkDir = os.path.split(dxsdkdocs[0])[0] + DXsdkDir = os.path.split(DXsdkDir)[0] + + include_path = r'%s\include;%s\include;%s\include' % (MSToolkitDir, PlatformSDKDir, DXsdkDir) + lib_path = r'%s\lib;%s\lib;%s\lib' % (MSToolkitDir, PlatformSDKDir, DXsdkDir) + exe_path = r'%s\bin;%s\bin\win95;%s\bin' % (MSToolkitDir, PlatformSDKDir, PlatformSDKDir) + return (include_path, lib_path, exe_path, PlatformSDKDir) def validate_vars(env): - """Validate the PDB, PCH, and PCHSTOP construction variables.""" - if env.has_key('PCH') and env['PCH']: - if not env.has_key('PCHSTOP'): - raise SCons.Errors.UserError, "The PCHSTOP construction must be defined if PCH is defined." - if not SCons.Util.is_String(env['PCHSTOP']): - raise SCons.Errors.UserError, "The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP'] + """Validate the PDB, PCH, and PCHSTOP construction variables.""" + if env.has_key('PCH') and env['PCH']: + if not env.has_key('PCHSTOP'): + raise SCons.Errors.UserError, "The PCHSTOP construction must be defined if PCH is defined." + if not SCons.Util.is_String(env['PCHSTOP']): + raise SCons.Errors.UserError, "The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP'] def pch_emitter(target, source, env): - """Sets up the PDB dependencies for a pch file, and adds the object - file target.""" + """Sets up the PDB dependencies for a pch file, and adds the object + file target.""" - validate_vars(env) + validate_vars(env) - pch = None - obj = None + pch = None + obj = None - for t in target: - if SCons.Util.splitext(str(t))[1] == '.pch': - pch = t - if SCons.Util.splitext(str(t))[1] == '.obj': - obj = t + for t in target: + if SCons.Util.splitext(str(t))[1] == '.pch': + pch = t + if SCons.Util.splitext(str(t))[1] == '.obj': + obj = t - if not obj: - obj = SCons.Util.splitext(str(pch))[0]+'.obj' + if not obj: + obj = SCons.Util.splitext(str(pch))[0]+'.obj' - target = [pch, obj] # pch must be first, and obj second for the PCHCOM to work + target = [pch, obj] # pch must be first, and obj second for the PCHCOM to work - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) + if env.has_key('PDB') and env['PDB']: + env.SideEffect(env['PDB'], target) + env.Precious(env['PDB']) - return (target, source) + return (target, source) def object_emitter(target, source, env, parent_emitter): - """Sets up the PDB and PCH dependencies for an object file.""" + """Sets up the PDB and PCH dependencies for an object file.""" - validate_vars(env) + validate_vars(env) - parent_emitter(target, source, env) + parent_emitter(target, source, env) - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) + if env.has_key('PDB') and env['PDB']: + env.SideEffect(env['PDB'], target) + env.Precious(env['PDB']) - if env.has_key('PCH') and env['PCH']: - env.Depends(target, env['PCH']) + if env.has_key('PCH') and env['PCH']: + env.Depends(target, env['PCH']) - return (target, source) + return (target, source) def static_object_emitter(target, source, env): - return object_emitter(target, source, env, - SCons.Defaults.StaticObjectEmitter) + return object_emitter(target, source, env, + SCons.Defaults.StaticObjectEmitter) def shared_object_emitter(target, source, env): - return object_emitter(target, source, env, - SCons.Defaults.SharedObjectEmitter) + return object_emitter(target, source, env, + SCons.Defaults.SharedObjectEmitter) pch_builder = SCons.Builder.Builder(action='$PCHCOM', suffix='.pch', emitter=pch_emitter) res_builder = SCons.Builder.Builder(action='$RCCOM', suffix='.res') def pdbGenerator(env, target, source, for_signature): - if target and env.has_key('PDB') and env['PDB']: - return ['/PDB:%s'%target[0].File(env['PDB']).get_string(for_signature), - '/DEBUG'] + if target and env.has_key('PDB') and env['PDB']: + return ['/PDB:%s'%target[0].File(env['PDB']).get_string(for_signature), + '/DEBUG'] def win32ShlinkTargets(target, source, env, for_signature): - listCmd = [] - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - if dll: listCmd.append("/out:%s"%dll.get_string(for_signature)) + listCmd = [] + dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') + if dll: listCmd.append("/out:%s"%dll.get_string(for_signature)) - implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: listCmd.append("/implib:%s"%implib.get_string(for_signature)) + implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') + if implib: listCmd.append("/implib:%s"%implib.get_string(for_signature)) - return listCmd + return listCmd def win32ShlinkSources(target, source, env, for_signature): - listCmd = [] - - deffile = env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX") - for src in source: - if src == deffile: - # Treat this source as a .def file. - listCmd.append("/def:%s" % src.get_string(for_signature)) - else: - # Just treat it as a generic source file. - listCmd.append(src) - return listCmd + listCmd = [] + + deffile = env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX") + for src in source: + if src == deffile: + # Treat this source as a .def file. + listCmd.append("/def:%s" % src.get_string(for_signature)) + else: + # Just treat it as a generic source file. + listCmd.append(src) + return listCmd def win32LibEmitter(target, source, env): - # SCons.Tool.msvc.validate_vars(env) + # SCons.Tool.msvc.validate_vars(env) - dll = env.FindIxes(target, "SHLIBPREFIX", "SHLIBSUFFIX") - no_import_lib = env.get('no_import_lib', 0) + dll = env.FindIxes(target, "SHLIBPREFIX", "SHLIBSUFFIX") + no_import_lib = env.get('no_import_lib', 0) - if not dll: - raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX") + if not dll: + raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX") - if env.get("WIN32_INSERT_DEF", 0) and \ - not env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX"): + if env.get("WIN32_INSERT_DEF", 0) and \ + not env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX"): - # append a def file to the list of sources - source.append(env.ReplaceIxes(dll, - "SHLIBPREFIX", "SHLIBSUFFIX", - "WIN32DEFPREFIX", "WIN32DEFSUFFIX")) + # append a def file to the list of sources + source.append(env.ReplaceIxes(dll, + "SHLIBPREFIX", "SHLIBSUFFIX", + "WIN32DEFPREFIX", "WIN32DEFSUFFIX")) - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) + if env.has_key('PDB') and env['PDB']: + env.SideEffect(env['PDB'], target) + env.Precious(env['PDB']) - if not no_import_lib and \ - not env.FindIxes(target, "LIBPREFIX", "LIBSUFFIX"): - # Append an import library to the list of targets. - target.append(env.ReplaceIxes(dll, - "SHLIBPREFIX", "SHLIBSUFFIX", - "LIBPREFIX", "LIBSUFFIX")) - # and .exp file is created if there are exports from a DLL - target.append(env.ReplaceIxes(dll, - "SHLIBPREFIX", "SHLIBSUFFIX", - "WIN32EXPPREFIX", "WIN32EXPSUFFIX")) + if not no_import_lib and \ + not env.FindIxes(target, "LIBPREFIX", "LIBSUFFIX"): + # Append an import library to the list of targets. + target.append(env.ReplaceIxes(dll, + "SHLIBPREFIX", "SHLIBSUFFIX", + "LIBPREFIX", "LIBSUFFIX")) + # and .exp file is created if there are exports from a DLL + target.append(env.ReplaceIxes(dll, + "SHLIBPREFIX", "SHLIBSUFFIX", + "WIN32EXPPREFIX", "WIN32EXPSUFFIX")) - return (target, source) + return (target, source) def prog_emitter(target, source, env): - #SCons.Tool.msvc.validate_vars(env) + #SCons.Tool.msvc.validate_vars(env) - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) + if env.has_key('PDB') and env['PDB']: + env.SideEffect(env['PDB'], target) + env.Precious(env['PDB']) - return (target,source) + return (target,source) def RegServerFunc(target, source, env): - if env.has_key('register') and env['register']: - ret = regServerAction([target[0]], [source[0]], env) - if ret: - raise SCons.Errors.UserError, "Unable to register %s" % target[0] - else: - print "Registered %s sucessfully" % target[0] - return ret - return 0 + if env.has_key('register') and env['register']: + ret = regServerAction([target[0]], [source[0]], env) + if ret: + raise SCons.Errors.UserError, "Unable to register %s" % target[0] + else: + print "Registered %s sucessfully" % target[0] + return ret + return 0 regServerAction = SCons.Action.Action("$REGSVRCOM") regServerCheck = SCons.Action.Action(RegServerFunc, None) @@ -248,106 +248,106 @@ shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK compositeLinkAction = shlibLinkAction + regServerCheck def generate(env): - """Add Builders and construction variables for MSVC++ to an Environment.""" - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - for suffix in CSuffixes: - static_obj.add_action(suffix, SCons.Defaults.CAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCAction) - - for suffix in CXXSuffixes: - static_obj.add_action(suffix, SCons.Defaults.CXXAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) - - SCons.Tool.createStaticLibBuilder(env) - SCons.Tool.createSharedLibBuilder(env) - SCons.Tool.createProgBuilder(env) - - env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Zi /Fd%s"%File(PDB)) or ""}']) - env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}']) - env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET $CCPCHFLAGS $CCPDBFLAGS' - env['CC'] = 'cl' - env['CCFLAGS'] = SCons.Util.CLVar('/nologo') - env['CCCOM'] = '$CC $CCFLAGS $CCCOMFLAGS' - env['SHCC'] = '$CC' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CCCOMFLAGS' - env['CXX'] = '$CC' - env['CXXFLAGS'] = SCons.Util.CLVar('$CCFLAGS $( /TP $)') - env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS' - env['SHCXX'] = '$CXX' - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CCCOMFLAGS' - env['CPPDEFPREFIX'] = '/D' - env['CPPDEFSUFFIX'] = '' - env['INCPREFIX'] = '/I' - env['INCSUFFIX'] = '' - env['OBJEMITTER'] = static_object_emitter - env['SHOBJEMITTER'] = shared_object_emitter - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - - env['RC'] = 'rc' - env['RCFLAGS'] = SCons.Util.CLVar('') - env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES' - CScan = env.get_scanner('.c') - if CScan: - CScan.add_skey('.rc') - env['BUILDERS']['RES'] = res_builder - - include_path, lib_path, exe_path, sdk_path = get_msvctoolkit_paths() - env.PrependENVPath('INCLUDE', include_path) - env.PrependENVPath('LIB', lib_path) - env.PrependENVPath('PATH', exe_path) - - env['ENV']['CPU'] = 'i386' - env['ENV']['MSSDK'] = sdk_path - env['ENV']['BkOffice'] = sdk_path - env['ENV']['Basemake'] = sdk_path + "\\Include\\BKOffice.Mak" - env['ENV']['INETSDK'] = sdk_path - env['ENV']['MSSDK'] = sdk_path - env['ENV']['MSTOOLS'] = sdk_path - env['ENV']['TARGETOS'] = 'WINNT' - env['ENV']['APPVER'] = '5.0' - - env['CFILESUFFIX'] = '.c' - env['CXXFILESUFFIX'] = '.cc' - - env['PCHCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo${TARGETS[1]} /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS' - env['BUILDERS']['PCH'] = pch_builder - - env['AR'] = 'lib.exe' #'"' +sdk_path + '\\bin\\Win64\\lib.exe"' - env['ARFLAGS'] = SCons.Util.CLVar('/nologo') - env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}" - - env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll') - env['_SHLINK_TARGETS'] = win32ShlinkTargets - env['_SHLINK_SOURCES'] = win32ShlinkSources - env['SHLINKCOM'] = compositeLinkAction - env['SHLIBEMITTER']= win32LibEmitter - env['LINK'] = 'link.exe' #'"' +sdk_path + '\\bin\\Win64\\' + 'link.exe"' - env['LINKFLAGS'] = SCons.Util.CLVar('/nologo') - env['_PDB'] = pdbGenerator - env["TEMPFILE"] = SCons.Platform.win32.TempFileMunge - env['LINKCOM'] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $SOURCES")}' - env['PROGEMITTER'] = prog_emitter - env['LIBDIRPREFIX']='/LIBPATH:' - env['LIBDIRSUFFIX']='' - env['LIBLINKPREFIX']='' - env['LIBLINKSUFFIX']='$LIBSUFFIX' - - env['WIN32DEFPREFIX'] = '' - env['WIN32DEFSUFFIX'] = '.def' - env['WIN32_INSERT_DEF'] = 0 - - env['WIN32EXPPREFIX'] = '' - env['WIN32EXPSUFFIX'] = '.exp' - - env['REGSVRACTION'] = regServerCheck - env['REGSVR'] = os.path.join(SCons.Platform.win32.get_system_root(),'System32','regsvr32') - env['REGSVRFLAGS'] = '/s ' - env['REGSVRCOM'] = '$REGSVR $REGSVRFLAGS $TARGET' + """Add Builders and construction variables for MSVC++ to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in CSuffixes: + static_obj.add_action(suffix, SCons.Defaults.CAction) + shared_obj.add_action(suffix, SCons.Defaults.ShCAction) + + for suffix in CXXSuffixes: + static_obj.add_action(suffix, SCons.Defaults.CXXAction) + shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) + + SCons.Tool.createStaticLibBuilder(env) + SCons.Tool.createSharedLibBuilder(env) + SCons.Tool.createProgBuilder(env) + + env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Zi /Fd%s"%File(PDB)) or ""}']) + env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}']) + env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET $CCPCHFLAGS $CCPDBFLAGS' + env['CC'] = 'cl' + env['CCFLAGS'] = SCons.Util.CLVar('/nologo') + env['CCCOM'] = '$CC $CCFLAGS $CCCOMFLAGS' + env['SHCC'] = '$CC' + env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') + env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CCCOMFLAGS' + env['CXX'] = '$CC' + env['CXXFLAGS'] = SCons.Util.CLVar('$CCFLAGS $( /TP $)') + env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS' + env['SHCXX'] = '$CXX' + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') + env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CCCOMFLAGS' + env['CPPDEFPREFIX'] = '/D' + env['CPPDEFSUFFIX'] = '' + env['INCPREFIX'] = '/I' + env['INCSUFFIX'] = '' + env['OBJEMITTER'] = static_object_emitter + env['SHOBJEMITTER'] = shared_object_emitter + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + + env['RC'] = 'rc' + env['RCFLAGS'] = SCons.Util.CLVar('') + env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES' + CScan = env.get_scanner('.c') + if CScan: + CScan.add_skey('.rc') + env['BUILDERS']['RES'] = res_builder + + include_path, lib_path, exe_path, sdk_path = get_msvctoolkit_paths() + env.PrependENVPath('INCLUDE', include_path) + env.PrependENVPath('LIB', lib_path) + env.PrependENVPath('PATH', exe_path) + + env['ENV']['CPU'] = 'i386' + env['ENV']['MSSDK'] = sdk_path + env['ENV']['BkOffice'] = sdk_path + env['ENV']['Basemake'] = sdk_path + "\\Include\\BKOffice.Mak" + env['ENV']['INETSDK'] = sdk_path + env['ENV']['MSSDK'] = sdk_path + env['ENV']['MSTOOLS'] = sdk_path + env['ENV']['TARGETOS'] = 'WINNT' + env['ENV']['APPVER'] = '5.0' + + env['CFILESUFFIX'] = '.c' + env['CXXFILESUFFIX'] = '.cc' + + env['PCHCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo${TARGETS[1]} /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS' + env['BUILDERS']['PCH'] = pch_builder + + env['AR'] = 'lib.exe' #'"' +sdk_path + '\\bin\\Win64\\lib.exe"' + env['ARFLAGS'] = SCons.Util.CLVar('/nologo') + env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}" + + env['SHLINK'] = '$LINK' + env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll') + env['_SHLINK_TARGETS'] = win32ShlinkTargets + env['_SHLINK_SOURCES'] = win32ShlinkSources + env['SHLINKCOM'] = compositeLinkAction + env['SHLIBEMITTER']= win32LibEmitter + env['LINK'] = 'link.exe' #'"' +sdk_path + '\\bin\\Win64\\' + 'link.exe"' + env['LINKFLAGS'] = SCons.Util.CLVar('/nologo') + env['_PDB'] = pdbGenerator + env["TEMPFILE"] = SCons.Platform.win32.TempFileMunge + env['LINKCOM'] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $SOURCES")}' + env['PROGEMITTER'] = prog_emitter + env['LIBDIRPREFIX']='/LIBPATH:' + env['LIBDIRSUFFIX']='' + env['LIBLINKPREFIX']='' + env['LIBLINKSUFFIX']='$LIBSUFFIX' + + env['WIN32DEFPREFIX'] = '' + env['WIN32DEFSUFFIX'] = '.def' + env['WIN32_INSERT_DEF'] = 0 + + env['WIN32EXPPREFIX'] = '' + env['WIN32EXPSUFFIX'] = '.exp' + + env['REGSVRACTION'] = regServerCheck + env['REGSVR'] = os.path.join(SCons.Platform.win32.get_system_root(),'System32','regsvr32') + env['REGSVRFLAGS'] = '/s ' + env['REGSVRCOM'] = '$REGSVR $REGSVRFLAGS $TARGET' def exists(env): - return env.Detect('cl') + return env.Detect('cl') diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index bb876a90a7c..d1ee5e0050d 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -8,7 +8,9 @@ include(cmake/external_libs.cmake) # Build Flags -set(GCC_OPTIM_FLAGS "-ffast-math -msse -msse2 -msse3 -mtune=native") +if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD) + set(GCC_OPTIM_FLAGS "-ffast-math -msse -msse2 -msse3") +endif() if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_OPTIM_FLAGS}") @@ -30,6 +32,9 @@ if(UNIX AND NOT APPLE) set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID") endif() +# not needed yet, is for open shading language +set(RTTI_DISABLE_FLAGS "") + # Definitions and Includes add_definitions(${BOOST_DEFINITIONS} ${OPENIMAGEIO_DEFINITIONS}) @@ -49,6 +54,10 @@ if(WITH_CYCLES_PARTIO) add_definitions(-DWITH_PARTIO) endif() +if(WITH_CYCLES_CUDA_BINARIES) + add_definitions(-DWITH_CUDA_BINARIES) +endif() + add_definitions(-DWITH_OPENCL) add_definitions(-DWITH_CUDA) add_definitions(-DWITH_MULTI) @@ -72,3 +81,4 @@ add_subdirectory(kernel) add_subdirectory(render) add_subdirectory(subd) add_subdirectory(util) + diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript index 27943ed6ac6..e2c81edea37 100644 --- a/intern/cycles/SConscript +++ b/intern/cycles/SConscript @@ -24,10 +24,13 @@ defs.append('WITH_MULTI') defs.append('WITH_CUDA') if env['OURPLATFORM'] in ('win32-mingw'): - cxxflags.append('-fno-rtti -ffast-math -msse -msse2 -msse3 -mtune=native'.split()) - ccflags.append('-ffast-math -msse -msse2 -msse3 -mtune=native'.split()) - defs.append('BOOST_NO_RTTI BOOST_NO_TYPEID'.split()) - + if env['WITH_BF_RAYOPTIMIZATION']: + cxxflags.append('-ffast-math -msse -msse2 -msse3'.split()) + ccflags.append('-ffast-math -msse -msse2 -msse3'.split()) + # not needed yet, is for open shading language + # cxxflags.append('-fno-rtti'.split()) + # defs.append('BOOST_NO_RTTI BOOST_NO_TYPEID'.split()) + incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split()) incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.split()) incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split()) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index dfbfb769170..7c7d4c81b89 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -350,7 +350,7 @@ def find_node_input(node, name): def panel_node_draw(layout, id, output_type, input_name): if not id.node_tree: layout.prop(id, "use_nodes", icon='NODETREE') - return + return False ntree = id.node_tree @@ -360,6 +360,8 @@ def panel_node_draw(layout, id, output_type, input_name): else: input = find_node_input(node, input_name) layout.template_node_view(ntree, node, input); + + return True class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): bl_label = "Lamp" @@ -411,8 +413,9 @@ class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel): def draw(self, context): layout = self.layout - mat = context.lamp - panel_node_draw(layout, mat, 'OUTPUT_LAMP', 'Surface') + lamp = context.lamp + if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'): + layout.prop(lamp, "color") class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel): bl_label = "Surface" @@ -425,8 +428,9 @@ class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel): def draw(self, context): layout = self.layout - mat = context.world - panel_node_draw(layout, mat, 'OUTPUT_WORLD', 'Surface') + world = context.world + if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'): + layout.prop(world, "horizon_color", text="Color") class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel): bl_label = "Volume" @@ -457,7 +461,8 @@ class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel): layout = self.layout mat = context.material - panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface') + if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'): + layout.prop(mat, "diffuse_color") class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel): bl_label = "Volume" @@ -730,7 +735,22 @@ def get_panels(): bpy.types.TEXTURE_PT_distortednoise, bpy.types.TEXTURE_PT_voxeldata, bpy.types.TEXTURE_PT_pointdensity, - bpy.types.TEXTURE_PT_pointdensity_turbulence] + bpy.types.TEXTURE_PT_pointdensity_turbulence, + bpy.types.PARTICLE_PT_context_particles, + bpy.types.PARTICLE_PT_emission, + bpy.types.PARTICLE_PT_hair_dynamics, + bpy.types.PARTICLE_PT_cache, + bpy.types.PARTICLE_PT_velocity, + bpy.types.PARTICLE_PT_rotation, + bpy.types.PARTICLE_PT_physics, + bpy.types.PARTICLE_PT_boidbrain, + bpy.types.PARTICLE_PT_render, + bpy.types.PARTICLE_PT_draw, + bpy.types.PARTICLE_PT_children, + bpy.types.PARTICLE_PT_field_weights, + bpy.types.PARTICLE_PT_force_fields, + bpy.types.PARTICLE_PT_vertexgroups, + bpy.types.PARTICLE_PT_custom_props] def register(): bpy.types.RENDER_PT_render.append(draw_device) diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 1095a3ee026..0edac820e94 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -229,8 +229,17 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d) } object_free_duplilist(*b_ob); + + /* check if we should render duplicator */ + hide = true; + BL::Object::particle_systems_iterator b_psys; + + for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys) + if(b_psys->settings().use_render_emitter()) + hide = false; } - else { + + if(!hide) { /* object itself */ Transform tfm = get_transform(b_ob->matrix_world()); sync_object(*b_ob, 0, *b_ob, tfm, visibility); diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index b6b8b351e13..9037362f1ab 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -85,3 +85,16 @@ if(WITH_CYCLES_BLENDER) add_definitions(-DBLENDER_PLUGIN) endif() +########################################################################### +# CUDA + +if(WITH_CYCLES_CUDA_BINARIES) + find_package(CUDA) # Try to auto locate CUDA toolkit + if(CUDA_FOUND) + message(STATUS "CUDA nvcc = ${CUDA_NVCC_EXECUTABLE}") + else() + message(STATUS "CUDA compiler not found, disabling WITH_CYCLES_CUDA_BINARIES") + set(WITH_CYCLES_CUDA_BINARIES OFF) + endif() +endif() + diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 14c2a765a8e..1158cc6c77c 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -223,6 +223,10 @@ public: if(path_exists(cubin)) return cubin; +#ifdef WITH_CUDA_BINARIES + fprintf(stderr, "CUDA binary kernel for this graphics card not found.\n"); + return ""; +#else /* if not, find CUDA compiler */ string nvcc = cuCompilerPath(); @@ -260,6 +264,7 @@ public: printf("Kernel compilation finished in %.2lfs.\n", time_dt() - starttime); return cubin; +#endif } bool load_kernels() diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 3a06aecdfcf..614391bd3f2 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -83,6 +83,32 @@ set(SRC_UTIL_HEADERS ../util/util_transform.h ../util/util_types.h ) +# CUDA module + +if(WITH_CYCLES_CUDA_BINARIES) + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(CUDA_BITS 64) + else() + set(CUDA_BITS 32) + endif() + + set(cuda_sources kernel.cu ${headers} ${svm_headers}) + set(cuda_cubins) + + foreach(arch ${CYCLES_CUDA_BINARIES_ARCH}) + set(cuda_cubin kernel_${arch}.cubin) + + add_custom_command( + OUTPUT ${cuda_cubin} + COMMAND ${CUDA_NVCC_EXECUTABLE} -arch=${arch} -m${CUDA_BITS} --cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu --use_fast_math -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} --ptxas-options="-v" --maxrregcount=24 --opencc-options -OPT:Olimit=0 -I${CMAKE_CURRENT_SOURCE_DIR}/../util -I${CMAKE_CURRENT_SOURCE_DIR}/svm -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC + DEPENDS ${cuda_sources}) + + delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_cubin}" ${CYCLES_INSTALL_PATH}/lib) + list(APPEND cuda_cubins ${cuda_cubin}) + endforeach() + + add_custom_target(cycles_kernel_cuda ALL DEPENDS ${cuda_cubins}) +endif() # OSL module diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index cee0710492f..fd96148968f 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -43,7 +43,7 @@ template<typename T> struct texture { return data[index]; } - __m128 fetch_m128(int index) + /*__m128 fetch_m128(int index) { kernel_assert(index >= 0 && index < width); return ((__m128*)data)[index]; @@ -53,7 +53,7 @@ template<typename T> struct texture { { kernel_assert(index >= 0 && index < width); return ((__m128i*)data)[index]; - } + }*/ float interp(float x) { diff --git a/intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h b/intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h index e16efebf5bb..2e9343647b8 100644 --- a/intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h +++ b/intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h @@ -68,8 +68,11 @@ __device float3 bsdf_ashikhmin_velvet_eval_reflect(const ShaderData *sd, const S float cosNH = dot(m_N, H); float cosHO = fabsf(dot(I, H)); + if(!(fabsf(cosNH) < 1.0f-1e-5f && cosHO > 1e-5f)) + return make_float3(0, 0, 0); + float cosNHdivHO = cosNH / cosHO; - cosNHdivHO = fmaxf(cosNHdivHO, 0.00001f); + cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f); float fac1 = 2 * fabsf(cosNHdivHO * cosNO); float fac2 = 2 * fabsf(cosNHdivHO * cosNI); @@ -86,6 +89,7 @@ __device float3 bsdf_ashikhmin_velvet_eval_reflect(const ShaderData *sd, const S *pdf = 0.5f * M_1_PI_F; return make_float3(out, out, out); } + return make_float3(0, 0, 0); } @@ -116,31 +120,36 @@ __device int bsdf_ashikhmin_velvet_sample(const ShaderData *sd, const ShaderClos float cosNH = dot(m_N, H); float cosHO = fabsf(dot(sd->I, H)); - float cosNHdivHO = cosNH / cosHO; - cosNHdivHO = fmaxf(cosNHdivHO, 0.00001f); + if(fabsf(cosNO) > 1e-5f && fabsf(cosNH) < 1.0f-1e-5f && cosHO > 1e-5f) { + float cosNHdivHO = cosNH / cosHO; + cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f); - float fac1 = 2 * fabsf(cosNHdivHO * cosNO); - float fac2 = 2 * fabsf(cosNHdivHO * cosNI); + float fac1 = 2 * fabsf(cosNHdivHO * cosNO); + float fac2 = 2 * fabsf(cosNHdivHO * cosNI); - float sinNH2 = 1 - cosNH * cosNH; - float sinNH4 = sinNH2 * sinNH2; - float cotangent2 = (cosNH * cosNH) / sinNH2; + float sinNH2 = 1 - cosNH * cosNH; + float sinNH4 = sinNH2 * sinNH2; + float cotangent2 = (cosNH * cosNH) / sinNH2; - float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4; - float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically + float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4; + float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically - float power = 0.25f * (D * G) / cosNO; + float power = 0.25f * (D * G) / cosNO; - *eval = make_float3(power, power, power); + *eval = make_float3(power, power, power); #ifdef __RAY_DIFFERENTIALS__ - // TODO: find a better approximation for the retroreflective bounce - *domega_in_dx = (2 * dot(m_N, sd->dI.dx)) * m_N - sd->dI.dx; - *domega_in_dy = (2 * dot(m_N, sd->dI.dy)) * m_N - sd->dI.dy; - *domega_in_dx *= 125.0f; - *domega_in_dy *= 125.0f; + // TODO: find a better approximation for the retroreflective bounce + *domega_in_dx = (2 * dot(m_N, sd->dI.dx)) * m_N - sd->dI.dx; + *domega_in_dy = (2 * dot(m_N, sd->dI.dy)) * m_N - sd->dI.dy; + *domega_in_dx *= 125.0f; + *domega_in_dy *= 125.0f; #endif - } else + } + else + *pdf = 0.0f; + } + else *pdf = 0.0f; return LABEL_REFLECT|LABEL_DIFFUSE; diff --git a/intern/cycles/util/util_cuda.cpp b/intern/cycles/util/util_cuda.cpp index bd5583b9718..fdf3d664a11 100644 --- a/intern/cycles/util/util_cuda.cpp +++ b/intern/cycles/util/util_cuda.cpp @@ -373,8 +373,14 @@ bool cuLibraryInit() /* cuda 4.0 */ CUDA_LIBRARY_FIND(cuCtxSetCurrent); +#ifndef WITH_CUDA_BINARIES +#ifdef _WIN32 + return false; /* runtime build doesn't work at the moment */ +#else if(cuCompilerPath() == "") return false; +#endif +#endif /* success */ result = true; @@ -401,7 +407,15 @@ string cuCompilerPath() else nvcc = path_join(defaultpath, executable); - return (path_exists(nvcc))? nvcc: ""; + if(path_exists(nvcc)) + return nvcc; + +#ifndef _WIN32 + if(system("which nvcc") == 0) + return "nvcc"; +#endif + + return ""; } CCL_NAMESPACE_END diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index 38e90f0b2b2..c0dd627a606 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -766,7 +766,7 @@ __device_inline float __uint_as_float(uint i) /* Interpolation */ -template<class A, class B> __device_inline A lerp(const A& a, const A& b, const B& t) +template<class A, class B> A lerp(const A& a, const A& b, const B& t) { return (A)(a * ((B)1 - t) + b * t); } diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h index af5b91c963a..2c0ae13ad2a 100644 --- a/intern/cycles/util/util_types.h +++ b/intern/cycles/util/util_types.h @@ -46,12 +46,13 @@ /* SIMD Types */ +/* not needed yet, will be for qbvh #ifndef __KERNEL_GPU__ #include <emmintrin.h> #include <xmmintrin.h> -#endif +#endif*/ #ifndef _WIN32 #ifndef __KERNEL_GPU__ diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index 324414b8bcb..919677fff8b 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -233,10 +233,13 @@ class FollowActiveQuads(Operator): bl_label = "Follow Active Quads" bl_options = {'REGISTER', 'UNDO'} - mode = bpy.props.EnumProperty(items=(("EVEN", "Even", "Space all UVs evently"), ("LENGTH", "Length", "Average space UVs edge length of each loop")), - name="Edge Length Mode", - description="Method to space UV edge loops", - default="LENGTH") + mode = bpy.props.EnumProperty( + name="Edge Length Mode", + description="Method to space UV edge loops", + items=(('EVEN', "Even", "Space all UVs evently"), + ('LENGTH', "Length", "Average space UVs edge length of each loop")), + default='LENGTH', + ) @classmethod def poll(cls, context): diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py index 52548817620..ae4add72a08 100644 --- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -552,9 +552,9 @@ class LightMapPack(Operator): PREF_CONTEXT = bpy.props.EnumProperty( name="Selection", - items=(("SEL_FACES", "Selected Faces", "Space all UVs evently"), - ("ALL_FACES", "All Faces", "Average space UVs edge length of each loop"), - ("ALL_OBJECTS", "Selected Mesh Object", "Average space UVs edge length of each loop") + items=(('SEL_FACES', "Selected Faces", "Space all UVs evently"), + ('ALL_FACES', "All Faces", "Average space UVs edge length of each loop"), + ('ALL_OBJECTS', "Selected Mesh Object", "Average space UVs edge length of each loop") ), ) diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 5dadcba2621..d1bc0694a89 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -71,7 +71,7 @@ class DATA_PT_skeleton(ArmatureButtonsPanel, Panel): flow.prop(arm, "use_deform_envelopes", text="Envelopes") flow.prop(arm, "use_deform_preserve_volume", text="Quaternion") - if context.scene.render.engine == "BLENDER_GAME": + if context.scene.render.engine == 'BLENDER_GAME': layout.row().prop(arm, "deform_method", expand=True) @@ -289,7 +289,7 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel): row.prop(itasc, "damping_max", text="Damp", slider=True) row.prop(itasc, "damping_epsilon", text="Eps", slider=True) -from bl_ui.properties_animviz import ( +from .properties_animviz import ( MotionPathButtonsPanel, OnionSkinButtonsPanel, ) diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index 1a0fb0ef4ac..1d7559b2ceb 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -18,7 +18,7 @@ # <pep8 compliant> import bpy -from bpy.types import Panel +from bpy.types import Panel, Menu from rna_prop_ui import PropertyPanel @@ -33,12 +33,12 @@ class CameraButtonsPanel(): return context.camera and (engine in cls.COMPAT_ENGINES) -class CAMERA_MT_presets(bpy.types.Menu): +class CAMERA_MT_presets(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 + draw = Menu.draw_preset class DATA_PT_context_camera(CameraButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_data_speaker.py b/release/scripts/startup/bl_ui/properties_data_speaker.py index a1b86b51f5f..853c11c96c6 100644 --- a/release/scripts/startup/bl_ui/properties_data_speaker.py +++ b/release/scripts/startup/bl_ui/properties_data_speaker.py @@ -18,6 +18,7 @@ # <pep8 compliant> import bpy +from bpy.types import Panel from rna_prop_ui import PropertyPanel @@ -32,7 +33,7 @@ class DataButtonsPanel(): return context.speaker and (engine in cls.COMPAT_ENGINES) -class DATA_PT_context_speaker(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_context_speaker(DataButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -52,7 +53,7 @@ class DATA_PT_context_speaker(DataButtonsPanel, bpy.types.Panel): split.template_ID(space, "pin_id") -class DATA_PT_speaker(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_speaker(DataButtonsPanel, Panel): bl_label = "Sound" COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -71,7 +72,7 @@ class DATA_PT_speaker(DataButtonsPanel, bpy.types.Panel): row.prop(speaker, "pitch") -class DATA_PT_distance(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_distance(DataButtonsPanel, Panel): bl_label = "Distance" COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -94,7 +95,7 @@ class DATA_PT_distance(DataButtonsPanel, bpy.types.Panel): col.prop(speaker, "distance_reference", text="Reference") -class DATA_PT_cone(DataButtonsPanel, bpy.types.Panel): +class DATA_PT_cone(DataButtonsPanel, Panel): bl_label = "Cone" COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -116,7 +117,7 @@ class DATA_PT_cone(DataButtonsPanel, bpy.types.Panel): col.prop(speaker, "cone_volume_outer", text="Outer") -class DATA_PT_custom_props_speaker(DataButtonsPanel, PropertyPanel, bpy.types.Panel): +class DATA_PT_custom_props_speaker(DataButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} _context_path = "object.data" _property_type = bpy.types.Speaker diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index ba9bb4a624d..877b6c0893d 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -406,7 +406,7 @@ class SceneButtonsPanel(): bl_context = "scene" -class SCENE_PT_game_navmesh(SceneButtonsPanel, bpy.types.Panel): +class SCENE_PT_game_navmesh(SceneButtonsPanel, Panel): bl_label = "Navigation mesh" bl_default_closed = True COMPAT_ENGINES = {'BLENDER_GAME'} diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index f5a95016baa..6e66bd0d98b 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -612,7 +612,7 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, Panel): col.prop(halo, "flare_subflare_size", text="Subsize") -class MATERIAL_PT_game_settings(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_game_settings(MaterialButtonsPanel, Panel): bl_label = "Game Settings" COMPAT_ENGINES = {'BLENDER_GAME'} @@ -637,7 +637,7 @@ class MATERIAL_PT_game_settings(MaterialButtonsPanel, bpy.types.Panel): row.prop(game, "face_orientation", text="") -class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel): +class MATERIAL_PT_physics(MaterialButtonsPanel, Panel): bl_label = "Physics" COMPAT_ENGINES = {'BLENDER_GAME'} diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 36b8129ad8a..27b6aa721a4 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -280,7 +280,7 @@ class OBJECT_PT_relations_extras(ObjectButtonsPanel, Panel): row.prop(ob, "slow_parent_offset", text="Offset") -from bl_ui.properties_animviz import ( +from .properties_animviz import ( MotionPathButtonsPanel, OnionSkinButtonsPanel, ) diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py index c493124c5bb..508818b62dc 100644 --- a/release/scripts/startup/bl_ui/properties_object_constraint.py +++ b/release/scripts/startup/bl_ui/properties_object_constraint.py @@ -131,7 +131,7 @@ class ConstraintButtonsPanel(): self.space_template(layout, con) def IK(self, context, layout, con): - if context.object.pose.ik_solver == "ITASC": + if context.object.pose.ik_solver == 'ITASC': layout.prop(con, "ik_type") getattr(self, 'IK_' + con.ik_type)(context, layout, con) else: diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index c6d96171c38..a541f43be66 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -21,7 +21,7 @@ import bpy from bpy.types import Panel from rna_prop_ui import PropertyPanel -from bl_ui.properties_physics_common import ( +from .properties_physics_common import ( point_cache_ui, effector_weights_ui, basic_force_field_settings_ui, diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index afb3c000980..32b94504525 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -20,7 +20,7 @@ import bpy from bpy.types import Menu, Panel -from bl_ui.properties_physics_common import ( +from .properties_physics_common import ( point_cache_ui, effector_weights_ui, ) @@ -60,61 +60,59 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel): md = context.cloth ob = context.object + cloth = md.settings - if md: - cloth = md.settings - - split = layout.split() + split = layout.split() - split.active = cloth_panel_enabled(md) + split.active = cloth_panel_enabled(md) - col = split.column() + col = split.column() - col.label(text="Presets:") - sub = col.row(align=True) - sub.menu("CLOTH_MT_presets", text=bpy.types.CLOTH_MT_presets.bl_label) - sub.operator("cloth.preset_add", text="", icon='ZOOMIN') - sub.operator("cloth.preset_add", text="", icon='ZOOMOUT').remove_active = True + col.label(text="Presets:") + sub = col.row(align=True) + sub.menu("CLOTH_MT_presets", text=bpy.types.CLOTH_MT_presets.bl_label) + sub.operator("cloth.preset_add", text="", icon='ZOOMIN') + sub.operator("cloth.preset_add", text="", icon='ZOOMOUT').remove_active = True - col.label(text="Quality:") - col.prop(cloth, "quality", text="Steps", slider=True) + col.label(text="Quality:") + col.prop(cloth, "quality", text="Steps", slider=True) - col.label(text="Material:") - col.prop(cloth, "mass") - col.prop(cloth, "structural_stiffness", text="Structural") - col.prop(cloth, "bending_stiffness", text="Bending") + col.label(text="Material:") + col.prop(cloth, "mass") + col.prop(cloth, "structural_stiffness", text="Structural") + col.prop(cloth, "bending_stiffness", text="Bending") - col = split.column() + col = split.column() - col.label(text="Damping:") - col.prop(cloth, "spring_damping", text="Spring") - col.prop(cloth, "air_damping", text="Air") + col.label(text="Damping:") + col.prop(cloth, "spring_damping", text="Spring") + col.prop(cloth, "air_damping", text="Air") - col.prop(cloth, "use_pin_cloth", text="Pinning") - sub = col.column() - sub.active = cloth.use_pin_cloth - sub.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="") - sub.prop(cloth, "pin_stiffness", text="Stiffness") + col.prop(cloth, "use_pin_cloth", text="Pinning") + sub = col.column() + sub.active = cloth.use_pin_cloth + sub.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="") + sub.prop(cloth, "pin_stiffness", text="Stiffness") - col.label(text="Pre roll:") - col.prop(cloth, "pre_roll", text="Frame") + col.label(text="Pre roll:") + col.prop(cloth, "pre_roll", text="Frame") - # Disabled for now - """ - if cloth.vertex_group_mass: - layout.label(text="Goal:") + # Disabled for now + """ + if cloth.vertex_group_mass: + layout.label(text="Goal:") - col = layout.column_flow() - col.prop(cloth, "goal_default", text="Default") - col.prop(cloth, "goal_spring", text="Stiffness") - col.prop(cloth, "goal_friction", text="Friction") - """ + col = layout.column_flow() + col.prop(cloth, "goal_default", text="Default") + col.prop(cloth, "goal_spring", text="Stiffness") + col.prop(cloth, "goal_friction", text="Friction") + """ - key = ob.data.shape_keys + key = ob.data.shape_keys - if key: - col.label(text="Rest Shape Key:") - col.prop_search(cloth, "rest_shape_key", key, "key_blocks", text="") + if key: + col.label(text="Rest Shape Key:") + col.prop_search(cloth, "rest_shape_key", key, "key_blocks", text="") class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index fdaa1ae7a60..f03d4793be0 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -17,13 +17,16 @@ # ##### END GPL LICENSE BLOCK ##### # <pep8 compliant> + import bpy +from bpy.types import Panel -from bl_ui.properties_physics_common import ( +from .properties_physics_common import ( point_cache_ui, effector_weights_ui, ) + class PhysicButtonsPanel(): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' @@ -33,10 +36,10 @@ class PhysicButtonsPanel(): def poll(cls, context): ob = context.object rd = context.scene.render - return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.dynamic_paint) + return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and context.dynamic_paint -class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, Panel): bl_label = "Dynamic Paint" def draw(self, context): @@ -45,82 +48,81 @@ class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, bpy.types.Panel): md = context.dynamic_paint ob = context.object - if md: - layout.prop(md, "ui_type", expand=True) + layout.prop(md, "ui_type", expand=True) - if (md.ui_type == "CANVAS"): - canvas = md.canvas_settings - - if (not canvas): - layout.operator("dpaint.type_toggle", text="Add Canvas").type = 'CANVAS' - else: - layout.operator("dpaint.type_toggle", text="Remove Canvas", icon='X').type = 'CANVAS' - - surface = canvas.canvas_surfaces.active - row = layout.row() - row.template_list(canvas, "canvas_surfaces", canvas.canvas_surfaces, "active_index", rows=2) - - col = row.column(align=True) - col.operator("dpaint.surface_slot_add", icon='ZOOMIN', text="") - col.operator("dpaint.surface_slot_remove", icon='ZOOMOUT', text="") - - if surface: - layout.prop(surface, "name") - layout.prop(surface, "surface_format", expand=False) - col = layout.column() - - if surface.surface_format != "VERTEX": - col.label(text="Quality:") - col.prop(surface, "image_resolution") - col.prop(surface, "use_antialiasing") - - col = layout.column() - col.label(text="Frames:") - split = col.split() - - col = split.column(align=True) - col.prop(surface, "frame_start", text="Start") - col.prop(surface, "frame_end", text="End") - - col = split.column() - col.prop(surface, "frame_substeps") - - elif (md.ui_type == "BRUSH"): - brush = md.brush_settings - engine = context.scene.render.engine - - if (not brush): - layout.operator("dpaint.type_toggle", text="Add Brush").type = 'BRUSH' + if md.ui_type == 'CANVAS': + canvas = md.canvas_settings + + if canvas is None: + layout.operator("dpaint.type_toggle", text="Add Canvas").type = 'CANVAS' + else: + layout.operator("dpaint.type_toggle", text="Remove Canvas", icon='X').type = 'CANVAS' + + surface = canvas.canvas_surfaces.active + + row = layout.row() + row.template_list(canvas, "canvas_surfaces", canvas.canvas_surfaces, "active_index", rows=2) + + col = row.column(align=True) + col.operator("dpaint.surface_slot_add", icon='ZOOMIN', text="") + col.operator("dpaint.surface_slot_remove", icon='ZOOMOUT', text="") + + if surface: + layout.prop(surface, "name") + layout.prop(surface, "surface_format") + + col = layout.column() + if surface.surface_format != 'VERTEX': + col.label(text="Quality:") + col.prop(surface, "image_resolution") + col.prop(surface, "use_antialiasing") + + col = layout.column() + col.label(text="Frames:") + split = col.split() + + col = split.column(align=True) + col.prop(surface, "frame_start", text="Start") + col.prop(surface, "frame_end", text="End") + + split.prop(surface, "frame_substeps") + + elif md.ui_type == 'BRUSH': + brush = md.brush_settings + engine = context.scene.render.engine + + if brush is None: + layout.operator("dpaint.type_toggle", text="Add Brush").type = 'BRUSH' + else: + layout.operator("dpaint.type_toggle", text="Remove Brush", icon='X').type = 'BRUSH' + + split = layout.split() + + col = split.column() + col.prop(brush, "absolute_alpha") + col.prop(brush, "paint_erase") + col.prop(brush, "paint_wetness", text="Wetness") + + col = split.column() + if engine == 'BLENDER_RENDER': + sub = col.column() + sub.active = (brush.paint_source != 'PARTICLE_SYSTEM') + sub.prop(brush, "use_material") + if brush.use_material and brush.paint_source != 'PARTICLE_SYSTEM' and engine == 'BLENDER_RENDER': + col.prop(brush, "material", text="") + col.prop(brush, "paint_alpha", text="Alpha Factor") else: - layout.operator("dpaint.type_toggle", text="Remove Brush", icon='X').type = 'BRUSH' - - split = layout.split() - - col = split.column() - col.prop(brush, "absolute_alpha") - col.prop(brush, "paint_erase") - col.prop(brush, "paint_wetness", text="Wetness") - - col = split.column() - if (engine == 'BLENDER_RENDER'): - sub = col.column() - sub.active = (brush.paint_source != "PARTICLE_SYSTEM"); - sub.prop(brush, "use_material") - if brush.use_material and brush.paint_source != "PARTICLE_SYSTEM" and (engine == 'BLENDER_RENDER'): - col.prop(brush, "material", text="") - col.prop(brush, "paint_alpha", text="Alpha Factor") - else: - col.prop(brush, "paint_color", text="") - col.prop(brush, "paint_alpha", text="Alpha") - - -class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, bpy.types.Panel): + col.prop(brush, "paint_color", text="") + col.prop(brush, "paint_alpha", text="Alpha") + + +class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, Panel): bl_label = "Dynamic Paint Advanced" @classmethod def poll(cls, context): md = context.dynamic_paint - return md and (md.ui_type == "CANVAS") and (md.canvas_settings) and (md.canvas_settings.canvas_surfaces.active) + return md and md.ui_type == 'CANVAS' and md.canvas_settings and md.canvas_settings.canvas_surfaces.active def draw(self, context): layout = self.layout @@ -129,75 +131,70 @@ class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, bpy.types.Panel): surface = canvas.canvas_surfaces.active ob = context.object - layout.prop(surface, "surface_type", expand=False) + surface_type = surface.surface_type + + layout.prop(surface, "surface_type") layout.separator() # dissolve - if (surface.surface_type == "PAINT"): + if surface_type == 'PAINT': split = layout.split(percentage=0.35) - col = split.column() - col.label(text="Wetmap drying:") + split.label(text="Wetmap drying:") + col = split.column() split = col.split(percentage=0.7) - col = split.column() - col.prop(surface, "dry_speed", text="Time") - col = split.column() - col.prop(surface, "use_dry_log", text="Slow") - - if (surface.surface_type != "WAVE"): + split.prop(surface, "dry_speed", text="Time") + split.prop(surface, "use_dry_log", text="Slow") + + if surface_type != 'WAVE': split = layout.split(percentage=0.35) col = split.column() - if (surface.surface_type == "DISPLACE"): - col.prop(surface, "use_dissolve", text="Dissolve:") - elif (surface.surface_type == "WEIGHT"): + if surface_type == 'WEIGHT': col.prop(surface, "use_dissolve", text="Fade:") else: col.prop(surface, "use_dissolve", text="Dissolve:") col = split.column() col.active = surface.use_dissolve split = col.split(percentage=0.7) - col = split.column() - col.prop(surface, "dissolve_speed", text="Time") - col = split.column() - col.prop(surface, "use_dissolve_log", text="Slow") - + split.prop(surface, "dissolve_speed", text="Time") + split.prop(surface, "use_dissolve_log", text="Slow") + # per type settings - if (surface.surface_type == "DISPLACE"): + if surface_type == 'DISPLACE': layout.prop(surface, "use_incremental_displace") - if (surface.surface_format == "VERTEX"): - split = layout.split() - col = split.column() - col.prop(surface, "depth_clamp") - col = split.column() - col.prop(surface, "displace_factor") - - if (surface.surface_type == "WAVE"): + if surface.surface_format == 'VERTEX': + row = layout.row() + row.prop(surface, "depth_clamp") + row.prop(surface, "displace_factor") + + elif surface_type == 'WAVE': layout.prop(surface, "wave_open_borders") - + split = layout.split() - + col = split.column(align=True) col.prop(surface, "wave_timescale") col.prop(surface, "wave_speed") - + col = split.column(align=True) col.prop(surface, "wave_damping") col.prop(surface, "wave_spring") - + layout.separator() layout.prop(surface, "brush_group", text="Brush Group") -class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, bpy.types.Panel): + +class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel): bl_label = "Dynamic Paint Output" bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): md = context.dynamic_paint - if (not (md and (md.ui_type == "CANVAS") and (md.canvas_settings))): + if not (md and md.ui_type == 'CANVAS' and md.canvas_settings): return 0 surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active - return (surface and not (surface.surface_format=="VERTEX" and (surface.surface_type=="DISPLACE" or surface.surface_type=="WAVE"))) + return surface and not (surface.surface_format == 'VERTEX' and (surface.surface_type in {'DISPLACE', 'WAVE'})) def draw(self, context): layout = self.layout @@ -205,90 +202,89 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, bpy.types.Panel): canvas = context.dynamic_paint.canvas_settings surface = canvas.canvas_surfaces.active ob = context.object - + + surface_type = surface.surface_type + # vertex format outputs - if (surface.surface_format == "VERTEX"): - if (surface.surface_type == "PAINT"): + if surface.surface_format == 'VERTEX': + if surface_type == 'PAINT': # toggle active preview layout.prop(surface, "preview_id") - + # paintmap output row = layout.row() row.prop_search(surface, "output_name", ob.data, "vertex_colors", text="Paintmap layer: ") - ic = 'ZOOMIN' - if (surface.output_exists(object=ob, index=0)): + if surface.output_exists(object=ob, index=0): ic = 'ZOOMOUT' - col = row.column(align=True) - col.operator("dpaint.output_toggle", icon=ic, text="").index = 0 - + else: + ic = 'ZOOMIN' + + row.operator("dpaint.output_toggle", icon=ic, text="").index = 0 + # wetmap output row = layout.row() row.prop_search(surface, "output_name2", ob.data, "vertex_colors", text="Wetmap layer: ") - ic = 'ZOOMIN' - if (surface.output_exists(object=ob, index=1)): + if surface.output_exists(object=ob, index=1): ic = 'ZOOMOUT' - col = row.column(align=True) - col.operator("dpaint.output_toggle", icon=ic, text="").index = 1 - if (surface.surface_type == "WEIGHT"): + else: + ic = 'ZOOMIN' + + row.operator("dpaint.output_toggle", icon=ic, text="").index = 1 + + elif surface_type == 'WEIGHT': row = layout.row() row.prop_search(surface, "output_name", ob, "vertex_groups", text="Vertex Group: ") - ic = 'ZOOMIN' - if (surface.output_exists(object=ob, index=0)): + if surface.output_exists(object=ob, index=0): ic = 'ZOOMOUT' - col = row.column(align=True) - col.operator("dpaint.output_toggle", icon=ic, text="").index = 0 + else: + ic = 'ZOOMIN' + + row.operator("dpaint.output_toggle", icon=ic, text="").index = 0 # image format outputs - if (surface.surface_format == "IMAGE"): - col = layout.column() - col.operator("dpaint.bake", text="Bake Image Sequence", icon='MOD_DYNAMICPAINT') - col.prop_search(surface, "uv_layer", ob.data, "uv_textures", text="UV layer:") + if surface.surface_format == 'IMAGE': + layout.operator("dpaint.bake", text="Bake Image Sequence", icon='MOD_DYNAMICPAINT') + layout.prop_search(surface, "uv_layer", ob.data, "uv_textures", text="UV layer:") layout.separator() - - col.separator() - col = layout.column() - col.prop(surface, "image_output_path", text="") - split = layout.split() - col = split.column() - col.prop(surface, "image_fileformat", text="") - col = split.column() - col.prop(surface, "premultiply", text="Premultiply alpha") - col.separator() - - if (surface.surface_type == "PAINT"): + + layout.prop(surface, "image_output_path", text="") + row = layout.row() + row.prop(surface, "image_fileformat", text="") + row.prop(surface, "premultiply", text="Premultiply alpha") + + if surface_type == 'PAINT': split = layout.split(percentage=0.4) - col = split.column() - col.prop(surface, "do_output1", text="Paintmaps:") - sub = split.column() + split.prop(surface, "do_output1", text="Paintmaps:") + sub = split.row() sub.active = surface.do_output1 sub.prop(surface, "output_name", text="") - + split = layout.split(percentage=0.4) - col = split.column() - col.prop(surface, "do_output2", text="Wetmaps:") - sub = split.column() + split.prop(surface, "do_output2", text="Wetmaps:") + sub = split.row() sub.active = surface.do_output2 sub.prop(surface, "output_name2", text="") else: col = layout.column() col.prop(surface, "output_name", text="Filename: ") - if (surface.surface_type == "DISPLACE"): + if surface_type == 'DISPLACE': col.prop(surface, "displace_type", text="Displace Type") col.prop(surface, "depth_clamp") - if (surface.surface_type == "WAVE"): + elif surface_type == 'WAVE': col.prop(surface, "depth_clamp", text="Wave Clamp") -class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, bpy.types.Panel): + +class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, Panel): bl_label = "Dynamic Paint Initial Color" bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): md = context.dynamic_paint - if (not (md and (md.ui_type == "CANVAS") and (md.canvas_settings))): + if not (md and md.ui_type == 'CANVAS' and md.canvas_settings): return 0 surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active - return (surface and surface.surface_type=="PAINT") + return (surface and surface.surface_type == 'PAINT') def draw(self, context): layout = self.layout @@ -301,27 +297,28 @@ class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, bpy.types.Panel): layout.separator() # dissolve - if (surface.init_color_type == "COLOR"): + if surface.init_color_type == 'COLOR': layout.prop(surface, "init_color") - - if (surface.init_color_type == "TEXTURE"): + + elif surface.init_color_type == 'TEXTURE': layout.prop(surface, "init_texture") layout.prop_search(surface, "init_layername", ob.data, "uv_textures", text="UV Layer:") - - if (surface.init_color_type == "VERTEX_COLOR"): + + elif surface.init_color_type == 'VERTEX_COLOR': layout.prop_search(surface, "init_layername", ob.data, "vertex_colors", text="Color Layer: ") -class PHYSICS_PT_dp_effects(PhysicButtonsPanel, bpy.types.Panel): + +class PHYSICS_PT_dp_effects(PhysicButtonsPanel, Panel): bl_label = "Dynamic Paint Effects" bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): md = context.dynamic_paint - if (not (md and (md.ui_type == "CANVAS") and (md.canvas_settings))): - return False; + if not (md and md.ui_type == 'CANVAS' and md.canvas_settings): + return False surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active - return surface and (surface.surface_type == "PAINT") + return (surface and surface.surface_type == 'PAINT') def draw(self, context): layout = self.layout @@ -331,75 +328,75 @@ class PHYSICS_PT_dp_effects(PhysicButtonsPanel, bpy.types.Panel): layout.prop(surface, "effect_ui", expand=True) - if surface.effect_ui == "SPREAD": + if surface.effect_ui == 'SPREAD': layout.prop(surface, "use_spread") - col = layout.column() - col.active = surface.use_spread - split = col.split() - sub = split.column() - sub.prop(surface, "spread_speed") - sub = split.column() - sub.prop(surface, "color_spread_speed") - elif surface.effect_ui == "DRIP": + row = layout.row() + row.active = surface.use_spread + row.prop(surface, "spread_speed") + row.prop(surface, "color_spread_speed") + + elif surface.effect_ui == 'DRIP': layout.prop(surface, "use_drip") + col = layout.column() col.active = surface.use_drip effector_weights_ui(self, context, surface.effector_weights) - split = layout.split() layout.label(text="Surface Movement:") - split = layout.split() - col = split.column() - col.prop(surface, "drip_velocity", slider=True) - col = split.column() - col.prop(surface, "drip_acceleration", slider=True) + row = layout.row() + row.prop(surface, "drip_velocity", slider=True) + row.prop(surface, "drip_acceleration", slider=True) - elif surface.effect_ui == "SHRINK": + elif surface.effect_ui == 'SHRINK': layout.prop(surface, "use_shrink") - col = layout.column() - col.active = surface.use_shrink - col.prop(surface, "shrink_speed") - -class PHYSICS_PT_dp_cache(PhysicButtonsPanel, bpy.types.Panel): + row = layout.row() + row.active = surface.use_shrink + row.prop(surface, "shrink_speed") + + +class PHYSICS_PT_dp_cache(PhysicButtonsPanel, Panel): bl_label = "Dynamic Paint Cache" bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): md = context.dynamic_paint - return md and (md.ui_type == "CANVAS") and (md.canvas_settings) and \ - (md.canvas_settings.canvas_surfaces.active) and (md.canvas_settings.canvas_surfaces.active.uses_cache) + return (md and + md.ui_type == 'CANVAS' and + md.canvas_settings and + md.canvas_settings.canvas_surfaces.active and + md.canvas_settings.canvas_surfaces.active.uses_cache) def draw(self, context): layout = self.layout surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active cache = surface.point_cache - + point_cache_ui(self, context, cache, (cache.is_baked is False), 'DYNAMIC_PAINT') -class PHYSICS_PT_dp_brush_source(PhysicButtonsPanel, bpy.types.Panel): +class PHYSICS_PT_dp_brush_source(PhysicButtonsPanel, Panel): bl_label = "Dynamic Paint Source" @classmethod def poll(cls, context): md = context.dynamic_paint - return md and (md.ui_type == "BRUSH") and (md.brush_settings) + return md and md.ui_type == 'BRUSH' and md.brush_settings def draw(self, context): layout = self.layout brush = context.dynamic_paint.brush_settings ob = context.object - + split = layout.split() col = split.column() col.prop(brush, "paint_source") - if brush.paint_source == "PARTICLE_SYSTEM": + if brush.paint_source == 'PARTICLE_SYSTEM': col.prop_search(brush, "particle_system", ob, "particle_systems", text="") if brush.particle_system: col.label(text="Particle effect:") @@ -408,83 +405,86 @@ class PHYSICS_PT_dp_brush_source(PhysicButtonsPanel, bpy.types.Panel): sub.prop(brush, "solid_radius", text="Solid Radius") col.prop(brush, "use_particle_radius", text="Use Particle's Radius") col.prop(brush, "smooth_radius", text="Smooth radius") - + if brush.paint_source in {'DISTANCE', 'VOLUME_DISTANCE', 'POINT'}: col.prop(brush, "paint_distance", text="Paint Distance") split = layout.row().split(percentage=0.4) sub = split.column() if brush.paint_source == 'DISTANCE': sub.prop(brush, "proximity_project") - if brush.paint_source == "VOLUME_DISTANCE": + elif brush.paint_source == 'VOLUME_DISTANCE': sub.prop(brush, "proximity_inverse") - + sub = split.column() if brush.paint_source == 'DISTANCE': column = sub.column() column.active = brush.proximity_project column.prop(brush, "ray_direction") sub.prop(brush, "proximity_falloff") - if brush.proximity_falloff == "RAMP": + if brush.proximity_falloff == 'RAMP': col = layout.row().column() col.separator() col.prop(brush, "proximity_ramp_alpha", text="Only Use Alpha") col.template_color_ramp(brush, "paint_ramp", expand=True) - -class PHYSICS_PT_dp_brush_velocity(PhysicButtonsPanel, bpy.types.Panel): + + +class PHYSICS_PT_dp_brush_velocity(PhysicButtonsPanel, Panel): bl_label = "Dynamic Paint Velocity" bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): md = context.dynamic_paint - return md and (md.ui_type == "BRUSH") and (md.brush_settings) + return md and md.ui_type == 'BRUSH' and md.brush_settings def draw(self, context): layout = self.layout brush = context.dynamic_paint.brush_settings ob = context.object - + split = layout.split() + col = split.column() col.prop(brush, "velocity_alpha") col.prop(brush, "velocity_color") - col = split.column() - col.prop(brush, "velocity_depth") - sub = layout.row().column() - sub.active = (brush.velocity_alpha or brush.velocity_color or brush.velocity_depth) - sub.prop(brush, "max_velocity") - sub.template_color_ramp(brush, "velocity_ramp", expand=True) + + split.prop(brush, "velocity_depth") + + col = layout.column() + col.active = (brush.velocity_alpha or brush.velocity_color or brush.velocity_depth) + col.prop(brush, "max_velocity") + col.template_color_ramp(brush, "velocity_ramp", expand=True) layout.separator() - split = layout.split() - col = split.column() - col.prop(brush, "do_smudge") - col = split.column() - col.active = brush.do_smudge - col.prop(brush, "smudge_strength") - -class PHYSICS_PT_dp_brush_wave(PhysicButtonsPanel, bpy.types.Panel): + + row = layout.row() + row.prop(brush, "do_smudge") + sub = row.row() + sub.active = brush.do_smudge + sub.prop(brush, "smudge_strength") + + +class PHYSICS_PT_dp_brush_wave(PhysicButtonsPanel, Panel): bl_label = "Dynamic Paint Waves" bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): md = context.dynamic_paint - return md and (md.ui_type == "BRUSH") and (md.brush_settings) + return md and md.ui_type == 'BRUSH' and md.brush_settings def draw(self, context): layout = self.layout brush = context.dynamic_paint.brush_settings ob = context.object - + layout.prop(brush, "wave_type") - if (brush.wave_type != "REFLECT"): - split = layout.split(percentage=0.5) - col = split.column() - col.prop(brush, "wave_factor") - col = split.column() - col.prop(brush, "wave_clamp") + if brush.wave_type != 'REFLECT': + row = layout.row() + row.prop(brush, "wave_factor") + row.prop(brush, "wave_clamp") + def register(): bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index 2229b9dc3da..bc7f330a546 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -20,7 +20,7 @@ import bpy from bpy.types import Panel -from bl_ui.properties_physics_common import ( +from .properties_physics_common import ( basic_force_field_settings_ui, basic_force_field_falloff_ui, ) diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index ce65350e69b..a89249a6f75 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -40,151 +40,149 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel): layout = self.layout md = context.fluid + fluid = md.settings + + row = layout.row() + if fluid is None: + row.label("Built without fluids") + return + + row.prop(fluid, "type") + if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}: + row.prop(fluid, "use", text="") + + layout = layout.column() + if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}: + layout.active = fluid.use + + if fluid.type == 'DOMAIN': + layout.operator("fluid.bake", text="Bake (Req. Memory:" + " %s)" % fluid.memory_estimate, icon='MOD_FLUIDSIM') + split = layout.split() - if md: - fluid = md.settings - - row = layout.row() - if fluid is None: - row.label("Built without fluids") - return - - row.prop(fluid, "type") - if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}: - row.prop(fluid, "use", text="") - - layout = layout.column() - if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}: - layout.active = fluid.use - - if fluid.type == 'DOMAIN': - layout.operator("fluid.bake", text="Bake (Req. Memory:" + " %s)" % fluid.memory_estimate, icon='MOD_FLUIDSIM') - split = layout.split() - - col = split.column() - col.label(text="Resolution:") - col.prop(fluid, "resolution", text="Final") - col.label(text="Render Display:") - col.prop(fluid, "render_display_mode", text="") - - col = split.column() - col.label() - col.prop(fluid, "preview_resolution", text="Preview") - col.label(text="Viewport Display:") - col.prop(fluid, "viewport_display_mode", text="") - - split = layout.split() - - col = split.column() - col.label(text="Time:") - sub = col.column(align=True) - sub.prop(fluid, "start_time", text="Start") - sub.prop(fluid, "end_time", text="End") - - col = split.column() - col.label() - col.prop(fluid, "use_speed_vectors") - col.prop(fluid, "use_reverse_frames") - - layout.prop(fluid, "filepath", text="") - - elif fluid.type == 'FLUID': - split = layout.split() - - col = split.column() - col.label(text="Volume Initialization:") - col.prop(fluid, "volume_initialization", text="") - col.prop(fluid, "use_animated_mesh") - - col = split.column() - col.label(text="Initial Velocity:") - col.prop(fluid, "initial_velocity", text="") - - elif fluid.type == 'OBSTACLE': - split = layout.split() - - col = split.column() - col.label(text="Volume Initialization:") - col.prop(fluid, "volume_initialization", text="") - col.prop(fluid, "use_animated_mesh") - - col = split.column() - col.label(text="Slip Type:") - col.prop(fluid, "slip_type", text="") - if fluid.slip_type == 'PARTIALSLIP': - col.prop(fluid, "partial_slip_factor", slider=True, text="Amount") - - col.label(text="Impact:") - col.prop(fluid, "impact_factor", text="Factor") - - elif fluid.type == 'INFLOW': - split = layout.split() - - col = split.column() - col.label(text="Volume Initialization:") - col.prop(fluid, "volume_initialization", text="") - col.prop(fluid, "use_animated_mesh") - row = col.row() - row.active = not fluid.use_animated_mesh - row.prop(fluid, "use_local_coords") - - col = split.column() - col.label(text="Inflow Velocity:") - col.prop(fluid, "inflow_velocity", text="") - - elif fluid.type == 'OUTFLOW': - split = layout.split() - - col = split.column() - col.label(text="Volume Initialization:") - col.prop(fluid, "volume_initialization", text="") - col.prop(fluid, "use_animated_mesh") - - split.column() - - elif fluid.type == 'PARTICLE': - split = layout.split() - - col = split.column() - col.label(text="Influence:") - col.prop(fluid, "particle_influence", text="Size") - col.prop(fluid, "alpha_influence", text="Alpha") - - col = split.column() - col.label(text="Type:") - col.prop(fluid, "use_drops") - col.prop(fluid, "use_floats") - col.prop(fluid, "show_tracer") - - layout.prop(fluid, "filepath", text="") - - elif fluid.type == 'CONTROL': - split = layout.split() - - col = split.column() - col.label(text="") - col.prop(fluid, "quality", slider=True) - col.prop(fluid, "use_reverse_frames") - - col = split.column() - col.label(text="Time:") - sub = col.column(align=True) - sub.prop(fluid, "start_time", text="Start") - sub.prop(fluid, "end_time", text="End") - - split = layout.split() - - col = split.column() - col.label(text="Attraction Force:") - sub = col.column(align=True) - sub.prop(fluid, "attraction_strength", text="Strength") - sub.prop(fluid, "attraction_radius", text="Radius") - - col = split.column() - col.label(text="Velocity Force:") - sub = col.column(align=True) - sub.prop(fluid, "velocity_strength", text="Strength") - sub.prop(fluid, "velocity_radius", text="Radius") + col = split.column() + col.label(text="Resolution:") + col.prop(fluid, "resolution", text="Final") + col.label(text="Render Display:") + col.prop(fluid, "render_display_mode", text="") + + col = split.column() + col.label() + col.prop(fluid, "preview_resolution", text="Preview") + col.label(text="Viewport Display:") + col.prop(fluid, "viewport_display_mode", text="") + + split = layout.split() + + col = split.column() + col.label(text="Time:") + sub = col.column(align=True) + sub.prop(fluid, "start_time", text="Start") + sub.prop(fluid, "end_time", text="End") + + col = split.column() + col.label() + col.prop(fluid, "use_speed_vectors") + col.prop(fluid, "use_reverse_frames") + + layout.prop(fluid, "filepath", text="") + + elif fluid.type == 'FLUID': + split = layout.split() + + col = split.column() + col.label(text="Volume Initialization:") + col.prop(fluid, "volume_initialization", text="") + col.prop(fluid, "use_animated_mesh") + + col = split.column() + col.label(text="Initial Velocity:") + col.prop(fluid, "initial_velocity", text="") + + elif fluid.type == 'OBSTACLE': + split = layout.split() + + col = split.column() + col.label(text="Volume Initialization:") + col.prop(fluid, "volume_initialization", text="") + col.prop(fluid, "use_animated_mesh") + + col = split.column() + col.label(text="Slip Type:") + col.prop(fluid, "slip_type", text="") + if fluid.slip_type == 'PARTIALSLIP': + col.prop(fluid, "partial_slip_factor", slider=True, text="Amount") + + col.label(text="Impact:") + col.prop(fluid, "impact_factor", text="Factor") + + elif fluid.type == 'INFLOW': + split = layout.split() + + col = split.column() + col.label(text="Volume Initialization:") + col.prop(fluid, "volume_initialization", text="") + col.prop(fluid, "use_animated_mesh") + row = col.row() + row.active = not fluid.use_animated_mesh + row.prop(fluid, "use_local_coords") + + col = split.column() + col.label(text="Inflow Velocity:") + col.prop(fluid, "inflow_velocity", text="") + + elif fluid.type == 'OUTFLOW': + split = layout.split() + + col = split.column() + col.label(text="Volume Initialization:") + col.prop(fluid, "volume_initialization", text="") + col.prop(fluid, "use_animated_mesh") + + split.column() + + elif fluid.type == 'PARTICLE': + split = layout.split() + + col = split.column() + col.label(text="Influence:") + col.prop(fluid, "particle_influence", text="Size") + col.prop(fluid, "alpha_influence", text="Alpha") + + col = split.column() + col.label(text="Type:") + col.prop(fluid, "use_drops") + col.prop(fluid, "use_floats") + col.prop(fluid, "show_tracer") + + layout.prop(fluid, "filepath", text="") + + elif fluid.type == 'CONTROL': + split = layout.split() + + col = split.column() + col.label(text="") + col.prop(fluid, "quality", slider=True) + col.prop(fluid, "use_reverse_frames") + + col = split.column() + col.label(text="Time:") + sub = col.column(align=True) + sub.prop(fluid, "start_time", text="Start") + sub.prop(fluid, "end_time", text="End") + + split = layout.split() + + col = split.column() + col.label(text="Attraction Force:") + sub = col.column(align=True) + sub.prop(fluid, "attraction_strength", text="Strength") + sub.prop(fluid, "attraction_radius", text="Radius") + + col = split.column() + col.label(text="Velocity Force:") + sub = col.column(align=True) + sub.prop(fluid, "velocity_strength", text="Strength") + sub.prop(fluid, "velocity_radius", text="Radius") class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index e270b53d6bb..4c413647210 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -20,7 +20,7 @@ import bpy from bpy.types import Panel -from bl_ui.properties_physics_common import ( +from .properties_physics_common import ( point_cache_ui, effector_weights_ui, ) @@ -47,60 +47,59 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel): md = context.smoke ob = context.object - if md: - layout.prop(md, "smoke_type", expand=True) + layout.prop(md, "smoke_type", expand=True) - if md.smoke_type == 'DOMAIN': - domain = md.domain_settings + if md.smoke_type == 'DOMAIN': + domain = md.domain_settings - split = layout.split() + split = layout.split() - split.enabled = not domain.point_cache.is_baked + split.enabled = not domain.point_cache.is_baked - col = split.column() - col.label(text="Resolution:") - col.prop(domain, "resolution_max", text="Divisions") - col.label(text="Time:") - col.prop(domain, "time_scale", text="Scale") - col.label(text="Border Collisions:") - col.prop(domain, "collision_extents", text="") + col = split.column() + col.label(text="Resolution:") + col.prop(domain, "resolution_max", text="Divisions") + col.label(text="Time:") + col.prop(domain, "time_scale", text="Scale") + col.label(text="Border Collisions:") + col.prop(domain, "collision_extents", text="") - col = split.column() - col.label(text="Behavior:") - col.prop(domain, "alpha") - col.prop(domain, "beta", text="Temp. Diff.") - col.prop(domain, "vorticity") - col.prop(domain, "use_dissolve_smoke", text="Dissolve") - sub = col.column() - sub.active = domain.use_dissolve_smoke - sub.prop(domain, "dissolve_speed", text="Time") - sub.prop(domain, "use_dissolve_smoke_log", text="Slow") + col = split.column() + col.label(text="Behavior:") + col.prop(domain, "alpha") + col.prop(domain, "beta", text="Temp. Diff.") + col.prop(domain, "vorticity") + col.prop(domain, "use_dissolve_smoke", text="Dissolve") + sub = col.column() + sub.active = domain.use_dissolve_smoke + sub.prop(domain, "dissolve_speed", text="Time") + sub.prop(domain, "use_dissolve_smoke_log", text="Slow") - elif md.smoke_type == 'FLOW': + elif md.smoke_type == 'FLOW': - flow = md.flow_settings + flow = md.flow_settings - split = layout.split() + split = layout.split() - col = split.column() - col.prop(flow, "use_outflow") - col.label(text="Particle System:") - col.prop_search(flow, "particle_system", ob, "particle_systems", text="") + col = split.column() + col.prop(flow, "use_outflow") + col.label(text="Particle System:") + col.prop_search(flow, "particle_system", ob, "particle_systems", text="") - sub = col.column() - sub.active = not md.flow_settings.use_outflow + sub = col.column() + sub.active = not md.flow_settings.use_outflow - sub.prop(flow, "initial_velocity", text="Initial Velocity") - sub = sub.column() - sub.active = flow.initial_velocity - sub.prop(flow, "velocity_factor", text="Multiplier") + sub.prop(flow, "initial_velocity", text="Initial Velocity") + sub = sub.column() + sub.active = flow.initial_velocity + sub.prop(flow, "velocity_factor", text="Multiplier") - sub = split.column() - sub.active = not md.flow_settings.use_outflow - sub.label(text="Initial Values:") - sub.prop(flow, "use_absolute") - sub.prop(flow, "density") - sub.prop(flow, "temperature") + sub = split.column() + sub.active = not md.flow_settings.use_outflow + sub.label(text="Initial Values:") + sub.prop(flow, "use_absolute") + sub.prop(flow, "density") + sub.prop(flow, "temperature") class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py b/release/scripts/startup/bl_ui/properties_physics_softbody.py index b9f8910fa59..78c74a7e1d3 100644 --- a/release/scripts/startup/bl_ui/properties_physics_softbody.py +++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py @@ -20,7 +20,7 @@ import bpy from bpy.types import Panel -from bl_ui.properties_physics_common import ( +from .properties_physics_common import ( point_cache_ui, effector_weights_ui, ) @@ -39,8 +39,6 @@ class PhysicButtonsPanel(): def poll(cls, context): ob = context.object rd = context.scene.render -# return (ob and ob.type == 'MESH') and (not rd.use_game_engine) -# i really hate touching things i do not understand completely .. but i think this should read (bjornmose) return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine) and (context.soft_body) @@ -53,22 +51,21 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, Panel): md = context.soft_body ob = context.object - if md: - softbody = md.settings + softbody = md.settings - # General - split = layout.split() - split.enabled = softbody_panel_enabled(md) + # General + split = layout.split() + split.enabled = softbody_panel_enabled(md) - col = split.column() - col.label(text="Object:") - col.prop(softbody, "friction") - col.prop(softbody, "mass") - col.prop_search(softbody, "vertex_group_mass", ob, "vertex_groups", text="Mass:") + col = split.column() + col.label(text="Object:") + col.prop(softbody, "friction") + col.prop(softbody, "mass") + col.prop_search(softbody, "vertex_group_mass", ob, "vertex_groups", text="Mass:") - col = split.column() - col.label(text="Simulation:") - col.prop(softbody, "speed") + col = split.column() + col.label(text="Simulation:") + col.prop(softbody, "speed") class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 73947c21a80..9ba0309aacd 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -44,7 +44,7 @@ class TEXTURE_MT_envmap_specials(Menu): layout.operator("texture.envmap_clear", icon='FILE_REFRESH') layout.operator("texture.envmap_clear_all", icon='FILE_REFRESH') -from bl_ui.properties_material import active_node_mat +from .properties_material import active_node_mat def context_tex_datablock(context): @@ -726,7 +726,7 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, Panel): col.prop(pd, "falloff", text="") if pd.falloff == 'SOFT': col.prop(pd, "falloff_soft") - if pd.falloff == "PARTICLE_VELOCITY": + if pd.falloff == 'PARTICLE_VELOCITY': col.prop(pd, "falloff_speed_scale") col.prop(pd, "use_falloff_curve") diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index b57d421dfaf..5f7462ce44e 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -26,7 +26,7 @@ class GRAPH_HT_header(Header): bl_space_type = 'GRAPH_EDITOR' def draw(self, context): - from bl_ui.space_dopesheet import dopesheet_filter + from .space_dopesheet import dopesheet_filter layout = self.layout diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 170ba3ccd0e..81526797109 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -312,19 +312,19 @@ class IMAGE_MT_uvs_select_mode(Menu): else: prop = layout.operator("wm.context_set_string", text="Vertex", icon='UV_VERTEXSEL') - prop.value = "VERTEX" + prop.value = 'VERTEX' prop.data_path = "tool_settings.uv_select_mode" prop = layout.operator("wm.context_set_string", text="Edge", icon='UV_EDGESEL') - prop.value = "EDGE" + prop.value = 'EDGE' prop.data_path = "tool_settings.uv_select_mode" prop = layout.operator("wm.context_set_string", text="Face", icon='UV_FACESEL') - prop.value = "FACE" + prop.value = 'FACE' prop.data_path = "tool_settings.uv_select_mode" prop = layout.operator("wm.context_set_string", text="Island", icon='UV_ISLANDSEL') - prop.value = "ISLAND" + prop.value = 'ISLAND' prop.data_path = "tool_settings.uv_select_mode" diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py index c878c20c8a7..59057166ec4 100644 --- a/release/scripts/startup/bl_ui/space_nla.py +++ b/release/scripts/startup/bl_ui/space_nla.py @@ -26,7 +26,7 @@ class NLA_HT_header(Header): bl_space_type = 'NLA_EDITOR' def draw(self, context): - from bl_ui.space_dopesheet import dopesheet_filter + from .space_dopesheet import dopesheet_filter layout = self.layout diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index a4dcf64b679..c1c9bc12b2d 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -456,7 +456,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel): elif strip.type == 'TRANSFORM': self.draw_panel_transform(strip) - elif strip.type == "MULTICAM": + elif strip.type == 'MULTICAM': layout.prop(strip, "multicam_source") row = layout.row(align=True) diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py index 0ce2df0e47e..72818dfc642 100644 --- a/release/scripts/startup/bl_ui/space_time.py +++ b/release/scripts/startup/bl_ui/space_time.py @@ -92,7 +92,7 @@ class TIME_HT_header(Header): row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT') -class TIME_MT_marker(bpy.types.Menu): +class TIME_MT_marker(Menu): bl_label = "Marker" def draw(self, context): diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index a2ede26ecc6..51f55fe019c 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -743,7 +743,7 @@ class USERPREF_PT_file(Panel): sub.active = paths.use_auto_save_temporary_files sub.prop(paths, "auto_save_time", text="Timer (mins)") -from bl_ui.space_userpref_keymap import InputKeyMapPanel +from .space_userpref_keymap import InputKeyMapPanel class USERPREF_MT_ndof_settings(Menu): diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 0631ccf2f70..5bf3906fca4 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -1538,10 +1538,10 @@ class VIEW3D_MT_edit_mesh_extrude(Menu): bl_label = "Extrude" _extrude_funcs = { - "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"), - "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"), - "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"), - "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"), + 'VERT': lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"), + 'EDGE': lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"), + 'FACE': lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"), + 'REGION': lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"), } @staticmethod @@ -1551,11 +1551,11 @@ class VIEW3D_MT_edit_mesh_extrude(Menu): menu = [] if mesh.total_face_sel: - menu += ["REGION", "FACE"] + menu += ['REGION', 'FACE'] if mesh.total_edge_sel and (select_mode[0] or select_mode[1]): - menu += ["EDGE"] + menu += ['EDGE'] if mesh.total_vert_sel and select_mode[0]: - menu += ["VERT"] + menu += ['VERT'] # should never get here return menu diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index 75b1f74a403..d7e0f8bdaae 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -6,7 +6,7 @@ * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * - * Contributor(s): Miika Hämäläinen + * Contributor(s): Miika Hämäläinen * * ***** END GPL LICENSE BLOCK ***** */ @@ -24,7 +24,7 @@ typedef struct PaintSurfaceData { struct PaintAdjData *adj_data; /* adjacency data for current surface */ struct PaintBakeData *bData; /* temporary per step data used for frame calculation */ - unsigned int total_points; + int total_points; } PaintSurfaceData; @@ -66,7 +66,7 @@ void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface); int dynamicPaint_surfaceHasColorPreview(struct DynamicPaintSurface *surface); int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, struct Object *ob, int index); void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface); -void dynamicPaintSurface_setUniqueName(struct DynamicPaintSurface *surface, char *basename); +void dynamicPaintSurface_setUniqueName(struct DynamicPaintSurface *surface, const char *basename); void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas); struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings *canvas); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 2ef942a2e09..ecc00901dd5 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -116,6 +116,22 @@ int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3 void *object_tfm_backup(struct Object *ob); void object_tfm_restore(struct Object *ob, void *obtfm_pt); +typedef struct ObjectTfmProtectedChannels { + float loc[3], dloc[3]; + float size[3], dsize[3]; + float rot[3], drot[3]; + float quat[4], dquat[4]; + float rotAxis[3], drotAxis[3]; + float rotAngle, drotAngle; +} ObjectTfmProtectedChannels; + +void object_tfm_protected_backup(const struct Object *ob, + ObjectTfmProtectedChannels *obtfm); + +void object_tfm_protected_restore(struct Object *ob, + const ObjectTfmProtectedChannels *obtfm, + const short protectflag); + void object_handle_update(struct Scene *scene, struct Object *ob); void object_sculpt_modifiers_changed(struct Object *ob); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 148f5aabf8d..9705c55b80c 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -181,6 +181,7 @@ set(SRC BKE_deform.h BKE_depsgraph.h BKE_displist.h + BKE_dynamicpaint.h BKE_effect.h BKE_fcurve.h BKE_fluidsim.h diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 9d1401acdfc..354aa57e200 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -6,7 +6,7 @@ * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * - * Contributor(s): Miika Hämäläinen + * Contributor(s): Miika Hämäläinen * * ***** END GPL LICENSE BLOCK ***** */ @@ -120,9 +120,9 @@ typedef struct VolumeGrid { Bounds3D grid_bounds; /* whole grid bounds */ Bounds3D *bounds; /* (x*y*z) precalculated grid cell bounds */ - unsigned int *s_pos; /* (x*y*z) t_index begin id */ - unsigned int *s_num; /* (x*y*z) number of t_index points */ - unsigned int *t_index; /* actual surface point index, + int *s_pos; /* (x*y*z) t_index begin id */ + int *s_num; /* (x*y*z) number of t_index points */ + int *t_index; /* actual surface point index, access: (s_pos+s_num) */ } VolumeGrid; @@ -145,8 +145,8 @@ typedef struct PaintBakeNormal { typedef struct PaintBakeData { /* point space data */ PaintBakeNormal *bNormal; - unsigned int *s_pos; /* index to start reading point sample realCoord */ - unsigned int *s_num; /* num of realCoord samples */ + int *s_pos; /* index to start reading point sample realCoord */ + int *s_num; /* num of realCoord samples */ Vec3f *realCoord; /* current pixel center world-space coordinates for each sample * ordered as (s_pos+s_num)*/ @@ -193,18 +193,18 @@ typedef struct EffVelPoint { #define ADJ_ON_MESH_EDGE (1<<0) typedef struct PaintAdjData { - unsigned int *n_target; /* array of neighbouring point indexes, + int *n_target; /* array of neighbouring point indexes, for single sample use (n_index+neigh_num) */ - unsigned int *n_index; /* index to start reading n_target for each point */ - unsigned int *n_num; /* num of neighs for each point */ - unsigned int *flags; /* vertex adjacency flags */ - unsigned int total_targets; /* size of n_target */ + int *n_index; /* index to start reading n_target for each point */ + int *n_num; /* num of neighs for each point */ + int *flags; /* vertex adjacency flags */ + int total_targets; /* size of n_target */ } PaintAdjData; /***************************** General Utils ******************************/ /* Set canvas error string to display at the bake report */ -static int setError(DynamicPaintCanvasSettings *canvas, char *string) +static int setError(DynamicPaintCanvasSettings *canvas, const char *string) { /* Add error to canvas ui info label */ BLI_snprintf(canvas->error, sizeof(canvas->error), string); @@ -339,7 +339,7 @@ static int surface_duplicateNameExists(void *arg, const char *name) return 0; } -void dynamicPaintSurface_setUniqueName(DynamicPaintSurface *surface, char *basename) +void dynamicPaintSurface_setUniqueName(DynamicPaintSurface *surface, const char *basename) { char name[64]; BLI_strncpy(name, basename, sizeof(name)); /* in case basename is surface->name use a copy */ @@ -488,7 +488,7 @@ static void scene_setSubframe(Scene *scene, float subframe) #define BRUSH_USES_VELOCITY (1<<0) -static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene, Object *ob) +static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene) { Base *base = NULL; GroupObject *go = NULL; @@ -704,7 +704,7 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface) for (i=0; i<sData->total_points; i++) { int co[3], j; for (j=0; j<3; j++) { - co[j] = floor((bData->realCoord[bData->s_pos[i]].v[j] - grid->grid_bounds.min[j])/dim[j]*grid->dim[j]); + co[j] = (int)floor((bData->realCoord[bData->s_pos[i]].v[j] - grid->grid_bounds.min[j])/dim[j]*grid->dim[j]); CLAMP(co[j], 0, grid->dim[j]-1); } @@ -972,7 +972,7 @@ struct DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSett surface->wave_damping = 0.05f; surface->wave_speed = 1.0f; surface->wave_timescale = 1.0f; - surface->wave_spring = 0.20; + surface->wave_spring = 0.20f; BLI_snprintf(surface->image_output_path, sizeof(surface->image_output_path), "%sdynamicpaint", U.textudir); BLI_cleanup_dir(NULL, surface->image_output_path); @@ -1516,7 +1516,9 @@ static void dynamicPaint_applySurfaceDisplace(DynamicPaintSurface *surface, Deri /* * Apply canvas data to the object derived mesh */ -static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Scene *scene, Object *ob, DerivedMesh *dm) +static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, + Object *ob, + DerivedMesh *dm) { DerivedMesh *result = CDDM_copy(dm); @@ -1801,7 +1803,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene BKE_ptcache_id_from_dynamicpaint(&pid, ob, surface); pid.cache->startframe = surface->start_frame; pid.cache->endframe = surface->end_frame; - BKE_ptcache_id_time(&pid, scene, scene->r.cfra, NULL, NULL, NULL); + BKE_ptcache_id_time(&pid, scene, (float)scene->r.cfra, NULL, NULL, NULL); /* reset non-baked cache at first frame */ if((int)scene->r.cfra == surface->start_frame && !(cache->flag & PTCACHE_BAKED)) @@ -1843,7 +1845,7 @@ struct DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, Scen dynamicPaint_frameUpdate(pmd, scene, ob, dm); /* Return output mesh */ - return dynamicPaint_Modifier_apply(pmd, scene, ob, dm); + return dynamicPaint_Modifier_apply(pmd, ob, dm); } @@ -2068,7 +2070,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) PaintUVPoint *tempPoints = NULL; Vec3f *tempWeights = NULL; - MVert *mvert = NULL; + /* MVert *mvert = NULL; */ /* UNUSED */ MFace *mface = NULL; MTFace *tface = NULL; Bounds2D *faceBB = NULL; @@ -2079,7 +2081,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) return setError(canvas, "Can't bake non-\"image sequence\" formats."); numOfFaces = dm->getNumFaces(dm); - mvert = dm->getVertArray(dm); + /* mvert = dm->getVertArray(dm); */ /* UNUSED */ mface = dm->getFaceArray(dm); /* get uv layer */ @@ -3039,7 +3041,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Scene *scene, Object *ob, Dy } /* calculate velocity for object center point */ -static void dynamicPaint_brushObjectCalculateVelocity(Scene *scene, Object *ob, DynamicPaintBrushSettings *brush, Vec3f *brushVel, float timescale) +static void dynamicPaint_brushObjectCalculateVelocity(Scene *scene, Object *ob, Vec3f *brushVel, float timescale) { float prev_obmat[4][4]; float cur_loc[3] = {0.0f}, prev_loc[3] = {0.0f}; @@ -3076,7 +3078,12 @@ static void dynamicPaint_brushObjectCalculateVelocity(Scene *scene, Object *ob, /* * Paint a brush object mesh to the surface */ -static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, DynamicPaintBrushSettings *brush, Object *canvasOb, Object *brushOb, BrushMaterials *bMats, Scene *scene, float timescale) +static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, + DynamicPaintBrushSettings *brush, + Object *brushOb, + BrushMaterials *bMats, + Scene *scene, + float timescale) { PaintSurfaceData *sData = surface->data; PaintBakeData *bData = sData->bData; @@ -3449,7 +3456,10 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, DynamicPaintBrus /* * Paint a particle system to the surface */ -static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, ParticleSystem *psys, DynamicPaintBrushSettings *brush, Object *canvasOb, float timescale) +static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, + ParticleSystem *psys, + DynamicPaintBrushSettings *brush, + float timescale) { ParticleSettings *part=psys->part; ParticleData *pa = NULL; @@ -3686,7 +3696,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, ParticleSys /* paint a single point of defined proximity radius to the surface */ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *pointCoord, DynamicPaintBrushSettings *brush, - Object *canvasOb, Object *brushOb, BrushMaterials *bMats, Scene *scene, float timescale) + Object *brushOb, BrushMaterials *bMats, Scene *scene, float timescale) { int index; PaintSurfaceData *sData = surface->data; @@ -3694,7 +3704,7 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po Vec3f brushVel; if (brush->flags & MOD_DPAINT_USES_VELOCITY) - dynamicPaint_brushObjectCalculateVelocity(scene, brushOb, brush, &brushVel, timescale); + dynamicPaint_brushObjectCalculateVelocity(scene, brushOb, &brushVel, timescale); /* * Loop through every surface point @@ -4208,7 +4218,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force float closest_d[2]; /* adjust drip speed depending on wetness */ - float w_factor = pPoint_prev->wetness*0.5 - 0.025f; + float w_factor = pPoint_prev->wetness*0.5f - 0.025f; if (w_factor <= 0) continue; /* get force affect points */ @@ -4283,7 +4293,7 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale) average_dist /= sData->adj_data->total_targets; /* determine number of required steps */ - steps = ceil((WAVE_TIME_FAC*timescale*surface->wave_timescale) / (average_dist/wave_speed/3)); + steps = (int)ceil((WAVE_TIME_FAC*timescale*surface->wave_timescale) / (average_dist/wave_speed/3)); CLAMP(steps, 1, 15); timescale /= steps; @@ -4472,12 +4482,12 @@ static int dynamicPaint_surfaceHasMoved(DynamicPaintSurface *surface, Object *ob return ret; } -static int surface_needsVelocityData(DynamicPaintSurface *surface, Scene *scene, Object *ob) +static int surface_needsVelocityData(DynamicPaintSurface *surface, Scene *scene, Object *UNUSED(ob)) { if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) return 1; - if (surface_getBrushFlags(surface, scene, ob) & BRUSH_USES_VELOCITY) + if (surface_getBrushFlags(surface, scene) & BRUSH_USES_VELOCITY) return 1; return 0; @@ -4783,16 +4793,16 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su /* Paint a particle system */ BKE_animsys_evaluate_animdata(scene, &brush->psys->part->id, brush->psys->part->adt, BKE_curframe(scene), ADT_RECALC_ANIM); - dynamicPaint_paintParticles(surface, brush->psys, brush, ob, timescale); + dynamicPaint_paintParticles(surface, brush->psys, brush, timescale); } } /* Object center distance: */ else if (brush->collision == MOD_DPAINT_COL_POINT && brushObj != ob) { - dynamicPaint_paintSinglePoint(surface, brushObj->loc, brush, ob, brushObj, &bMats, scene, timescale); + dynamicPaint_paintSinglePoint(surface, brushObj->loc, brush, brushObj, &bMats, scene, timescale); } /* Mesh volume/proximity: */ else if (brushObj != ob) { - dynamicPaint_paintMesh(surface, brush, ob, brushObj, &bMats, scene, timescale); + dynamicPaint_paintMesh(surface, brush, brushObj, &bMats, scene, timescale); } /* free temp material data */ @@ -4878,4 +4888,4 @@ int dynamicPaint_calculateFrame(DynamicPaintSurface *surface, Scene *scene, Obje } return dynamicPaint_doStep(scene, cObject, surface, timescale, 0.0f); -}
\ No newline at end of file +} diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 44a398b8bbe..5cbce85844e 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1499,6 +1499,71 @@ void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat) } } +void object_tfm_protected_backup(const Object *ob, + ObjectTfmProtectedChannels *obtfm) +{ + +#define TFMCPY( _v) (obtfm->_v = ob->_v) +#define TFMCPY3D( _v) copy_v3_v3(obtfm->_v, ob->_v) +#define TFMCPY4D( _v) copy_v4_v4(obtfm->_v, ob->_v) + + TFMCPY3D(loc); + TFMCPY3D(dloc); + TFMCPY3D(size); + TFMCPY3D(dsize); + TFMCPY3D(rot); + TFMCPY3D(drot); + TFMCPY4D(quat); + TFMCPY4D(dquat); + TFMCPY3D(rotAxis); + TFMCPY3D(drotAxis); + TFMCPY(rotAngle); + TFMCPY(drotAngle); + +#undef TFMCPY +#undef TFMCPY3D +#undef TFMCPY4D + +} + +void object_tfm_protected_restore(Object *ob, + const ObjectTfmProtectedChannels *obtfm, + const short protectflag) +{ + unsigned int i; + + for (i= 0; i < 3; i++) { + if (protectflag & (OB_LOCK_LOCX<<i)) { + ob->loc[i]= obtfm->loc[i]; + ob->dloc[i]= obtfm->dloc[i]; + } + + if (protectflag & (OB_LOCK_SCALEX<<i)) { + ob->size[i]= obtfm->size[i]; + ob->dsize[i]= obtfm->dsize[i]; + } + + if (protectflag & (OB_LOCK_ROTX<<i)) { + ob->rot[i]= obtfm->rot[i]; + ob->drot[i]= obtfm->drot[i]; + + ob->quat[i + 1]= obtfm->quat[i + 1]; + ob->dquat[i + 1]= obtfm->dquat[i + 1]; + + ob->rotAxis[i]= obtfm->rotAxis[i]; + ob->drotAxis[i]= obtfm->drotAxis[i]; + } + } + + if ((protectflag & OB_LOCK_ROT4D) && (protectflag & OB_LOCK_ROTW)) { + ob->quat[0]= obtfm->quat[0]; + ob->dquat[0]= obtfm->dquat[0]; + + ob->rotAngle= obtfm->rotAngle; + ob->drotAngle= obtfm->drotAngle; + } +} + /* see pchan_apply_mat4() for the equivalent 'pchan' function */ void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const short use_parent) { diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index c256e99cd24..a9aeb37e478 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -122,7 +122,7 @@ static int ptcache_extra_datasize[] = { /* forward declerations */ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result, unsigned int len); static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, unsigned int in_len, unsigned char *out, int mode); -static int ptcache_file_write(PTCacheFile *pf, void *f, unsigned int tot, unsigned int size); +static int ptcache_file_write(PTCacheFile *pf, const void *f, unsigned int tot, unsigned int size); static int ptcache_file_read(PTCacheFile *pf, void *f, unsigned int tot, unsigned int size); /* Common functions */ @@ -656,12 +656,12 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v) return 1; } #else // WITH_SMOKE -static int ptcache_smoke_totpoint(void *UNUSED(smoke_v), int UNUSED(cfra)) { return 0; }; -static void ptcache_smoke_read(PTCacheFile *UNUSED(pf), void *UNUSED(smoke_v)) {} +static int ptcache_smoke_totpoint(void *UNUSED(smoke_v), int UNUSED(cfra)) { return 0; } +static int ptcache_smoke_read(PTCacheFile *UNUSED(pf), void *UNUSED(smoke_v)) { return 0; } static int ptcache_smoke_write(PTCacheFile *UNUSED(pf), void *UNUSED(smoke_v)) { return 0; } #endif // WITH_SMOKE -static int ptcache_dynamicpaint_totpoint(void *sd, int cfra) +static int ptcache_dynamicpaint_totpoint(void *sd, int UNUSED(cfra)) { DynamicPaintSurface *surface = (DynamicPaintSurface*)sd; @@ -680,7 +680,7 @@ static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v) ptcache_file_write(pf, DPAINT_CACHE_VERSION, 1, sizeof(char)*4); if(surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) { - unsigned int total_points=surface->data->total_points; + int total_points=surface->data->total_points; unsigned int in_len; unsigned char *out; @@ -1261,7 +1261,7 @@ static int ptcache_file_read(PTCacheFile *pf, void *f, unsigned int tot, unsigne { return (fread(f, size, tot, pf->fp) == tot); } -static int ptcache_file_write(PTCacheFile *pf, void *f, unsigned int tot, unsigned int size) +static int ptcache_file_write(PTCacheFile *pf, const void *f, unsigned int tot, unsigned int size) { return (fwrite(f, size, tot, pf->fp) == tot); } diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 299a85f8207..e92b445c27f 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -687,4 +687,4 @@ void BLI_end_threaded_malloc(void) thread_levels--; if(thread_levels==0) MEM_set_lock_callback(NULL, NULL); -}
\ No newline at end of file +} diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 4d1b5895f66..547e782e872 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2125,11 +2125,61 @@ static void lib_link_nodetree(FileData *fd, Main *main) } } +static void do_versions_socket_default_value(bNodeSocket *sock) +{ + bNodeSocketValueFloat *valfloat; + bNodeSocketValueVector *valvector; + bNodeSocketValueRGBA *valrgba; + + if (sock->default_value) + return; + + switch (sock->type) { + case SOCK_FLOAT: + valfloat = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueFloat), "default socket value"); + valfloat->value = sock->ns.vec[0]; + valfloat->min = sock->ns.min; + valfloat->max = sock->ns.max; + valfloat->subtype = PROP_NONE; + break; + case SOCK_VECTOR: + valvector = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueVector), "default socket value"); + copy_v3_v3(valvector->value, sock->ns.vec); + valvector->min = sock->ns.min; + valvector->max = sock->ns.max; + valvector->subtype = PROP_NONE; + break; + case SOCK_RGBA: + valrgba = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueRGBA), "default socket value"); + copy_v4_v4(valrgba->value, sock->ns.vec); + break; + } +} + +static void do_versions_nodetree_default_value(bNodeTree *ntree) +{ + bNode *node; + bNodeSocket *sock; + for (node=ntree->nodes.first; node; node=node->next) { + for (sock=node->inputs.first; sock; sock=sock->next) + do_versions_socket_default_value(sock); + for (sock=node->outputs.first; sock; sock=sock->next) + do_versions_socket_default_value(sock); + } + for (sock=ntree->inputs.first; sock; sock=sock->next) + do_versions_socket_default_value(sock); + for (sock=ntree->outputs.first; sock; sock=sock->next) + do_versions_socket_default_value(sock); +} + static void lib_nodetree_init_types_cb(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree) { bNode *node; ntreeInitTypes(ntree); + + /* need to do this here instead of in do_versions, otherwise next function can crash */ + do_versions_nodetree_default_value(ntree); /* XXX could be replaced by do_versions for new nodes */ for (node=ntree->nodes.first; node; node=node->next) @@ -7247,53 +7297,6 @@ static void do_version_bone_roll_256(Bone *bone) do_version_bone_roll_256(child); } -static void do_versions_socket_default_value(bNodeSocket *sock) -{ - bNodeSocketValueFloat *valfloat; - bNodeSocketValueVector *valvector; - bNodeSocketValueRGBA *valrgba; - - if (sock->default_value) - return; - - switch (sock->type) { - case SOCK_FLOAT: - valfloat = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueFloat), "default socket value"); - valfloat->value = sock->ns.vec[0]; - valfloat->min = sock->ns.min; - valfloat->max = sock->ns.max; - valfloat->subtype = PROP_NONE; - break; - case SOCK_VECTOR: - valvector = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueVector), "default socket value"); - copy_v3_v3(valvector->value, sock->ns.vec); - valvector->min = sock->ns.min; - valvector->max = sock->ns.max; - valvector->subtype = PROP_NONE; - break; - case SOCK_RGBA: - valrgba = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueRGBA), "default socket value"); - copy_v4_v4(valrgba->value, sock->ns.vec); - break; - } -} - -static void do_versions_nodetree_default_value(bNodeTree *ntree) -{ - bNode *node; - bNodeSocket *sock; - for (node=ntree->nodes.first; node; node=node->next) { - for (sock=node->inputs.first; sock; sock=sock->next) - do_versions_socket_default_value(sock); - for (sock=node->outputs.first; sock; sock=sock->next) - do_versions_socket_default_value(sock); - } - for (sock=ntree->inputs.first; sock; sock=sock->next) - do_versions_socket_default_value(sock); - for (sock=ntree->outputs.first; sock; sock=sock->next) - do_versions_socket_default_value(sock); -} - static void do_versions_nodetree_dynamic_sockets(bNodeTree *ntree) { bNodeSocket *sock; diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 4e8aadecfc7..27c61e98e21 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -41,7 +41,7 @@ struct wmWindowManager; /* space_image.c, exported for transform */ struct Image *ED_space_image(struct SpaceImage *sima); -void ED_space_image_set(struct bContext *C, struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima); +void ED_space_image_set(struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima); struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **lock_r); void ED_space_image_release_buffer(struct SpaceImage *sima, void *lock); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index b36416151a9..0fbf5a8bd92 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -700,6 +700,9 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + /* nullify inverse matrix first */ + unit_m4(data->invmat); + /* try to find a pose channel */ // TODO: get from context instead? if (ob && ob->pose) @@ -733,18 +736,15 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) where_is_pose(scene, ob); } else if (ob) { - Object workob; - /* use what_does_parent to find inverse - just like for normal parenting. - * NOTE: what_does_parent uses a static workob defined in object.c - */ + Object workob = {{0}}; + + /* use what_does_parent to find inverse - just like for normal parenting */ what_does_parent(scene, ob, &workob); invert_m4_m4(data->invmat, workob.obmat); } - else - unit_m4(data->invmat); - + WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob); - + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index 888b5af01bb..550da63d7aa 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -24,6 +24,7 @@ #include "BLI_blenlib.h" #include "BLI_string.h" +#include "BLI_utildefines.h" #include "DNA_dynamicpaint_types.h" #include "DNA_modifier_types.h" @@ -52,7 +53,7 @@ #include "WM_types.h" #include "WM_api.h" -static int surface_slot_add_exec(bContext *C, wmOperator *op) +static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) { DynamicPaintModifierData *pmd = 0; Object *cObject = CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -94,7 +95,7 @@ void DPAINT_OT_surface_slot_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int surface_slot_remove_exec(bContext *C, wmOperator *op) +static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op)) { DynamicPaintModifierData *pmd = 0; Object *cObject = CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -418,4 +419,4 @@ void DPAINT_OT_bake(wmOperatorType *ot) /* api callbacks */ ot->exec= dynamicpaint_bake_exec; ot->poll= ED_operator_object_active_editable; -}
\ No newline at end of file +} diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 9eb96a9a4c5..630038d4c6b 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -936,7 +936,8 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, draw_marker_slide_zones(sc, track, marker, cur_pos, 1, 0, 0, width, height); draw_marker_slide_zones(sc, track, marker, cur_pos, 0, 0, 0, width, height); - if(fp) fp+= 2; + if(fp) + fp+= 2; } } @@ -950,20 +951,19 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, while(track) { if((track->flag&TRACK_HIDDEN)==0) { int act= track==act_track; + marker= BKE_tracking_get_marker(track, framenr); - if(!act) { - marker= BKE_tracking_get_marker(track, framenr); - - if(MARKER_VISIBLE(sc, marker)) { + if(MARKER_VISIBLE(sc, marker)) { + if(!act) { copy_v2_v2(cur_pos, fp ? fp : marker->pos); draw_marker_areas(sc, track, marker, cur_pos, width, height, 0, 1); draw_marker_slide_zones(sc, track, marker, cur_pos, 0, 1, 0, width, height); } - } - if(MARKER_VISIBLE(sc, marker) && fp) - fp+= 2; + if(fp) + fp+= 2; + } } track= track->next; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 7121e4872eb..77c92b2d9c3 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -804,7 +804,7 @@ static int image_open_exec(bContext *C, wmOperator *op) RNA_property_update(C, &pprop->ptr, pprop->prop); } else if(sima) { - ED_space_image_set(C, sima, scene, obedit, ima); + ED_space_image_set(sima, scene, obedit, ima); iuser= &sima->iuser; } else { @@ -1420,7 +1420,7 @@ static int image_new_exec(bContext *C, wmOperator *op) RNA_property_update(C, &ptr, prop); } else if(sima) - ED_space_image_set(C, sima, scene, obedit, ima); + ED_space_image_set(sima, scene, obedit, ima); // XXX other users? BKE_image_signal(ima, (sima)? &sima->iuser: NULL, IMA_SIGNAL_USER_NEW_IMAGE); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index f462f118203..acc2bf5349a 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -83,9 +83,10 @@ Image *ED_space_image(SpaceImage *sima) } /* called to assign images to UV faces */ -void ED_space_image_set(bContext *C, SpaceImage *sima, Scene *scene, Object *obedit, Image *ima) +void ED_space_image_set(SpaceImage *sima, Scene *scene, Object *obedit, Image *ima) { - ED_uvedit_assign_image(CTX_data_main(C), scene, obedit, ima, sima->image); + /* context may be NULL, so use global */ + ED_uvedit_assign_image(G.main, scene, obedit, ima, sima->image); /* change the space ima after because uvedit_face_visible uses the space ima * to check if the face is displayed in UV-localview */ @@ -100,13 +101,10 @@ void ED_space_image_set(bContext *C, SpaceImage *sima, Scene *scene, Object *obe if(sima->image && sima->image->id.us==0) sima->image->id.us= 1; - if(C) { - if(obedit) - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - - ED_area_tag_redraw(CTX_wm_area(C)); - - } + if(obedit) + WM_main_add_notifier(NC_GEOM|ND_DATA, obedit->data); + + WM_main_add_notifier(NC_SPACE|ND_SPACE_IMAGE, NULL); } ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **lock_r) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 29a35187719..2a430f4c520 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -406,7 +406,7 @@ static int draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr) } } -static int draw_mcol__set_draw_legacy(MTFace *tface, int has_mcol, int matnr) +static int draw_mcol__set_draw_legacy(MTFace *UNUSED(tface), int has_mcol, int UNUSED(matnr)) { if (has_mcol) return 1; else return 2; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 7331959ef51..0329b6c3739 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -99,6 +99,7 @@ void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d) int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) { if(ED_view3d_camera_lock_check(v3d, rv3d)) { + ObjectTfmProtectedChannels obtfm; Object *root_parent; if((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (root_parent= v3d->camera->parent)) { @@ -117,7 +118,10 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) mul_m4_m4m4(diff_mat, v3d->camera->imat, view_mat); mul_m4_m4m4(parent_mat, root_parent->obmat, diff_mat); + + object_tfm_protected_backup(root_parent, &obtfm); object_apply_mat4(root_parent, parent_mat, TRUE, FALSE); + object_tfm_protected_restore(root_parent, &obtfm, root_parent->protectflag); ob_update= v3d->camera; while(ob_update) { @@ -127,7 +131,10 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) } } else { + object_tfm_protected_backup(v3d->camera, &obtfm); ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist); + object_tfm_protected_restore(v3d->camera, &obtfm, v3d->camera->protectflag); + DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d->camera); } @@ -346,6 +353,7 @@ typedef struct ViewOpsData { double timer_lastdraw; float oldquat[4]; + float viewquat[4]; /* working copy of rv3d->viewquat */ float trackvec[3]; float mousevec[3]; /* dolly only */ float reverse, dist0; @@ -408,6 +416,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) ED_view3d_camera_lock_init(vod->v3d, vod->rv3d); vod->dist0= rv3d->dist; + copy_qt_qt(vod->viewquat, rv3d->viewquat); copy_qt_qt(vod->oldquat, rv3d->viewquat); vod->origx= vod->oldx= event->x; vod->origy= vod->oldy= event->y; @@ -643,13 +652,13 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) q1[0]= cos(phi); mul_v3_fl(q1+1, sin(phi)); - mul_qt_qtqt(rv3d->viewquat, q1, vod->oldquat); + mul_qt_qtqt(vod->viewquat, q1, vod->oldquat); if (vod->use_dyn_ofs) { /* compute the post multiplication quat, to rotate the offset correctly */ copy_qt_qt(q1, vod->oldquat); conjugate_qt(q1); - mul_qt_qtqt(q1, q1, rv3d->viewquat); + mul_qt_qtqt(q1, q1, vod->viewquat); conjugate_qt(q1); /* conj == inv for unit quat */ copy_v3_v3(rv3d->ofs, vod->ofs); @@ -671,7 +680,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) const float sensitivity = 0.0035f; /* Get the 3x3 matrix and its inverse from the quaternion */ - quat_to_mat3( m,rv3d->viewquat); + quat_to_mat3( m,vod->viewquat); invert_m3_m3(m_inv,m); /* Determine the direction of the x vector (for rotating up and down) */ @@ -682,7 +691,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) phi = sensitivity * -(y - vod->oldy); q1[0] = cos(phi); mul_v3_v3fl(q1+1, xvec, sin(phi)); - mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1); + mul_qt_qtqt(vod->viewquat, vod->viewquat, q1); if (vod->use_dyn_ofs) { conjugate_qt(q1); /* conj == inv for unit quat */ @@ -696,7 +705,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) q1[0] = cos(phi); q1[1] = q1[2] = 0.0; q1[3] = sin(phi); - mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, q1); + mul_qt_qtqt(vod->viewquat, vod->viewquat, q1); if (vod->use_dyn_ofs) { conjugate_qt(q1); @@ -711,7 +720,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) int i; float viewquat_inv[4]; float zaxis[3]={0,0,1}; - invert_qt_qt(viewquat_inv, rv3d->viewquat); + invert_qt_qt(viewquat_inv, vod->viewquat); mul_qt_v3(viewquat_inv, zaxis); @@ -736,7 +745,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) * for testing roll */ rotation_between_vecs_to_quat(viewquat_align, zaxis_test, zaxis); normalize_qt(viewquat_align); - mul_qt_qtqt(viewquat_align, rv3d->viewquat, viewquat_align); + mul_qt_qtqt(viewquat_align, vod->viewquat, viewquat_align); normalize_qt(viewquat_align); invert_qt_qt(viewquat_align_inv, viewquat_align); @@ -766,7 +775,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) } } - copy_qt_qt(rv3d->viewquat, quat_best); + copy_qt_qt(vod->viewquat, quat_best); rv3d->view= view; /* if we snap to a rolled camera the grid is invalid */ break; @@ -777,7 +786,11 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) vod->oldy= y; /* avoid precision loss over time */ - normalize_qt(rv3d->viewquat); + normalize_qt(vod->viewquat); + + /* use a working copy so view rotation locking doesnt overwrite the locked + * rotation back into the view we calculate with */ + copy_qt_qt(rv3d->viewquat, vod->viewquat); ED_view3d_camera_lock_sync(vod->v3d, rv3d); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index a5251c18160..222edf7b82e 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -370,6 +370,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); + ObjectTfmProtectedChannels obtfm; copy_qt_qt(rv3d->lviewquat, rv3d->viewquat); rv3d->lview= rv3d->view; @@ -377,7 +378,12 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) rv3d->lpersp= rv3d->persp; } + object_tfm_protected_backup(v3d->camera, &obtfm); + ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist); + + object_tfm_protected_restore(v3d->camera, &obtfm, v3d->camera->protectflag); + DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); rv3d->persp = RV3D_CAMOB; diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h index c8dfdf83a57..04d50c78652 100644 --- a/source/blender/makesdna/DNA_dynamicpaint_types.h +++ b/source/blender/makesdna/DNA_dynamicpaint_types.h @@ -6,7 +6,7 @@ * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * -* Contributor(s): Miika Hämäläinen +* Contributor(s): Miika Hämäläinen * * ***** END GPL LICENSE BLOCK ***** */ diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 1f678faf421..754ed82e010 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -6,7 +6,7 @@ * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * - * Contributor(s): Miika Hämäläinen + * Contributor(s): Miika Hämäläinen * * ***** END GPL LICENSE BLOCK ***** */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index db4db299f92..31f3d59e643 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -514,7 +514,7 @@ static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value) SpaceImage *sima= (SpaceImage*)(ptr->data); bScreen *sc= (bScreen*)ptr->id.data; - ED_space_image_set(NULL, sima, sc->scene, sc->scene->obedit, (Image*)value.data); + ED_space_image_set(sima, sc->scene, sc->scene->obedit, (Image*)value.data); } static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr, diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 26dc7076101..364022a9bcf 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -115,7 +115,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), faceMap = MEM_callocN(sizeof(*faceMap) * maxFaces, "build modifier faceMap"); for(i = 0; i < maxFaces; ++i) faceMap[i] = i; - frac = BKE_curframe(md->scene) - bmd->start / bmd->length; + frac = (BKE_curframe(md->scene) - bmd->start) / bmd->length; CLAMP(frac, 0.0f, 1.0f); numFaces = dm->getNumFaces(dm) * frac; diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index f697f149ce4..c6b9e5752e0 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -6,7 +6,7 @@ * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * -* Contributor(s): Miika Hämäläinen +* Contributor(s): Miika Hämäläinen * * ***** END GPL LICENSE BLOCK ***** * @@ -21,6 +21,8 @@ #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" + #include "BKE_cdderivedmesh.h" #include "BKE_dynamicpaint.h" #include "BKE_modifier.h" @@ -53,7 +55,7 @@ static void freeData(ModifierData *md) dynamicPaint_Modifier_free(pmd); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { DynamicPaintModifierData *pmd = (DynamicPaintModifierData*)md; CustomDataMask dataMask = 0; @@ -88,8 +90,8 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, - int useRenderParams, - int isFinalCalc) + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md; @@ -120,7 +122,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, } } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } @@ -143,8 +145,8 @@ static void foreachIDLink(ModifierData *md, Object *ob, } } -static void foreachTexLink(ModifierData *md, Object *ob, - TexWalkFunc walk, void *userData) +static void foreachTexLink(ModifierData *UNUSED(md), Object *UNUSED(ob), + TexWalkFunc UNUSED(walk), void *UNUSED(userData)) { //walk(userData, ob, md, ""); /* re-enable when possible */ } diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h index f1415a8c8f0..6deea004417 100644 --- a/source/blender/nodes/NOD_composite.h +++ b/source/blender/nodes/NOD_composite.h @@ -1,21 +1,21 @@ /* * ***** BEGIN GPL LICENSE BLOCK ***** * - * This program is free software(ListBase *lb); you can redistribute it and/or + * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation(ListBase *lb); either version 2 + * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. The Blender * Foundation also sells licenses for use in proprietary software under * the Blender License. See http://www.blender.org/BL/ for information * about this. * * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY(ListBase *lb); without even the implied warranty of + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program(ListBase *lb); if not, write to the Free Software Foundation, + * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2005 Blender Foundation. diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c index 1bb62fead6d..7d3b91d34d4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c @@ -53,7 +53,7 @@ void register_node_type_sh_bsdf_glass(ListBase *lb) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER, 0); + node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_glass_in, sh_node_bsdf_glass_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c index 2338a8a3cd2..5ccc1cf4a61 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c @@ -53,7 +53,7 @@ void register_node_type_sh_bsdf_glossy(ListBase *lb) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER, 0); + node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_bsdf_glossy_in, sh_node_bsdf_glossy_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c index ddf1180df9e..6547194b33a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geom.c +++ b/source/blender/nodes/shader/nodes/node_shader_geom.c @@ -144,7 +144,6 @@ void register_node_type_sh_geom(ListBase *lb) node_type_base(&ntype, SH_NODE_GEOMETRY, "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/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c index f9ab16ae84a..ecf5a053ad3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c @@ -75,7 +75,7 @@ void register_node_type_sh_tex_environment(ListBase *lb) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE, 0); + node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_environment_in, sh_node_tex_environment_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c index 076759fa75f..d78a5e9693a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c @@ -67,7 +67,7 @@ void register_node_type_sh_tex_gradient(ListBase *lb) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE, 0); + node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_gradient_in, sh_node_tex_gradient_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c index a7b0925d001..75b5f26b252 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c @@ -75,7 +75,7 @@ void register_node_type_sh_tex_image(ListBase *lb) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE, 0); + node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_image_in, sh_node_tex_image_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c index 00327311da4..6c021a7f900 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c @@ -72,7 +72,7 @@ void register_node_type_sh_tex_magic(ListBase *lb) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE, 0); + node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_magic_in, sh_node_tex_magic_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c index 45fa6338bfa..4aefea3e383 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c @@ -73,7 +73,7 @@ void register_node_type_sh_tex_musgrave(ListBase *lb) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE, 0); + node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_musgrave_in, sh_node_tex_musgrave_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c index 3ab5e61196c..1abcec86b12 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c @@ -69,7 +69,7 @@ void register_node_type_sh_tex_sky(ListBase *lb) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE, 0); + node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_sky_in, sh_node_tex_sky_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c index c32063c8b2d..6be3a2e928b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c @@ -68,7 +68,7 @@ void register_node_type_sh_tex_voronoi(ListBase *lb) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE, 0); + node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_voronoi_in, sh_node_tex_voronoi_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c index 3574975c7b8..ed0aa230721 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c @@ -71,7 +71,7 @@ void register_node_type_sh_tex_wave(ListBase *lb) { static bNodeType ntype; - node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE, 0); + node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE, NODE_OPTIONS); node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_socket_templates(&ntype, sh_node_tex_wave_in, sh_node_tex_wave_out); node_type_size(&ntype, 150, 60, 200); diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 96df88ed9b0..c69210ce7fe 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -47,6 +47,7 @@ struct CSG_VertexIteratorDescriptor; struct ColorBand; struct CurveMapping; struct Curve; +struct DerivedMesh; struct EditBone; struct EditFace; struct EditMesh; @@ -77,6 +78,7 @@ struct RenderEngine; struct RenderEngineType; struct RenderLayer; struct RenderResult; +struct Scene; struct ScrArea; struct SculptSession; struct ShadeInput; @@ -217,7 +219,7 @@ int ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit){r int ED_space_image_show_render(struct SpaceImage *sima){return 0;} int ED_space_image_show_paint(struct SpaceImage *sima){return 0;} void ED_space_image_paint_update(struct wmWindowManager *wm, struct ToolSettings *settings){} -void ED_space_image_set(struct bContext *C, struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima){} +void ED_space_image_set(struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima){} struct ImBuf *ED_space_image_buffer(struct SpaceImage *sima){return (struct ImBuf *) NULL;} void ED_screen_set_scene(struct bContext *C, struct Scene *scene){} void ED_space_clip_set(struct bContext *C, struct SpaceClip *sc, struct MovieClip *clip){} |