svn merge ^/trunk/blender -r41961:41998
authorCampbell Barton <ideasman42@gmail.com>
Sun, 20 Nov 2011 01:14:33 +0000 (01:14 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 20 Nov 2011 01:14:33 +0000 (01:14 +0000)
85 files changed:
build_files/cmake/cmake_consistency_check.py
build_files/cmake/project_info.py
build_files/cmake/project_source_info.py
build_files/scons/config/darwin-config.py
build_files/scons/config/freebsd7-config.py
build_files/scons/config/freebsd8-config.py
build_files/scons/config/freebsd9-config.py
build_files/scons/config/linux-config.py
build_files/scons/tools/Blender.py
doc/python_api/epy/testbgl.py [deleted file]
extern/libmv/libmv/simple_pipeline/camera_intrinsics.cc
intern/cycles/CMakeLists.txt
intern/cycles/blender/CMakeLists.txt
intern/cycles/blender/addon/ui.py
intern/cycles/cmake/external_libs.cmake
intern/cycles/kernel/svm/bsdf_oren_nayar.h
release/scripts/modules/animsys_refactor.py
release/scripts/startup/bl_operators/clip.py
release/scripts/startup/bl_ui/properties_particle.py
release/scripts/startup/bl_ui/properties_scene.py
release/scripts/startup/bl_ui/space_clip.py
release/scripts/startup/bl_ui/space_sequencer.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_camera.h
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/camera.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/nla.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/tracking.c
source/blender/blenlib/intern/math_geom.c
source/blender/blenlib/intern/math_rotation.c
source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/include/ED_transform.h
source/blender/editors/include/ED_view3d.h
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_style.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/resources.c
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/render/render_opengl.c
source/blender/editors/screen/area.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform_snap.c
source/blender/imbuf/intern/anim_movie.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_actuator.c
source/blender/makesrna/intern/rna_camera.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_controller.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_tracking.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/modifiers/intern/MOD_uvproject.c
source/blender/nodes/composite/nodes/node_composite_defocus.c
source/blender/python/generic/noise_py_api.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/source/envmap.c
source/blender/render/intern/source/initrender.c
source/blenderplayer/bad_level_call_stubs/stubs.c
source/creator/CMakeLists.txt
source/gameengine/Ketsji/BL_Shader.cpp
source/tests/pep8.py

index be68455a113e7fa39337e8254b5b8ec62ef3307a..65a9442a90d75943fc8f58530b1de3e64053baa1 100755 (executable)
 
 # <pep8 compliant>
 
+import sys
+if not sys.version.startswith("3"):
+    print("\nPython3.x needed, found %s.\nAborting!\n" %
+          sys.version.partition(" ")[0])
+    sys.exit(1)
+
 from cmake_consistency_check_config import IGNORE, UTF8_CHECK, SOURCE_DIR
 
 import os
index 7162b324f944b3f355bdf9afbb2436a9f366957e..65afd109302595698839d068450d57cd7cbdd670 100755 (executable)
@@ -44,7 +44,14 @@ __all__ = (
     "project_name_get"
 )
 
+
 import sys
+if not sys.version.startswith("3"):
+    print("\nPython3.x needed, found %s.\nAborting!\n" %
+          sys.version.partition(" ")[0])
+    sys.exit(1)
+
+
 import os
 from os.path import join, dirname, normpath, abspath, splitext, exists
 
@@ -142,10 +149,11 @@ def cmake_advanced_info():
 
     from xml.dom.minidom import parse
     tree = parse(join(CMAKE_DIR, ".cproject"))
-    '''
-    f = open(".cproject_pretty", 'w')
-    f.write(tree.toprettyxml(indent="    ", newl=""))
-    '''
+
+    # to check on nicer xml
+    # f = open(".cproject_pretty", 'w')
+    # f.write(tree.toprettyxml(indent="    ", newl=""))
+
     ELEMENT_NODE = tree.ELEMENT_NODE
 
     cproject, = tree.getElementsByTagName("cproject")
index d4b48ccd859871ece6efc3ddffe2e8acfed82f51..a39ed94bd69d05a1ad8328ad42cb81a87ed97a5c 100644 (file)
@@ -25,6 +25,14 @@ __all__ = (
     "SOURCE_DIR",
     )
 
+
+import sys
+if not sys.version.startswith("3"):
+    print("\nPython3.x needed, found %s.\nAborting!\n" %
+          sys.version.partition(" ")[0])
+    sys.exit(1)
+
+
 import os
 from os.path import join, dirname, normpath, abspath
 
index d6da908f074d0d18928acf71ba6bc0944624869c..028b1bd028900b1b72002bac3bed2c51e8c34c36 100644 (file)
@@ -18,20 +18,20 @@ MACOSX_ARCHITECTURE = 'i386' # valid archs: ppc, i386, ppc64, x86_64
 
 
 cmd = 'uname -p'
-MAC_PROC=commands.getoutput(cmd) 
+MAC_PROC=commands.getoutput(cmd)
 cmd = 'uname -r'
-cmd_res=commands.getoutput(cmd) 
+cmd_res=commands.getoutput(cmd)
 
 if cmd_res[:1]=='7':
-       MAC_CUR_VER='10.3'
+    MAC_CUR_VER='10.3'
 elif cmd_res[:1]=='8':
-       MAC_CUR_VER='10.4'
+    MAC_CUR_VER='10.4'
 elif cmd_res[:1]=='9':
-       MAC_CUR_VER='10.5'
+    MAC_CUR_VER='10.5'
 elif cmd_res[:2]=='10':
-       MAC_CUR_VER='10.6'
+    MAC_CUR_VER='10.6'
 elif cmd_res[:2]=='11':
-       MAC_CUR_VER='10.7'
+    MAC_CUR_VER='10.7'
 cmd = 'xcodebuild -version'
 cmd_xcode=commands.getoutput(cmd)
 XCODE_CUR_VER=cmd_xcode
@@ -40,7 +40,7 @@ cmd_sdk=commands.getoutput(cmd)
 MACOSX_SDK_CHECK=cmd_sdk
 
 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
-       USE_QTKIT=True # Carbon quicktime is not available for 64bit
+    USE_QTKIT=True # Carbon quicktime is not available for 64bit
 
 
 # Default target OSX settings per architecture
@@ -48,41 +48,41 @@ if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
 
 if MACOSX_ARCHITECTURE == 'ppc' and MAC_CUR_VER == '10.4':
 # all releases are now made for 10.5 !
-#      MAC_MIN_VERS = '10.3'
-#      MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
-#      LCGDIR = '#../lib/darwin-6.1-powerpc'
-#      CC = 'gcc-3.3'
-#      CXX = 'g++-3.3'
-       MAC_MIN_VERS = '10.4'
-       MACOSX_DEPLOYMENT_TARGET = '10.4'
-       MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
-       LCGDIR = '#../lib/darwin-8.0.0-powerpc'
-       CC = 'gcc-4.0'
-       CXX = 'g++-4.0'
+#   MAC_MIN_VERS = '10.3'
+#   MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
+#   LCGDIR = '#../lib/darwin-6.1-powerpc'
+#   CC = 'gcc-3.3'
+#   CXX = 'g++-3.3'
+    MAC_MIN_VERS = '10.4'
+    MACOSX_DEPLOYMENT_TARGET = '10.4'
+    MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
+    LCGDIR = '#../lib/darwin-8.0.0-powerpc'
+    CC = 'gcc-4.0'
+    CXX = 'g++-4.0'
 elif MACOSX_ARCHITECTURE == 'i386' and MAC_CUR_VER == '10.4':
-       MAC_MIN_VERS = '10.4'
-       MACOSX_DEPLOYMENT_TARGET = '10.4'
-       MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
-       LCGDIR = '#../lib/darwin-8.x.i386'
-       CC = 'gcc-4.0'
-       CXX = 'g++-4.0'
+    MAC_MIN_VERS = '10.4'
+    MACOSX_DEPLOYMENT_TARGET = '10.4'
+    MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
+    LCGDIR = '#../lib/darwin-8.x.i386'
+    CC = 'gcc-4.0'
+    CXX = 'g++-4.0'
 else :
-       if 'Mac OS X 10.5' in MACOSX_SDK_CHECK:
-               # OSX 10.5/6 with Xcode 3.x
-               MAC_MIN_VERS = '10.5'
-               MACOSX_DEPLOYMENT_TARGET = '10.5'
-               MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
-               LCGDIR = '#../lib/darwin-9.x.universal'
-               CC = 'gcc-4.2'
-               CXX = 'g++-4.2'
-       else:
-               # OSX 10.6/7 with Xcode 4.x
-               MAC_MIN_VERS = '10.6'
-               MACOSX_DEPLOYMENT_TARGET = '10.6'
-               MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk'
-               LCGDIR = '#../lib/darwin-9.x.universal'
-               CC = 'gcc-4.2'
-               CXX = 'g++-4.2'
+    if 'Mac OS X 10.5' in MACOSX_SDK_CHECK:
+        # OSX 10.5/6 with Xcode 3.x
+        MAC_MIN_VERS = '10.5'
+        MACOSX_DEPLOYMENT_TARGET = '10.5'
+        MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
+        LCGDIR = '#../lib/darwin-9.x.universal'
+        CC = 'gcc-4.2'
+        CXX = 'g++-4.2'
+    else:
+        # OSX 10.6/7 with Xcode 4.x
+        MAC_MIN_VERS = '10.6'
+        MACOSX_DEPLOYMENT_TARGET = '10.6'
+        MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk'
+        LCGDIR = '#../lib/darwin-9.x.universal'
+        CC = 'gcc-4.2'
+        CXX = 'g++-4.2'
 
 LIBDIR = '${LCGDIR}'
 
@@ -109,32 +109,32 @@ BF_PYTHON_VERSION = '3.2'
 WITH_OSX_STATICPYTHON = True
 
 if WITH_OSX_STATICPYTHON:
-       # python 3.2 uses precompiled libraries in bf svn /lib by default
-
-       BF_PYTHON = LIBDIR + '/python'
-       BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
-       # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
-       BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
-       BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
-       # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
+    # python 3.2 uses precompiled libraries in bf svn /lib by default
+
+    BF_PYTHON = LIBDIR + '/python'
+    BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
+    # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
+    BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
+    BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
+    # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
 else:
-       # python 3.2 uses Python-framework additionally installed in /Library/Frameworks
-       
-       BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
-       BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
-       BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
-       #BF_PYTHON_LIB = ''
-       BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
-       
+    # python 3.2 uses Python-framework additionally installed in /Library/Frameworks
+
+    BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
+    BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
+    BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
+    #BF_PYTHON_LIB = ''
+    BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
+
 WITH_BF_OPENAL = True
 #different lib must be used  following version of gcc
 # for gcc 3.3
 #BF_OPENAL = LIBDIR + '/openal'
 # for gcc 3.4 and ulterior
 if MAC_PROC == 'powerpc':
-       BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
+    BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
 else :
-       BF_OPENAL = LIBDIR + '/openal'
+    BF_OPENAL = LIBDIR + '/openal'
 
 WITH_BF_STATICOPENAL = False
 BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
@@ -233,7 +233,7 @@ BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
 #WITH_BF_NSPR = True
 #BF_NSPR = $(LIBDIR)/nspr
 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
-#BF_NSPR_LIB = 
+#BF_NSPR_LIB =
 
 # Uncomment the following line to use Mozilla inplace of netscape
 #CPPFLAGS += -DMOZ_NOT_NET
@@ -284,7 +284,7 @@ BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
 #BF_EXPAT_LIBPATH = '/usr/lib'
 
 #Cycles
-WITH_BF_CYCLES = True 
+WITH_BF_CYCLES = True
 
 WITH_BF_OIIO = True
 BF_OIIO = LIBDIR + '/openimageio'
@@ -318,9 +318,9 @@ WITH_BF_3DMOUSE = True
 BF_QUIET = '1' # suppress verbose output
 
 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
-       ARCH_FLAGS = ['-m64']
+    ARCH_FLAGS = ['-m64']
 else:
-       ARCH_FLAGS = ['-m32']
+    ARCH_FLAGS = ['-m32']
 
 CFLAGS = []
 CXXFLAGS = []
@@ -329,53 +329,53 @@ CCFLAGS = ['-pipe','-funsigned-char']
 CPPFLAGS = list(ARCH_FLAGS)
 
 if WITH_GHOST_COCOA:
-       PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
+    PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
 else:
-       PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
+    PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
 
 if WITH_BF_QUICKTIME:
-       if USE_QTKIT:
-               PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
-       else:
-               PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
+    if USE_QTKIT:
+        PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
+    else:
+        PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
 
 if not WITH_OSX_STATICPYTHON:
-               PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
+    PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
 
 
 #note to build succesfully on 10.3.9 SDK you need to patch  10.3.9 by adding the SystemStubs.a lib from 10.4
 #for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
 if MACOSX_DEPLOYMENT_TARGET == '10.7':
-       LLIBS = ['stdc++']
+    LLIBS = ['stdc++']
 else:
-       LLIBS = ['stdc++', 'SystemStubs']
+    LLIBS = ['stdc++', 'SystemStubs']
 
 # some flags shuffling for different OS versions
 if MAC_MIN_VERS == '10.3':
-       CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS
-       PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS
-       LLIBS.append('crt3.o')
-       
+    CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS
+    PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS
+    LLIBS.append('crt3.o')
+
 if USE_SDK:
-       SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]    
-       PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
-       CCFLAGS=SDK_FLAGS+CCFLAGS
-       CXXFLAGS=SDK_FLAGS+CXXFLAGS
+    SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]
+    PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
+    CCFLAGS=SDK_FLAGS+CCFLAGS
+    CXXFLAGS=SDK_FLAGS+CXXFLAGS
 
-#Intel Macs are CoreDuo and Up 
+#Intel Macs are CoreDuo and Up
 if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
-       REL_CFLAGS = []
-       REL_CXXFLAGS = []
-       REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
+    REL_CFLAGS = []
+    REL_CXXFLAGS = []
+    REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
 else:
-       CCFLAGS += ['-fno-strict-aliasing']
-       REL_CFLAGS = []
-       REL_CXXFLAGS = []
-       REL_CCFLAGS = ['-DNDEBUG', '-O2']
+    CCFLAGS += ['-fno-strict-aliasing']
+    REL_CFLAGS = []
+    REL_CXXFLAGS = []
+    REL_CCFLAGS = ['-DNDEBUG', '-O2']
 
 # Intel 64bit Macs are Core2Duo and up
 if MACOSX_ARCHITECTURE == 'x86_64':
-       REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
+    REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
 
 CC_WARN = ['-Wall']
 C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes']
index ed99ac6e094580b70c59a92baadbe02de9ad38d5..bf778061f0f58967e7cdd460de64dc7f9f3b9b4d 100644 (file)
@@ -175,8 +175,8 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFIL
 CPPFLAGS = []
 CXXFLAGS = []
 if WITH_BF_FFMPEG:
-  # libavutil needs UINT64_C()
-  CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
+    # libavutil needs UINT64_C()
+    CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
 REL_CFLAGS = []
 REL_CXXFLAGS = []
 REL_CCFLAGS = ['-DNDEBUG', '-O2']
index c62b30a7a565edf8cdebe99a6983e09683e79e50..738f14ab973e2812e5caf587a3e55b729de907a8 100644 (file)
@@ -175,8 +175,8 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFIL
 CPPFLAGS = []
 CXXFLAGS = []
 if WITH_BF_FFMPEG:
-  # libavutil needs UINT64_C()
-  CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
+    # libavutil needs UINT64_C()
+    CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
 REL_CFLAGS = []
 REL_CXXFLAGS = []
 REL_CCFLAGS = ['-DNDEBUG', '-O2']
index c16795929f2b0796136c1b64b8e55d7d410c717b..f40fc33646e09a0ddbcc2cb218146136dc2baf98 100644 (file)
@@ -175,8 +175,8 @@ CXXFLAGS = []
 
 CPPFLAGS = []
 if WITH_BF_FFMPEG:
-  # libavutil needs UINT64_C()
-  CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
+    # libavutil needs UINT64_C()
+    CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
 REL_CFLAGS = []
 REL_CXXFLAGS = []
 REL_CCFLAGS = ['-DNDEBUG', '-O2']
index af5f73fb87ce6d1287d0edaba8026445f5f64922..b25bf98c9e62e98b9ae3ffe5572070f9bdca4f5c 100644 (file)
@@ -247,8 +247,8 @@ CPPFLAGS = []
 # g++ 4.6, only needed for bullet
 CXXFLAGS += ['-fpermissive']
 if WITH_BF_FFMPEG:
-  # libavutil needs UINT64_C()
-  CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
+    # libavutil needs UINT64_C()
+    CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
 REL_CFLAGS = []
 REL_CXXFLAGS = []
 REL_CCFLAGS = ['-DNDEBUG', '-O2']
index 4f447ce6240c50b0b8320b383b5ff0ba34bba3d8..f9a9023c5ce3c3935d9582cd7e831cc4986de706 100644 (file)
@@ -258,9 +258,9 @@ def setup_syslibs(lenv):
         if lenv['WITH_BF_OGG']:
             syslibs += Split(lenv['BF_OGG_LIB'])
     if lenv['WITH_BF_JACK']:
-            syslibs += Split(lenv['BF_JACK_LIB'])
+        syslibs += Split(lenv['BF_JACK_LIB'])
     if lenv['WITH_BF_SNDFILE'] and not lenv['WITH_BF_STATICSNDFILE']:
-            syslibs += Split(lenv['BF_SNDFILE_LIB'])
+        syslibs += Split(lenv['BF_SNDFILE_LIB'])
     if lenv['WITH_BF_FFTW3'] and not lenv['WITH_BF_STATICFFTW3']:
         syslibs += Split(lenv['BF_FFTW3_LIB'])
     if lenv['WITH_BF_SDL']:
@@ -764,17 +764,17 @@ class BlenderEnvironment(SConsEnvironment):
             lenv.Append(CPPPATH=includes)
             lenv.Append(CPPDEFINES=defines)
             if lenv['BF_DEBUG'] or (libname in quickdebug):
-                    lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS'])
-                    lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS'])
-                    lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS'])
+                lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS'])
+                lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS'])
+                lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS'])
             else:
-                    lenv.Append(CFLAGS = lenv['REL_CFLAGS'])
-                    lenv.Append(CCFLAGS = lenv['REL_CCFLAGS'])
-                    lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS'])
+                lenv.Append(CFLAGS = lenv['REL_CFLAGS'])
+                lenv.Append(CCFLAGS = lenv['REL_CCFLAGS'])
+                lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS'])
             if lenv['BF_PROFILE']:
-                    lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS'])
-                    lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS'])
-                    lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS'])
+                lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS'])
+                lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS'])
+                lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS'])
             if compileflags:
                 lenv.Replace(CFLAGS = compileflags)
             if cc_compileflags:
@@ -834,7 +834,7 @@ class BlenderEnvironment(SConsEnvironment):
             if lenv['WITH_BF_PYTHON']:
                 lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
             if lenv['CXX'].endswith('CC'):
-                 lenv.Replace(LINK = '$CXX')
+                lenv.Replace(LINK = '$CXX')
         if  lenv['OURPLATFORM']=='darwin':
             if lenv['WITH_BF_PYTHON']:
                 lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
@@ -846,8 +846,8 @@ class BlenderEnvironment(SConsEnvironment):
         lenv.Append(LIBPATH=libpath)
         lenv.Append(LIBS=libs)
         if lenv['WITH_BF_QUICKTIME']:
-             lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB'])
-             lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH'])
+            lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB'])
+            lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH'])
         prog = lenv.Program(target=builddir+'bin/'+progname, source=sources)
         if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc') and lenv['BF_BSC']:
             f = lenv.File(progname + '.bsc', builddir)
