Merging r57546 through r57569 from trunk into soc-2013-depsgraph_mt
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 19 Jun 2013 08:57:02 +0000 (08:57 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 19 Jun 2013 08:57:02 +0000 (08:57 +0000)
48 files changed:
SConstruct
build_files/buildbot/slave_compile.py
build_files/buildbot/slave_pack.py
build_files/scons/config/win32-vc-config.py
build_files/scons/config/win64-vc-config.py
build_files/scons/tools/btools.py
intern/cycles/CMakeLists.txt
intern/cycles/SConscript
intern/cycles/blender/addon/__init__.py
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/bvh/bvh.cpp
intern/cycles/kernel/kernel_bvh_traversal.h
intern/cycles/kernel/kernel_jitter.h
intern/cycles/kernel/kernel_sse3.cpp
intern/cycles/util/util_math.h
intern/cycles/util/util_system.cpp
intern/cycles/util/util_types.h
release/scripts/modules/addon_utils.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/space_userpref.py
source/blender/blenkernel/BKE_autoexec.h [new file with mode: 0644]
source/blender/blenkernel/BKE_modifier.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/autoexec.c [new file with mode: 0644]
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenlib/BLI_path_util.h
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/screen/screendump.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sound/sound_ops.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_image/image_ops.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/modifiers/intern/MOD_edgesplit.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_operators.c
source/creator/creator.c

index 306a783b53c103a3256005dee0fed339ef62cf0b..0a7fa2aec9ed89cd1b4bd1d3acbc129dc8d77b9c 100644 (file)
@@ -137,6 +137,8 @@ else:
     B.quickie=[]
 
 toolset = B.arguments.get('BF_TOOLSET', None)
+vcver = B.arguments.get('MSVS_VERSION', '9.0')
+
 if toolset:
     print "Using " + toolset
     if toolset=='mstoolkit':
@@ -148,9 +150,9 @@ if toolset:
             btools.SetupSpawn(env)
 else:
     if bitness==64 and platform=='win32':
-        env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64', TARGET_ARCH='x86_64')
+        env = BlenderEnvironment(ENV = os.environ, MSVS_ARCH='amd64', TARGET_ARCH='x86_64', MSVC_VERSION=vcver)
     else:
-        env = BlenderEnvironment(ENV = os.environ, TARGET_ARCH='x86')
+        env = BlenderEnvironment(ENV = os.environ, TARGET_ARCH='x86', MSVC_VERSION=vcver)
 
 if not env:
     print "Could not create a build environment"
@@ -384,6 +386,8 @@ else:
 env['CPPFLAGS'].append('-DWITH_AUDASPACE')
 env['CPPFLAGS'].append('-DWITH_AVI')
 env['CPPFLAGS'].append('-DWITH_BOOL_COMPAT')
+if env['OURPLATFORM'] in ('win32-vc', 'win64-vc') and env['MSVC_VERSION'] == '11.0':
+    env['CPPFLAGS'].append('-D_ALLOW_KEYWORD_MACROS')
 
 if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
     env['CPPFLAGS'].append('-DHAVE_STDBOOL_H')
@@ -940,7 +944,10 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
 
     if env['WITH_BF_OPENAL']:
         dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
-        dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
+        if env['OURPLATFORM'] in ('win32-vc', 'win64-vc') and env['MSVC_VERSION'] == '11.0':
+            pass
+        else:
+            dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
 
     if env['WITH_BF_SNDFILE']:
         dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
index 7e50798b33ff6f6bb3c8b609ba4f6374a0719235..33879ccff170c1d3e68c7fa602e7b87970207bcb 100644 (file)
@@ -143,6 +143,8 @@ else:
             scons_options.append('BF_CYCLES_CUDA_NVCC=nvcc.exe')
             if builder.find('mingw') != -1:
                 scons_options.append('BF_TOOLSET=mingw')
+            if builder.endswith('vc2012'):
+                scons_options.append('MSVS_VERSION=11.0')
             scons_options.append('BF_NUMJOBS=1')
 
         elif builder.find('mac') != -1:
@@ -156,7 +158,10 @@ else:
         retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
 
         if builder.find('win') != -1:
-            dlls = ('msvcm90.dll', 'msvcp90.dll', 'msvcr90.dll', 'vcomp90.dll', 'Microsoft.VC90.CRT.manifest', 'Microsoft.VC90.OpenMP.manifest')
+            if builder.endswith('vc2012'):
+                dlls = ('msvcp110.dll', 'msvcr110.dll', 'vcomp110.dll')
+            else:
+                dlls = ('msvcm90.dll', 'msvcp90.dll', 'msvcr90.dll', 'vcomp90.dll', 'Microsoft.VC90.CRT.manifest', 'Microsoft.VC90.OpenMP.manifest')
             if builder.find('win64') == -1:
                 dlls_path = '..\\..\\..\\redist\\x86'
             else:
index 3c2569e4a691fd2c62a3a0717c123bb56c8f0bb9..3e8ae939dd5721f60657c2de0d32dfbbecccdeb2 100644 (file)
@@ -99,6 +99,8 @@ if builder.find('scons') != -1:
             scons_options.append('BF_CYCLES_CUDA_NVCC=nvcc.exe')
             if builder.find('mingw') != -1:
                 scons_options.append('BF_TOOLSET=mingw')
+            if builder.endswith('vc2012'):
+                scons_options.append('MSVS_VERSION=11.0')
 
         elif builder.find('mac') != -1:
             if builder.find('x86_64') != -1:
index e43bb5336b814a6093dd99f418583faf62574946..bceab628b47fc3b8712606e0fe32a27d3b1a11b0 100644 (file)
@@ -1,12 +1,28 @@
-LCGDIR = '#../lib/windows'
+import subprocess
+
+CL_OUT = subprocess.Popen(["cl.exe"],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+CL_STDOUT, CL_STDERR = CL_OUT.communicate()
+
+if CL_STDERR.find("Version 15.00.") == -1:
+    VC_VERSION = '11.0'
+    LCGDIR = '#../lib/windows_vc11'
+    
+else:
+    VC_VERSION = '9.0'
+    LCGDIR = '#../lib/windows'
+
 LIBDIR = '${LCGDIR}'
 
 WITH_BF_FFMPEG = True
 BF_FFMPEG = LIBDIR +'/ffmpeg'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc'
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
-BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib swscale-2.lib'
-BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
+if VC_VERSION == '11.0':
+    BF_FFMPEG_LIB = 'avformat-54.lib avcodec-54.lib avdevice-54.lib avutil-52.lib avfilter-3.lib swscale-2.lib swresample-0.lib'
+    BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-54.dll ${BF_FFMPEG_LIBPATH}/avcodec-54.dll ${BF_FFMPEG_LIBPATH}/avdevice-54.dll ${BF_FFMPEG_LIBPATH}/avutil-52.dll ${BF_FFMPEG_LIBPATH}/avfilter-3.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll ${BF_FFMPEG_LIBPATH}/swresample-0.dll'
+else:
+    BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib swscale-2.lib'
+    BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
 
 BF_PYTHON = LIBDIR + '/python'
 BF_PYTHON_VERSION = '3.3'
@@ -19,7 +35,10 @@ BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 WITH_BF_OPENAL = True
 BF_OPENAL = LIBDIR + '/openal'
 BF_OPENAL_INC = '${BF_OPENAL}/include '
-BF_OPENAL_LIB = 'wrap_oal'
+if VC_VERSION == '11.0':
+    BF_OPENAL_LIB = 'OpenAL32'
+else:
+    BF_OPENAL_LIB = 'wrap_oal'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
 WITH_BF_ICONV = True
@@ -43,7 +62,10 @@ BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
 WITH_BF_SDL = True
 BF_SDL = LIBDIR + '/sdl'
 BF_SDL_INC = '${BF_SDL}/include'
-BF_SDL_LIB = 'SDL.lib'
+if VC_VERSION == '11.0':
+    BF_SDL_LIB = 'SDL.lib dxguid.lib'
+else:
+    BF_SDL_LIB = 'SDL.lib'
 BF_SDL_LIBPATH = '${BF_SDL}/lib'
 
 BF_PTHREADS = LIBDIR + '/pthreads'
@@ -182,8 +204,12 @@ WITH_BF_STATICOCIO = True
 WITH_BF_BOOST = True
 BF_BOOST = '${LIBDIR}/boost'
 BF_BOOST_INC = '${BF_BOOST}/include'
-BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49 libboost_wave-vc90-mt-s-1_49'
-BF_BOOST_LIB_INTERNATIONAL = 'libboost_locale-vc90-mt-s-1_49'
+if VC_VERSION == '11.0':
+    BF_BOOST_LIB = 'libboost_date_time-vc110-mt-s-1_53 libboost_filesystem-vc110-mt-s-1_53 libboost_regex-vc110-mt-s-1_53 libboost_system-vc110-mt-s-1_53 libboost_thread-vc110-mt-s-1_53 libboost_wave-vc110-mt-s-1_53'
+    BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc110-mt-s-1_53'
+else:
+    BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49 libboost_wave-vc90-mt-s-1_49'
+    BF_BOOST_LIB_INTERNATIONAL = 'libboost_locale-vc90-mt-s-1_49'
 BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
 
 #CUDA
@@ -209,16 +235,16 @@ BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a'
 CC = 'cl.exe'
 CXX = 'cl.exe'
 
-CCFLAGS = ['/nologo', '/Ob1', '/J', '/W1', '/Gd', '/wd4018', '/wd4244', '/wd4305', '/wd4800', '/wd4065', '/wd4267', '/we4013']
+CCFLAGS = ['/nologo', '/J', '/W1', '/Gd', '/wd4018', '/wd4244', '/wd4305', '/wd4800', '/wd4065', '/wd4267', '/we4013']
 CXXFLAGS = ['/EHsc']
-BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE']
+BGE_CXXFLAGS = ['/O2', '/Ob2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE']
 
-BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
+BF_DEBUG_CCFLAGS = ['/Zi', '/Ob0', '/Od', '/FR${TARGET}.sbr']
 
 CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE', '-DOPJ_STATIC']
 REL_CFLAGS = []
 REL_CXXFLAGS = []
-REL_CCFLAGS = ['-O2', '-DNDEBUG']
+REL_CCFLAGS = ['-O2', '/Ob2', '-DNDEBUG']
 
 C_WARN = []
 CC_WARN = []
@@ -235,5 +261,9 @@ PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/IN
 
 BF_BSC=False
 
-BF_BUILDDIR = '..\\build\\win32-vc'
-BF_INSTALLDIR='..\\install\\win32-vc'
+if VC_VERSION == '11.0':
+    BF_BUILDDIR = '..\\build\\win32-vc11'
+    BF_INSTALLDIR='..\\install\\win32-vc11'
+else:
+    BF_BUILDDIR = '..\\build\\win32-vc'
+    BF_INSTALLDIR='..\\install\\win32-vc'
index eb3533cdb8ba727a6ff1d4b8a7c11eb0c4be5449..c7bf2fa0bd253da50286cfb0e69f72e514134e4e 100644 (file)
@@ -1,12 +1,29 @@
-LCGDIR = '#../lib/win64'
+import subprocess
+
+CL_OUT = subprocess.Popen(["cl.exe"],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+CL_STDOUT, CL_STDERR = CL_OUT.communicate()
+
+if CL_STDERR.find("Version 15.00.") == -1:
+    VC_VERSION = '11.0'
+    LCGDIR = '#../lib/win64_vc11'
+    
+else:
+    VC_VERSION = '9.0'
+    LCGDIR = '#../lib/win64'
+
 LIBDIR = '${LCGDIR}'
 
 WITH_BF_FFMPEG = True
 BF_FFMPEG = LIBDIR +'/ffmpeg'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc '
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
-BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib swscale-2.lib'
-BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
+if VC_VERSION == '11.0':
+    BF_FFMPEG_LIB = 'avformat-54.lib avcodec-54.lib avdevice-54.lib avutil-52.lib avfilter-3.lib swscale-2.lib swresample-0.lib'
+    BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-54.dll ${BF_FFMPEG_LIBPATH}/avcodec-54.dll ${BF_FFMPEG_LIBPATH}/avdevice-54.dll ${BF_FFMPEG_LIBPATH}/avutil-52.dll ${BF_FFMPEG_LIBPATH}/avfilter-3.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll ${BF_FFMPEG_LIBPATH}/swresample-0.dll'
+else:
+    BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib swscale-2.lib'
+    BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
+    
 
 BF_PYTHON = LIBDIR + '/python'
 BF_PYTHON_VERSION = '3.3'
@@ -19,7 +36,10 @@ BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 WITH_BF_OPENAL = True
 BF_OPENAL = LIBDIR + '/openal'
 BF_OPENAL_INC = '${BF_OPENAL}/include '
-BF_OPENAL_LIB = 'wrap_oal'
+if VC_VERSION == '11.0':
+    BF_OPENAL_LIB = 'OpenAL32'
+else:
+    BF_OPENAL_LIB = 'wrap_oal'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
 WITH_BF_SNDFILE = True
@@ -37,7 +57,10 @@ BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
 WITH_BF_SDL = True
 BF_SDL = LIBDIR + '/sdl'
 BF_SDL_INC = '${BF_SDL}/include'
-BF_SDL_LIB = 'SDL.lib'
+if VC_VERSION == '11.0':
+    BF_SDL_LIB = 'SDL.lib dxguid.lib'
+else:
+    BF_SDL_LIB = 'SDL.lib'
 BF_SDL_LIBPATH = '${BF_SDL}/lib'
 
 WITH_BF_JACK = False
@@ -178,8 +201,12 @@ WITH_BF_STATICOCIO = True
 WITH_BF_BOOST = True
 BF_BOOST = '${LIBDIR}/boost'
 BF_BOOST_INC = '${BF_BOOST}/include'
-BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49 libboost_wave-vc90-mt-s-1_49'
-BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc90-mt-s-1_49'
+if VC_VERSION == '11.0':
+    BF_BOOST_LIB = 'libboost_date_time-vc110-mt-s-1_53 libboost_filesystem-vc110-mt-s-1_53 libboost_regex-vc110-mt-s-1_53 libboost_system-vc110-mt-s-1_53 libboost_thread-vc110-mt-s-1_53 libboost_wave-vc110-mt-s-1_53'
+    BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc110-mt-s-1_53'
+else:
+    BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49 libboost_wave-vc90-mt-s-1_49'
+    BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc90-mt-s-1_49'
 BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
 
 #CUDA
@@ -206,16 +233,16 @@ CC = 'cl.exe'
 CXX = 'cl.exe'
 
 CFLAGS = []
-CCFLAGS = ['/nologo', '/Ob1', '/J', '/W1', '/Gd', '/we4013', '/wd4018', '/wd4244', '/wd4305', '/wd4800', '/wd4065', '/wd4267']
+CCFLAGS = ['/nologo', '/J', '/W1', '/Gd', '/we4013', '/wd4018', '/wd4244', '/wd4305', '/wd4800', '/wd4065', '/wd4267']
 CXXFLAGS = ['/EHsc']
-BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast']
+BGE_CXXFLAGS = ['/O2', '/Ob2', '/EHsc', '/GR', '/fp:fast']
 
-BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od']
+BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od', '/Ob0']
 
 CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE', '-DOPJ_STATIC']
 REL_CFLAGS = []
 REL_CXXFLAGS = []
-REL_CCFLAGS = ['-O2', '-DNDEBUG']
+REL_CCFLAGS = ['-O2', '/Ob2', '-DNDEBUG']
 
 C_WARN = []
 CC_WARN = []
@@ -224,7 +251,9 @@ CXX_WARN = []
 LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi']
 
 PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
-
-BF_BUILDDIR = '..\\build\\win64-vc'
-BF_INSTALLDIR='..\\install\\win64-vc'
-
+if VC_VERSION == '11.0':
+    BF_BUILDDIR = '..\\build\\win64-vc11'
+    BF_INSTALLDIR='..\\install\\win64-vc11'
+else:
+    BF_BUILDDIR = '..\\build\\win64-vc'
+    BF_INSTALLDIR='..\\install\\win64-vc'
index 868d443f8bbc8f0437f153643afd6b420921bc43..90674113f4735c8070e233667c2e94ebbd73e4af 100644 (file)
@@ -190,7 +190,7 @@ def validate_arguments(args, bc):
             'BF_BSC', 'BF_CONFIG',
             'BF_PRIORITYLIST', 'BF_BUILDINFO','CC', 'CXX', 'BF_QUICKDEBUG',
             'BF_LISTDEBUG', 'LCGDIR', 'BF_X264_CONFIG', 'BF_XVIDCORE_CONFIG',
-            'BF_UNIT_TEST', 'BF_BITNESS']
+            'BF_UNIT_TEST', 'BF_BITNESS', 'MSVS_VERSION']
 
     okdict = {}
 
@@ -687,6 +687,9 @@ def buildslave(target=None, source=None, env=None):
     if platform == 'darwin':
         platform = 'OSX-' + env['MACOSX_DEPLOYMENT_TARGET'] + '-' + env['MACOSX_ARCHITECTURE']
 
+    if env['MSVC_VERSION'] == '11.0':
+        platform = env['OURPLATFORM'] + '11'
+
     branch = env['BUILDBOT_BRANCH']
 
     outdir = os.path.abspath(env['BF_INSTALLDIR'])
index 9f067bede33b0aa4144167525e9b9f19d8a041b4..a8293ac683c772d18d6400bba3ac8250c4a46732 100644 (file)
@@ -13,9 +13,10 @@ if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
 endif()
 
 if(WIN32 AND MSVC)
-       set(CYCLES_SSE2_KERNEL_FLAGS "/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc")
-       set(CYCLES_SSE3_KERNEL_FLAGS "/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc")
-       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /EHsc")
+       set(CYCLES_SSE2_KERNEL_FLAGS "/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc /Ox /GS-")
+       # there is no /arch:SSE3, but intrinsics are available anyway
+       set(CYCLES_SSE3_KERNEL_FLAGS "/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc /Ox /GS-")
+       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /EHsc /Ox /GS-")
 elseif(CMAKE_COMPILER_IS_GNUCC)
        set(CYCLES_SSE2_KERNEL_FLAGS "-ffast-math -msse -msse2 -mfpmath=sse")
        set(CYCLES_SSE3_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse")
index 43f838157b9f2823a3bfcaece9c4210614b1689b..57f44ae9d5291ba06b1004bf10b7924af5eb3cd1 100644 (file)
@@ -79,11 +79,12 @@ if env['WITH_BF_RAYOPTIMIZATION']:
     sse3_cxxflags = Split(env['CXXFLAGS'])
 
     if env['OURPLATFORM'] == 'win32-vc':
-        sse2_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
-        sse3_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
+        sse2_cxxflags.append('/arch:SSE /arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc /Ox /Gs-'.split())
+        # there is no /arch:SSE3, but intrinsics are available anyway
+        sse3_cxxflags.append('/arch:SSE /arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc /Ox /Gs-'.split())
     elif env['OURPLATFORM'] == 'win64-vc':
-        sse2_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
-        sse3_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
+        sse2_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc /Ox /Gs-'.split())
+        sse3_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc /Ox /Gs-'.split())
     else:
         sse2_cxxflags.append('-ffast-math -msse -msse2 -mfpmath=sse'.split())
         sse3_cxxflags.append('-ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse'.split())
index e1015fa3ceecec0b9545ff500b688162057dd916..b451b8ef3bf38ea687124020952a784d0a34174d 100644 (file)
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "Cycles Render Engine",
     "author": "",
-    "blender": (2, 66, 0),
+    "blender": (2, 67, 0),
     "location": "Info header, render engine menu",
     "description": "Cycles Render Engine integration",
     "warning": "",
index b94dd32fad0116536674ebadc725540a065eedf9..ca49ffccd2a59415d3f5cc4241aba5c49ca0efbf 100644 (file)
@@ -506,7 +506,7 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
                 )
         cls.use_transparent_shadow = BoolProperty(
                 name="Transparent Shadows",
-                description="Use transparent shadows for this material if it contains a Transparent BSDF"
+                description="Use transparent shadows for this material if it contains a Transparent BSDF"
                             "disabling will render faster but not give accurate shadows",
                 default=True,
                 )
index e9f8a4f0a8d19d8f42e59ced6e87cf43f9a06e7f..273b099a99d5dde7bea8857c25833e9dd8f6095f 100644 (file)
@@ -917,12 +917,14 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
         col = split.column()
         col.prop(mat, "diffuse_color", text="Viewport Color")
 
-        col = split.column()
+        col = split.column(align=True)
+        col.label()
         col.prop(mat, "pass_index")
+        
+        col = layout.column()
+        col.prop(cmat, "sample_as_light")
         col.prop(cmat, "use_transparent_shadow")
 
-        layout.prop(cmat, "sample_as_light")
-
 
 class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
     bl_label = ""
index 69ccf2588c9969396c63ef25934082d5aa62e54e..dd647fec2d35ddac58b72b4986264a235fea4deb 100644 (file)
@@ -579,6 +579,7 @@ void RegularBVH::pack_nodes(const array<int>& prims, const BVHNode *root)
        int nextNodeIdx = 0;
 
        vector<BVHStackEntry> stack;
+       stack.reserve(BVHParams::MAX_DEPTH*2);
        stack.push_back(BVHStackEntry(root, nextNodeIdx++));
 
        while(stack.size()) {
@@ -776,6 +777,7 @@ void QBVH::pack_nodes(const array<int>& prims, const BVHNode *root)
        int nextNodeIdx = 0;
 
        vector<BVHStackEntry> stack;
+       stack.reserve(BVHParams::MAX_DEPTH*2);
        stack.push_back(BVHStackEntry(root, nextNodeIdx++));
 
        while(stack.size()) {
index 9fd466a67310f430aa4a5297caa243f7f3d9da6d..900aa7e75fb054139786dcf6e035b212295b8569 100644 (file)
@@ -80,7 +80,7 @@ __device bool BVH_FUNCTION_NAME
        isect->u = 0.0f;
        isect->v = 0.0f;
 
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
        const __m128i shuffle_identity = _mm_set_epi8(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
        const __m128i shuffle_swap = _mm_set_epi8(7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8);
 
@@ -111,10 +111,10 @@ __device bool BVH_FUNCTION_NAME
                        {
                                bool traverseChild0, traverseChild1;
                                int nodeAddrChild1;
-                               float t = isect->t;
 
-#if !defined(__KERNEL_SSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if !defined(__KERNEL_SSSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
                                /* Intersect two child bounding boxes, non-SSE version */
+                               float t = isect->t;
 
                                /* fetch node data */
                                float4 node0 = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+0);
@@ -166,8 +166,8 @@ __device bool BVH_FUNCTION_NAME
                                traverseChild1 = (c1max >= c1min);
 #endif
 
-#else // __KERNEL_SSE3__
-                               /* Intersect two child bounding boxes, SSE3 version adapted from Embree */
+#else // __KERNEL_SSSE3__
+                               /* Intersect two child bounding boxes, SSSE3 version adapted from Embree */
 
                                /* fetch node data */
                                __m128 *bvh_nodes = (__m128*)kg->__bvh_nodes.data + nodeAddr*BVH_NODE_SIZE;
@@ -190,14 +190,14 @@ __device bool BVH_FUNCTION_NAME
                                traverseChild0 = (_mm_movemask_ps(lrhit) & 1);
                                traverseChild1 = (_mm_movemask_ps(lrhit) & 2);
 #endif
-#endif // __KERNEL_SSE3__
+#endif // __KERNEL_SSSE3__
 
                                nodeAddr = __float_as_int(cnodes.x);
                                nodeAddrChild1 = __float_as_int(cnodes.y);
 
                                if(traverseChild0 && traverseChild1) {
                                        /* both children were intersected, push the farther one */
-#if !defined(__KERNEL_SSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if !defined(__KERNEL_SSSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
                                        bool closestChild1 = (c1min < c0min);
 #else
                                        union { __m128 m128; float v[4]; } uminmax;
@@ -282,7 +282,7 @@ __device bool BVH_FUNCTION_NAME
                                                                hit = bvh_triangle_intersect(kg, isect, P, idir, visibility, object, primAddr);
 
                                                        /* shadow ray early termination */
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
                                                        if(hit) {
                                                                if(visibility == PATH_RAY_SHADOW_OPAQUE)
                                                                        return true;
@@ -315,7 +315,7 @@ __device bool BVH_FUNCTION_NAME
                                                bvh_instance_push(kg, object, ray, &P, &idir, &isect->t, tmax);
 #endif
 
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
                                                Psplat[0] = _mm_set_ps1(P.x);
                                                Psplat[1] = _mm_set_ps1(P.y);
                                                Psplat[2] = _mm_set_ps1(P.z);
@@ -359,7 +359,7 @@ __device bool BVH_FUNCTION_NAME
                        bvh_instance_pop(kg, object, ray, &P, &idir, &isect->t, tmax);
 #endif
 
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
                        Psplat[0] = _mm_set_ps1(P.x);
                        Psplat[1] = _mm_set_ps1(P.y);
                        Psplat[2] = _mm_set_ps1(P.z);
index 15d2151228fdc6fabbc169c004efb0220336845f..17704b48cee7c8357e23b9ba0a784830e4dc5d72 100644 (file)
@@ -37,7 +37,7 @@ __device_inline int cmj_fast_mod_pow2(int a, int b)
 /* a must be > 0 and b must be > 1 */
 __device_inline int cmj_fast_div_pow2(int a, int b)
 {
-#ifdef __KERNEL_SSE2__
+#if defined(__KERNEL_SSE2__) && !defined(_MSC_VER)
        return a >> __builtin_ctz(b);
 #else
        return a/b;
@@ -46,7 +46,7 @@ __device_inline int cmj_fast_div_pow2(int a, int b)
 
 __device_inline uint cmj_w_mask(uint w)
 {
-#ifdef __KERNEL_SSE2__
+#if defined(__KERNEL_SSE2__) && !defined(_MSC_VER)
        return ((1 << (32 - __builtin_clz(w))) - 1);
 #else
        w |= w >> 1;
index ccd3ee5ac74e4c23a5bb58812115b88ba160f8e6..ff6bb412d5bd84eb1ba33731cfd479d94bfb12c0 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-/* Optimized CPU kernel entry points. This file is compiled with SSE3
+/* Optimized CPU kernel entry points. This file is compiled with SSE3/SSSE3
  * optimization flags and nearly all functions inlined, while kernel.cpp
  * is compiled without for other CPU's. */
 
 #ifdef WITH_OPTIMIZED_KERNEL
 
 #define __KERNEL_SSE3__
+#define __KERNEL_SSSE3__
 
 #include "kernel.h"
 #include "kernel_compat_cpu.h"
index 68668d88d4437ee549aee8a7ad663d6c6de69bb5..05ed8a2d3f6f65baf9c6c53d597cb0b8aa7b7c69 100644 (file)
@@ -165,7 +165,7 @@ __device_inline float clamp(float a, float mn, float mx)
 
 __device_inline int float_to_int(float f)
 {
-#ifdef __KERNEL_SSE2__
+#if defined(__KERNEL_SSE2__) && !defined(_MSC_VER)
        return _mm_cvtt_ss2si(_mm_load_ss(&f));
 #else
        return (int)f;
index c3ecc303a346d1ce77211eae29a7ca8d9eb542a2..7ba749f4287bff9948c4c3a2d60092a6fa770b16 100644 (file)
@@ -194,7 +194,7 @@ bool system_cpu_support_sse2()
 bool system_cpu_support_sse3()
 {
        CPUCapabilities& caps = system_cpu_capabilities();
-       return caps.sse && caps.sse2 && caps.sse3;
+       return caps.sse && caps.sse2 && caps.sse3 && caps.ssse3;
 }
 
 #else
index d4ff95b06632bf6b763e26eeb54f215f5df047b3..d0116186ee813580867a829f8462a653e88ea89a 100644 (file)
 #include <xmmintrin.h> /* SSE 1 */
 #include <emmintrin.h> /* SSE 2 */
 #include <pmmintrin.h> /* SSE 3 */
-#include <tmmintrin.h> /* SSE 3 */
+#include <tmmintrin.h> /* SSSE 3 */
 #include <smmintrin.h> /* SSE 4 */
 
 #ifndef __KERNEL_SSE2__
 #define __KERNEL_SSE2__
 #endif
 
-#ifndef __KERNEL_SSE3__
-#define __KERNEL_SSE3__
+#ifndef __KERNEL_SSSE3__
+#define __KERNEL_SSSE3__
+#endif
+
+#ifndef __KERNEL_SSSE3__
+#define __KERNEL_SSSE3__
 #endif
 
 #ifndef __KERNEL_SSE4__
@@ -86,7 +90,7 @@
 
 #else
 
-#if defined(__x86_64__) || defined(__KERNEL_SSE3__)
+#if defined(__x86_64__) || defined(__KERNEL_SSSE3__)
 
 /* MinGW64 has conflicting declarations for these SSE headers in <windows.h>.
  * Since we can't avoid including <windows.h>, better only include that */
 #include <xmmintrin.h> /* SSE 1 */
 #include <emmintrin.h> /* SSE 2 */
 
-#ifdef __KERNEL_SSE3__
+#ifdef __KERNEL_SSSE3__
 #include <pmmintrin.h> /* SSE 3 */
-#include <tmmintrin.h> /* SSE 3 */
+#endif
+#ifdef __KERNEL_SSSE3__
+#include <tmmintrin.h> /* SSSE 3 */
 #endif
 #endif
 
 
 #endif
 
+/* int8_t, uint16_t, and friends */
 #ifndef _WIN32
-
 #include <stdint.h>
-
 #endif
 
 #endif
@@ -486,7 +491,7 @@ __device_inline int4 make_int4(const float3& f)
 
 #endif
 
-#ifdef __KERNEL_SSE3__
+#ifdef __KERNEL_SSSE3__
 
 /* SSE shuffle utility functions */
 
@@ -506,26 +511,6 @@ template<size_t i0, size_t i1, size_t i2, size_t i3> __device_inline const __m12
 }
 #endif
 
-#if defined(__KERNEL_SSE2__) && defined(_MSC_VER)
-
-/* count zeros from start or end of integer bits */
-
-__device_inline uint32_t __builtin_ctz(uint32_t i)
-{
-       unsigned long r = 0;
-       _BitScanForward(&r, i);
-       return (uint32_t)r;
-}
-
-__device_inline uint32_t __builtin_clz(uint32_t i)
-{
-       unsigned long r = 0;
-       _BitScanReverse(&r, i);
-       return (uint32_t)r;
-}
-
-#endif
-
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_TYPES_H__ */
index 7e7612e56d8d7c33ff2e96bb0e02b738e9e48062..a197c20fdab2f7d6e79dd5a6249d2984033bf3a0 100644 (file)
@@ -239,7 +239,7 @@ def _addon_remove(module_name):
             addons.remove(addon)
 
 
-def enable(module_name, default_set=True, persistent=False):
+def enable(module_name, default_set=True, persistent=False, handle_error=None):
     """
     Enables an addon by name.
 
@@ -253,9 +253,10 @@ def enable(module_name, default_set=True, persistent=False):
     import sys
     from bpy_restrict_state import RestrictBlend
 
-    def handle_error():
-        import traceback
-        traceback.print_exc()
+    if handle_error is None:
+        def handle_error():
+            import traceback
+            traceback.print_exc()
 
     # reload if the mtime changes
     mod = sys.modules.get(module_name)
@@ -322,7 +323,7 @@ def enable(module_name, default_set=True, persistent=False):
     return mod
 
 
-def disable(module_name, default_set=True):
+def disable(module_name, default_set=True, handle_error=None):
     """
     Disables an addon by name.
 
@@ -330,6 +331,12 @@ def disable(module_name, default_set=True):
     :type module_name: string
     """
     import sys
+
+    if handle_error is None:
+        def handle_error():
+            import traceback
+            traceback.print_exc()
+
     mod = sys.modules.get(module_name)
 
     # possible this addon is from a previous session and didn't load a
@@ -344,8 +351,7 @@ def disable(module_name, default_set=True):
         except:
             print("Exception in module unregister(): %r" %
                   getattr(mod, "__file__", module_name))
-            import traceback
-            traceback.print_exc()
+            handle_error()
     else:
         print("addon_utils.disable: %s not %s." %
               (module_name, "disabled" if mod is None else "loaded"))
index fd1f538efd33d0c80bd2bc045738d126ba5ecd69..fba7672e8466ed602c86bad4a11053c1fb6668e3 100644 (file)
@@ -1574,8 +1574,15 @@ class WM_OT_addon_enable(Operator):
 
     def execute(self, context):
         import addon_utils
+        
+        err_str = ""
+        def err_cb():
+            import traceback
+            nonlocal err_str
+            err_str = traceback.format_exc()
+            print(err_str)
 
-        mod = addon_utils.enable(self.module)
+        mod = addon_utils.enable(self.module, handle_error=err_cb)
 
         if mod:
             info = addon_utils.module_bl_info(mod)
@@ -1590,6 +1597,10 @@ class WM_OT_addon_enable(Operator):
                                          info_ver)
             return {'FINISHED'}
         else:
+
+            if err_str:
+                self.report({'ERROR'}, err_str)
+
             return {'CANCELLED'}
 
 
@@ -1606,7 +1617,18 @@ class WM_OT_addon_disable(Operator):
     def execute(self, context):
         import addon_utils
 
-        addon_utils.disable(self.module)
+        err_str = ""
+        def err_cb():
+            import traceback
+            nonlocal err_str
+            err_str = traceback.format_exc()
+            print(err_str)
+
+        addon_utils.disable(self.module, handle_error=err_cb)
+
+        if err_str:
+            self.report({'ERROR'}, err_str)
+
         return {'FINISHED'}
 
 
index ef4e5468194c57f6d60ce6463e826b8357f85bbb..a497ecfb927fbd621f0d773d5ca918bf7a76c2ac 100644 (file)
@@ -867,8 +867,21 @@ class USERPREF_PT_file(Panel):
 
         colsplit = col.split(percentage=0.95)
         sub = colsplit.column()
-        sub.label(text="Author:")
-        sub.prop(system, "author", text="")
+
+        row = sub.split(percentage=0.3)
+        row.label(text="Auto Execution:")
+        row.prop(system, "use_scripts_auto_execute")
+
+        if system.use_scripts_auto_execute:
+            box = sub.box()
+            row = box.row()
+            row.label(text="Excluded Paths:")
+            row.operator("wm.userpref_autoexec_path_add", text="", icon='ZOOMIN', emboss=False)
+            for i, path_cmp in enumerate(userpref.autoexec_paths):
+                row = box.row()
+                row.prop(path_cmp, "path", text="")
+                row.prop(path_cmp, "use_glob", text="", icon='FILTER')
+                row.operator("wm.userpref_autoexec_path_remove", text="", icon='X', emboss=False).index = i
 
         col = split.column()
         col.label(text="Save & Load:")
@@ -896,10 +909,12 @@ class USERPREF_PT_file(Panel):
 
         col.separator()
 
-        col.label(text="Scripts:")
-        col.prop(system, "use_scripts_auto_execute")
+        col.label(text="Text Editor:")
         col.prop(system, "use_tabs_as_spaces")
 
+        col.label(text="Author:")
+        col.prop(system, "author", text="")
+
 
 from bl_ui.space_userpref_keymap import InputKeyMapPanel
 
diff --git a/source/blender/blenkernel/BKE_autoexec.h b/source/blender/blenkernel/BKE_autoexec.h
new file mode 100644 (file)
index 0000000..7dc1e76
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Foundation 2013
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __BKE_AUTOEXEC_H__
+#define __BKE_AUTOEXEC_H__
+
+/** \file BKE_autoexec.h
+ *  \ingroup bke
+ */
+
+bool BKE_autoexec_match(const char *path);
+
+#endif  /* __BKE_AUTOEXEC_H__ */
index 6b9392a416983dac267d60fce175fb835b6b8d05..3f3a5739d556b8816d03116f89ff5bf2dc03d503 100644 (file)
@@ -391,5 +391,30 @@ void modifier_mdef_compact_influences(struct ModifierData *md);
 void        modifier_path_init(char *path, int path_maxlen, const char *name);
 const char *modifier_path_relbase(struct Object *ob);
 
+
+/* wrappers for modifier callbacks */
+
+struct DerivedMesh *modwrap_applyModifier(
+        ModifierData *md, struct Object *ob,
+        struct DerivedMesh *dm,
+        ModifierApplyFlag flag);
+
+struct DerivedMesh *modwrap_applyModifierEM(
+        ModifierData *md, struct Object *ob,
+        struct BMEditMesh *em,
+        struct DerivedMesh *dm,
+        ModifierApplyFlag flag);
+
+void modwrap_deformVerts(
+        ModifierData *md, struct Object *ob,
+        struct DerivedMesh *dm,
+        float (*vertexCos)[3], int numVerts,
+        ModifierApplyFlag flag);
+
+void modwrap_deformVertsEM(
+        ModifierData *md, struct Object *ob,
+        struct BMEditMesh *em, struct DerivedMesh *dm,
+        float (*vertexCos)[3], int numVerts);
+
 #endif
 
index 3864fe3b350d1d6c58e3f2eeef8e52bd6a9249de..7e1355b5421d616f1667d7d667e4dd64300f9b5b 100644 (file)
@@ -63,6 +63,7 @@ set(SRC
        intern/anim.c
        intern/anim_sys.c
        intern/armature.c
+       intern/autoexec.c
        intern/blender.c
        intern/bmfont.c
        intern/boids.c
@@ -163,6 +164,7 @@ set(SRC
        BKE_anim.h
        BKE_animsys.h
        BKE_armature.h
+       BKE_autoexec.h
        BKE_blender.h
        BKE_bmesh.h
        BKE_bmfont.h
index 6a21f33ac15407ae4cca3030c34c6aacf36c4c4a..c9c33014aa59df6c4daf3bee8a1e2088680fe9e7 100644 (file)
@@ -845,69 +845,6 @@ DerivedMesh *mesh_create_derived(Mesh *me, Object *ob, float (*vertCos)[3])
        return dm;
 }
 
-/***/
-
-/* wrapper around ModifierTypeInfo.applyModifier that ensures valid normals */
-
-static DerivedMesh *modwrap_applyModifier(
-        ModifierData *md, Object *ob,
-        DerivedMesh *dm,
-        ModifierApplyFlag flag)
-{
-       ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-       BLI_assert(CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
-
-       if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
-               DM_ensure_normals(dm);
-       }
-       return mti->applyModifier(md, ob, dm, flag);
-}
-
-static DerivedMesh *modwrap_applyModifierEM(
-        ModifierData *md, Object *ob,
-        BMEditMesh *em,
-        DerivedMesh *dm,
-        ModifierApplyFlag flag)
-{
-       ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-       BLI_assert(CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
-
-       if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
-               DM_ensure_normals(dm);
-       }
-       return mti->applyModifierEM(md, ob, em, dm, flag);
-}
-
-static void modwrap_deformVerts(
-        ModifierData *md, Object *ob,
-        DerivedMesh *dm,
-        float (*vertexCos)[3], int numVerts,
-        ModifierApplyFlag flag)
-{
-       ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-       BLI_assert(!dm || CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
-
-       if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
-               DM_ensure_normals(dm);
-       }
-       mti->deformVerts(md, ob, dm, vertexCos, numVerts, flag);
-}
-
-static void modwrap_deformVertsEM(
-        ModifierData *md, Object *ob,
-        BMEditMesh *em, DerivedMesh *dm,
-        float (*vertexCos)[3], int numVerts)
-{
-       ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-       BLI_assert(!dm || CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
-
-       if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
-               DM_ensure_normals(dm);
-       }
-       mti->deformVertsEM(md, ob, em, dm, vertexCos, numVerts);
-}
-/* end modifier callback wrappers */
-
 DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob, 
                                               ModifierData *md, int build_shapekey_layers)
 {
diff --git a/source/blender/blenkernel/intern/autoexec.c b/source/blender/blenkernel/intern/autoexec.c
new file mode 100644 (file)
index 0000000..c27343b
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Foundation 2013
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/armature.c
+ *  \ingroup bke
+ *
+ * Currently just checks if a blend file can be trusted to autoexec,
+ * may add signing here later.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "DNA_userdef_types.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_fnmatch.h"
+#include "BLI_string.h"
+#include "BLI_path_util.h"
+
+#include "BKE_autoexec.h"  /* own include */
+
+/**
+ * \param path  The path to check against.
+ * \return Success
+ */
+bool BKE_autoexec_match(const char *path)
+{
+       bPathCompare *path_cmp;
+
+#ifdef WIN32
+       const int fnmatch_flags = FNM_CASEFOLD;
+#else
+       const int fnmatch_flags = 0;
+#endif
+
+       BLI_assert((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0);
+
+       for (path_cmp = U.autoexec_paths.first; path_cmp; path_cmp = path_cmp->next) {
+               if ((path_cmp->flag & USER_PATHCMP_GLOB)) {
+                       if (fnmatch(path_cmp->path, path, fnmatch_flags) == 0) {
+                               return true;
+                       }
+               }
+               else if (BLI_path_ncmp(path_cmp->path, path, strlen(path_cmp->path)) == 0) {
+                       return true;
+               }
+       }
+
+       return false;
+}
index 87a8def52bfa86a2a098de71f7d7461ef941d582..1e7aba6d25bb6ea7d09592d4536ee0bd39b0fb20 100644 (file)
@@ -416,6 +416,8 @@ void BKE_userdef_free(void)
                MEM_freeN(addon);
        }
 
+       BLI_freelistN(&U.autoexec_paths);
+
        BLI_freelistN(&U.uistyles);
        BLI_freelistN(&U.uifonts);
        BLI_freelistN(&U.themes);
index 7ae9fa0b0c3da98a1a0bb768bf993fe65d83181d..243276ca55262fdaa4f193def10bac2adf36a287 100644 (file)
@@ -970,7 +970,6 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
                                        dm = tdm;
 
                                        CDDM_apply_vert_coords(dm, vertCos);
-                                       CDDM_calc_normals_mapping(dm);
                                }
                        }
                        else {
@@ -983,8 +982,6 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
                                }
 
                                dm = CDDM_from_curve_displist(ob, dispbase);
-
-                               CDDM_calc_normals_mapping(dm);
                        }
 
                        if (vertCos) {
@@ -995,7 +992,8 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 
                        if (useCache)
                                appf |= MOD_APPLY_USECACHE;
-                       ndm = mti->applyModifier(md, ob, dm, appf);
+
+                       ndm = modwrap_applyModifier(md, ob, dm, appf);
 
                        if (ndm) {
                                /* Modifier returned a new derived mesh */
@@ -1025,8 +1023,19 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
        }
 
        if (derivedFinal) {
-               if (dm)
-                       DM_ensure_tessface(dm);  /* needed for drawing */
+               if (dm) {
+                       /* see: mesh_calc_modifiers */
+                       if (dm->getNumTessFaces(dm) == 0) {
+                               dm->recalcTessellation(dm);
+                       }
+                       /* Even if tessellation is not needed, some modifiers might have modified CD layers
+                        * (like mloopcol or mloopuv), hence we have to update those. */
+                       else if (dm->dirty & DM_DIRTY_TESS_CDLAYERS) {
+                               DM_update_tessface_data(dm);
+                       }
+
+                       CDDM_calc_normals_mapping_ex(dm, (dm->dirty & DM_DIRTY_NORMALS) ? false : true);
+               }
                (*derivedFinal) = dm;
        }
 
index c17830639e4cc7ed182bf3adaa49f715f3856e9f..a0fa33172971e07e94a4e0ec14a52da926f3da1f 100644 (file)
@@ -36,7 +36,7 @@
  *  \ingroup bke
  */
 
-
+#include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
 #include <stdarg.h>
@@ -60,6 +60,7 @@
 #include "BKE_cloth.h"
 #include "BKE_key.h"
 #include "BKE_multires.h"
+#include "BKE_DerivedMesh.h"
 
 /* may move these, only for modifier_path_relbase */
 #include "BKE_global.h" /* ugh, G.main->name only */
@@ -693,3 +694,65 @@ void modifier_path_init(char *path, int path_maxlen, const char *name)
                         G.relbase_valid ? "//" : BLI_temporary_dir(),
                         name);
 }
+
+
+/* wrapper around ModifierTypeInfo.applyModifier that ensures valid normals */
+
+struct DerivedMesh *modwrap_applyModifier(
+        ModifierData *md, Object *ob,
+        struct DerivedMesh *dm,
+        ModifierApplyFlag flag)
+{
+       ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+       BLI_assert(CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
+
+       if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+               DM_ensure_normals(dm);
+       }
+       return mti->applyModifier(md, ob, dm, flag);
+}
+
+struct DerivedMesh *modwrap_applyModifierEM(
+        ModifierData *md, Object *ob,
+        struct BMEditMesh *em,
+        DerivedMesh *dm,
+        ModifierApplyFlag flag)
+{
+       ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+       BLI_assert(CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
+
+       if (mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+               DM_ensure_normals(dm);
+       }
+       return mti->applyModifierEM(md, ob, em, dm, flag);
+}
+
+void modwrap_deformVerts(
+        ModifierData *md, Object *ob,
+        DerivedMesh *dm,
+        float (*vertexCos)[3], int numVerts,
+        ModifierApplyFlag flag)
+{
+       ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+       BLI_assert(!dm || CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
+
+       if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+               DM_ensure_normals(dm);
+       }
+       mti->deformVerts(md, ob, dm, vertexCos, numVerts, flag);
+}
+
+void modwrap_deformVertsEM(
+        ModifierData *md, Object *ob,
+        struct BMEditMesh *em, DerivedMesh *dm,
+        float (*vertexCos)[3], int numVerts)
+{
+       ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+       BLI_assert(!dm || CustomData_has_layer(&dm->polyData, CD_NORMAL) == false);
+
+       if (dm && mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+               DM_ensure_normals(dm);
+       }
+       mti->deformVertsEM(md, ob, em, dm, vertexCos, numVerts);
+}
+/* end modifier callback wrappers */
index a36627bd903136658b5696b119f09a74f9bc0b01..e0a34e35acc99db45beabbbf6312e62acde96e07 100644 (file)
@@ -162,7 +162,7 @@ void BLI_path_rel(char *file, const char *relfile);
 bool BLI_path_is_rel(const char *path);
 
 /* path string comparisons: case-insensitive for Windows, case-sensitive otherwise */
-#ifdef WIN32
+#if defined(WIN32)
 #  define BLI_path_cmp BLI_strcasecmp
 #  define BLI_path_ncmp BLI_strncasecmp
 #else
index d44e3fd49489f4ad740f599a9558a52a2c9b2089..07ed2f181112fb6be69e9d0d9e72d54247bbfe03 100644 (file)
@@ -9605,6 +9605,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
        link_list(fd, &user->themes);
        link_list(fd, &user->user_keymaps);
        link_list(fd, &user->addons);
+       link_list(fd, &user->autoexec_paths);
        
        for (keymap=user->user_keymaps.first; keymap; keymap=keymap->next) {
                keymap->modal_items= NULL;
index d8bf1a5e4c4ab81c163de27e9fff7419d05cbca9..9b6699f3f215ccba1db7c0f82191d559f6763b7d 100644 (file)
@@ -860,6 +860,7 @@ static void write_userdef(WriteData *wd)
        wmKeyMapItem *kmi;
        wmKeyMapDiffItem *kmdi;
        bAddon *bext;
+       bPathCompare *path_cmp;
        uiStyle *style;
        
        writestruct(wd, USER, "UserDef", 1, &U);
@@ -888,6 +889,10 @@ static void write_userdef(WriteData *wd)
                        IDP_WriteProperty(bext->prop, wd);
                }
        }
+
+       for (path_cmp = U.autoexec_paths.first; path_cmp; path_cmp = path_cmp->next) {
+               writestruct(wd, DATA, "bPathCompare", 1, path_cmp);
+       }
        
        for (style= U.uistyles.first; style; style= style->next) {
                writestruct(wd, DATA, "uiStyle", 1, style);
index a9378d11cc3dc8577d9aa5a4a83ece88c8684a0b..85a23a9da2239f70ae9b0881ff21ec89faacafe8 100644 (file)
@@ -6581,7 +6581,8 @@ static void ui_mouse_motion_towards_reinit(uiPopupBlockHandle *menu, const int x
        ui_mouse_motion_towards_init_ex(menu, xy, true);
 }
 
-static bool ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *menu, const int xy[2])
+static bool ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *menu, const int xy[2],
+                                          const bool use_wiggle_room)
 {
        float p1[2], p2[2], p3[2], p4[2];
        float oldp[2] = {menu->towards_xy[0], menu->towards_xy[1]};
@@ -6615,8 +6616,8 @@ static bool ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *me
        p4[1] = rect_px.ymax + margin;
 
        /* allow for some wiggle room, if the user moves a few pixels away,
-        * don't immediately quit */
-       {
+        * don't immediately quit (only for top level menus) */
+       if (use_wiggle_room) {
                const float cent[2] = {
                    BLI_rctf_cent_x(&rect_px),
                    BLI_rctf_cent_y(&rect_px)};
@@ -6789,7 +6790,8 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock
        return retval;
 }
 
-static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu, int level)
+static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu,
+                                int level, const bool is_parent_inside)
 {
        ARegion *ar;
        uiBlock *block;
@@ -7130,7 +7132,7 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH
                                        menu->menuretval = UI_RETURN_CANCEL | UI_RETURN_POPUP_OK;
                        }
                        else {
-                               ui_mouse_motion_towards_check(block, menu, &event->x);
+                               ui_mouse_motion_towards_check(block, menu, &event->x, is_parent_inside == false);
 
                                /* check mouse moving outside of the menu */
                                if (inside == 0 && (block->flag & UI_BLOCK_MOVEMOUSE_QUIT)) {
@@ -7233,7 +7235,8 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo
                return WM_UI_HANDLER_BREAK;
 }
 
-static int ui_handle_menus_recursive(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu, int level)
+static int ui_handle_menus_recursive(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu,
+                                     int level, const bool is_parent_inside)
 {
        uiBut *but;
        uiHandleButtonData *data;
@@ -7246,8 +7249,21 @@ static int ui_handle_menus_recursive(bContext *C, const wmEvent *event, uiPopupB
        data = (but) ? but->active : NULL;
        submenu = (data) ? data->menu : NULL;
 
-       if (submenu)
-               retval = ui_handle_menus_recursive(C, event, submenu, level + 1);
+       if (submenu) {
+               bool inside = false;
+
+               if (is_parent_inside == false) {
+                       int mx, my;
+                       uiBlock *block = menu->region->uiblocks.first;
+
+                       mx = event->x;
+                       my = event->y;
+                       ui_window_to_block(menu->region, block, &mx, &my);
+                       inside = BLI_rctf_isect_pt(&block->rect, mx, my);
+               }
+
+               retval = ui_handle_menus_recursive(C, event, submenu, level + 1, is_parent_inside || inside);
+       }
 
        /* now handle events for our own menu */
        if (retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
@@ -7275,7 +7291,7 @@ static int ui_handle_menus_recursive(bContext *C, const wmEvent *event, uiPopupB
                        }
                }
                else {
-                       retval = ui_handle_menu_event(C, event, menu, level);
+                       retval = ui_handle_menu_event(C, event, menu, level, is_parent_inside);
                }
        }
 
@@ -7371,7 +7387,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
                        /* handle events for menus and their buttons recursively,
                         * this will handle events from the top to the bottom menu */
                        if (data->menu)
-                               retval = ui_handle_menus_recursive(C, event, data->menu, 0);
+                               retval = ui_handle_menus_recursive(C, event, data->menu, 0, false);
 
                        /* handle events for the activated button */
                        if ((data->menu && (retval == WM_UI_HANDLER_CONTINUE)) ||
@@ -7417,7 +7433,7 @@ static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata)
                retval = WM_UI_HANDLER_CONTINUE;
        }
 
-       ui_handle_menus_recursive(C, event, menu, 0);
+       ui_handle_menus_recursive(C, event, menu, 0, false);
 
        /* free if done, does not free handle itself */
        if (menu->menuretval) {
index 20edd3d32e798d9cd00038b9d40552d02c738491..527715cdbd3b412560ef150df20a0b5413d9056b 100644 (file)
@@ -220,7 +220,7 @@ static int screenshot_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
        return OPERATOR_CANCELLED;
 }
 
-static int screenshot_check(bContext *UNUSED(C), wmOperator *op)
+static bool screenshot_check(bContext *UNUSED(C), wmOperator *op)
 {
        ScreenshotData *scd = op->customdata;
        return WM_operator_filesel_ensure_ext_imtype(op, &scd->im_format);
index 1ff7df3b0419d2101148c52d41820f0b26f77631..181b32d58fc2e19ca3f808db04ee7b281ce4de35 100644 (file)
@@ -2145,7 +2145,7 @@ struct WPaintData {
 };
 
 /* ensure we have data on wpaint start, add if needed */
-static int wpaint_ensure_data(bContext *C, wmOperator *op)
+static bool wpaint_ensure_data(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
        Object *ob = CTX_data_active_object(C);
@@ -3390,6 +3390,10 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
                vert_cache = gesture->userdata;
        }
        else {
+               if (wpaint_ensure_data(C, op) == FALSE) {
+                       return OPERATOR_CANCELLED;
+               }
+
                data.is_init = true;
                vert_cache = MEM_mallocN(sizeof(DMGradient_vertStore) * me->totvert, __func__);
        }
index 0cb0a3d6e5cd37a721d94dbdfc9d8edfb1dcb904..a2189f6237c0b30d060fa20f7bdaa7b0d61a2067 100644 (file)
@@ -391,7 +391,7 @@ static const char *snd_ext_sound[] = {
        NULL
 };
 
-static int sound_mixdown_check(bContext *UNUSED(C), wmOperator *op)
+static bool sound_mixdown_check(bContext *UNUSED(C), wmOperator *op)
 {
        AUD_Container container = RNA_enum_get(op->ptr, "container");
 
index 604206490935a94f9e7f95f4f3eb96b8fcdf56df..986b71abc8a582fe7125dbf019499be7761f4474 100644 (file)
@@ -807,7 +807,7 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
 static int clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
 {
        if (drag->type == WM_DRAG_PATH)
-               if (ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
+               if (ELEM4(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
                        return TRUE;
 
        return FALSE;
index 25d865d857b761b5b792b3041c330211b464d0ec..59801796f8c2f1cb82268070524b37508e787496 100644 (file)
@@ -609,6 +609,7 @@ void file_change_dir(bContext *C, int checkdir)
 
                folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
 
+               file_draw_check_cb(C, NULL, NULL);
        }
 }
 
index 8272222e4c20104a92b65941872b255a76bd888a..0a2bd2aad81c852423775d5bc9d1247a4568f6c0 100644 (file)
@@ -1441,7 +1441,7 @@ static int image_save_as_exec(bContext *C, wmOperator *op)
 }
 
 
-static int image_save_as_check(bContext *UNUSED(C), wmOperator *op)
+static bool image_save_as_check(bContext *UNUSED(C), wmOperator *op)
 {
        ImageFormatData *imf = op->customdata;
        return WM_operator_filesel_ensure_ext_imtype(op, imf);
index a846ac697f0b696d40411369bdc99e94ebb09b17..e0c5cd5608ee1de04ae614dec488ece64c200141 100644 (file)
@@ -360,6 +360,12 @@ typedef struct bAddon {
        IDProperty *prop;  /* User-Defined Properties on this  Addon (for storing preferences) */
 } bAddon;
 
+typedef struct bPathCompare {
+       struct bPathCompare *next, *prev;
+       char path[768];  /* FILE_MAXDIR */
+       char flag, pad[7];
+} bPathCompare;
+
 typedef struct SolidLight {
        int flag, pad;
        float col[4], spec[4], vec[4];
@@ -412,6 +418,7 @@ typedef struct UserDef {
        struct ListBase keymaps  DNA_DEPRECATED; /* deprecated in favor of user_keymaps */
        struct ListBase user_keymaps;
        struct ListBase addons;
+       struct ListBase autoexec_paths;
        char keyconfigstr[64];
        
        short undosteps;
@@ -522,7 +529,12 @@ typedef enum eUserPref_Flag {
        USER_TXT_TABSTOSPACES_DISABLE   = (1 << 25),
        USER_TOOLTIPS_PYTHON    = (1 << 26),
 } eUserPref_Flag;
-       
+
+/* flag */
+typedef enum ePathCompare_Flag {
+       USER_PATHCMP_GLOB               = (1 << 0),
+} ePathCompare_Flag;
+
 /* helper macro for checking frame clamping */
 #define FRAMENUMBER_MIN_CLAMP(cfra)  {                                        \
        if ((U.flag & USER_NONEGFRAMES) && (cfra < 0))                            \
index 347c57f9044588f7efce20d1661c4342e5170d13..f34366a23c761516eeaf35502a7b1514e2da00da 100644 (file)
@@ -339,9 +339,9 @@ static bAddon *rna_userdef_addon_new(void)
        return bext;
 }
 
-static void rna_userdef_addon_remove(ReportList *reports, PointerRNA *bext_ptr)
+static void rna_userdef_addon_remove(ReportList *reports, PointerRNA *path_cmp_ptr)
 {
-       bAddon *bext = bext_ptr->data;
+       bAddon *bext = path_cmp_ptr->data;
        if (BLI_findindex(&U.addons, bext) == -1) {
                BKE_report(reports, RPT_ERROR, "Addon is no longer valid");
                return;
@@ -353,7 +353,26 @@ static void rna_userdef_addon_remove(ReportList *reports, PointerRNA *bext_ptr)
        }
 
        BLI_freelinkN(&U.addons, bext);
-       RNA_POINTER_INVALIDATE(bext_ptr);
+       RNA_POINTER_INVALIDATE(path_cmp_ptr);
+}
+
+static bPathCompare *rna_userdef_pathcompare_new(void)
+{
+       bPathCompare *path_cmp = MEM_callocN(sizeof(bPathCompare), "bPathCompare");
+       BLI_addtail(&U.autoexec_paths, path_cmp);
+       return path_cmp;
+}
+
+static void rna_userdef_pathcompare_remove(ReportList *reports, PointerRNA *path_cmp_ptr)
+{
+       bPathCompare *path_cmp = path_cmp_ptr->data;
+       if (BLI_findindex(&U.autoexec_paths, path_cmp) == -1) {
+               BKE_report(reports, RPT_ERROR, "Addon is no longer valid");
+               return;
+       }
+
+       BLI_freelinkN(&U.autoexec_paths, path_cmp);
+       RNA_POINTER_INVALIDATE(path_cmp_ptr);
 }
 
 static void rna_userdef_temp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
@@ -2733,6 +2752,25 @@ static void rna_def_userdef_addon(BlenderRNA *brna)
        RNA_def_property_pointer_funcs(prop, "rna_Addon_preferences_get", NULL, NULL, NULL);
 }
 
+static void rna_def_userdef_pathcompare(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       srna = RNA_def_struct(brna, "PathCompare", NULL);
+       RNA_def_struct_sdna(srna, "bPathCompare");
+       RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+       RNA_def_struct_ui_text(srna, "Path Compare", "Match paths against this value");
+
+       prop = RNA_def_property(srna, "path", PROP_STRING, PROP_DIRPATH);
+       RNA_def_property_ui_text(prop, "Path", "");
+       RNA_def_struct_name_property(srna, prop);
+
+       prop = RNA_def_property(srna, "use_glob", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_PATHCMP_GLOB);
+       RNA_def_property_ui_text(prop, "Use Wildcard", "Enable wildcard globbing");
+}
+
 static void rna_def_userdef_addon_pref(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -4027,6 +4065,32 @@ static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cpro
        RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
 }
 
+static void rna_def_userdef_autoexec_path_collection(BlenderRNA *brna, PropertyRNA *cprop)
+{
+       StructRNA *srna;
+       FunctionRNA *func;
+       PropertyRNA *parm;
+
+       RNA_def_property_srna(cprop, "PathCompareCollection");
+       srna = RNA_def_struct(brna, "PathCompareCollection", NULL);
+       RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+       RNA_def_struct_ui_text(srna, "Paths Compare", "Collection of paths");
+
+       func = RNA_def_function(srna, "new", "rna_userdef_pathcompare_new");
+       RNA_def_function_flag(func, FUNC_NO_SELF);
+       RNA_def_function_ui_description(func, "Add a new addon");
+       /* return type */
+       parm = RNA_def_pointer(func, "pathcmp", "PathCompare", "", "");
+       RNA_def_function_return(func, parm);
+
+       func = RNA_def_function(srna, "remove", "rna_userdef_pathcompare_remove");
+       RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
+       RNA_def_function_ui_description(func, "Remove path");
+       parm = RNA_def_pointer(func, "pathcmp", "PathCompare", "", "");
+       RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+       RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
+}
+
 void RNA_def_userdef(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -4074,6 +4138,11 @@ void RNA_def_userdef(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Addon", "");
        rna_def_userdef_addon_collection(brna, prop);
 
+       prop = RNA_def_property(srna, "autoexec_paths", PROP_COLLECTION, PROP_NONE);
+       RNA_def_property_collection_sdna(prop, NULL, "autoexec_paths", NULL);
+       RNA_def_property_struct_type(prop, "PathCompare");
+       RNA_def_property_ui_text(prop, "Autoexec Paths", "");
+       rna_def_userdef_autoexec_path_collection(brna, prop);
 
        /* nested structs */
        prop = RNA_def_property(srna, "view", PROP_POINTER, PROP_NONE);
@@ -4113,6 +4182,7 @@ void RNA_def_userdef(BlenderRNA *brna)
        rna_def_userdef_system(brna);
        rna_def_userdef_addon(brna);
        rna_def_userdef_addon_pref(brna);
+       rna_def_userdef_pathcompare(brna);
        
 }
 
index 6bf3beec57b93f71b26173b7f5b32887a20eccc8..b70ab7c15f2a699748733ddede182ca1c319ed49 100644 (file)
@@ -955,7 +955,7 @@ static int operator_execute(bContext *C, wmOperator *op)
 }
 
 /* same as execute() but no return value */
-static int operator_check(bContext *C, wmOperator *op)
+static bool operator_check(bContext *C, wmOperator *op)
 {
        extern FunctionRNA rna_Operator_check_func;
 
@@ -963,7 +963,7 @@ static int operator_check(bContext *C, wmOperator *op)
        ParameterList list;
        FunctionRNA *func;
        void *ret;
-       int result;
+       bool result;
 
        RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
        func = &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
@@ -973,7 +973,7 @@ static int operator_check(bContext *C, wmOperator *op)
        op->type->ext.call(C, &opr, func, &list);
 
        RNA_parameter_get_lookup(&list, "result", &ret);
-       result = *(int *)ret;
+       result = (*(int *)ret) != 0;
 
        RNA_parameter_list_free(&list);
 
index d877932b81de9fb34b27a44aa1862f0bc722b64a..e37fc56d08c757888d2ce0992caaccdde32622fe 100644 (file)
@@ -49,7 +49,7 @@
 #include "DNA_object_types.h"
 
 
-static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Object *UNUSED(ob))
+static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd)
 {
        DerivedMesh *result;
        BMesh *bm;
@@ -97,7 +97,8 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
 
        result = CDDM_from_bmesh(bm, TRUE);
        BM_mesh_free(bm);
-       
+
+       result->dirty |= DM_DIRTY_NORMALS;
        return result;
 }
 
@@ -119,25 +120,16 @@ static void copyData(ModifierData *md, ModifierData *target)
        temd->flags = emd->flags;
 }
 
-static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd,
-                                         Object *ob, DerivedMesh *dm)
-{
-       if (!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG)))
-               return dm;
-
-       return doEdgeSplit(dm, emd, ob);
-}
-
-static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *derivedData,
+static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), DerivedMesh *dm,
                                   ModifierApplyFlag UNUSED(flag))
 {
        DerivedMesh *result;
        EdgeSplitModifierData *emd = (EdgeSplitModifierData *) md;
 
-       result = edgesplitModifier_do(emd, ob, derivedData);
+       if (!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG)))
+               return dm;
 
-       if (result != derivedData)
-               result->dirty |= DM_DIRTY_NORMALS;
+       result = doEdgeSplit(dm, emd);
 
        return result;
 }
index 189c30b02e84bf5cdf4950b0c878ae74aec53b6b..72b54e2f1f7359fea668a6806b75f583e8de34e4 100644 (file)
@@ -112,6 +112,7 @@ bool                WM_is_draw_triple(struct wmWindow *win);
 
 
                        /* files */
+void           WM_file_autoexec_init(const char *filepath);
 void           WM_file_read(struct bContext *C, const char *filepath, struct ReportList *reports);
 void           WM_autosave_init(struct wmWindowManager *wm);
 void           WM_recover_last_session(struct bContext *C, struct ReportList *reports);
@@ -193,7 +194,7 @@ int                 WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, const str
 int                    WM_operator_confirm             (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
                /* invoke callback, file selector "filepath" unset + exec */
 int                    WM_operator_filesel             (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
-int         WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format);
+bool        WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format);
                        /* poll callback, context checks */
 int                    WM_operator_winactive   (struct bContext *C);
                        /* invoke callback, exec + redo popup */
index cb0600771665282ff4eb4320d95d844a01ed2a96..cd3899897a1748a2fc3ab5c7be44338af82abd46 100644 (file)
@@ -531,7 +531,7 @@ typedef struct wmOperatorType {
         * is changed. It can correct its own properties or report errors for
         * invalid settings in exceptional cases.
         * Boolean return value, True denotes a change has been made and to redraw */
-       int (*check)(struct bContext *, struct wmOperator *);
+       bool (*check)(struct bContext *, struct wmOperator *);
 
        /* for modal temporary operators, initially invoke is called. then
         * any further events are handled in modal. if the operation is
index b6aecf120cc042bb6e66f35bb7dc3683087492ca..f4b50667b2f270f6e986a7dd7483f7505a2c0a67 100644 (file)
@@ -70,6 +70,7 @@
 #include "DNA_screen_types.h"
 #include "DNA_windowmanager_types.h"
 
+#include "BKE_autoexec.h"
 #include "BKE_blender.h"
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
@@ -364,6 +365,21 @@ static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
        return retval;
 }
 
+void WM_file_autoexec_init(const char *filepath)
+{
+       if (G.f & G_SCRIPT_OVERRIDE_PREF) {
+               return;
+       }
+
+       if (G.f & G_SCRIPT_AUTOEXEC) {
+               char path[FILE_MAX];
+               BLI_split_dir_part(filepath, path, sizeof(path));
+               if (BKE_autoexec_match(path)) {
+                       G.f &= ~G_SCRIPT_AUTOEXEC;
+               }
+       }
+}
+
 void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
 {
        int retval;
index 3d4bd2a1bc6ddc5e582be7cd4543f2e1c3a7c856..cd0042731c1609ce25a3c639cb9757acbab46e57 100644 (file)
@@ -60,6 +60,7 @@
 
 #include "BLO_readfile.h"
 
+#include "BKE_autoexec.h"
 #include "BKE_blender.h"
 #include "BKE_brush.h"
 #include "BKE_context.h"
@@ -1038,7 +1039,7 @@ int WM_operator_filesel(bContext *C, wmOperator *op, const wmEvent *UNUSED(event
        }
 }
 
-int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format)
+bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format)
 {
        PropertyRNA *prop;
        char filepath[FILE_MAX];
@@ -1868,6 +1869,47 @@ static void WM_OT_save_homefile(wmOperatorType *ot)
        ot->poll = WM_operator_winactive;
 }
 
+static int wm_userpref_autoexec_add_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
+{
+       bPathCompare *path_cmp = MEM_callocN(sizeof(bPathCompare), "bPathCompare");
+       BLI_addtail(&U.autoexec_paths, path_cmp);
+       return OPERATOR_FINISHED;
+}
+
+static void WM_OT_userpref_autoexec_path_add(wmOperatorType *ot)
+{
+       ot->name = "Add Autoexec Path";
+       ot->idname = "WM_OT_userpref_autoexec_path_add";
+
+       ot->exec = wm_userpref_autoexec_add_exec;
+       ot->poll = WM_operator_winactive;
+
+       ot->flag = OPTYPE_INTERNAL;
+}
+
+static int wm_userpref_autoexec_remove_exec(bContext *UNUSED(C), wmOperator *op)
+{
+       const int index = RNA_int_get(op->ptr, "index");
+       bPathCompare *path_cmp = BLI_findlink(&U.autoexec_paths, index);
+       if (path_cmp) {
+               BLI_freelinkN(&U.autoexec_paths, path_cmp);
+       }
+       return OPERATOR_FINISHED;
+}
+
+static void WM_OT_userpref_autoexec_path_remove(wmOperatorType *ot)
+{
+       ot->name = "Remove Autoexec Path";
+       ot->idname = "WM_OT_userpref_autoexec_path_remove";
+
+       ot->exec = wm_userpref_autoexec_remove_exec;
+       ot->poll = WM_operator_winactive;
+
+       ot->flag = OPTYPE_INTERNAL;
+
+       RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
+}
+
 static void WM_OT_save_userpref(wmOperatorType *ot)
 {
        ot->name = "Save User Settings";
@@ -1916,6 +1958,12 @@ static void WM_OT_read_factory_settings(wmOperatorType *ot)
 
 /* *************** open file **************** */
 
+/* currently fits in a pointer */
+struct FileRuntime {
+       bool is_untrusted;
+};
+
+
 static void open_set_load_ui(wmOperator *op, bool use_prefs)
 {
        PropertyRNA *prop = RNA_struct_find_property(op->ptr, "load_ui");
@@ -1960,6 +2008,7 @@ static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *U
        RNA_string_set(op->ptr, "filepath", openname);
        open_set_load_ui(op, true);
        open_set_use_scripts(op, true);
+       op->customdata = NULL;
 
        WM_event_add_fileselect(C, op);
 
@@ -1990,11 +2039,65 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
        /* do it before for now, but is this correct with multiple windows? */
        WM_event_add_notifier(C, NC_WINDOW, NULL);
 
+       /* autoexec is already set correctly for invoke() for exec() though we need to initialize */
+       if (!RNA_struct_property_is_set(op->ptr, "use_scripts")) {
+               WM_file_autoexec_init(path);
+       }
        WM_file_read(C, path, op->reports);
-       
+
        return OPERATOR_FINISHED;
 }
 
+static bool wm_open_mainfile_check(bContext *UNUSED(C), wmOperator *op)
+{
+       struct FileRuntime *file_info = (struct FileRuntime *)&op->customdata;
+       PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_scripts");
+       bool is_untrusted = false;
+       char path[FILE_MAX];
+       char *lslash;
+
+       RNA_string_get(op->ptr, "filepath", path);
+
+       /* get the dir */
+       lslash = (char *)BLI_last_slash(path);
+       if (lslash) *(lslash + 1) = '\0';
+
+       if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) {
+               if (BKE_autoexec_match(path) == true) {
+                       RNA_property_boolean_set(op->ptr, prop, false);
+                       is_untrusted = true;
+               }
+       }
+
+       if (file_info) {
+               file_info->is_untrusted = is_untrusted;
+       }
+
+       return is_untrusted;
+}
+
+static void wm_open_mainfile_ui(bContext *UNUSED(C), wmOperator *op)
+{
+       struct FileRuntime *file_info = (struct FileRuntime *)&op->customdata;
+       uiLayout *layout = op->layout;
+       uiLayout *col = op->layout;
+       const char *autoexec_text = NULL;
+
+       uiItemR(layout, op->ptr, "load_ui", 0, NULL, ICON_NONE);
+
+       col = uiLayoutColumn(layout, false);
+       if (file_info->is_untrusted) {
+               autoexec_text = "Trusted Source [Untrusted Path]";
+               uiLayoutSetActive(col, false);
+               uiLayoutSetEnabled(col, false);
+       }
+       else {
+               autoexec_text = "Trusted Source";
+       }
+
+       uiItemR(col, op->ptr, "use_scripts", 0, autoexec_text, ICON_NONE);
+}
+
 static void WM_OT_open_mainfile(wmOperatorType *ot)
 {
        ot->name = "Open Blender File";
@@ -2003,6 +2106,8 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
 
        ot->invoke = wm_open_mainfile_invoke;
        ot->exec = wm_open_mainfile_exec;
+       ot->check = wm_open_mainfile_check;
+       ot->ui = wm_open_mainfile_ui;
        /* ommit window poll so this can work in background mode */
 
        WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_OPENFILE,
@@ -2233,6 +2338,7 @@ void WM_recover_last_session(bContext *C, ReportList *reports)
                WM_event_add_notifier(C, NC_WINDOW, NULL);
                
                /* load file */
+               WM_file_autoexec_init(filename);
                WM_file_read(C, filename, reports);
        
                G.fileflags &= ~G_FILE_RECOVER;
@@ -2279,6 +2385,7 @@ static int wm_recover_auto_save_exec(bContext *C, wmOperator *op)
        WM_event_add_notifier(C, NC_WINDOW, NULL);
 
        /* load file */
+       WM_file_autoexec_init(path);
        WM_file_read(C, path, op->reports);
 
        G.fileflags &= ~G_FILE_RECOVER;
@@ -2400,7 +2507,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
 }
 
 /* function used for WM_OT_save_mainfile too */
-static int blend_save_check(bContext *UNUSED(C), wmOperator *op)
+static bool blend_save_check(bContext *UNUSED(C), wmOperator *op)
 {
        char filepath[FILE_MAX];
        RNA_string_get(op->ptr, "filepath", filepath);
@@ -4044,6 +4151,8 @@ void wm_operatortype_init(void)
        WM_operatortype_append(WM_OT_read_factory_settings);
        WM_operatortype_append(WM_OT_save_homefile);
        WM_operatortype_append(WM_OT_save_userpref);
+       WM_operatortype_append(WM_OT_userpref_autoexec_path_add);
+       WM_operatortype_append(WM_OT_userpref_autoexec_path_remove);
        WM_operatortype_append(WM_OT_window_fullscreen_toggle);
        WM_operatortype_append(WM_OT_quit_blender);
        WM_operatortype_append(WM_OT_open_mainfile);
index 302467c6b3d5e57bcfbd9500615e3c06bb280d86..817bc4fcf60829b33ab909e747137e985bf2f90b 100644 (file)
@@ -1262,6 +1262,7 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
                 * a file - this should do everything a 'load file' does */
                ReportList reports;
                BKE_reports_init(&reports, RPT_PRINT);
+               WM_file_autoexec_init(filename);
                WM_file_read(C, filename, &reports);
                BKE_reports_clear(&reports);
        }