diff --git a/doc/python_api/epy/testbgl.py b/doc/python_api/epy/testbgl.py
deleted file mode 100644 (file)
index e895d01..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# Testing the BGL module
-
-import Blender
-from Blender.BGL import *
-from Blender import Draw
-
-R = G = B = 0
-A = 1
-
-instructions = "Hold mouse buttons to change the background color."
-quitting = " Press ESC or q to quit."
-
-def show_win():
-  glClearColor(R,G,B,A)                # define color used to clear buffers 
-  glClear(GL_COLOR_BUFFER_BIT)         # use it to clear the color buffer
-  glColor3f(1,1,1)                     # change default color
-  glRasterPos2i(50,100)                # move cursor to x = 50, y = 100
-  Draw.Text("Testing BGL  + Draw")     # draw this text there
-  glRasterPos2i(350,20)                # move cursor again
-  Draw.Text(instructions + quitting)   # draw another msg
-  glBegin(GL_LINE_LOOP)                # begin a vertex-data list
-  glVertex2i(46,92)
-  glVertex2i(120,92)
-  glVertex2i(120,115)
-  glVertex2i(46,115)
-  glEnd()                              # close this list
-  glColor3f(0.35,0.18,0.92)            # change default color again
-  glBegin(GL_POLYGON)                  # another list, for a polygon
-  glVertex2i(315, 292)
-  glVertex2i(412, 200)
-  glVertex2i(264, 256)
-  glEnd()
-  Draw.Redraw(1)                       # make changes visible.
-
-def ev(evt, val):                      # this is a callback for Draw.Register()
-  global R,G,B,A                       # it handles input events
-  if evt == Draw.ESCKEY or evt == Draw.QKEY:
-    Draw.Exit()                        # this quits the script
-  elif evt == Draw.LEFTMOUSE: R = 1 - R
-  elif evt == Draw.MIDDLEMOUSE: G = 1 - G
-  elif evt == Draw.RIGHTMOUSE: B = 1 - B
-  else:
-    Draw.Register(show_win, ev, None)
-
-Draw.Register(show_win, ev, None)      # start the main loop
index 917f80e6926b42a446c9687a7c51b9b1af2fb9bd..ba88ce7676d0a3739c3dab93cccf5c9712cff579 100644 (file)
@@ -24,7 +24,7 @@
 namespace libmv {
 
 struct Offset {
-  signed char ix, iy;
+  short ix, iy;
   unsigned char fx,fy;
 };
 
@@ -201,20 +201,14 @@ void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height, doub
       warp_y = warp_y*aspy + 0.5 * overscan * h;
       int ix = int(warp_x), iy = int(warp_y);
       int fx = round((warp_x-ix)*256), fy = round((warp_y-iy)*256);
-      if(fx == 256) { fx=0; ix++; }
-      if(fy == 256) { fy=0; iy++; }
       // Use nearest border pixel
       if( ix < 0 ) { ix = 0, fx = 0; }
       if( iy < 0 ) { iy = 0, fy = 0; }
       if( ix >= width-2 ) ix = width-2;
       if( iy >= height-2 ) iy = height-2;
-      if ( ix-x > -128 && ix-x < 128 && iy-y > -128 && iy-y < 128 ) {
-        Offset offset = { ix-x, iy-y, fx, fy };
-        grid->offset[y*width+x] = offset;
-      } else {
-        Offset offset = { 0, 0, 0, 0 };
-        grid->offset[y*width+x] = offset;
-      }
+
+      Offset offset = { ix-x, iy-y, fx, fy };
+      grid->offset[y*width+x] = offset;
     }
   }
 }
index cfff7485e611de12762f211f91b84955e108af92..a85b2ba8c2a14e4d3cc4ccc3ef0510dd02df7647 100644 (file)
@@ -61,6 +61,7 @@ include_directories(
 # Subdirectories
 
 if(WITH_CYCLES_BLENDER)
+       add_definitions(-DBLENDER_PLUGIN)
        add_subdirectory(blender)
 endif(WITH_CYCLES_BLENDER)
 
index ea46911ce16cea23235d470b646a9b834df62763..e81f02f2090f7287520feb848ba22e5ba4989b99 100644 (file)
@@ -1,11 +1,4 @@
 
-set(BLENDER_INCLUDE_DIRS
-       ${CMAKE_SOURCE_DIR}/intern/guardedalloc
-       ${CMAKE_SOURCE_DIR}/source/blender/makesdna
-       ${CMAKE_SOURCE_DIR}/source/blender/makesrna
-       ${CMAKE_SOURCE_DIR}/source/blender/blenloader
-       ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern)
-
 set(INC
        ../render
        ../device
@@ -13,15 +6,18 @@ set(INC
        ../kernel/svm
        ../util
        ../subd
+       ../../../intern/guardedalloc
+       ../../../source/blender/makesdna
+       ../../../source/blender/makesrna
+       ../../../source/blender/blenloader
+       ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern
 )
 
 set(INC_SYS
-       ${BLENDER_INCLUDE_DIRS}
        ${PYTHON_INCLUDE_DIRS}
        ${GLEW_INCLUDE_PATH}
 )
 
-
 set(SRC
        blender_camera.cpp
        blender_mesh.cpp
index 00010bb7463f346b7e73a1c5913cccb159107e77..f3ed3b677fb5f35055181c615aef2e4b16781cdd 100644 (file)
@@ -295,7 +295,7 @@ class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return CyclesButtonsPanel.poll(context) and context.mesh or context.curve or context.meta_ball
+        return CyclesButtonsPanel.poll(context) and (context.mesh or context.curve or context.meta_ball)
 
     def draw(self, context):
         layout = self.layout
index 9037362f1ab9eef6738a03bdc1280fb38e4e21aa..7d12e2610684ad1522826f371862ca4623e84357 100644 (file)
@@ -70,21 +70,6 @@ if(WITH_CYCLES_PARTIO)
 
 endif()
 
-###########################################################################
-# Blender
-
-if(WITH_CYCLES_BLENDER)
-
-       set(BLENDER_INCLUDE_DIRS
-               ${CMAKE_SOURCE_DIR}/intern/guardedalloc
-               ${CMAKE_SOURCE_DIR}/source/blender/makesdna
-               ${CMAKE_SOURCE_DIR}/source/blender/makesrna
-               ${CMAKE_SOURCE_DIR}/source/blender/blenloader
-               ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern)
-
-       add_definitions(-DBLENDER_PLUGIN)
-endif()
-
 ###########################################################################
 # CUDA
 
index 11dc07e485c77e7b7d555deda43621496e8cf2b8..0ad7cad06bbc0139d54cf22bc00977bfbb9ccc59 100644 (file)
@@ -70,8 +70,8 @@ __device float3 bsdf_oren_nayar_get_intensity(const ShaderClosure *sc, float3 n,
                cos_b = nl;
        }
 
-       float sin_a = sqrtf(1.0f - cos_a * cos_a);
-       float tan_b = sqrtf(1.0f - cos_b * cos_b) / (cos_b + FLT_MIN);
+       float sin_a = sqrtf(max(1.0f - cos_a * cos_a, 0.0f));
+       float tan_b = sqrtf(max(1.0f - cos_b * cos_b, 0.0f)) / max(cos_b, 1e-8f);
 
        float is = nl * (sc->data0 + sc->data1 * t * sin_a * tan_b);
        return make_float3(is, is, is);
@@ -84,8 +84,10 @@ __device void bsdf_oren_nayar_setup(ShaderData *sd, ShaderClosure *sc, float sig
 
        sigma = clamp(sigma, 0.0f, 1.0f);
 
-       sc->data0 =  1.0f / ((1.0f + 0.5f * sigma) * M_PI_F);
-       sc->data1 = sigma / ((1.0f + 0.5f * sigma) * M_PI_F);
+       float div = 1.0f / ((1.0f + 0.5f * sigma) * M_PI_F);
+
+       sc->data0 =  1.0f * div;
+       sc->data1 = sigma * div;
 }
 
 __device void bsdf_oren_nayar_blur(ShaderClosure *sc, float roughness)
index 64110b0f620da057087855aa294dcf1f14854f68..f97ba3c2a5038253c0f7d874081c04162d1006a4 100644 (file)
@@ -35,9 +35,9 @@ def drepr(string):
 
 
 class DataPathBuilder(object):
-    __slots__ = ("data_path", )
     """ Dummy class used to parse fcurve and driver data paths.
     """
+    __slots__ = ("data_path", )
     def __init__(self, attrs):
         self.data_path = attrs
 
index d5d9684bcf39a42712679953685a1efb9cb19cce..6c2256dc08b8e507fa6b964b94c3179a34bebd33 100644 (file)
@@ -116,7 +116,7 @@ class CLIP_OT_delete_proxy(Operator):
 
     bl_idname = "clip.delete_proxy"
     bl_label = "Delete Proxy"
-    bl_options = {'UNDO', 'REGISTER'}
+    bl_options = {'REGISTER'}
 
     @classmethod
     def poll(cls, context):
@@ -191,7 +191,7 @@ class CLIP_OT_set_viewport_background(Operator):
 
     bl_idname = "clip.set_viewport_background"
     bl_label = "Set as Background"
-    bl_options = {'UNDO', 'REGISTER'}
+    bl_options = {'REGISTER'}
 
     @classmethod
     def poll(cls, context):
@@ -211,7 +211,7 @@ class CLIP_OT_set_viewport_background(Operator):
                 break
 
         if not bgpic:
-            bgpic = space_v3d.background_images.add()
+            bgpic = space_v3d.background_images.new()
 
         bgpic.source = 'MOVIE'
         bgpic.clip = clip
index a541f43be66a52fa26a038d53c626b641b5616b1..f7f67527b639f5030bd7c52a1d03233c0c93b38d 100644 (file)
@@ -262,10 +262,6 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
         return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
 
     def draw_header(self, context):
-        #cloth = context.cloth.collision_settings
-
-        #self.layout.active = cloth_panel_enabled(context.cloth)
-        #self.layout.prop(cloth, "use_collision", text="")
         psys = context.particle_system
         self.layout.prop(psys, "use_hair_dynamics", text="")
 
index 86880b9ddec54d1de9f98ac038da2690ca1160a6..05f4887a5424403a45fde839c0b9acce401b5d47 100644 (file)
@@ -195,14 +195,13 @@ class SCENE_PT_simplify(SceneButtonsPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     def draw_header(self, context):
-        scene = context.scene
-        rd = scene.render
+        rd = context.scene.render
         self.layout.prop(rd, "use_simplify", text="")
 
     def draw(self, context):
         layout = self.layout
-        scene = context.scene
-        rd = scene.render
+
+        rd = context.scene.render
 
         layout.active = rd.use_simplify
 
index 237dd7f998db29eb1568f7b0bb5c76ef1059e101..a70d632e8b0691b57b6cffa0ddc968e238742ca1 100644 (file)
@@ -474,16 +474,14 @@ class CLIP_PT_stabilization(Panel):
         return sc.mode == 'RECONSTRUCTION' and sc.clip
 
     def draw_header(self, context):
-        sc = context.space_data
-        tracking = sc.clip.tracking
-        stab = tracking.stabilization
-
+        stab = context.space_data.clip.tracking.stabilization
+        
         self.layout.prop(stab, "use_2d_stabilization", text="")
 
     def draw(self, context):
         layout = self.layout
-        sc = context.space_data
-        tracking = sc.clip.tracking
+
+        tracking = context.space_data.clip.tracking
         stab = tracking.stabilization
 
         layout.active = stab.use_2d_stabilization
index c1c9bc12b2df04c4d1ca249e37faa6c849ffd4e8..06f481d29930dcf59fdad098ed890c1b8903fc9d 100644 (file)
@@ -473,9 +473,9 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
         if strip.type == 'SPEED':
             col.prop(strip, "multiply_speed")
         elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
-                col.prop(strip, "use_default_fade", "Default fade")
-                if not strip.use_default_fade:
-                    col.prop(strip, "effect_fader", text="Effect fader")
+            col.prop(strip, "use_default_fade", "Default fade")
+            if not strip.use_default_fade:
+                col.prop(strip, "effect_fader", text="Effect fader")
 
         layout.prop(strip, "use_translation", text="Image Offset:")
         if strip.use_translation:
index c889e7f3de6a790557073cd15a9ba7588ac2415d..d71d57509c14b12360237360b17d19f2e16c8977 100644 (file)
@@ -634,12 +634,51 @@ class USERPREF_PT_theme(Panel):
             colsub.row().prop(ui, "inner_key_sel")
             colsub.row().prop(ui, "blend")
 
+            col.separator()
+            col.separator()
+
             ui = theme.user_interface
+            col.label("Icons:")
+
+            row = col.row()
+
+            subsplit = row.split(percentage=0.95)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            colsub.row().prop(ui, "icon_file")
+
+            subsplit = row.split(percentage=0.85)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            colsub.row().prop(ui, "icon_alpha")
+
             col.separator()
             col.separator()
 
-            split = col.split(percentage=0.93)
-            split.prop(ui, "icon_file")
+            ui = theme.user_interface.panel
+            col.label("Panels:")
+
+            row = col.row()
+
+            subsplit = row.split(percentage=0.95)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            rowsub = colsub.row()
+            rowsub.prop(ui, "show_header")
+            rowsub.label()
+
+            subsplit = row.split(percentage=0.85)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            colsub.row().prop(ui, "header")
 
             layout.separator()
             layout.separator()
index 802f4a8486d7f97c18bd1be0fa4dd1ea0f82af83..1cadf60895dfede596434a444ac1c8900c6c3ca8 100644 (file)
@@ -524,7 +524,7 @@ class VIEW3D_MT_select_edit_mesh(Menu):
 
         layout.operator("mesh.select_by_number_vertices", text = "By Number of Verts")
         if context.scene.tool_settings.mesh_select_mode[2] == False:
-                layout.operator("mesh.select_non_manifold", text="Non Manifold")
+            layout.operator("mesh.select_non_manifold", text="Non Manifold")
         layout.operator("mesh.select_loose_verts", text = "Loose Verts/Edges")
         layout.operator("mesh.select_similar", text="Similar")
 
@@ -2197,10 +2197,9 @@ class VIEW3D_PT_view3d_motion_tracking(Panel):
         return (view)
 
     def draw_header(self, context):
-        layout = self.layout
         view = context.space_data
 
-        layout.prop(view, "show_reconstruction", text="")
+        self.layout.prop(view, "show_reconstruction", text="")
 
     def draw(self, context):
         layout = self.layout
@@ -2282,10 +2281,9 @@ class VIEW3D_PT_background_image(Panel):
     bl_options = {'DEFAULT_CLOSED'}
 
     def draw_header(self, context):
-        layout = self.layout
         view = context.space_data
 
-        layout.prop(view, "show_background_images", text="")
+        self.layout.prop(view, "show_background_images", text="")
 
     def draw(self, context):
         layout = self.layout
@@ -2302,7 +2300,7 @@ class VIEW3D_PT_background_image(Panel):
             row.prop(bg, "show_expanded", text="", emboss=False)
             if bg.source == 'IMAGE' and bg.image:
                 row.prop(bg.image, "name", text="", emboss=False)
-            if bg.source == 'MOVIE' and bg.clip:
+            elif bg.source == 'MOVIE' and bg.clip:
                 row.prop(bg.clip, "name", text="", emboss=False)
             else:
                 row.label(text="Not Set")
@@ -2364,14 +2362,12 @@ class VIEW3D_PT_transform_orientations(Panel):
         layout = self.layout
 
         view = context.space_data
+        orientation = view.current_orientation
 
         col = layout.column()
-
         col.prop(view, "transform_orientation")
         col.operator("transform.create_orientation", text="Create")
 
-        orientation = view.current_orientation
-
         if orientation:
             col.prop(orientation, "name")
             col.operator("transform.delete_orientation", text="Delete")
index 73f2fdc2a51c41f0233ace38bfcced69a737b71c..a64ebe56c9c8bd85da4d9f7c925bf1e131172acf 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION                        260
-#define BLENDER_SUBVERSION             4
+#define BLENDER_SUBVERSION             5
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
index fc0ef0248f34cd141a91b640a94bef39bbc9e3dd..72e22dc15832c4ecc67ea9ac93724d98f9542692 100644 (file)
 extern "C" {
 #endif
 
+#include "DNA_vec_types.h"
+
 struct Camera;
 struct Object;
+struct RegionView3D;
 struct RenderData;
 struct Scene;
 struct rctf;
 struct View3D;
 
+/* Camera Datablock */
+
 void *add_camera(const char *name);
 struct Camera *copy_camera(struct Camera *cam);
 void make_local_camera(struct Camera *cam);
 void free_camera(struct Camera *ca);
 
-float dof_camera(struct Object *ob);
+/* Camera Usage */
+
+float object_camera_dof_distance(struct Object *ob);
+void object_camera_mode(struct RenderData *rd, struct Object *ob);
+
+int camera_sensor_fit(int sensor_fit, float sizex, float sizey);
+float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y);
+
+/* Camera Parameters:
+ *
+ * Intermediate struct for storing camera parameters from various sources,
+ * to unify computation of viewplane, window matrix, ... */
+
+typedef struct CameraParams {
+       /* lens */
+       int is_ortho;
+       float lens;
+       float ortho_scale;
+       float zoom;
+
+       float shiftx;
+       float shifty;
+       float offsetx;
+       float offsety;
+
+       /* sensor */
+       float sensor_x;
+       float sensor_y;
+       int sensor_fit;
+
+       /* clipping */
+       float clipsta;
+       float clipend;
+
+       /* fields */
+       int use_fields;
+       int field_second;
+       int field_odd;
+
+       /* computed viewplane */
+       float ycor;
+       float viewdx;
+       float viewdy;
+       rctf viewplane;
+
+       /* computed matrix */
+       float winmat[4][4];
+} CameraParams;
+
+void camera_params_init(CameraParams *params);
+void camera_params_from_object(CameraParams *params, struct Object *camera);
+void camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d);
+
+void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy);
+void camera_params_compute_matrix(CameraParams *params);
 
-void object_camera_mode(struct RenderData *rd, struct Object *camera);
-void object_camera_intrinsics(struct Object *camera, struct Camera **cam_r, short *is_ortho, float *shiftx, float *shifty,
-                       float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit);
-void object_camera_matrix(
-               struct RenderData *rd, struct Object *camera, int winx, int winy, short field_second,
-               float winmat[][4], struct rctf *viewplane, float *clipsta, float *clipend, float *lens,
-               float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor,
-               float *viewdx, float *viewdy);
+/* Camera View Frame */
 
 void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3],
                           float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]);
index cb79c7a7290b3d050e60b1ead7feb46444d1a9d9..5eb9529b2fcc80c53f630958074c5f3850f26ae8 100644 (file)
@@ -94,7 +94,6 @@ void object_to_mat3(struct Object *ob, float mat[][3]);
 void object_to_mat4(struct Object *ob, float mat[][4]);
 void object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
 
-void set_no_parent_ipo(int val);
 struct Object *object_pose_armature_get(struct Object *ob);
 
 void where_is_object_time(struct Scene *scene, struct Object *ob, float ctime);
index 63ab74fc105241a5da24d993984eb42b5470fd78..b32421a6b3ddc6afda636b299cad9769a9d8326e 100644 (file)
@@ -1373,17 +1373,17 @@ void animsys_evaluate_action (PointerRNA *ptr, bAction *act, AnimMapper *remap,
 static float nlastrip_get_influence (NlaStrip *strip, float cframe)
 {
        /* sanity checks - normalise the blendin/out values? */
-       strip->blendin= (float)fabs(strip->blendin);
-       strip->blendout= (float)fabs(strip->blendout);
+       strip->blendin= fabsf(strip->blendin);
+       strip->blendout= fabsf(strip->blendout);
        
        /* result depends on where frame is in respect to blendin/out values */
        if (IS_EQ(strip->blendin, 0)==0 && (cframe <= (strip->start + strip->blendin))) {
                /* there is some blend-in */
-               return (float)fabs(cframe - strip->start) / (strip->blendin);
+               return fabsf(cframe - strip->start) / (strip->blendin);
        }
        else if (IS_EQ(strip->blendout, 0)==0 && (cframe >= (strip->end - strip->blendout))) {
                /* there is some blend-out */
-               return (float)fabs(strip->end - cframe) / (strip->blendout);
+               return fabsf(strip->end - cframe) / (strip->blendout);
        }
        else {
                /* in the middle of the strip, we should be full strength */
index 6ba7a76dd5c46c6ad2ceb5f5aa31112112bca1f0..da7c0ab17747c027661a313c156d726af59066ec 100644 (file)
@@ -35,6 +35,7 @@
 #include "DNA_lamp_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_view3d_types.h"
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
@@ -45,6 +46,9 @@
 #include "BKE_global.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
+#include "BKE_screen.h"
+
+/****************************** Camera Datablock *****************************/
 
 void *add_camera(const char *name)
 {
@@ -70,7 +74,9 @@ Camera *copy_camera(Camera *cam)
        Camera *camn;
        
        camn= copy_libblock(&cam->id);
-       
+
+       id_lib_extern((ID *)camn->dof_ob);
+
        return camn;
 }
 
@@ -121,8 +127,26 @@ void make_local_camera(Camera *cam)
        }
 }
 
+void free_camera(Camera *ca)
+{
+       BKE_free_animdata((ID *)ca);
+}
+
+/******************************** Camera Usage *******************************/
+
+void object_camera_mode(RenderData *rd, Object *cam_ob)
+{
+       rd->mode &= ~(R_ORTHO|R_PANORAMA);
+
+       if(cam_ob && cam_ob->type==OB_CAMERA) {
+               Camera *cam= cam_ob->data;
+               if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
+               if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
+       }
+}
+
 /* get the camera's dof value, takes the dof object into account */
-float dof_camera(Object *ob)
+float object_camera_dof_distance(Object *ob)
 {
        Camera *cam = (Camera *)ob->data; 
        if (ob->type != OB_CAMERA)
@@ -136,180 +160,212 @@ float dof_camera(Object *ob)
                normalize_m4(obmat);
                invert_m4_m4(imat, obmat);
                mul_m4_m4m4(mat, cam->dof_ob->obmat, imat);
-               return (float)fabs(mat[3][2]);
+               return fabsf(mat[3][2]);
        }
        return cam->YF_dofdist;
 }
 
-void free_camera(Camera *ca)
+float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
 {
-       BKE_free_animdata((ID *)ca);
+       /* sensor size used to fit to. for auto, sensor_x is both x and y. */
+       if(sensor_fit == CAMERA_SENSOR_FIT_VERT)
+               return sensor_y;
+
+       return sensor_x;
 }
 
-void object_camera_mode(RenderData *rd, Object *camera)
+int camera_sensor_fit(int sensor_fit, float sizex, float sizey)
 {
-       rd->mode &= ~(R_ORTHO|R_PANORAMA);
-       if(camera && camera->type==OB_CAMERA) {
-               Camera *cam= camera->data;
-               if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
-               if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
+       if(sensor_fit == CAMERA_SENSOR_FIT_AUTO) {
+               if(sizex >= sizey)
+                       return CAMERA_SENSOR_FIT_HOR;
+               else
+                       return CAMERA_SENSOR_FIT_VERT;
        }
+
+       return sensor_fit;
 }
 
-void object_camera_intrinsics(Object *camera, Camera **cam_r, short *is_ortho, float *shiftx, float *shifty,
-                       float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit)
+/******************************** Camera Params *******************************/
+
+void camera_params_init(CameraParams *params)
 {
-       Camera *cam= NULL;
+       memset(params, 0, sizeof(CameraParams));
 
-       (*shiftx)= 0.0f;
-       (*shifty)= 0.0f;
+       /* defaults */
+       params->sensor_x= DEFAULT_SENSOR_WIDTH;
+       params->sensor_y= DEFAULT_SENSOR_HEIGHT;
+       params->sensor_fit= CAMERA_SENSOR_FIT_AUTO;
 
-       (*sensor_x)= DEFAULT_SENSOR_WIDTH;
-       (*sensor_y)= DEFAULT_SENSOR_HEIGHT;
-       (*sensor_fit)= CAMERA_SENSOR_FIT_AUTO;
+       params->zoom= 1.0f;
+}
 
-       if(camera->type==OB_CAMERA) {
-               cam= camera->data;
+void camera_params_from_object(CameraParams *params, Object *ob)
+{
+       if(!ob)
+               return;
 
-               if(cam->type == CAM_ORTHO) {
-                       *is_ortho= TRUE;
-               }
+       if(ob->type==OB_CAMERA) {
+               /* camera object */
+               Camera *cam= ob->data;
 
-               /* solve this too... all time depending stuff is in convertblender.c?
-                * Need to update the camera early because it's used for projection matrices
-                * and other stuff BEFORE the animation update loop is done
-                * */
-#if 0 // XXX old animation system
-               if(cam->ipo) {
-                       calc_ipo(cam->ipo, frame_to_float(re->scene, re->r.cfra));
-                       execute_ipo(&cam->id, cam->ipo);
-               }
-#endif // XXX old animation system
-               (*shiftx)=cam->shiftx;
-               (*shifty)=cam->shifty;
-               (*lens)= cam->lens;
-               (*sensor_x)= cam->sensor_x;
-               (*sensor_y)= cam->sensor_y;
-               (*clipsta)= cam->clipsta;
-               (*clipend)= cam->clipend;
-               (*sensor_fit)= cam->sensor_fit;
+               if(cam->type == CAM_ORTHO)
+                       params->is_ortho= TRUE;
+               params->lens= cam->lens;
+               params->ortho_scale= cam->ortho_scale;
+
+               params->shiftx= cam->shiftx;
+               params->shifty= cam->shifty;
+
+               params->sensor_x= cam->sensor_x;
+               params->sensor_y= cam->sensor_y;
+               params->sensor_fit= cam->sensor_fit;
+
+               params->clipsta= cam->clipsta;
+               params->clipend= cam->clipend;
        }
-       else if(camera->type==OB_LAMP) {
-               Lamp *la= camera->data;
+       else if(ob->type==OB_LAMP) {
+               /* lamp object */
+               Lamp *la= ob->data;
                float fac= cosf((float)M_PI*la->spotsize/360.0f);
                float phi= acos(fac);
 
-               (*lens)= 16.0f*fac/sinf(phi);
-               if((*lens)==0.0f)
-                       (*lens)= 35.0f;
-               (*clipsta)= la->clipsta;
-               (*clipend)= la->clipend;
-       }
-       else {  /* envmap exception... */;
-               if((*lens)==0.0f) /* is this needed anymore? */
-                       (*lens)= 16.0f;
+               params->lens= 16.0f*fac/sinf(phi);
+               if(params->lens==0.0f)
+                       params->lens= 35.0f;
 
-               if((*clipsta)==0.0f || (*clipend)==0.0f) {
-                       (*clipsta)= 0.1f;
-                       (*clipend)= 1000.0f;
-               }
+               params->clipsta= la->clipsta;
+               params->clipend= la->clipend;
        }
-
-       (*cam_r)= cam;
 }
 
-/* 'lens' may be set for envmap only */
-void object_camera_matrix(
-               RenderData *rd, Object *camera, int winx, int winy, short field_second,
-               float winmat[][4], rctf *viewplane, float *clipsta, float *clipend, float *lens,
-               float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor,
-               float *viewdx, float *viewdy)
+void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *rv3d)
 {
-       Camera *cam=NULL;
-       float pixsize;
-       float shiftx=0.0, shifty=0.0, winside, viewfac;
-       short is_ortho= FALSE;
-
-       /* question mark */
-       (*ycor)= rd->yasp / rd->xasp;
-       if(rd->mode & R_FIELDS)
-               (*ycor) *= 2.0f;
-
-       object_camera_intrinsics(camera, &cam, &is_ortho, &shiftx, &shifty, clipsta, clipend, lens, sensor_x, sensor_y, sensor_fit);
-
-       /* ortho only with camera available */
-       if(cam && is_ortho) {
-               if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) {
-                       if(rd->xasp*winx >= rd->yasp*winy) viewfac= winx;
-                       else viewfac= (*ycor) * winy;
-               }
-               else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) {
-                       viewfac= winx;
-               }
-               else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */
-                       viewfac= (*ycor) * winy;
-               }
+       /* common */
+       params->lens= v3d->lens;
+       params->clipsta= v3d->near;
+       params->clipend= v3d->far;
+
+       if(rv3d->persp==RV3D_CAMOB) {
+               /* camera view */
+               camera_params_from_object(params, v3d->camera);
+
+               params->zoom= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom);
+
+               params->offsetx= 2.0f*rv3d->camdx*params->zoom;
+               params->offsety= 2.0f*rv3d->camdy*params->zoom;
+
+               params->shiftx *= params->zoom;
+               params->shifty *= params->zoom;
 
-               /* ortho_scale == 1.0 means exact 1 to 1 mapping */
-               pixsize= cam->ortho_scale/viewfac;
+               params->zoom= 1.0f/params->zoom;
+       }
+       else if(rv3d->persp==RV3D_ORTHO) {
+               /* orthographic view */
+               params->clipend *= 0.5f;        // otherwise too extreme low zbuffer quality
+               params->clipsta= - params->clipend;
+
+               params->is_ortho= TRUE;
+               params->ortho_scale = rv3d->dist;
+               params->zoom= 2.0f;
        }
        else {
-               if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) {
-                       if(rd->xasp*winx >= rd->yasp*winy)      viewfac= ((*lens) * winx) / (*sensor_x);
-                       else                                    viewfac= (*ycor) * ((*lens) * winy) / (*sensor_x);
-               }
-               else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) {
-                       viewfac= ((*lens) * winx) / (*sensor_x);
-               }
-               else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */
-                       viewfac= ((*lens) * winy) / (*sensor_y);
-               }
-
-               pixsize= (*clipsta) / viewfac;
+               /* perspective view */
+               params->zoom= 2.0f;
        }
+}
 
-       /* viewplane fully centered, zbuffer fills in jittered between -.5 and +.5 */
-       winside= MAX2(winx, winy);
-
-       if(cam) {
-               if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR)
-                       winside= winx;
-               else if(cam->sensor_fit==CAMERA_SENSOR_FIT_VERT)
-                       winside= winy;
+void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float xasp, float yasp)
+{
+       rctf viewplane;
+       float pixsize, viewfac, sensor_size, dx, dy;
+       int sensor_fit;
+
+       /* fields rendering */
+       params->ycor= yasp/xasp;
+       if(params->use_fields)
+               params->ycor *= 2.0f;
+
+       if(params->is_ortho) {
+               /* orthographic camera */
+               /* scale == 1.0 means exact 1 to 1 mapping */
+               pixsize= params->ortho_scale;
+       }
+       else {
+               /* perspective camera */
+               sensor_size= camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y);
+               pixsize= (sensor_size * params->clipsta)/params->lens;
        }
 
-       viewplane->xmin= -0.5f*(float)winx + shiftx*winside;
-       viewplane->ymin= -0.5f*(*ycor)*(float)winy + shifty*winside;
-       viewplane->xmax=  0.5f*(float)winx + shiftx*winside;
-       viewplane->ymax=  0.5f*(*ycor)*(float)winy + shifty*winside;
+       /* determine sensor fit */
+       sensor_fit = camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy);
 
-       if(field_second) {
-               if(rd->mode & R_ODDFIELD) {
-                       viewplane->ymin-= 0.5f * (*ycor);
-                       viewplane->ymax-= 0.5f * (*ycor);
+       if(sensor_fit==CAMERA_SENSOR_FIT_HOR)
+               viewfac= winx;
+       else
+               viewfac= params->ycor * winy;
+
+       pixsize /= viewfac;
+
+       /* extra zoom factor */
+       pixsize *= params->zoom;
+
+       /* compute view plane:
+        * fully centered, zbuffer fills in jittered between -.5 and +.5 */
+       viewplane.xmin= -0.5f*(float)winx;
+       viewplane.ymin= -0.5f*params->ycor*(float)winy;
+       viewplane.xmax=  0.5f*(float)winx;
+       viewplane.ymax=  0.5f*params->ycor*(float)winy;
+
+       /* lens shift and offset */
+       dx= params->shiftx*viewfac + winx*params->offsetx;
+       dy= params->shifty*viewfac + winy*params->offsety;
+
+       viewplane.xmin += dx;
+       viewplane.ymin += dy;
+       viewplane.xmax += dx;
+       viewplane.ymax += dy;
+
+       /* fields offset */
+       if(params->field_second) {
+               if(params->field_odd) {
+                       viewplane.ymin-= 0.5f * params->ycor;
+                       viewplane.ymax-= 0.5f * params->ycor;
                }
                else {
-                       viewplane->ymin+= 0.5f * (*ycor);
-                       viewplane->ymax+= 0.5f * (*ycor);
+                       viewplane.ymin+= 0.5f * params->ycor;
+                       viewplane.ymax+= 0.5f * params->ycor;
                }
        }
+
        /* the window matrix is used for clipping, and not changed during OSA steps */
        /* using an offset of +0.5 here would give clip errors on edges */
-       viewplane->xmin *= pixsize;
-       viewplane->xmax *= pixsize;
-       viewplane->ymin *= pixsize;
-       viewplane->ymax *= pixsize;
+       viewplane.xmin *= pixsize;
+       viewplane.xmax *= pixsize;
+       viewplane.ymin *= pixsize;
+       viewplane.ymax *= pixsize;
+
+       params->viewdx= pixsize;
+       params->viewdy= params->ycor * pixsize;
+       params->viewplane= viewplane;
+}
 
-       (*viewdx)= pixsize;
-       (*viewdy)= (*ycor) * pixsize;
+/* viewplane is assumed to be already computed */
+void camera_params_compute_matrix(CameraParams *params)
+{
+       rctf viewplane= params->viewplane;
 
-       if(is_ortho)
-               orthographic_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
+       /* compute projection matrix */
+       if(params->is_ortho)
+               orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax,
+                       viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
        else
-               perspective_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
-
+               perspective_m4(params->winmat, viewplane.xmin, viewplane.xmax,
+                       viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
 }
 
+/***************************** Camera View Frame *****************************/
+
 void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const short do_clip, const float scale[3],
                           float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3])
 {
@@ -320,25 +376,16 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh
        if (scene) {
                float aspx= (float) scene->r.xsch*scene->r.xasp;
                float aspy= (float) scene->r.ysch*scene->r.yasp;
+               int sensor_fit= camera_sensor_fit(camera->sensor_fit, aspx, aspy);
 
-               if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
-                       if(aspx < aspy) {
-                               r_asp[0]= aspx / aspy;
-                               r_asp[1]= 1.0;
-                       }
-                       else {
-                               r_asp[0]= 1.0;
-                               r_asp[1]= aspy / aspx;
-                       }
+               if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+                       r_asp[0]= 1.0;
+                       r_asp[1]= aspy / aspx;
                }
-               else if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
+               else {
                        r_asp[0]= aspx / aspy;
                        r_asp[1]= 1.0;
                }
-               else {
-                       r_asp[0]= 1.0;
-                       r_asp[1]= aspy / aspx;
-               }
        }
        else {
                r_asp[0]= 1.0f;
@@ -419,6 +466,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data)
 }
 
 /* dont move the camera, just yield the fit location */
+/* only valid for perspective cameras */
 int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3])
 {
        float shift[2];
index 8c313cc84a1e7df540dc229bb5d72c27500b570c..3ff9b74ecc1623aab0b9f1d0c3dea02949ae9a8c 100644 (file)
@@ -3990,7 +3990,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
                        MovieTrackingMarker *marker;
                        float vec[3], disp[3], axis[3], mat[4][4];
                        float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
-                       float sensor_x, sensor_y, lens, len, d, ortho_scale= 1.0f;
+                       float len, d;
                        
                        where_is_object_mat(scene, camob, mat);
                        
@@ -4008,23 +4008,20 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
                        len= len_v3(disp);
                        
                        if (len > FLT_EPSILON) {
-                               float pos[2], rmat[4][4], shiftx= 0.0f, shifty= 0.0f, clipsta= 0.0f, clipend= 0.0f;
-                               short is_ortho= 0, sensor_fit= CAMERA_SENSOR_FIT_AUTO;
-                               Camera *cam= NULL;
+                               CameraParams params;
+                               float pos[2], rmat[4][4];
                                
                                user.framenr= scene->r.cfra;
                                marker= BKE_tracking_get_marker(track, user.framenr);
                                
                                add_v2_v2v2(pos, marker->pos, track->offset);
                                
-                               object_camera_intrinsics(camob, &cam, &is_ortho, &shiftx, &shifty, &clipsta, &clipend, &lens, &sensor_x, &sensor_y, &sensor_fit);
-                               
-                               if (is_ortho) {
-                                       if (cam)
-                                               ortho_scale= cam->ortho_scale;
-                                       
-                                       vec[0]= ortho_scale * (pos[0]-0.5f+shiftx);
-                                       vec[1]= ortho_scale * (pos[1]-0.5f+shifty);
+                               camera_params_init(&params);
+                               camera_params_from_object(&params, camob);
+
+                               if (params.is_ortho) {
+                                       vec[0]= params.ortho_scale * (pos[0]-0.5f+params.shiftx);
+                                       vec[1]= params.ortho_scale * (pos[1]-0.5f+params.shifty);
                                        vec[2]= -len;
                                        
                                        if (aspect > 1.0f) vec[1] /= aspect;
@@ -4039,10 +4036,10 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
                                        copy_v3_v3(cob->matrix[3], disp);
                                }
                                else {
-                                       d= (len*sensor_x) / (2.0f*lens);
+                                       d= (len*params.sensor_x) / (2.0f*params.lens);
                                        
-                                       vec[0]= d*(2.0f*(pos[0]+shiftx)-1.0f);
-                                       vec[1]= d*(2.0f*(pos[1]+shifty)-1.0f);
+                                       vec[0]= d*(2.0f*(pos[0]+params.shiftx)-1.0f);
+                                       vec[1]= d*(2.0f*(pos[1]+params.shifty)-1.0f);
                                        vec[2]= -len;
                                        
                                        if (aspect > 1.0f) vec[1] /= aspect;
index 4bb9dc47fda8d74fc4502947e3ef31b2a35d6c1a..d01e3de0796a77fd51c917018e522b44644bc668 100644 (file)
@@ -1707,8 +1707,8 @@ void correct_bezpart (float *v1, float *v2, float *v3, float *v4)
         *      - len2  = length of handle of end key
         */
        len= v4[0]- v1[0];
-       len1= (float)fabs(h1[0]);
-       len2= (float)fabs(h2[0]);
+       len1= fabsf(h1[0]);
+       len2= fabsf(h2[0]);
        
        /* if the handles have no length, no need to do any corrections */
        if ((len1+len2) == 0.0f) 
index d8628e526ef8fd21aa44e9db8845b230acd61cca..3e3f16dcfa39030c2e3bfbc474ac71b3ce108df5 100644 (file)
@@ -1781,11 +1781,11 @@ float init_meta(Scene *scene, Object *ob)       /* return totsize */
 
                calc_mballco(mainb[a], vec);
        
-               size= (float)fabs( vec[0] );
+               size= fabsf( vec[0] );
                if( size > totsize ) totsize= size;
-               size= (float)fabs( vec[1] );
+               size= fabsf( vec[1] );
                if( size > totsize ) totsize= size;
-               size= (float)fabs( vec[2] );
+               size= fabsf( vec[2] );
                if( size > totsize ) totsize= size;
 
                vec[0]= mainb[a]->x - mainb[a]->rad;
@@ -1794,11 +1794,11 @@ float init_meta(Scene *scene, Object *ob)       /* return totsize */
                                
                calc_mballco(mainb[a], vec);
        
-               size= (float)fabs( vec[0] );
+               size= fabsf( vec[0] );
                if( size > totsize ) totsize= size;
-               size= (float)fabs( vec[1] );
+               size= fabsf( vec[1] );
                if( size > totsize ) totsize= size;
-               size= (float)fabs( vec[2] );
+               size= fabsf( vec[2] );
                if( size > totsize ) totsize= size;
        }
 
index 8a9080978626735904e21177f4fb333a6168765f..fd184b9def4385bac779468c622d5682f23adf31 100644 (file)
@@ -400,7 +400,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
        
        /* scaling */
        if (IS_EQF(strip->scale, 0.0f)) strip->scale= 1.0f;
-       scale = (float)fabs(strip->scale); /* scale must be positive - we've got a special flag for reversing */
+       scale = fabsf(strip->scale); /* scale must be positive - we've got a special flag for reversing */
        
        /* length of referenced action */
        actlength = strip->actend - strip->actstart;
@@ -1087,7 +1087,7 @@ void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
 short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
 {
        const float stripLen= (strip) ? strip->end - strip->start : 0.0f;
-       const float boundsLen= (float)fabs(max - min);
+       const float boundsLen= fabsf(max - min);
        
        /* sanity checks */
        if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f))
index c0c19b2604e7482afc42bed8b4ab4ed3a96ebe0a..d0e34ab371c7b478a94f97dc65e832a3d0252e96 100644 (file)
@@ -1900,13 +1900,6 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4])
        }
 }
 
-// XXX what the hell is this?
-static int no_parent_ipo=0;
-void set_no_parent_ipo(int val)
-{
-       no_parent_ipo= val;
-}
-
 static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4])
 {
        float *fp1, *fp2;
@@ -1914,7 +1907,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
        int a;
 
        // include framerate
-       fac1= ( 1.0f / (1.0f + (float)fabs(ob->sf)) );
+       fac1= ( 1.0f / (1.0f + fabsf(ob->sf)) );
        if(fac1 >= 1.0f) return 0;
        fac2= 1.0f-fac1;
 
@@ -1946,7 +1939,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime)
                
                /* hurms, code below conflicts with depgraph... (ton) */
                /* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
-               if(no_parent_ipo==0 && stime != par->ctime) {
+               if(stime != par->ctime) {
                        // only for ipo systems? 
                        Object tmp= *par;
                        
index 59fdf403f0f8d0f6c6fb819870ed55a38764d739..49e6d598ea27db6571c5a4301b255d7eca153df1 100644 (file)
@@ -1285,8 +1285,10 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
        MovieTrackingTrack *track;
        MovieTrackingReconstruction *reconstruction= &tracking->reconstruction;
        MovieReconstructedCamera *reconstructed;
-       float origin[3]= {0.0f, 0.0f, 0.0f};
        int ok= 1;
+       float imat[4][4];
+
+       unit_m4(imat);
 
        track= tracking->tracks.first;
        while(track) {
@@ -1354,12 +1356,13 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
                                        mat[i][j]= matd[i][j];
 
                        if(!origin_set) {
-                               copy_v3_v3(origin, mat[3]);
+                               copy_m4_m4(imat, mat);
+                               invert_m4(imat);
                                origin_set= 1;
                        }
 
                        if(origin_set)
-                               sub_v3_v3(mat[3], origin);
+                               mul_m4_m4m4(mat, mat, imat);
 
                        copy_m4_m4(reconstructed[reconstruction->camnr].mat, mat);
                        reconstructed[reconstruction->camnr].framenr= a;
@@ -1380,7 +1383,7 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
                track= tracking->tracks.first;
                while(track) {
                        if(track->flag&TRACK_HAS_BUNDLE)
-                               sub_v3_v3(track->bundle_pos, origin);
+                               mul_v3_m4v3(track->bundle_pos, imat, track->bundle_pos);
 
                        track= track->next;
                }
index fa041158c90ea4036e16ff484cc917c74fa50830..eecaed10bcc7188b8b59858acbda14f50c84e19c 100644 (file)
@@ -134,9 +134,9 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3])
        int a, px=0, py=1;
 
        /* first: find dominant axis: 0==X, 1==Y, 2==Z */
-       x= (float)fabs(normal[0]);
-       y= (float)fabs(normal[1]);
-       z= (float)fabs(normal[2]);
+       x= fabsf(normal[0]);
+       y= fabsf(normal[1]);
+       z= fabsf(normal[2]);
        max = MAX3(x, y, z);
        if(max==y) py=2;
        else if(max==x) {
@@ -1689,9 +1689,9 @@ static int barycentric_weights(const float v1[3], const float v2[3], const float
 
        /* find best projection of face XY, XZ or YZ: barycentric weights of
           the 2d projected coords are the same and faster to compute */
-       xn= (float)fabs(n[0]);
-       yn= (float)fabs(n[1]);
-       zn= (float)fabs(n[2]);
+       xn= fabsf(n[0]);
+       yn= fabsf(n[1]);
+       zn= fabsf(n[2]);
        if(zn>=xn && zn>=yn) {i= 0; j= 1;}
        else if(yn>=xn && yn>=zn) {i= 0; j= 2;}
        else {i= 1; j= 2;} 
index 1637cd161610bc4233180d7fe42d4f4ddc459204..e4664798f5d7b81658e1d75f60a3764e69fc21e1 100644 (file)
@@ -1322,8 +1322,8 @@ void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order,float ma
        compatible_eul(eul1, oldrot);
        compatible_eul(eul2, oldrot);
        
-       d1= (float)fabs(eul1[0]-oldrot[0]) + (float)fabs(eul1[1]-oldrot[1]) + (float)fabs(eul1[2]-oldrot[2]);
-       d2= (float)fabs(eul2[0]-oldrot[0]) + (float)fabs(eul2[1]-oldrot[1]) + (float)fabs(eul2[2]-oldrot[2]);
+       d1= fabsf(eul1[0]-oldrot[0]) + fabsf(eul1[1]-oldrot[1]) + fabsf(eul1[2]-oldrot[2]);
+       d2= fabsf(eul2[0]-oldrot[0]) + fabsf(eul2[1]-oldrot[1]) + fabsf(eul2[2]-oldrot[2]);
        
        /* return best, which is just the one with lowest difference */
        if (d1 > d2)
index 081d604819da64c53e6e3e9c23d05c6f3d826578..def6cd61370482d28133a189a515b6a5160b9770 100644 (file)
@@ -794,7 +794,7 @@ void draw_gpencil_view3d (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
         * deal with the camera border, otherwise map the coords to the camera border. */
        if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) {
                rctf rectf;
-               ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, -1); /* negative shift */
+               ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, TRUE); /* no shift */
                BLI_copy_rcti_rctf(&rect, &rectf);
        }
        else {
index 65db5e27ed7b7b9b9e4b49d0ebc95add5ecae99f..9a492153b7f30b2e7992f13bc558f1fcbee3be56 100644 (file)
@@ -468,7 +468,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
                /* for camera view set the subrect */
                if (rv3d->persp == RV3D_CAMOB) {
                        Scene *scene= CTX_data_scene(C);
-                       ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, -1); /* negative shift */
+                       ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, TRUE); /* no shift */
                        return 1;
                }
        }
index 2dd8ef4da94989f6e7d11107ec361c4f2f61c0b1..f09797bf6f1bcb6cd81d2280ea58bb50408e23b9 100644 (file)
@@ -1258,7 +1258,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
 
                        /* for camera view set the subrect */
                        if (rv3d->persp == RV3D_CAMOB) {
-                               ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, -1); /* negative shift */
+                               ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, TRUE); /* no shift */
                                p->subrect= &p->subrect_data;
                        }
                }
index 37f647abfd9d808096532ede1ef6b0e8ef33076b..2ca3e2bfe7fe1f9702dc6b1e8ac6a3710f808277 100644 (file)
@@ -183,10 +183,10 @@ typedef enum SnapMode
 
 #define SNAP_MIN_DISTANCE 30
 
-int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, float mval[2]);
-int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, float mval[2]);
-int snapObjectsTransform(struct TransInfo *t, float mval[2], int *dist, float *loc, float *no, SnapMode mode);
-int snapObjectsContext(struct bContext *C, float mval[2], int *dist, float *loc, float *no, SnapMode mode);
+int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2]);
+int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2]);
+int snapObjectsTransform(struct TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
+int snapObjectsContext(struct bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
 
 #endif
 
index 51e0e25f545e4bd973bbe320a6b5cb68eed5e88c..07fc4e77ac11b389e4cdc725968e8d68fe3321a3 100644 (file)
@@ -209,13 +209,13 @@ void project_int_noclip(struct ARegion *ar, const float vec[3], int adr[2]);
 void project_float(struct ARegion *ar, const float vec[3], float adr[2]);
 void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]);
 
-void ED_view3d_ob_clip_range_get(struct Object *ob, float *lens, float *clipsta, float *clipend);
 int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
-int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
+int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend);
 void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
 void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]);
+void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short no_shift);
 void ED_view3d_project_float_v3(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
-void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift);
+void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, float size_r[2]);
 
 /* drawobject.c iterators */
 void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, int x, int y, int index), void *userData, int clipVerts);
@@ -294,6 +294,7 @@ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d);
 /* copy the view to the camera, return TRUE if */
 int ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d);
 
-struct BGpic *ED_view3D_background_image_add(struct View3D *v3d);
+struct BGpic *ED_view3D_background_image_new(struct View3D *v3d);
+void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic);
 
 #endif /* ED_VIEW3D_H */
index 4b1371c532c4ee5407d1fe2542ad1c415a914925..37a057303e9e79a0049bc62d66a2967ab038af4e 100644 (file)
@@ -318,6 +318,9 @@ void        UI_ThemeClearColor(int colorid);
 // internal (blender) usage only, for init and set active
 void   UI_SetTheme(int spacetype, int regionid);
 
+// get current theme
+struct bTheme *UI_GetTheme(void);
+
 /* only for buttons in theme editor! */
 const unsigned char    *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);
 
index b34b56f31ed932307b10a3a1604abadb43f9ef33..4b7adbc10643b11a38fe27c04236af37f8db92d8 100644 (file)
@@ -2618,11 +2618,8 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
                                else
                                        BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
 
-                               if(value == item[i].value) {
+                               if(value == item[i].value)
                                        icon= item[i].icon;
-                                       if(!tip)
-                                               tip= item[i].description;
-                               }
                        }
                        str= BLI_dynstr_get_cstring(dynstr);
                        BLI_dynstr_free(dynstr);
index 089458f1da45ddbeb5b0406abc64c0819fadfffa..1b7308d328e55925d17a53b3bd95a62b2a6315ab 100644 (file)
@@ -506,7 +506,7 @@ static void init_brush_icons(void)
 
 static void init_internal_icons(void)
 {
-       bTheme *btheme= U.themes.first;
+       bTheme *btheme= UI_GetTheme();
        ImBuf *bbuf= NULL;
        int x, y, icontype;
        char iconfilestr[FILE_MAXDIR+FILE_MAXFILE];
@@ -950,6 +950,7 @@ static int get_draw_size(enum eIconSizes size)
 
 static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
 {
+       bTheme *btheme= UI_GetTheme();
        Icon *icon = NULL;
        DrawInfo *di = NULL;
        IconImage *iimg;
@@ -957,6 +958,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
        int w, h;
        
        icon = BKE_icon_get(icon_id);
+       alpha *= btheme->tui.icon_alpha;
        
        if (icon==NULL) {
                if (G.f & G_DEBUG)
index 16e0153b9103ee3615738c79543bf263f9b9e742..d6460f9046e7fde8a11f77c044c0de27addf2f26 100644 (file)
@@ -112,7 +112,7 @@ typedef enum {
 
 /* internal panel drawing defines */
 #define PNL_GRID       (UI_UNIT_Y / 5) /* 4 default */
-#define PNL_HEADER  UI_UNIT_Y          /* 20 default */
+#define PNL_HEADER  (UI_UNIT_Y + 4)    /* 24 default */
 
 /* panel->flag */
 #define PNL_SELECT     1
index aa80cb632ecb3c644962cd2b43b87f34e2f8bd50..ad79e550575d89035300a376beebbe28679d0da0 100644 (file)
@@ -59,6 +59,7 @@
 #include "ED_screen.h"
 
 #include "UI_interface.h"
+#include "UI_resources.h"
 
 #include "interface_intern.h"
 
@@ -173,7 +174,6 @@ static void ui_panel_copy_offset(Panel *pa, Panel *papar)
 
 Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int *open)
 {
-       uiStyle *style= UI_GetStyle();
        Panel *pa, *patab, *palast, *panext;
        char *drawname= pt->label;
        char *idname= pt->idname;
@@ -208,7 +208,7 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
                }
        
                pa->ofsx= 0;
-               pa->ofsy= style->panelouter;
+               pa->ofsy= 0;
                pa->sizex= 0;
                pa->sizey= 0;
                pa->runtime_flag |= PNL_NEW_ADDED;
@@ -482,6 +482,7 @@ static void rectf_scale(rctf *rect, float scale)
 /* panel integrated in buttonswindow, tool/property lists etc */
 void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
 {
+       bTheme *btheme= UI_GetTheme();
        Panel *panel= block->panel;
        rcti headrect;
        rctf itemrect;
@@ -493,19 +494,37 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
        /* calculate header rect */
        /* + 0.001f to prevent flicker due to float inaccuracy */
        headrect= *rect;
-       headrect.ymin= headrect.ymax;
+       headrect.ymin= headrect.ymax - 2.0f/block->aspect;
        headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f);
        
-       if(!(panel->runtime_flag & PNL_FIRST)) {
-               float minx= rect->xmin+5.0f/block->aspect;
-               float maxx= rect->xmax-5.0f/block->aspect;
+       {
+               float minx= rect->xmin;
+               float maxx= rect->xmax;
                float y= headrect.ymax;
-               
+
                glEnable(GL_BLEND);
-               glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
-               fdrawline(minx, y+1, maxx, y+1);
-               glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
-               fdrawline(minx, y, maxx, y);
+
+               if(btheme->tui.panel.show_header) {
+                       /* draw with background color */
+                       glEnable(GL_BLEND);
+                       glColor4ubv((unsigned char*)btheme->tui.panel.header);
+                       glRectf(minx, headrect.ymin, maxx, y);
+
+                       fdrawline(minx, y, maxx, y);
+                       fdrawline(minx, y, maxx, y);
+               }
+               else if(!(panel->runtime_flag & PNL_FIRST)) {
+                       /* draw embossed separator */
+                       minx += 5.0f/block->aspect;
+                       maxx -= 5.0f/block->aspect;
+                       
+                       glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
+                       fdrawline(minx, y+1, maxx, y+1);
+                       glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
+                       fdrawline(minx, y, maxx, y);
+                       glDisable(GL_BLEND);
+               }
+
                glDisable(GL_BLEND);
        }
        
@@ -518,7 +537,8 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
                itemrect.xmin= itemrect.xmax - (headrect.ymax-headrect.ymin);
                itemrect.ymin= headrect.ymin;
                itemrect.ymax= headrect.ymax;
-               rectf_scale(&itemrect, 0.8f);
+
+               rectf_scale(&itemrect, 0.7f);
                ui_draw_panel_dragwidget(&itemrect);
        }
        
@@ -538,7 +558,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
                /* in some occasions, draw a border */
                if(panel->flag & PNL_SELECT) {
                        if(panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL);
-                       else uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
+                       else uiSetRoundBox(UI_CNR_NONE);
                        
                        UI_ThemeColorShade(TH_BACK, -120);
                        uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8);
@@ -567,7 +587,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
        itemrect.ymin= headrect.ymin;
        itemrect.ymax= headrect.ymax;
        
-       rectf_scale(&itemrect, 0.5f);
+       rectf_scale(&itemrect, 0.35f);
        
        if(panel->flag & PNL_CLOSEDY)
                ui_draw_tria_rect(&itemrect, 'h');
@@ -589,12 +609,12 @@ static int get_panel_header(Panel *pa)
        return PNL_HEADER;
 }
 
-static int get_panel_size_y(uiStyle *style, Panel *pa)
+static int get_panel_size_y(Panel *pa)
 {
        if(pa->type && (pa->type->flag & PNL_NO_HEADER))
                return pa->sizey;
 
-       return PNL_HEADER + pa->sizey + style->panelouter;
+       return PNL_HEADER + pa->sizey;
 }
 
 /* this function is needed because uiBlock and Panel itself dont
@@ -667,7 +687,6 @@ static int compare_panel(const void *a1, const void *a2)
 /* returns 1 when it did something */
 static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
 {
-       uiStyle *style= UI_GetStyle();
        Panel *pa;
        PanelSort *ps, *panelsort, *psnext;
        int a, tot=0, done;
@@ -719,18 +738,18 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
        /* no smart other default start loc! this keeps switching f5/f6/etc compatible */
        ps= panelsort;
        ps->pa->ofsx= 0;
-       ps->pa->ofsy= -get_panel_size_y(style, ps->pa);
+       ps->pa->ofsy= -get_panel_size_y(ps->pa);
 
        for(a=0; a<tot-1; a++, ps++) {
                psnext= ps+1;
        
                if(align==BUT_VERTICAL) {
                        psnext->pa->ofsx= ps->pa->ofsx;
-                       psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(style, psnext->pa);
+                       psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa);
                }
                else {
                        psnext->pa->ofsx= get_panel_real_ofsx(ps->pa);
-                       psnext->pa->ofsy= ps->pa->ofsy + get_panel_size_y(style, ps->pa) - get_panel_size_y(style, psnext->pa);
+                       psnext->pa->ofsy= ps->pa->ofsy + get_panel_size_y(ps->pa) - get_panel_size_y(psnext->pa);
                }
        }
        
index 513f084b6e8dbc9fb35d16b3b092377ca5e5a85d..47dde3f03f089ac41c288691176447de235651c4 100644 (file)
@@ -376,17 +376,18 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                        data->totline++;
                }
 
-               if(but->type == ROW) {
+               if(ELEM(but->type, ROW, MENU)) {
                        EnumPropertyItem *item;
                        int i, totitem, free;
+                       int value = (but->type == ROW)? but->hardmax: ui_get_but_val(but);
 
                        RNA_property_enum_items_gettexted(C, &but->rnapoin, but->rnaprop, &item, &totitem, &free);
 
                        for(i=0; i<totitem; i++) {
-                               if(item[i].identifier[0] && item[i].value == (int)but->hardmax) {
+                               if(item[i].identifier[0] && item[i].value == value) {
                                        if(item[i].description[0]) {
                                                BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description);
-                                               data->color[data->totline]= 0xFFFFFF;
+                                               data->color[data->totline]= 0xDDDDDD;
                                                data->totline++;
                                        }
                                        break;
@@ -1446,6 +1447,8 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
 void ui_popup_block_scrolltest(uiBlock *block)
 {
        uiBut *bt;
+       /* Knowing direction is necessary for multi-column menus... */
+       int is_flip = (block->direction & UI_TOP) && !(block->flag & UI_BLOCK_NO_FLIP);
        
        block->flag &= ~(UI_BLOCK_CLIPBOTTOM|UI_BLOCK_CLIPTOP);
        
@@ -1462,9 +1465,9 @@ void ui_popup_block_scrolltest(uiBlock *block)
                        block->flag |= UI_BLOCK_CLIPBOTTOM;
                        /* make space for arrow */
                        if(bt->y2 < block->miny +10) {
-                               if(bt->next && bt->next->y1 > bt->y1)
+                               if(is_flip && bt->next && bt->next->y1 > bt->y1)
                                        bt->next->flag |= UI_SCROLLED;
-                               if(bt->prev && bt->prev->y1 > bt->y1)
+                               else if(!is_flip && bt->prev && bt->prev->y1 > bt->y1)
                                        bt->prev->flag |= UI_SCROLLED;
                        }
                }
@@ -1473,9 +1476,9 @@ void ui_popup_block_scrolltest(uiBlock *block)
                        block->flag |= UI_BLOCK_CLIPTOP;
                        /* make space for arrow */
                        if(bt->y1 > block->maxy -10) {
-                               if(bt->next && bt->next->y2 < bt->y2)
+                               if(!is_flip && bt->next && bt->next->y2 < bt->y2)
                                        bt->next->flag |= UI_SCROLLED;
-                               if(bt->prev && bt->prev->y2 < bt->y2)
+                               else if(is_flip && bt->prev && bt->prev->y2 < bt->y2)
                                        bt->prev->flag |= UI_SCROLLED;
                        }
                }
index 0e9dbaf3022d3286df2706bed7079ec9d20012d1..3caafe308d05f4703dbd2be09ced5a9a614a6fdb 100644 (file)
@@ -124,7 +124,6 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id
        style->buttonspacex= 8;
        style->buttonspacey= 2;
        style->panelspace= 8;
-       style->panelouter= 4;
        
        return style;
 }
index c9fcb7f1d24ed5ab2a2a5a4ef7976d0bc740f2d4..9a438070e1eac8b9d600d8724c60a088a8fcc6c3 100644 (file)
@@ -1617,7 +1617,7 @@ static void widget_state_option_menu(uiWidgetType *wt, int state)
        if(state & UI_SELECT)
                UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
        else {
-               bTheme *btheme= U.themes.first; /* XXX */
+               bTheme *btheme= UI_GetTheme(); /* XXX */
 
                copy_v3_v3_char(wt->wcol.text, btheme->tui.wcol_menu_back.text);
        }
@@ -2760,7 +2760,7 @@ static void widget_disabled(rcti *rect)
 
 static uiWidgetType *widget_type(uiWidgetTypeEnum type)
 {
-       bTheme *btheme= U.themes.first;
+       bTheme *btheme= UI_GetTheme();
        static uiWidgetType wt;
        
        /* defaults */
@@ -2945,7 +2945,7 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
 /* conversion from old to new buttons, so still messy */
 void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
 {
-       bTheme *btheme= U.themes.first;
+       bTheme *btheme= UI_GetTheme();
        ThemeUI *tui= &btheme->tui;
        uiFontStyle *fstyle= &style->widget;
        uiWidgetType *wt= NULL;
index 738531e3badd29882466bc29c0d263676f75a5ce..66add6d8f0c243e0871d261d93bb3324b684f101 100644 (file)
@@ -839,6 +839,11 @@ void UI_SetTheme(int spacetype, int regionid)
        }
 }
 
+bTheme *UI_GetTheme()
+{
+       return U.themes.first;
+}
+
 // for space windows only
 void UI_ThemeColor(int colorid)
 {
@@ -1668,6 +1673,15 @@ void init_userdef_do_versions(void)
                }
        }
 
+       if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 5)) {
+               bTheme *btheme;
+
+               for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+                       SETCOL(btheme->tui.panel.header, 0, 0, 0, 25);
+                       btheme->tui.icon_alpha= 1.0;
+               }
+       }
+
        /* GL Texture Garbage Collection (variable abused above!) */
        if (U.textimeout == 0) {
                U.texcollectrate = 60;
index 5e97e01aed6bfc8fdb12f30006880fdfe7514007..c2c482b0a2cc0fab07da0e6c4bd09d66bb3b90b4 100644 (file)
@@ -1558,7 +1558,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
        if (scroll & V2D_SCROLL_HORIZONTAL) {
                /* only draw scrollbar when it doesn't fill the entire space */
                if(vs->horfull==0) {
-                       bTheme *btheme= U.themes.first;
+                       bTheme *btheme= UI_GetTheme();
                        uiWidgetColors wcol= btheme->tui.wcol_scroll;
                        rcti slider;
                        int state;
@@ -1669,7 +1669,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
        if (scroll & V2D_SCROLL_VERTICAL) {
                /* only draw scrollbar when it doesn't fill the entire space */
                if(vs->vertfull==0) {
-                       bTheme *btheme= U.themes.first;
+                       bTheme *btheme= UI_GetTheme();
                        uiWidgetColors wcol= btheme->tui.wcol_scroll;
                        rcti slider;
                        int state;
index 998e70d5e254cc90c2a4d7fb666311786723c407..5706da93fe912b3eb2f7a3fa077b5d74d49fbc3b 100644 (file)
@@ -985,12 +985,12 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
                        
                        /* x-axis transform */
                        dist = (v2d->mask.xmax - v2d->mask.xmin) / 2.0f;
-                       dx= 1.0f - ((float)fabs(vzd->lastx - dist) + 2.0f) / ((float)fabs(event->x - dist) + 2.0f);
+                       dx= 1.0f - (fabsf(vzd->lastx - dist) + 2.0f) / (fabsf(event->x - dist) + 2.0f);
                        dx*= 0.5f * (v2d->cur.xmax - v2d->cur.xmin);
                        
                        /* y-axis transform */
                        dist = (v2d->mask.ymax - v2d->mask.ymin) / 2.0f;
-                       dy= 1.0f - ((float)fabs(vzd->lasty - dist) + 2.0f) / ((float)fabs(event->y - dist) + 2.0f);
+                       dy= 1.0f - (fabsf(vzd->lasty - dist) + 2.0f) / (fabsf(event->y - dist) + 2.0f);
                        dy*= 0.5f * (v2d->cur.ymax - v2d->cur.ymin);
                }
                else {
index fa764e6eefc2af4492959fe4010302a1047588e9..843918e9173d0e0fb9b585d3e1c93ba158552c2d 100644 (file)
@@ -147,7 +147,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
                        rctf viewplane;
                        float clipsta, clipend;
 
-                       int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL);
+                       int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend);
                        if(is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
                        else  perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
                }
index 6a93e39a662d9f3b06f4d07e21574e72434ca26d..4a06ee6d0aeb5d0fc1c98ae4f84952a246032f74 100644 (file)
@@ -175,6 +175,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
        dx= copysign(ceil(0.3f*fabs(dx)), dx);
        dy= copysign(ceil(0.3f*fabs(dy)), dy);
 
+       glEnable(GL_BLEND);
        glEnable(GL_LINE_SMOOTH);
        
        glColor4ub(255, 255, 255, 180);
@@ -192,6 +193,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
        fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1);
 
        glDisable(GL_LINE_SMOOTH);
+       glDisable(GL_BLEND);
 }
 
 static void region_draw_azone_icon(AZone *az)
@@ -228,6 +230,49 @@ static void region_draw_azone_icon(AZone *az)
        sdrawline(midx-2, midy, midx+3, midy);
 }
 
+static void draw_azone_plus(float x1, float y1, float x2, float y2)
+{
+       float width = 2.0f;
+       float pad = 4.0f;
+       
+       glRectf((x1 + x2 - width)*0.5f, y1 + pad, (x1 + x2 + width)*0.5f, y2 - pad);
+       glRectf(x1 + pad, (y1 + y2 - width)*0.5f, (x1 + x2 - width)*0.5f, (y1 + y2 + width)*0.5f);
+       glRectf((x1 + x2 + width)*0.5f, (y1 + y2 - width)*0.5f, x2 - pad, (y1 + y2 + width)*0.5f);
+}
+
+static void region_draw_azone_tab_plus(AZone *az)
+{
+       extern void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); /* xxx temp */
+       
+       glEnable(GL_BLEND);
+       
+       /* add code to draw region hidden as 'too small' */
+       switch(az->edge) {
+               case AE_TOP_TO_BOTTOMRIGHT:
+                       uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
+                       break;
+               case AE_BOTTOM_TO_TOPLEFT:
+                       uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT);
+                       break;
+               case AE_LEFT_TO_TOPRIGHT:
+                       uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
+                       break;
+               case AE_RIGHT_TO_TOPLEFT:
+                       uiSetRoundBox(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT);
+                       break;
+       }
+
+       glColor4f(0.05f, 0.05f, 0.05f, 0.5f);
+       uiRoundBox((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
+
+       glEnable(GL_BLEND);
+
+       glColor4f(0.8f, 0.8f, 0.8f, 0.5f);
+       draw_azone_plus((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2);
+
+       glDisable(GL_BLEND);
+}
+
 static void region_draw_azone_tab(AZone *az)
 {
        float col[3];
@@ -326,13 +371,14 @@ void ED_area_overdraw(bContext *C)
                                        if(az->ar) {
                                                /* only display tab or icons when the region is hidden */
                                                if (az->ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
-                                       
-                                                       if(G.rt==2)
+                                                       if(G.rt==3)
+                                                               region_draw_azone_icon(az);
+                                                       else if(G.rt==2)
                                                                region_draw_azone_tria(az);
                                                        else if(G.rt==1)
                                                                region_draw_azone_tab(az);
                                                        else
-                                                               region_draw_azone_icon(az);
+                                                               region_draw_azone_tab_plus(az);
                                                }
                                        }
                                }
@@ -665,6 +711,51 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
        }
 }
 
+#define AZONEPAD_TAB_PLUSW     16
+#define AZONEPAD_TAB_PLUSH     16
+
+/* region already made zero sized, in shape of edge */
+static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
+{
+       AZone *azt;
+       int tot= 0, add;
+       
+       for(azt= sa->actionzones.first; azt; azt= azt->next) {
+               if(azt->edge == az->edge) tot++;
+       }
+       
+       switch(az->edge) {
+               case AE_TOP_TO_BOTTOMRIGHT:
+                       if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+                       az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
+                       az->y1= ar->winrct.ymax - add;
+                       az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW;
+                       az->y2= ar->winrct.ymax - add + AZONEPAD_TAB_PLUSH;
+                       break;
+               case AE_BOTTOM_TO_TOPLEFT:
+                       az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
+                       az->y1= ar->winrct.ymin - AZONEPAD_TAB_PLUSH;
+                       az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW;
+                       az->y2= ar->winrct.ymin;
+                       break;
+               case AE_LEFT_TO_TOPRIGHT:
+                       az->x1= ar->winrct.xmin + 1 - AZONEPAD_TAB_PLUSH;
+                       az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW;
+                       az->x2= ar->winrct.xmin + 1;
+                       az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW;
+                       break;
+               case AE_RIGHT_TO_TOPLEFT:
+                       az->x1= ar->winrct.xmax - 1;
+                       az->y1= ar->winrct.ymax - 2.5*AZONEPAD_TAB_PLUSW;
+                       az->x2= ar->winrct.xmax - 1 + AZONEPAD_TAB_PLUSH;
+                       az->y2= ar->winrct.ymax - 1.5*AZONEPAD_TAB_PLUSW;
+                       break;
+       }
+       /* rect needed for mouse pointer test */
+       BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+}      
+
+
 #define AZONEPAD_TABW  18
 #define AZONEPAD_TABH  7
 
@@ -766,12 +857,14 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge)
        az->edge= edge;
        
        if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
-               if(G.rt==2)
+               if(G.rt==3)
+                       region_azone_icon(sa, az, ar);
+               else if(G.rt==2)
                        region_azone_tria(sa, az, ar);
                else if(G.rt==1)
                        region_azone_tab(sa, az, ar);
                else
-                       region_azone_icon(sa, az, ar);
+                       region_azone_tab_plus(sa, az, ar);
        } else {
                region_azone_edge(az, ar);
        }
@@ -1481,7 +1574,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
        }
 
        x= 0;
-       y= -style->panelouter;
+       y= 0;
 
        /* create panels */
        uiBeginPanels(C, ar);
@@ -1553,11 +1646,11 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
                                if(pt->flag & PNL_NO_HEADER)
                                        y += yco;
                                else
-                                       y += yco-style->panelouter;
+                                       y += yco;
                        }
                        else {
                                x += w;
-                               miny= MIN2(y, yco-style->panelouter-header);
+                               miny= MIN2(y, yco-header);
                        }
                }
        }
index c0d4b9106e629392272d9dc454a6d42e7058e997..7ae5f433ff3cae6928cbc28b4b28d09d6cf39dc7 100644 (file)
@@ -3060,25 +3060,24 @@ static void project_paint_begin(ProjPaintState *ps)
                                invert_m4_m4(viewinv, viewmat);
                        }
                        else if (ps->source==PROJ_SRC_IMAGE_CAM) {
-                               Object *camera= ps->scene->camera;
-
-                               /* dont actually use these */
-                               float _viewdx, _viewdy, _ycor, _lens=0.0f, _sensor_x=DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT;
-                               short _sensor_fit= CAMERA_SENSOR_FIT_AUTO;
-                               rctf _viewplane;
+                               Object *cam_ob= ps->scene->camera;
+                               CameraParams params;
 
                                /* viewmat & viewinv */
-                               copy_m4_m4(viewinv, ps->scene->camera->obmat);
+                               copy_m4_m4(viewinv, cam_ob->obmat);
                                normalize_m4(viewinv);
                                invert_m4_m4(viewmat, viewinv);
 
-                               /* camera winmat */
-                               object_camera_mode(&ps->scene->r, camera);
-                               object_camera_matrix(&ps->scene->r, camera, ps->winx, ps->winy, 0,
-                                               winmat, &_viewplane, &ps->clipsta, &ps->clipend,
-                                               &_lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_ycor, &_viewdx, &_viewdy);
+                               /* window matrix, clipping and ortho */
+                               camera_params_init(&params);
+                               camera_params_from_object(&params, cam_ob);
+                               camera_params_compute_viewplane(&params, ps->winx, ps->winy, 1.0f, 1.0f);
+                               camera_params_compute_matrix(&params);
 
-                               ps->is_ortho= (ps->scene->r.mode & R_ORTHO) ? 1 : 0;
+                               copy_m4_m4(winmat, params.winmat);
+                               ps->clipsta= params.clipsta;
+                               ps->clipend= params.clipend;
+                               ps->is_ortho= params.is_ortho;
                        }
 
                        /* same as view3d_get_object_project_mat */
index d59d947f0c8156d45b2eb3585650170a523a0cc3..2465d42bbf1097bb99bedd30d117825be7f8e370 100644 (file)
@@ -1179,7 +1179,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
 
 static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
 {
-       bTheme *btheme= U.themes.first;
+       bTheme *btheme= UI_GetTheme();
        uiWidgetColors wcol= btheme->tui.wcol_scroll;
        unsigned char col[4];
        float rad;
index bbc72500df4e863fecff3f07e4e97e1aa4542f1c..17cb1ce2995398017aee103fc7c76edce65403ef 100644 (file)
@@ -115,7 +115,7 @@ static void set_pchan_colorset (Object *ob, bPoseChannel *pchan)
         * color set (based on the theme colors for 3d-view) is used. 
         */
        if (color_index > 0) {
-               bTheme *btheme= U.themes.first;
+               bTheme *btheme= UI_GetTheme();
                bcolor= &btheme->tarm[(color_index - 1)];
        }
        else if (color_index == -1) {
index 44bacd7a20eda1449deab94fdc6df349b95e72a9..959e267f50e214575ef0d986b17a2c18752c58f0 100644 (file)
@@ -1696,7 +1696,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
                        if(cam->flag & CAM_SHOWLIMITS) {
                                draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF);
                                /* qdn: was yafray only, now also enabled for Blender to be used with defocus composit node */
-                               draw_focus_cross(dof_camera(ob), cam->drawsize);
+                               draw_focus_cross(object_camera_dof_distance(ob), cam->drawsize);
                        }
 
                        wrld= scene->world;
index 7ce758d4f47fc8b06b21c86d992feda0277184f2..7dae02aba39552c28a076c762ed6a2eceb5b0acb 100644 (file)
@@ -923,75 +923,48 @@ static void draw_selected_name(Scene *scene, Object *ob)
        BLF_draw_default(offset,  10, 0.0f, info, sizeof(info)-1);
 }
 
-void view3d_viewborder_size_get(Scene *scene, Object *camob, ARegion *ar, float size_r[2])
+static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short no_shift, short no_zoom)
 {
-       float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
-       short sensor_fit= CAMERA_SENSOR_FIT_AUTO;
-
-       if(camob && camob->type==OB_CAMERA) {
-               Camera *cam= (Camera *)camob->data;
-               sensor_fit= cam->sensor_fit;
-       }
+       CameraParams params;
+       rctf rect_view, rect_camera;
+
+       /* get viewport viewplane */
+       camera_params_init(&params);
+       camera_params_from_view3d(&params, v3d, rv3d);
+       if(no_zoom)
+               params.zoom= 1.0f;
+       camera_params_compute_viewplane(&params, ar->winx, ar->winy, 1.0f, 1.0f);
+       rect_view= params.viewplane;
+
+       /* get camera viewplane */
+       camera_params_init(&params);
+       camera_params_from_object(&params, v3d->camera);
+       if(no_shift) {
+               params.shiftx= 0.0f;
+               params.shifty= 0.0f;
+       }
+       camera_params_compute_viewplane(&params, scene->r.xsch, scene->r.ysch, scene->r.xasp, scene->r.yasp);
+       rect_camera= params.viewplane;
+
+       /* get camera border within viewport */
+       viewborder_r->xmin= ((rect_camera.xmin - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx;
+       viewborder_r->xmax= ((rect_camera.xmax - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx;
+       viewborder_r->ymin= ((rect_camera.ymin - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy;
+       viewborder_r->ymax= ((rect_camera.ymax - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy;
+}
 
-       if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
-               float winmax= MAX2(ar->winx, ar->winy);
+void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, float size_r[2])
+{
+       rctf viewborder;
 
-               if(aspect > 1.0f) {
-                       size_r[0]= winmax;
-                       size_r[1]= winmax/aspect;
-               } else {
-                       size_r[0]= winmax*aspect;
-                       size_r[1]= winmax;
-               }
-       }
-       else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
-               size_r[0]= ar->winx;
-               size_r[1]= ar->winx/aspect;
-       }
-       else {
-               size_r[0]= ar->winy*aspect;
-               size_r[1]= ar->winy;
-       }
+       view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, TRUE, TRUE);
+       size_r[0]= viewborder.xmax - viewborder.xmin;
+       size_r[1]= viewborder.ymax - viewborder.ymin;
 }
 
-void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short do_shift)
+void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short no_shift)
 {
-       const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom);
-       float size[2];
-       float dx= 0.0f, dy= 0.0f;
-       
-       view3d_viewborder_size_get(scene, v3d->camera, ar, size);
-
-       size[0]= size[0]*zoomfac;
-       size[1]= size[1]*zoomfac;
-       
-       /* center in window */
-       viewborder_r->xmin= 0.5f * ar->winx - 0.5f * size[0];
-       viewborder_r->ymin= 0.5f * ar->winy - 0.5f * size[1];
-       viewborder_r->xmax= viewborder_r->xmin + size[0];
-       viewborder_r->ymax= viewborder_r->ymin + size[1];
-       
-       dx= ar->winx*rv3d->camdx*zoomfac*2.0f;
-       dy= ar->winy*rv3d->camdy*zoomfac*2.0f;
-       
-       /* apply offset */
-       viewborder_r->xmin-= dx;
-       viewborder_r->ymin-= dy;
-       viewborder_r->xmax-= dx;
-       viewborder_r->ymax-= dy;
-       
-       if(do_shift && v3d->camera && v3d->camera->type==OB_CAMERA) {
-               Camera *cam= v3d->camera->data;
-               float w = viewborder_r->xmax - viewborder_r->xmin;
-               float h = viewborder_r->ymax - viewborder_r->ymin;
-               float side = MAX2(w, h);
-
-               if(do_shift == -1) side *= -1;
-               viewborder_r->xmin+= cam->shiftx*side;
-               viewborder_r->xmax+= cam->shiftx*side;
-               viewborder_r->ymin+= cam->shifty*side;
-               viewborder_r->ymax+= cam->shifty*side;
-       }
+       view3d_camera_border(scene, ar, v3d, rv3d, viewborder_r, no_shift, FALSE);
 }
 
 static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float fac)
@@ -1228,19 +1201,39 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
                        uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
                }
                if (ca && (ca->flag & CAM_SHOWSENSOR)) {
-                       /* assume fixed sensor width for now */
-
-                       /* float sensor_aspect = ca->sensor_x / ca->sensor_y; */ /* UNUSED */
-                       float sensor_scale = (x2i-x1i) / ca->sensor_x;
-                       float sensor_height = sensor_scale * ca->sensor_y;
+                       /* determine sensor fit, and get sensor x/y, for auto fit we
+                          assume and square sensor and only use sensor_x */
+                       float sizex= scene->r.xsch*scene->r.xasp;
+                       float sizey= scene->r.ysch*scene->r.yasp;
+                       int sensor_fit = camera_sensor_fit(ca->sensor_fit, sizex, sizey);
+                       float sensor_x= ca->sensor_x;
+                       float sensor_y= (ca->sensor_fit == CAMERA_SENSOR_FIT_AUTO)? ca->sensor_x: ca->sensor_y;
+
+                       /* determine sensor plane */
+                       rctf rect;
+
+                       if(sensor_fit == CAMERA_SENSOR_FIT_HOR) {
+                               float sensor_scale = (x2i-x1i) / sensor_x;
+                               float sensor_height = sensor_scale * sensor_y;
+
+                               rect.xmin= x1i;
+                               rect.xmax= x2i;
+                               rect.ymin= (y1i + y2i)*0.5f - sensor_height*0.5f;
+                               rect.ymax= rect.ymin + sensor_height;
+                       }
+                       else {
+                               float sensor_scale = (y2i-y1i) / sensor_y;
+                               float sensor_width = sensor_scale * sensor_x;
 
-                       float ymid = y1i + (y2i-y1i)/2.f;
-                       float sy1= ymid - sensor_height/2.f;
-                       float sy2= ymid + sensor_height/2.f;
+                               rect.xmin= (x1i + x2i)*0.5f - sensor_width*0.5f;
+                               rect.xmax= rect.xmin + sensor_width;
+                               rect.ymin= y1i;
+                               rect.ymax= y2i;
+                       }
 
+                       /* draw */
                        UI_ThemeColorShade(TH_WIRE, 100);
-
-                       uiDrawBox(GL_LINE_LOOP, x1i, sy1, x2i, sy2, 2.0f);
+                       uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 2.0f);
                }
        }
 
@@ -2485,15 +2478,14 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
 
        /* render 3d view */
        if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
-               float winmat[4][4];
-               float _clipsta, _clipend, _lens, _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT;
-               short _sensor_fit= CAMERA_SENSOR_FIT_AUTO;
-               rctf _viewplane;
+               CameraParams params;
 
-               object_camera_matrix(&scene->r, v3d->camera, sizex, sizey, 0, winmat, &_viewplane, &_clipsta, &_clipend, &_lens,
-                       &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy);
+               camera_params_init(&params);
+               camera_params_from_object(&params, v3d->camera);
+               camera_params_compute_viewplane(&params, sizex, sizey, scene->r.xasp, scene->r.yasp);
+               camera_params_compute_matrix(&params);
 
-               ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat);
+               ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, params.winmat);
        }
        else {
                ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, NULL);
@@ -2546,10 +2538,17 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w
        invert_m4_m4(rv3d.viewmat, rv3d.viewinv);
 
        {
-               float _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT;
-               short _sensor_fit= CAMERA_SENSOR_FIT_AUTO;
-               rctf _viewplane;
-               object_camera_matrix(&scene->r, v3d.camera, width, height, 0, rv3d.winmat, &_viewplane, &v3d.near, &v3d.far, &v3d.lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy);
+               CameraParams params;
+
+               camera_params_init(&params);
+               camera_params_from_object(&params, v3d.camera);
+               camera_params_compute_viewplane(&params, width, height, scene->r.xasp, scene->r.yasp);
+               camera_params_compute_matrix(&params);
+
+               copy_m4_m4(rv3d.winmat, params.winmat);
+               v3d.near= params.clipsta;
+               v3d.far= params.clipend;
+               v3d.lens= params.lens;
        }
 
        mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat);
index 7eaa5d42dd03820d93aecc12fc81801c34aef968..32e162fd09c2329c4e4f878af38a65b895cf85d9 100644 (file)
@@ -47,6 +47,7 @@
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
+#include "BKE_camera.h"
 #include "BKE_context.h"
 #include "BKE_image.h"
 #include "BKE_library.h"
@@ -2265,7 +2266,7 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was
 
        rv3d->camdx= rv3d->camdy= 0.0f;
 
-       view3d_viewborder_size_get(scene, v3d->camera, ar, size);
+       ED_view3d_calc_camera_border_size(scene, ar, v3d, rv3d, size);
 
        /* 4px is just a little room from the edge of the area */
        xfac= (float)ar->winx / (float)(size[0] + 4);
@@ -2533,7 +2534,7 @@ static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar, View3D *v3d)
        float size[2];
        int im_width= (scene->r.size*scene->r.xsch)/100;
        
-       view3d_viewborder_size_get(scene, v3d->camera, ar, size);
+       ED_view3d_calc_camera_border_size(scene, ar, v3d, rv3d, size);
 
        rv3d->camzoom= BKE_screen_view3d_zoom_from_fac((float)im_width/size[0]);
        CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
@@ -2944,7 +2945,7 @@ static BGpic *background_image_add(bContext *C)
 {
        View3D *v3d= CTX_wm_view3d(C);
 
-       return ED_view3D_background_image_add(v3d);
+       return ED_view3D_background_image_new(v3d);
 }
 
 static int background_image_add_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3014,16 +3015,13 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot)
 /* ***** remove image operator ******* */
 static int background_image_remove_exec(bContext *C, wmOperator *op)
 {
-       View3D *vd = CTX_wm_view3d(C);
+       View3D *v3d = CTX_wm_view3d(C);
        int index = RNA_int_get(op->ptr, "index");
-       BGpic *bgpic_rem= BLI_findlink(&vd->bgpicbase, index);
+       BGpic *bgpic_rem= BLI_findlink(&v3d->bgpicbase, index);
 
        if(bgpic_rem) {
-               BLI_remlink(&vd->bgpicbase, bgpic_rem);
-               if(bgpic_rem->ima)      id_us_min(&bgpic_rem->ima->id);
-               if(bgpic_rem->clip) id_us_min(&bgpic_rem->clip->id);
-               MEM_freeN(bgpic_rem);
-               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, vd);
+               ED_view3D_background_image_remove(v3d, bgpic_rem);
+               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
                return OPERATOR_FINISHED;
        }
        else {
@@ -3516,8 +3514,12 @@ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist,
 {
        ED_view3d_from_m4(ob->obmat, ofs, quat, dist);
 
-       if (lens) {
-               ED_view3d_ob_clip_range_get(ob, lens, NULL, NULL);
+       if(lens) {
+               CameraParams params;
+
+               camera_params_init(&params);
+               camera_params_from_object(&params, ob);
+               *lens= params.lens;
        }
 }
 
@@ -3529,7 +3531,7 @@ void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], co
        object_apply_mat4(ob, mat, TRUE, TRUE);
 }
 
-BGpic *ED_view3D_background_image_add(View3D *v3d)
+BGpic *ED_view3D_background_image_new(View3D *v3d)
 {
        BGpic *bgpic= MEM_callocN(sizeof(BGpic), "Background Image");
 
@@ -3538,8 +3540,22 @@ BGpic *ED_view3D_background_image_add(View3D *v3d)
        bgpic->iuser.fie_ima= 2;
        bgpic->iuser.ok= 1;
        bgpic->view= 0; /* 0 for all */
+       bgpic->flag |= V3D_BGPIC_EXPANDED;
 
        BLI_addtail(&v3d->bgpicbase, bgpic);
 
        return bgpic;
 }
+
+void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic)
+{
+       BLI_remlink(&v3d->bgpicbase, bgpic);
+
+       if(bgpic->ima)
+               id_us_min(&bgpic->ima->id);
+
+       if(bgpic->clip)
+               id_us_min(&bgpic->clip->id);
+
+       MEM_freeN(bgpic);
+}
index 775cb45066ac5eb51398e274ad71d4a7c05c2d91..42f58ba26f7549d4dc3a697367cfaf7c14916e6f 100644 (file)
@@ -140,7 +140,6 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
 void view3d_clr_clipping(void);
 void view3d_set_clipping(RegionView3D *rv3d);
 void add_view3d_after(ListBase *lb, Base *base, int flag);
-void view3d_viewborder_size_get(struct Scene *scene, struct Object *camob, struct ARegion *ar, float size_r[2]);
 
 void circf(float x, float y, float rad);
 void circ(float x, float y, float rad);
index 1b4b26aeaaaf6728a815d344359418e8ab344eeb..1a5e86aee71a0aac088b9f3e149d473482821911 100644 (file)
@@ -104,31 +104,6 @@ float *give_cursor(Scene *scene, View3D *v3d)
 }
 
 
-/* Gets the lens and clipping values from a camera of lamp type object */
-void ED_view3d_ob_clip_range_get(Object *ob, float *lens, float *clipsta, float *clipend)
-{
-       if(ob->type==OB_LAMP ) {
-               Lamp *la = ob->data;
-               if (lens) {
-                       float x1, fac;
-                       fac= cosf((float)M_PI*la->spotsize/360.0f);
-                       x1= saacos(fac);
-                       *lens= 16.0f*fac/sinf(x1);
-               }
-               if (clipsta)    *clipsta= la->clipsta;
-               if (clipend)    *clipend= la->clipend;
-       }
-       else if(ob->type==OB_CAMERA) {
-               Camera *cam= ob->data;
-               if (lens)               *lens= cam->lens;
-               if (clipsta)    *clipsta= cam->clipsta;
-               if (clipend)    *clipend= cam->clipend;
-       }
-       else {
-               if (lens)               *lens= 35.0f;
-       }
-}
-
 /* ****************** smooth view operator ****************** */
 /* This operator is one of the 'timer refresh' ones like animation playback */
 
@@ -367,7 +342,7 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot)
 
 /* ****************** change view operators ****************** */
 
-static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op))
+static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
 {
        View3D *v3d = CTX_wm_view3d(C);
        RegionView3D *rv3d= CTX_wm_region_view3d(C);
@@ -394,7 +369,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op))
 
 }
 
-static int view3d_setcameratoview_poll(bContext *C)
+static int view3d_camera_to_view_poll(bContext *C)
 {
        View3D *v3d= CTX_wm_view3d(C);
        if(v3d && v3d->camera && v3d->camera->id.lib==NULL) {
@@ -415,8 +390,8 @@ void VIEW3D_OT_camera_to_view(wmOperatorType *ot)
        ot->idname= "VIEW3D_OT_camera_to_view";
        
        /* api callbacks */
-       ot->exec= view3d_setcameratoview_exec;  
-       ot->poll= view3d_setcameratoview_poll;
+       ot->exec= view3d_camera_to_view_exec;
+       ot->poll= view3d_camera_to_view_poll;
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -456,6 +431,24 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o
        }
 }
 
+static int view3d_camera_to_view_selected_poll(bContext *C)
+{
+       View3D *v3d= CTX_wm_view3d(C);
+       if(v3d && v3d->camera && v3d->camera->id.lib==NULL) {
+               RegionView3D *rv3d= CTX_wm_region_view3d(C);
+               if(rv3d) {
+                       if (rv3d->is_persp == FALSE) {
+                               CTX_wm_operator_poll_msg_set(C, "Only valid for a perspective camera view");
+                       }
+                       else if (!rv3d->viewlock) {
+                               return 1;
+                       }
+               }
+       }
+
+       return 0;
+}
+
 void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
 {
        /* identifiers */
@@ -465,7 +458,7 @@ void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec= view3d_camera_to_view_selected_exec;
-       // ot->poll= view3d_setcameratoview_poll;
+       ot->poll= view3d_camera_to_view_selected_poll;
 
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -983,202 +976,31 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2])
 /* copies logic of get_view3d_viewplane(), keep in sync */
 int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend)
 {
-       int orth= 0;
+       CameraParams params;
 
-       *clipsta= v3d->near;
-       *clipend= v3d->far;
+       camera_params_init(&params);
+       camera_params_from_view3d(&params, v3d, rv3d);
 
-       if(rv3d->persp==RV3D_CAMOB) {
-               if(v3d->camera) {
-                       if(v3d->camera->type==OB_LAMP ) {
-                               Lamp *la= v3d->camera->data;
-                               *clipsta= la->clipsta;
-                               *clipend= la->clipend;
-                       }
-                       else if(v3d->camera->type==OB_CAMERA) {
-                               Camera *cam= v3d->camera->data;
-                               *clipsta= cam->clipsta;
-                               *clipend= cam->clipend;
-
-                               if(cam->type==CAM_ORTHO)
-                                       orth= 1;
-                       }
-               }
-       }
-
-       if(rv3d->persp==RV3D_ORTHO) {
-               *clipend *= 0.5f;       // otherwise too extreme low zbuffer quality
-               *clipsta= - *clipend;
-               orth= 1;
-       }
+       if(clipsta) *clipsta= params.clipsta;
+       if(clipend) *clipend= params.clipend;
 
-       return orth;
+       return params.is_ortho;
 }
 
 /* also exposed in previewrender.c */
-int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize)
+int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy, rctf *viewplane, float *clipsta, float *clipend)
 {
-       Camera *cam=NULL;
-       float lens, sensor_x =DEFAULT_SENSOR_WIDTH, sensor_y= DEFAULT_SENSOR_HEIGHT, fac, x1, y1, x2, y2;
-       float winx= (float)winxi, winy= (float)winyi;
-       int orth= 0;
-       short sensor_fit= CAMERA_SENSOR_FIT_AUTO;
-
-       /* currnetly using sensor size (depends on fov calculating method) */
-       float sensor= DEFAULT_SENSOR_WIDTH;
-
-       lens= v3d->lens;        
-       
-       *clipsta= v3d->near;
-       *clipend= v3d->far;
-       
-       if(rv3d->persp==RV3D_CAMOB) {
-               if(v3d->camera) {
-                       if(v3d->camera->type==OB_LAMP ) {
-                               Lamp *la;
-                               
-                               la= v3d->camera->data;
-                               fac= cosf(((float)M_PI)*la->spotsize/360.0f);
-                               
-                               x1= saacos(fac);
-                               lens= 16.0f*fac/sinf(x1);
-                               
-                               *clipsta= la->clipsta;
-                               *clipend= la->clipend;
-                       }
-                       else if(v3d->camera->type==OB_CAMERA) {
-                               cam= v3d->camera->data;
-                               lens= cam->lens;
-                               sensor_x= cam->sensor_x;
-                               sensor_y= cam->sensor_y;
-                               *clipsta= cam->clipsta;
-                               *clipend= cam->clipend;
-                               sensor_fit= cam->sensor_fit;
-
-                               sensor= (cam->sensor_fit==CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : (cam->sensor_x);
-                       }
-               }
-       }
-       
-       if(rv3d->persp==RV3D_ORTHO) {
-               if(winx>winy) x1= -rv3d->dist;
-               else x1= -winx*rv3d->dist/winy;
-               x2= -x1;
-               
-               if(winx>winy) y1= -winy*rv3d->dist/winx;
-               else y1= -rv3d->dist;
-               y2= -y1;
-               
-               *clipend *= 0.5f;       // otherwise too extreme low zbuffer quality
-               *clipsta= - *clipend;
-               orth= 1;
-       }
-       else {
-               /* fac for zoom, also used for camdx */
-               if(rv3d->persp==RV3D_CAMOB) {
-                       fac= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom) * 4.0f;
-               }
-               else {
-                       fac= 2.0;
-               }
-               
-               /* viewplane size depends... */
-               if(cam && cam->type==CAM_ORTHO) {
-                       /* ortho_scale == 1 means exact 1 to 1 mapping */
-                       float dfac= 2.0f*cam->ortho_scale/fac;
-
-                       if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
-                               if(winx>winy) {
-                                       x1= -dfac;
-                                       y1= -winy*dfac/winx;
-                               }
-                               else {
-                                       x1= -winx*dfac/winy;
-                                       y1= -dfac;
-                               }
-                       }
-                       else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
-                               x1= -dfac;
-                               y1= -winy*dfac/winx;
-                       }
-                       else {
-                               x1= -winx*dfac/winy;
-                               y1= -dfac;
-                       }
-
-                       x2= -x1;
-                       y2= -y1;
-
-                       orth= 1;
-               }
-               else {
-                       float dfac;
-                       
-                       if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
-                               if(winx>winy) dfac= (sensor_x * 2.0f) / (fac*winx*lens);
-                               else dfac= (sensor_x * 2.0f) / (fac*winy*lens);
-                       }
-                       else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
-                               dfac= (sensor_x * 2.0f) / (fac*winx*lens);
-                       }
-                       else {
-                               dfac= (sensor_y * 2.0f) / (fac*winy*lens);
-                       }
-                       
-                       x1= - *clipsta * winx*dfac;
-                       x2= -x1;
-                       y1= - *clipsta * winy*dfac;
-                       y2= -y1;
-                       orth= 0;
-               }
-               /* cam view offset */
-               if(cam) {
-                       float dx= 0.5f*fac*rv3d->camdx*(x2-x1);
-                       float dy= 0.5f*fac*rv3d->camdy*(y2-y1);
-
-                       /* shift offset */              
-                       if(cam->type==CAM_ORTHO) {
-                               dx += cam->shiftx * cam->ortho_scale;
-                               dy += cam->shifty * cam->ortho_scale;
-                       }
-                       else {
-                               dx += cam->shiftx * (cam->clipsta / cam->lens) * sensor;
-                               dy += cam->shifty * (cam->clipsta / cam->lens) * sensor;
-                       }
+       CameraParams params;
 
-                       x1+= dx;
-                       x2+= dx;
-                       y1+= dy;
-                       y2+= dy;
-               }
-       }
-       
-       if(pixsize) {
-               float viewfac;
-               
-               if(orth) {
-                       viewfac= (winx >= winy)? winx: winy;
-                       *pixsize= 1.0f/viewfac;
-               }
-               else {
-                       float size= ((winx >= winy)? winx: winy);
-
-                       if(sensor_fit==CAMERA_SENSOR_FIT_HOR)
-                               size= winx;
-                       else if(sensor_fit==CAMERA_SENSOR_FIT_VERT)
-                               size= winy;
+       camera_params_init(&params);
+       camera_params_from_view3d(&params, v3d, rv3d);
+       camera_params_compute_viewplane(&params, winx, winy, 1.0f, 1.0f);
 
-                       viewfac= (size*lens)/sensor;
-                       *pixsize= *clipsta/viewfac;
-               }
-       }
-       
-       viewplane->xmin= x1;
-       viewplane->ymin= y1;
-       viewplane->xmax= x2;
-       viewplane->ymax= y2;
+       if(viewplane) *viewplane= params.viewplane;
+       if(clipsta) *clipsta= params.clipsta;
+       if(clipend) *clipend= params.clipend;
        
-       return orth;
+       return params.is_ortho;
 }
 
 void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect)          /* rect: for picking */
@@ -1188,7 +1010,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect)             /* rect: for pick
        float clipsta, clipend, x1, y1, x2, y2;
        int orth;
        
-       orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL);
+       orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend);
        rv3d->is_persp= !orth;
 
        //      printf("%d %d %f %f %f %f %f %f\n", winx, winy, viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax, clipsta, clipend);
index cf8defe39684a46486960e8b989794b29aeb9648..e108262758a563d932f68245587155caf4ab56aa 100644 (file)
@@ -96,9 +96,9 @@ static void setSnappingCallback(TransInfo *t);
 
 static void ApplySnapTranslation(TransInfo *t, float vec[3]);
 static void ApplySnapRotation(TransInfo *t, float *vec);
-static void ApplySnapResize(TransInfo *t, float *vec);
+static void ApplySnapResize(TransInfo *t, float vec[2]);
 
-static void CalcSnapGrid(TransInfo *t, float *vec);
+/* static void CalcSnapGrid(TransInfo *t, float *vec); */
 static void CalcSnapGeometry(TransInfo *t, float *vec);
 
 static void TargetSnapMedian(TransInfo *t);
@@ -703,7 +703,7 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
 
 /********************** CALC **************************/
 
-static void CalcSnapGrid(TransInfo *t, float *UNUSED(vec))
+static void UNUSED_FUNCTION(CalcSnapGrid)(TransInfo *t, float *UNUSED(vec))
 {
        snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS);
 }
@@ -1037,7 +1037,7 @@ static void TargetSnapClosest(TransInfo *t)
 }
 /*================================================================*/
 #ifndef USE_BVH_FACE_SNAP
-static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4co, float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth)
+static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], float *v4co, float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float loc[3], float no[3], int *dist, float *depth)
 {
        float lambda;
        int result;
@@ -1089,7 +1089,9 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl
 }
 #endif
 
-static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth)
+static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], short v2no[3], float obmat[][4], float timat[][3],
+                    const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2],
+                    float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
 {
        float intersect[3] = {0, 0, 0}, ray_end[3], dvec[3];
        int result;
@@ -1143,11 +1145,11 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
                         * this takes care of series of connected edges a bit slanted w.r.t the viewport
                         * otherwise, it would stick to the verts of the closest edge and not slide along merrily 
                         * */
-                       if (new_dist <= *dist && new_depth < *depth * 1.001f)
+                       if (new_dist <= *r_dist && new_depth < *r_depth * 1.001f)
                        {
                                float n1[3], n2[3];
                                
-                               *depth = new_depth;
+                               *r_depth = new_depth;
                                retval = 1;
                                
                                sub_v3_v3v3(edge_loc, v1co, v2co);
@@ -1155,18 +1157,18 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
                                
                                mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc);
                                
-                               if (no)
+                               if (r_no)
                                {
                                        normal_short_to_float_v3(n1, v1no);                                             
                                        normal_short_to_float_v3(n2, v2no);
-                                       interp_v3_v3v3(no, n2, n1, mul);
-                                       mul_m3_v3(timat, no);
-                                       normalize_v3(no);
+                                       interp_v3_v3v3(r_no, n2, n1, mul);
+                                       mul_m3_v3(timat, r_no);
+                                       normalize_v3(r_no);
                                }                       
 
-                               copy_v3_v3(loc, location);
+                               copy_v3_v3(r_loc, location);
                                
-                               *dist = new_dist;
+                               *r_dist = new_dist;
                        } 
                }
        }
@@ -1174,7 +1176,9 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
        return retval;
 }
 
-static int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray_start[3], float ray_start_local[3], float ray_normal_local[3], float obmat[][4], float timat[][3], float *loc, float *no, int *dist, float *depth)
+static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4], float timat[][3],
+                      const float ray_start[3], const float ray_start_local[3], const float ray_normal_local[3], const float mval[2],
+                      float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
 {
        int retval = 0;
        float dvec[3];
@@ -1192,33 +1196,35 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], fl
                
                mul_m4_v3(obmat, location);
                
-               new_depth = len_v3v3(location, ray_start);                                      
+               new_depth = len_v3v3(location, ray_start);
                
                project_int(ar, location, screen_loc);
                new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
                
-               if (new_dist <= *dist && new_depth < *depth)
+               if (new_dist <= *r_dist && new_depth < *r_depth)
                {
-                       *depth = new_depth;
+                       *r_depth = new_depth;
                        retval = 1;
                        
-                       copy_v3_v3(loc, location);
+                       copy_v3_v3(r_loc, location);
                        
-                       if (no)
+                       if (r_no)
                        {
-                               normal_short_to_float_v3(no, vno);
-                               mul_m3_v3(timat, no);
-                               normalize_v3(no);
+                               normal_short_to_float_v3(r_no, vno);
+                               mul_m3_v3(timat, r_no);
+                               normalize_v3(r_no);
                        }
 
-                       *dist = new_dist;
+                       *r_dist = new_dist;
                } 
        }
        
        return retval;
 }
 
-static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *UNUSED(no), int *dist, float *depth)
+static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4],
+                        const float ray_start[3], const float ray_normal[3], const float mval[2],
+                        float r_loc[3], float *UNUSED(r_no), int *r_dist, float *r_depth)
 {
        float imat[4][4];
        float ray_start_local[3], ray_normal_local[3];
@@ -1243,11 +1249,11 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
                                        switch (snap_mode)
                                        {
                                                case SCE_SNAP_MODE_VERTEX:
-                                                       retval |= snapVertex(ar, eBone->head, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
-                                                       retval |= snapVertex(ar, eBone->tail, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+                                                       retval |= snapVertex(ar, eBone->head, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
+                                                       retval |= snapVertex(ar, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
                                                        break;
                                                case SCE_SNAP_MODE_EDGE:
-                                                       retval |= snapEdge(ar, eBone->head, NULL, eBone->tail, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+                                                       retval |= snapEdge(ar, eBone->head, NULL, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
                                                        break;
                                        }
                                }
@@ -1269,11 +1275,11 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
                                switch (snap_mode)
                                {
                                        case SCE_SNAP_MODE_VERTEX:
-                                               retval |= snapVertex(ar, head_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
-                                               retval |= snapVertex(ar, tail_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+                                               retval |= snapVertex(ar, head_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
+                                               retval |= snapVertex(ar, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
                                                break;
                                        case SCE_SNAP_MODE_EDGE:
-                                               retval |= snapEdge(ar, head_vec, NULL, tail_vec, NULL, mval, ray_start, ray_start_local, ray_normal_local, obmat, NULL, loc, NULL, dist, depth);
+                                               retval |= snapEdge(ar, head_vec, NULL, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
                                                break;
                                }
                        }
@@ -1283,10 +1289,9 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
        return retval;
 }
 
-static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, 
-                                                  DerivedMesh *dm, BMEditMesh *em, float obmat[][4], 
-                                                  float ray_start[3], float ray_normal[3], float mval[2],
-                                                  float *loc, float *no, int *dist, float *depth)
+static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, BMEditMesh *em, float obmat[][4],
+                           const float ray_start[3], const float ray_normal[3], const float mval[2],
+                           float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
 {
        int retval = 0;
        int totvert = dm->getNumVerts(dm);
@@ -1335,21 +1340,21 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob,
                                        bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6);
 
                                        hit.index = -1;
-                                       hit.dist = *depth * (*depth == FLT_MAX ? 1.0f : local_scale);
+                                       hit.dist = *r_depth * (*r_depth == FLT_MAX ? 1.0f : local_scale);
 
                                        if(treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1)
                                        {
-                                               if(hit.dist/local_scale <= *depth) {
-                                                       *depth= hit.dist/local_scale;
-                                                       copy_v3_v3(loc, hit.co);
-                                                       copy_v3_v3(no, hit.no);
+                                               if(hit.dist/local_scale <= *r_depth) {
+                                                       *r_depth= hit.dist/local_scale;
+                                                       copy_v3_v3(r_loc, hit.co);
+                                                       copy_v3_v3(r_no, hit.no);
 
                                                        /* back to worldspace */
-                                                       mul_m4_v3(obmat, loc);
-                                                       copy_v3_v3(no, hit.no);
+                                                       mul_m4_v3(obmat, r_loc);
+                                                       copy_v3_v3(r_no, hit.no);
 
-                                                       mul_m3_v3(timat, no);
-                                                       normalize_v3(no);
+                                                       mul_m3_v3(timat, r_no);
+                                                       normalize_v3(r_no);
 
                                                        retval |= 1;
                                                }
@@ -1488,7 +1493,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob,
                                                
                                                if (test)
                                                {
-                                                       retval |= snapVertex(ar, v->co, v->no, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth);
+                                                       retval |= snapVertex(ar, v->co, v->no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth);
                                                }
                                        }
 
@@ -1550,7 +1555,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob,
                                                
                                                if (test)
                                                {
-                                                       retval |= snapEdge(ar, verts[e->v1].co, verts[e->v1].no, verts[e->v2].co, verts[e->v2].no, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth);
+                                                       retval |= snapEdge(ar, verts[e->v1].co, verts[e->v1].no, verts[e->v2].co, verts[e->v2].no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth);
                                                }
                                        }
 
@@ -1567,7 +1572,9 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob,
        return retval;
 } 
 
-static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *no, int *dist, float *depth)
+static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obmat[][4],
+                      const float ray_start[3], const float ray_normal[3], const float mval[2],
+                      float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
 {
        ToolSettings *ts= scene->toolsettings;
        int retval = 0;
@@ -1588,19 +1595,20 @@ static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, flo
                        dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
                }
                
-               retval = snapDerivedMesh(ts->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
+               retval = snapDerivedMesh(ts->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, r_depth);
 
                dm->release(dm);
        }
        else if (ob->type == OB_ARMATURE)
        {
-               retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, loc, no, dist, depth);
+               retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, r_depth);
        }
        
        return retval;
 }
 
-static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mval[2], int *dist, float *loc, float *no, SnapMode mode)
+static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, const float mval[2],
+                       int *r_dist, float r_loc[3], float r_no[3], SnapMode mode)
 {
        Base *base;
        float depth = FLT_MAX;
@@ -1613,7 +1621,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f
        {
                Object *ob = obedit;
 
-               retval |= snapObject(scene, ar, ob, 1, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth);
+               retval |= snapObject(scene, ar, ob, 1, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
        }
 
        /* Need an exception for particle edit because the base is flagged with BA_HAS_RECALC_DATA
@@ -1625,7 +1633,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f
        if(base && base->object && base->object->mode & OB_MODE_PARTICLE_EDIT)
        {
                Object *ob = base->object;
-               retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth);
+               retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
        }
 
        for ( base = FIRSTBASE; base != NULL; base = base->next ) {
@@ -1641,30 +1649,30 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f
                                {
                                        Object *dob = dupli_ob->ob;
                                        
-                                       retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, loc, no, dist, &depth);
+                                       retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
                                }
                                
                                free_object_duplilist(lb);
                        }
                        
-                       retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth);
+                       retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
                }
        }
        
        return retval;
 }
 
-int snapObjectsTransform(TransInfo *t, float mval[2], int *dist, float *loc, float *no, SnapMode mode)
+int snapObjectsTransform(TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode)
 {
-       return snapObjects(t->scene, t->view, t->ar, t->obedit, mval, dist, loc, no, mode);
+       return snapObjects(t->scene, t->view, t->ar, t->obedit, mval, r_dist, r_loc, r_no, mode);
 }
 
-int snapObjectsContext(bContext *C, float mval[2], int *dist, float *loc, float *no, SnapMode mode)
+int snapObjectsContext(bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode)
 {
        ScrArea *sa = CTX_wm_area(C);
        View3D *v3d = sa->spacedata.first;
 
-       return snapObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), mval, dist, loc, no, mode);
+       return snapObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), mval, r_dist, r_loc, r_no, mode);
 }
 
 /******************** PEELING *********************************/
@@ -1724,7 +1732,9 @@ static void addDepthPeel(ListBase *depth_peels, float depth, float p[3], float n
        peel->flag = 0;
 }
 
-static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float UNUSED(mval[2]), ListBase *depth_peels)
+static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
+                           const float ray_start[3], const float ray_normal[3], const float UNUSED(mval[2]),
+                           ListBase *depth_peels)
 {
        int retval = 0;
        int totvert = dm->getNumVerts(dm);
@@ -1832,7 +1842,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float
        return retval;
 } 
 
-static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, float mval[2])
+static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, const float mval[2])
 {
        Base *base;
        int retval = 0;
@@ -1915,12 +1925,12 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
        return retval;
 }
 
-int peelObjectsTransForm(TransInfo *t, ListBase *depth_peels, float mval[2])
+int peelObjectsTransForm(TransInfo *t, ListBase *depth_peels, const float mval[2])
 {
        return peelObjects(t->scene, t->view, t->ar, t->obedit, depth_peels, mval);
 }
 
-int peelObjectsContext(bContext *C, ListBase *depth_peels, float mval[2])
+int peelObjectsContext(bContext *C, ListBase *depth_peels, const float mval[2])
 {
        ScrArea *sa = CTX_wm_area(C);
        View3D *v3d = sa->spacedata.first;
index 3c32332cd8d28417920a3a50f80c435b6494f969..db27c1cee6363d561667f1f1912bf9973d597d0f 100644 (file)
@@ -895,7 +895,7 @@ static int ffmpeg_seek_by_byte(AVFormatContext *pFormatCtx)
 
 static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
                                IMB_Timecode_Type tc) {
-       unsigned long long pts_to_search = 0;
+       int64_t pts_to_search = 0;
        double frame_rate;
        double pts_time_base;
        long long st_time; 
index 92c32470057d7ead33350c5802ca9b1390613417..a25ed938c0f3dc46f26150e319e6e1caa0ec03a3 100644 (file)
@@ -112,9 +112,8 @@ typedef struct uiStyle {
        short buttonspacex;
        short buttonspacey;
        short panelspace;
-       short panelouter;
 
-       short pad[1];
+       short pad[2];
 } uiStyle;
 
 typedef struct uiWidgetColors {
@@ -139,6 +138,12 @@ typedef struct uiWidgetStateColors {
        float blend, pad;
 } uiWidgetStateColors;
 
+typedef struct uiPanelColors {
+       char header[4];
+       short show_header;
+       short pad;
+} uiPanelColors;
+
 typedef struct ThemeUI {
        
        /* Interface Elements (buttons, menus, icons) */
@@ -149,9 +154,13 @@ typedef struct ThemeUI {
        uiWidgetColors wcol_box, wcol_scroll, wcol_progress, wcol_list_item;
        
        uiWidgetStateColors wcol_state;
-       
+
+       uiPanelColors panel;
+
        char iconfile[80];      // FILE_MAXFILE length
-       
+       float icon_alpha;
+
+       float pad;
 } ThemeUI;
 
 /* try to put them all in one, if needed a special struct can be created as well
index b941e9ebed72dae7dce027e83e36801367094127..392aa6a7f5a396d9c14720b5b58189f5c277e3cc 100644 (file)
@@ -626,7 +626,7 @@ static void rna_def_action_actuator(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
        RNA_def_property_range(prop, 0, 100);
-       RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers. With 2 or more actions at once, the overriding channels must be lower in the stack");
+       RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers (with 2 or more actions at once, the overriding channels must be lower in the stack)");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "layer", PROP_INT, PROP_NONE);
index 1e7a969caaa3a07b02130baef013ed4c5b7f0b5b..6f6a4baec9245d9d78e459c49073bbc7186bc6ee 100644 (file)
 
 #ifdef RNA_RUNTIME
 
+#include "BKE_camera.h"
 #include "BKE_object.h"
 #include "BKE_depsgraph.h"
 
-/* only for rad/deg conversion! can remove later */
-static float get_camera_sensor(Camera *cam)
-{
-       if(cam->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
-               return cam->sensor_x;
-       }
-       else if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) {
-               return cam->sensor_x;
-       }
-       else {
-               return cam->sensor_y;
-       }
-}
-
 static float rna_Camera_angle_get(PointerRNA *ptr)
 {
        Camera *cam= ptr->id.data;
-       float sensor= get_camera_sensor(cam);
+       float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
        return focallength_to_fov(cam->lens, sensor);
 }
 
 static void rna_Camera_angle_set(PointerRNA *ptr, float value)
 {
        Camera *cam= ptr->id.data;
-       float sensor= get_camera_sensor(cam);
+       float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
        cam->lens= fov_to_focallength(value, sensor);
 }
 
@@ -126,9 +113,9 @@ void RNA_def_camera(BlenderRNA *brna)
                {CAM_ANGLETOGGLE, "DEGREES", 0, "Degrees", ""},
                {0, NULL, 0, NULL, NULL}};
        static EnumPropertyItem sensor_fit_items[] = {
-               {CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Calculate field of view using sensor size, with direction depending on image resolution"},
-               {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Calculate field of view using sensor width"},
-               {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Calculate field of view using sensor height"},
+               {CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Fit to the sensor width or height depending on image resolution"},
+               {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Fit to the sensor width"},
+               {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Fit to the sensor height"},
                {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "Camera", "ID");
@@ -151,7 +138,7 @@ void RNA_def_camera(BlenderRNA *brna)
        prop= RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "sensor_fit");
        RNA_def_property_enum_items(prop, sensor_fit_items);
-       RNA_def_property_ui_text(prop, "Sensor Fit", "Mode of calculating field of view from sensor dimensions and focal length");
+       RNA_def_property_ui_text(prop, "Sensor Fit", "Method to fit image and field of view angle inside the sensor");
        RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
        /* Number values */
index 0cd36eb37559dbac4de4f20c2c9005dd32c8516d..4ab14550fd1a5ff2aebe00727b03c308945ba9c9 100644 (file)
@@ -367,7 +367,7 @@ static void rna_def_constraint_childof(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "ChildOfConstraint", "Constraint"); 
-       RNA_def_struct_ui_text(srna, "Child Of Constraint", "Creates constraint-based parent-child relationship"); 
+       RNA_def_struct_ui_text(srna, "Child Of Constraint", "Create constraint-based parent-child relationship"); 
        RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data"); 
 
        prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -440,7 +440,7 @@ static void rna_def_constraint_python(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "PythonConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Python Constraint", "Uses Python script for constraint evaluation");
+       RNA_def_struct_ui_text(srna, "Python Constraint", "Use Python script for constraint evaluation");
        RNA_def_struct_sdna_from(srna, "bPythonConstraint", "data");
 
        prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
@@ -641,7 +641,7 @@ static void rna_def_constraint_track_to(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "TrackToConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Track To Constraint", "Aims the constrained object toward the target");
+       RNA_def_struct_ui_text(srna, "Track To Constraint", "Aim the constrained object toward the target");
 
        prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
        RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -685,7 +685,7 @@ static void rna_def_constraint_locate_like(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copies the location of the target");
+       RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target");
 
        prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
        RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -748,7 +748,7 @@ static void rna_def_constraint_rotate_like(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copies the rotation of the target");
+       RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target");
        RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
 
        prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -804,7 +804,7 @@ static void rna_def_constraint_size_like(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copies the scale of the target");
+       RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target");
        RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
 
        prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -852,7 +852,7 @@ static void rna_def_constraint_same_volume(BlenderRNA *brna)
        {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintains a constant volume along a single scaling axis");
+       RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintain a constant volume along a single scaling axis");
        RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
 
        prop= RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
@@ -874,7 +874,7 @@ static void rna_def_constraint_transform_like(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copies all the transforms of the target");
+       RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copy all the transforms of the target");
        
        prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
        RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -910,7 +910,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "FloorConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Floor Constraint", "Uses the target object for location limitation");
+       RNA_def_struct_ui_text(srna, "Floor Constraint", "Use the target object for location limitation");
        RNA_def_struct_sdna_from(srna, "bMinMaxConstraint","data");
 
        prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -1038,7 +1038,7 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Points toward the target along the track axis, while locking the other axis");
+       RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Point toward the target along the track axis, while locking the other axis");
        
        prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
        RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -1092,7 +1092,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Locks motion to the target path");
+       RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path");
        RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
 
        prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -1137,7 +1137,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_RADIUS);
-       RNA_def_property_ui_text(prop, "Curve Radius", "Objects scale by the curve radius");
+       RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 }
 
@@ -1159,7 +1159,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "StretchToConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretches to meet the target object");
+       RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object");
 
        prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
        RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -1209,9 +1209,9 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
        PropertyRNA *prop;
 
        static EnumPropertyItem pivot_items[] = {
-               {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allows rotations around all axes"},
-               {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Works in one plane, allows rotations around one axis only"},
-               {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allows rotations around all axes with limits for the cone and twist axes"},
+               {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allow rotations around all axes"},
+               {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Work in one plane, allow rotations around one axis only"},
+               {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allow rotations around all axes with limits for the cone and twist axes"},
                {CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF", "No constraints by default, limits can be set individually"},
                {0, NULL, 0, NULL, NULL}};
 
@@ -1343,7 +1343,7 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
        /* Limit Booleans */
        prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
-       RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum x limit");
+       RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum X limit");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
        
        prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
@@ -1358,17 +1358,17 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 8);
-       RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum x angular limit");
+       RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum X angular limit");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
        
        prop= RNA_def_property(srna, "use_angular_limit_y", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 16);
-       RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum y angular limit");
+       RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum Y angular limit");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
        
        prop= RNA_def_property(srna, "use_angular_limit_z", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 32);
-       RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum z angular limit");
+       RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum Z angular limit");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 }
 
@@ -1403,7 +1403,7 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag2", CLAMPTO_CYCLIC);
-       RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box");
+       RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 }
 
@@ -1553,7 +1553,7 @@ static void rna_def_constraint_location_limit(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limits the location of the constrained object");
+       RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limit the location of the constrained object");
        RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
 
        prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
@@ -1634,7 +1634,7 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limits the rotation of the constrained object");
+       RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object");
        RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
 
        prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
@@ -1700,7 +1700,7 @@ static void rna_def_constraint_size_limit(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limits the scaling of the constrained object");
+       RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limit the scaling of the constrained object");
        RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
 
        prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
@@ -1781,7 +1781,7 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limits the distance from target object");
+       RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limit the distance from target object");
        
        prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
        RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -1825,13 +1825,13 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
        PropertyRNA *prop;
        
        static EnumPropertyItem type_items[] = {
-               {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrinks the location to the nearest target surface"},
-               {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrinks the location to the nearest target surface along a given axis"},
-               {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrinks the location to the nearest target vertex"},
+               {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrink the location to the nearest target surface"},
+               {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrink the location to the nearest target surface along a given axis"},
+               {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrink the location to the nearest target vertex"},
                {0, NULL, 0, NULL, NULL}};
        
        srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint"); 
-       RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Creates constraint-based shrinkwrap relationship"); 
+       RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship"); 
        RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
        
        prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -1844,7 +1844,7 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
        prop= RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
        RNA_def_property_enum_items(prop, type_items);
-       RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Selects type of shrinkwrap algorithm for target position");
+       RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position");
        RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
        
        prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
@@ -1884,7 +1884,7 @@ static void rna_def_constraint_damped_track(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Damped Track Constraint", "Points toward target by taking the shortest rotation path");
+       RNA_def_struct_ui_text(srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path");
        
        prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
        RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
@@ -2039,7 +2039,7 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Locks motion to the target motion track");
+       RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Lock motion to the target motion track");
        RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
 
        /* movie clip */
@@ -2074,7 +2074,7 @@ static void rna_def_constraint_camera_solver(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
-       RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Locks motion to the reconstructed camera movenment");
+       RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Lock motion to the reconstructed camera movement");
        RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
 
        /* movie clip */
index 89239c10ffd4fdab109dc71cd4af4a5485770403..5278c1e3532021f4cea5782418d3a8712530a4ac 100644 (file)
@@ -258,7 +258,7 @@ void RNA_def_controller(BlenderRNA *brna)
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
-       RNA_def_property_ui_text(prop, "Module", "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
+       RNA_def_property_ui_text(prop, "Module", "Module name and function to run, e.g. \"someModule.main\" (internal texts and external python files can be used)");
        RNA_def_property_update(prop, NC_LOGIC, NULL);
 
        prop= RNA_def_property(srna, "use_debug", PROP_BOOLEAN, PROP_NONE);
index afe11656aeef0eb77853c01d8d1fa6a1da39d255..ee3193b54299d7f7b4a867c725b4cc7f7bea823c 100644 (file)
@@ -1125,8 +1125,8 @@ static void rna_def_transform_orientation(BlenderRNA *brna)
        RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
        
        prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
-       RNA_def_property_string_sdna(prop, NULL, "name");
        RNA_def_struct_name_property(srna, prop);
+       RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
        RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 }
 
index 8fb232332d5abd9c177eaba8ff4a49798d85637a..a33622cf8a111f6628acbb66e2d5e38a569193ca 100644 (file)
@@ -891,15 +891,26 @@ static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
        bgpic->blend = 1.0f - value;
 }
 
-static BGpic *rna_BackgroundImage_add(View3D *v3d)
+static BGpic *rna_BackgroundImage_new(View3D *v3d)
 {
-       BGpic *bgpic= ED_view3D_background_image_add(v3d);;
+       BGpic *bgpic= ED_view3D_background_image_new(v3d);
 
-       WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL);
+       WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, v3d);
 
        return bgpic;
 }
 
+static void rna_BackgroundImage_remove(View3D *v3d, ReportList *reports, BGpic *bgpic)
+{
+       if (BLI_findindex(&v3d->bgpicbase, bgpic) == -1) {
+               BKE_report(reports, RPT_ERROR, "BackgroundImage can't be removed");
+       }
+       else {
+               ED_view3D_background_image_remove(v3d, bgpic);
+               WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, v3d);
+       }
+}
+
 /* Space Node Editor */
 
 static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, PointerRNA value)
@@ -1307,11 +1318,16 @@ static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_struct_sdna(srna, "View3D");
        RNA_def_struct_ui_text(srna, "Background Images", "Collection of background images");
 
-       func= RNA_def_function(srna, "add", "rna_BackgroundImage_add");
+       func= RNA_def_function(srna, "new", "rna_BackgroundImage_new");
        RNA_def_function_ui_description(func, "Add new background image");
-
        parm= RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
        RNA_def_function_return(func, parm);
+
+       func= RNA_def_function(srna, "remove", "rna_BackgroundImage_remove");
+       RNA_def_function_ui_description(func, "Remove background image");
+       RNA_def_function_flag(func, FUNC_USE_REPORTS);
+       parm= RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
+       RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
 static void rna_def_space_view3d(BlenderRNA *brna)
index 73b2914fba1b52650f94c5300697c31f88d1c221..269860e1d7ed162352ac351f5331fe8f0f6edfc6 100644 (file)
@@ -451,9 +451,9 @@ static void rna_def_trackingMarker(BlenderRNA *brna)
        RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
 
        /* enable */
-       prop= RNA_def_property(srna, "enable", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MARKER_DISABLED);
-       RNA_def_property_ui_text(prop, "Enable", "Is marker enabled for current frame");
+       prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", MARKER_DISABLED);
+       RNA_def_property_ui_text(prop, "Mode", "Is marker muted for current frame");
        RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
 }
 
index 329a8b70d85684d55ee631639f841e2d3c2e02e3..34ee95c296203b388ad57a18a1f0209cd8b28ad7 100644 (file)
@@ -506,6 +506,25 @@ static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna)
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 }
 
+static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+       
+       srna= RNA_def_struct(brna, "ThemePanelColors", NULL);
+       RNA_def_struct_sdna(srna, "uiPanelColors");
+       RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+       RNA_def_struct_ui_text(srna, "Theme Panel Color", "Theme settings for panel colors");
+               
+       prop= RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_ui_text(prop, "Header", "");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+       prop= RNA_def_property(srna, "show_header", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_ui_text(prop, "Show Header", "");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+}
+
 static void rna_def_userdef_theme_ui(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -513,6 +532,7 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
 
        rna_def_userdef_theme_ui_wcol(brna);
        rna_def_userdef_theme_ui_wcol_state(brna);
+       rna_def_userdef_theme_ui_panel(brna);
        
        srna= RNA_def_struct(brna, "ThemeUserInterface", NULL);
        RNA_def_struct_sdna(srna, "ThemeUI");
@@ -521,127 +541,102 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "wcol_regular", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_regular");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Regular Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_tool", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_tool");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Tool Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_radio");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Radio Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_text", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_text");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Text Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_option", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_option");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Option Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
        prop= RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_toggle");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Toggle Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_num");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Number Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_numslider", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_numslider");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Slider Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_box");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Box Backdrop Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Menu Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_pulldown", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_pulldown");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Pulldown Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_menu_back", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu_back");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Menu Backdrop Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_menu_item");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Menu Item Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
        prop= RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_scroll");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Scroll Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "wcol_progress", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_progress");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "Progress Bar Widget Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
        prop= RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_list_item");
-       RNA_def_property_struct_type(prop, "ThemeWidgetColors");
        RNA_def_property_ui_text(prop, "List Item Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
 
        prop= RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "wcol_state");
-       RNA_def_property_struct_type(prop, "ThemeWidgetStateColors");
        RNA_def_property_ui_text(prop, "State Colors", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+       prop= RNA_def_property(srna, "panel", PROP_POINTER, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_NEVER_NULL);
+       RNA_def_property_ui_text(prop, "Panel Colors", "");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
        
        prop= RNA_def_property(srna, "icon_file", PROP_STRING, PROP_FILEPATH);
        RNA_def_property_string_sdna(prop, NULL, "iconfile");
        RNA_def_property_ui_text(prop, "Icon File", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+       prop= RNA_def_property(srna, "icon_alpha", PROP_FLOAT, PROP_FACTOR);
+       RNA_def_property_ui_text(prop, "Icon Alpha", "Transparency of icons in the interface, to reduce contrast");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
 }
 
 static void rna_def_userdef_theme_spaces_main(StructRNA *srna, int spacetype)
index 201747402152a3a25d5ef6f36f036f8a422e0be5..de43bdb8131c70cb5bbe2659bad2ff7e4e2b03dd 100644 (file)
@@ -46,6 +46,7 @@
 #include "BLI_utildefines.h"
 
 
+#include "BKE_camera.h"
 #include "BKE_DerivedMesh.h"
 
 #include "MOD_modifiertypes.h"
@@ -195,20 +196,12 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
                                free_uci= 1;
                        }
                        else {
-                               float sensor= (cam->sensor_fit == CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : cam->sensor_x;
+                               float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
+                               int sensor_fit= camera_sensor_fit(cam->sensor_fit, aspx, aspy);
                                float scale= (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale;
                                float xmax, xmin, ymax, ymin;
 
-                               if(cam->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
-                                       if(aspect > 1.0f) {
-                                               xmax = 0.5f * scale;
-                                               ymax = xmax / aspect;
-                                       } else {
-                                               ymax = 0.5f * scale;
-                                               xmax = ymax * aspect;
-                                       }
-                               }
-                               else if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+                               if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
                                        xmax = 0.5f * scale;
                                        ymax = xmax / aspect;
                                }
index 515d24dcc51823ea5b8f7290acd7447053e5a3a8..f1c2fb321d195a5fa672fe254c282863fa5817ce 100644 (file)
@@ -261,7 +261,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
        if (camob && camob->type==OB_CAMERA) {
                Camera* cam = (Camera*)camob->data;
                cam_lens = cam->lens;
-               cam_fdist = dof_camera(camob);
+               cam_fdist = object_camera_dof_distance(camob);
                if (cam_fdist==0.0f) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */
                cam_invfdist = 1.f/cam_fdist;
        }
index c84aab83b7e9a2701fa660d7ce80721b149b1df0..902e64eb7c15795855912f154646bff9859704d0 100644 (file)
@@ -291,7 +291,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
        amp = 1.f;
        out = (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f);
        if (hard)
-               out = (float)fabs(out);
+               out = fabsf(out);
        for (i = 1; i < oct; i++) {
                amp *= ampscale;
                x *= freqscale;
@@ -299,7 +299,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
                z *= freqscale;
                t = (float)(amp * (2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f));
                if (hard)
-                       t = (float)fabs(t);
+                       t = fabsf(t);
                out += t;
        }
        return out;
@@ -321,16 +321,16 @@ static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args)
 /* Turbulence Vector */
 
 static void vTurb(float x, float y, float z, int oct, int hard, int nb,
-                  float ampscale, float freqscale, float v[3])
+                  float ampscale, float freqscale, float v[3])
 {
        float amp, t[3];
        int i;
        amp = 1.f;
        noise_vector(x, y, z, nb, v);
        if (hard) {
-               v[0] = (float)fabs(v[0]);
-               v[1] = (float)fabs(v[1]);
-               v[2] = (float)fabs(v[2]);
+               v[0] = fabsf(v[0]);
+               v[1] = fabsf(v[1]);
+               v[2] = fabsf(v[2]);
        }
        for (i = 1; i < oct; i++) {
                amp *= ampscale;
@@ -339,9 +339,9 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb,
                z *= freqscale;
                noise_vector(x, y, z, nb, t);
                if (hard) {
-                       t[0] = (float)fabs(t[0]);
-                       t[1] = (float)fabs(t[1]);
-                       t[2] = (float)fabs(t[2]);
+                       t[0] = fabsf(t[0]);
+                       t[1] = fabsf(t[1]);
+                       t[2] = fabsf(t[2]);
                }
                v[0] += amp * t[0];
                v[1] += amp * t[1];
index c00df7db87e8e1b392bd1dcae4bb6d9f9b15262c..bcce7cbdfcc411cf3a0e4a50cc3e35512ec296bb 100644 (file)
@@ -188,6 +188,7 @@ void RE_SetDispRect (struct Render *re, rcti *disprect);
 /* set up the viewplane/perspective matrix, three choices */
 struct Object *RE_GetCamera(struct Render *re); /* return camera override if set */
 void RE_SetCamera(struct Render *re, struct Object *camera);
+void RE_SetEnvmapCamera(struct Render *re, struct Object *cam_ob, float viewscale, float clipsta, float clipend);
 void RE_SetWindow (struct Render *re, rctf *viewplane, float clipsta, float clipend);
 void RE_SetOrtho (struct Render *re, rctf *viewplane, float clipsta, float clipend);
 void RE_SetPixelSize(struct Render *re, float pixsize);
index 7cad8c36df4b43a12f909526d8bb4a0053f9009d..a931de047378765d1e73a41e719bfffb3603116c 100644 (file)
@@ -152,10 +152,7 @@ struct Render
        int partx, party;
        
        /* values for viewing */
-       float lens;
-       float sensor_x, sensor_y; /* image sensor size, same variable in camera */
        float ycor; /* (scene->xasp / scene->yasp), multiplied with 'winy' */
-       short sensor_fit;
        
        float panophi, panosi, panoco, panodxp, panodxv;
        
index 62cb29c3d5f474812c2bff7ad5b6e5b9d44554ba..3512ffa865b03ed94e8224e8469ed9262428e527 100644 (file)
@@ -131,6 +131,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
 static Render *envmap_render_copy(Render *re, EnvMap *env)
 {
        Render *envre;
+       float viewscale;
        int cuberes;
        
        envre= RE_NewRender("Envmap");
@@ -156,15 +157,8 @@ static Render *envmap_render_copy(Render *re, EnvMap *env)
        envre->lay= re->lay;
 
        /* view stuff in env render */
-       envre->lens= 16.0f;
-       envre->sensor_x= 32.0f;
-       if(env->type==ENV_PLANE)
-               envre->lens*= env->viewscale;
-       envre->ycor= 1.0f; 
-       envre->clipsta= env->clipsta;   /* render_scene_set_window() respects this for now */
-       envre->clipend= env->clipend;
-       
-       RE_SetCamera(envre, env->object);
+       viewscale= (env->type == ENV_PLANE)? env->viewscale: 1.0f;
+       RE_SetEnvmapCamera(envre, env->object, viewscale, env->clipsta, env->clipend);
        
        /* callbacks */
        envre->display_draw= re->display_draw;
index 7bd8dad65021d4fd4c6378dc0696180e7e52cdea..b7254cd1221b37eb33c93f701ad1d0c97d9bf271 100644 (file)
@@ -451,15 +451,64 @@ struct Object *RE_GetCamera(Render *re)
        return re->camera_override ? re->camera_override : re->scene->camera;
 }
 
+static void re_camera_params_get(Render *re, CameraParams *params, Object *cam_ob)
+{
+       copy_m4_m4(re->winmat, params->winmat);
+
+       re->clipsta= params->clipsta;
+       re->clipend= params->clipend;
+
+       re->ycor= params->ycor;
+       re->viewdx= params->viewdx;
+       re->viewdy= params->viewdy;
+       re->viewplane= params->viewplane;
+
+       object_camera_mode(&re->r, cam_ob);
+}
+
+void RE_SetEnvmapCamera(Render *re, Object *cam_ob, float viewscale, float clipsta, float clipend)
+{
+       CameraParams params;
+
+       /* setup parameters */
+       camera_params_init(&params);
+       camera_params_from_object(&params, cam_ob);
+
+       params.lens= 16.0f*viewscale;
+       params.sensor_x= 32.0f;
+       params.sensor_y= 32.0f;
+       params.sensor_fit = CAMERA_SENSOR_FIT_AUTO;
+       params.clipsta= clipsta;
+       params.clipend= clipend;
+       
+       /* compute matrix, viewplane, .. */
+       camera_params_compute_viewplane(&params, re->winx, re->winy, 1.0f, 1.0f);
+       camera_params_compute_matrix(&params);
+
+       /* extract results */
+       re_camera_params_get(re, &params, cam_ob);
+}
+
 /* call this after InitState() */
 /* per render, there's one persistent viewplane. Parts will set their own viewplanes */
-void RE_SetCamera(Render *re, Object *camera)
+void RE_SetCamera(Render *re, Object *cam_ob)
 {
-       object_camera_mode(&re->r, camera);
+       CameraParams params;
+
+       /* setup parameters */
+       camera_params_init(&params);
+       camera_params_from_object(&params, cam_ob);
+
+       params.use_fields= (re->r.mode & R_FIELDS);
+       params.field_second= (re->flag & R_SEC_FIELD);
+       params.field_odd= (re->r.mode & R_ODDFIELD);
+
+       /* compute matrix, viewplane, .. */
+       camera_params_compute_viewplane(&params, re->winx, re->winy, re->r.xasp, re->r.yasp);
+       camera_params_compute_matrix(&params);
 
-       object_camera_matrix(&re->r, camera, re->winx, re->winy, re->flag & R_SEC_FIELD,
-                       re->winmat, &re->viewplane, &re->clipsta, &re->clipend,
-                       &re->lens, &re->sensor_x, &re->sensor_y, &re->sensor_fit, &re->ycor, &re->viewdx, &re->viewdy);
+       /* extract results */
+       re_camera_params_get(re, &params, cam_ob);
 }
 
 void RE_SetPixelSize(Render *re, float pixsize)
index 0b4b6ca9112022773d269f9fd75b5df6f2ba5615..0e28d23e52b21fd047d828b16de034e7aa249cbf 100644 (file)
@@ -280,7 +280,8 @@ void ED_view3d_scene_layers_update(struct Main *bmain, struct Scene *scene){}
 int ED_view3d_scene_layer_set(int lay, const int *values){return 0;}
 void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar){}
 void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist){}
-struct BGpic *ED_view3D_background_image_add(struct View3D *v3d){return (struct BGpic *) NULL;}
+struct BGpic *ED_view3D_background_image_new(struct View3D *v3d){return (struct BGpic *) NULL;}
+void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic){}
 void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist){}
 int text_file_modified(struct Text *text){return 0;}
 void ED_node_shader_default(struct Material *ma){}
index d0bbd9db45aeeae559abd2a8a39442473b7aff6e..786271c2d2fbfe1b9444da7c436bf47aa62b3944 100644 (file)
@@ -311,7 +311,7 @@ if("${CMAKE_GENERATOR}" MATCHES ".*Makefiles.*")
        # message after building.
        add_custom_command(
                TARGET blender POST_BUILD MAIN_DEPENDENCY blender
-               COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}'
+               COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files and scripts to ${TARGETDIR_VER}'
        )
 endif()
 
index 682b42cc3cfcc1cd017b11bdf14657e817bb96e9..b1e3737af076383c295b1b0dd0b0daa5308db843 100644 (file)
@@ -1362,14 +1362,17 @@ KX_PYMETHODDEF_DOC( BL_Shader, setAttrib, "setAttrib(enum)" )
        
        int attr=0;
        
-       if(!PyArg_ParseTuple(args, "i:setAttrib", &attr ))
+       if(!PyArg_ParseTuple(args, "i:setAttrib", &attr))
                return NULL;
-       
+
+       attr= SHD_TANGENT; /* user input is ignored for now, there is only 1 attr */
+
        if(mShader==0) {
                PyErr_SetString(PyExc_ValueError, "shader.setAttrib() BL_Shader, invalid shader object");
                return NULL;
        }
-       mAttr=SHD_TANGENT; /* What the heck is going on here - attr is just ignored??? - Campbell */
+
+       mAttr= attr;
        glUseProgramObjectARB(mShader);
        glBindAttribLocationARB(mShader, mAttr, "Tangent");
        Py_RETURN_NONE;
index f7c416553b203f72ed0aff57a43b8bae51902e72..0c7c90a238286c0c5a4815644e0eaab10a2e8cd9 100644 (file)
@@ -16,7 +16,7 @@
 #
 # ##### END GPL LICENSE BLOCK #####
 
-# <pep8 compliant>
+# <pep8-80 compliant>
 
 import os
 
@@ -37,6 +37,7 @@ import os
 # should be directly after the licence header, ~20 in most cases
 PEP8_SEEK_COMMENT = 40
 SKIP_PREFIX = "./tools", "./config", "./scons", "./extern"
+FORCE_PEP8_ALL = False
 
 
 def file_list_py(path):
@@ -75,7 +76,7 @@ def main():
         if [None for prefix in SKIP_PREFIX if f.startswith(prefix)]:
             continue
 
-        pep8_type = is_pep8(f)
+        pep8_type = FORCE_PEP8_ALL or is_pep8(f)
 
         if pep8_type:
             # so we can batch them for each tool.
@@ -112,7 +113,27 @@ def main():
     print("\n\n\n# running pylint...")
     for f, pep8_type in files:
         # let pep8 complain about line length
-        os.system("pylint --reports=n --max-line-length=1000 '%s'" % f)
+        os.system("pylint "
+                  "--disable="
+                  "C0111,"  # missing docstring
+                  "C0103,"  # invalid name
+                  "W0613,"  # unused argument, may add this back
+                            # but happens a lot for 'context' for eg.
+                  "W0232,"  # class has no __init__, Operator/Panel/Menu etc
+                  "W0142,"  # Used * or ** magic
+                            # even needed in some cases
+                  "R0903,"  # bake_action] Too many statements (68/50)
+                  "R0911,"  # Too many return statements
+                  "R0912,"  # Too many branches
+                  "R0913,"  # Too many arguments
+                  "R0914,"  # Too many local variables
+                  "R0915,"  # bake_action] Too many statements (68/50)
+                  " "
+                  "--include-ids=y "
+                  "--output-format=parseable "
+                  "--reports=n "
+                  "--max-line-length=1000"
+                  " '%s'" % f)
 
 if __name__ == "__main__":
     main()