svn merge -r37500:37600 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Sun, 24 Jul 2011 13:21:54 +0000 (13:21 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 24 Jul 2011 13:21:54 +0000 (13:21 +0000)
78 files changed:
CMakeLists.txt
build_files/cmake/Modules/FindOpenEXR.cmake [new file with mode: 0644]
build_files/cmake/macros.cmake
build_files/scons/config/win32-vc-config.py
build_files/scons/config/win64-vc-config.py
doc/python_api/blender-org/layout.html
release/scripts/modules/rna_prop_ui.py
release/scripts/startup/bl_operators/nla.py
release/scripts/startup/bl_ui/properties_data_curve.py
release/scripts/startup/bl_ui/properties_data_metaball.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/BKE_action.h
source/blender/blenkernel/BKE_displist.h
source/blender/blenkernel/depsgraph_private.h
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/object.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/resources.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_relations.c
source/blender/editors/space_buttons/buttons_intern.h
source/blender/editors/space_buttons/buttons_ops.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/space_node.c
source/blender/editors/space_outliner/outliner.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_intern.h
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_snap.c
source/blender/gpu/GPU_draw.h
source/blender/gpu/intern/gpu_draw.c
source/blender/imbuf/intern/openexr/CMakeLists.txt
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/util.c
source/blender/makesdna/DNA_object_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/python/generic/IDProp.c
source/blender/python/generic/IDProp.h
source/blender/python/generic/py_capi_utils.c
source/blender/python/generic/py_capi_utils.h
source/blender/python/intern/bpy_props.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna_array.c
source/blender/python/intern/bpy_util.c
source/blender/render/extern/include/RE_shader_ext.h
source/blender/render/intern/source/rendercore.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_operators.c
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/BL_Texture.cpp
source/gameengine/Ketsji/KX_Camera.cpp

index 2c27076c10ef1c6304385035ce6991e34cafe423..4cd775a222beff219f8e2abdfe38747c2cb01794 100644 (file)
@@ -50,7 +50,7 @@ endif()
 cmake_minimum_required(VERSION 2.8)
 
 # this starts out unset
-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules/")
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules")
 
 # quiet output for Makefiles, 'make -s' helps too
 # set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
@@ -342,23 +342,8 @@ if(UNIX AND NOT APPLE)
        endif()
 
        if(WITH_IMAGE_OPENEXR)
-               set(OPENEXR /usr CACHE FILEPATH "OPENEXR Directory")
-               mark_as_advanced(OPENEXR)
-               find_path(OPENEXR_INC
-                       ImfXdr.h
-                       PATHS
-                       ${OPENEXR}/include/OpenEXR
-                       /usr/local/include/OpenEXR
-                       /sw/include/OpenEXR
-                       /opt/local/include/OpenEXR
-                       /opt/csw/include/OpenEXR
-                       /opt/include/OpenEXR
-               )
-               mark_as_advanced(OPENEXR_INC)
-
-               set(OPENEXR_LIB Half IlmImf Iex Imath)
-               
-               if(NOT OPENEXR_INC)
+               find_package(OpenEXR)  # our own module
+               if(NOT OPENEXR_FOUND)
                        set(WITH_IMAGE_OPENEXR OFF)
                endif()
        endif()
@@ -643,10 +628,7 @@ elseif(WIN32)
                endif()
 
                if(WITH_IMAGE_OPENEXR)
-                       if(MSVC80)
-                               set(MSVC_LIB _vs2005)
-                               set(MSVC_INC)
-                       elseif(MSVC90)
+                       if(MSVC90)
                                set(MSVC_LIB _vs2008)
                                set(MSVC_INC)
                        elseif(MSVC10)
@@ -656,11 +638,24 @@ elseif(WIN32)
                                set(MSVC_LIB msvc)
                                set(MSVC_INC)
                        endif()
-                       set(OPENEXR ${LIBDIR}/openexr)                  
-                       set(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
+                       set(OPENEXR ${LIBDIR}/openexr)
                        set(OPENEXR_LIBPATH ${OPENEXR}/lib${MSVC_LIB})
+                       set(OPENEXR_LIBRARIES
+                               ${OPENEXR_LIBPATH}/Iex.lib
+                               ${OPENEXR_LIBPATH}/Half.lib
+                               ${OPENEXR_LIBPATH}/IlmImf.lib
+                               ${OPENEXR_LIBPATH}/Imath.lib
+                               ${OPENEXR_LIBPATH}/IlmThread.lib
+                       )
                        set(OPENEXR_INCUDE ${OPENEXR}/include${MSVC_INC})
-                       set(OPENEXR_INC ${OPENEXR_INCUDE}/ ${OPENEXR_INCUDE}/IlmImf ${OPENEXR_INCUDE}/Iex ${OPENEXR_INCUDE}/Imath)
+                       set(OPENEXR_INCLUDE_DIRS
+                               ${OPENEXR_INCUDE}
+                               ${OPENEXR_INCUDE}/IlmImf
+                               ${OPENEXR_INCUDE}/Iex
+                               ${OPENEXR_INCUDE}/Imath
+                       )
+                       unset(OPENEXR_INCUDE)
+                       unset(OPENEXR_LIBPATH)
                endif()
 
                if(WITH_IMAGE_TIFF)
@@ -759,8 +754,8 @@ elseif(WIN32)
 
                if(WITH_IMAGE_OPENEXR)
                        set(OPENEXR ${LIBDIR}/gcc/openexr)
-                       set(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/OpenEXR)
-                       set(OPENEXR_LIB Half IlmImf Imath IlmThread)
+                       set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
+                       set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread)
                        set(OPENEXR_LIBPATH ${OPENEXR}/lib)
 
                        # TODO, gives linking errors, force off
@@ -892,8 +887,8 @@ elseif(APPLE)
 
        if(WITH_IMAGE_OPENEXR)
                set(OPENEXR ${LIBDIR}/openexr)
-               set(OPENEXR_INC ${OPENEXR}/include/OpenEXR ${OPENEXR}/include)
-               set(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
+               set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
+               set(OPENEXR_LIBRARIES Iex Half IlmImf Imath IlmThread)
                set(OPENEXR_LIBPATH ${OPENEXR}/lib)
        endif()
 
diff --git a/build_files/cmake/Modules/FindOpenEXR.cmake b/build_files/cmake/Modules/FindOpenEXR.cmake
new file mode 100644 (file)
index 0000000..9a11697
--- /dev/null
@@ -0,0 +1,88 @@
+# - Find OpenEXR library
+# Find the native OpenEXR includes and library
+# This module defines
+#  OPENEXR_INCLUDE_DIRS, where to find ImfXdr.h, etc. Set when
+#                        OPENEXR_INCLUDE_DIR is found.
+#  OPENEXR_LIBRARIES, libraries to link against to use OpenEXR.
+#  OPENEXR_ROOT_DIR, The base directory to search for OpenEXR.
+#                    This can also be an environment variable.
+#  OPENEXR_FOUND, If false, do not try to use OpenEXR.
+#
+# For indervidual library access these advanced settings are available
+#  OPENEXR_HALF_LIBRARY, Path to Half library
+#  OPENEXR_IEX_LIBRARY, Path to Half library
+#  OPENEXR_ILMIMF_LIBRARY, Path to Ilmimf library
+#  OPENEXR_ILMTHREAD_LIBRARY, Path to IlmThread library
+#  OPENEXR_IMATH_LIBRARY, Path to Imath library
+#
+# also defined, but not for general use are
+#  OPENEXR_LIBRARY, where to find the OpenEXR library.
+
+#=============================================================================
+# Copyright 2002-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# If OPENEXR_ROOT_DIR was defined in the environment, use it.
+IF(NOT OPENEXR_ROOT_DIR AND NOT $ENV{OPENEXR_ROOT_DIR} STREQUAL "")
+  SET(OPENEXR_ROOT_DIR $ENV{OPENEXR_ROOT_DIR})
+ENDIF()
+
+SET(_openexr_FIND_COMPONENTS
+  Half
+  Iex
+  IlmImf
+  IlmThread
+  Imath
+)
+
+SET(_openexr_SEARCH_DIRS
+  ${OPENEXR_ROOT_DIR}
+  /usr/local
+  /sw # Fink
+  /opt/local # DarwinPorts
+  /opt/csw # Blastwave
+)
+
+FIND_PATH(OPENEXR_INCLUDE_DIR ImfXdr.h
+  HINTS
+    ${_openexr_SEARCH_DIRS}
+  PATH_SUFFIXES
+    include/OpenEXR
+)
+
+SET(_openexr_LIBRARIES)
+FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
+  STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+  FIND_LIBRARY(OPENEXR_${UPPERCOMPONENT}_LIBRARY NAMES ${COMPONENT}
+      HINTS ${_openexr_SEARCH_DIRS}
+      PATH_SUFFIXES lib64 lib
+      )
+  LIST(APPEND _openexr_LIBRARIES "${OPENEXR_${UPPERCOMPONENT}_LIBRARY}")
+ENDFOREACH()
+
+# handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR  DEFAULT_MSG
+    _openexr_LIBRARIES OPENEXR_INCLUDE_DIR)
+
+IF(OPENEXR_FOUND)
+  SET(OPENEXR_LIBRARIES ${_openexr_LIBRARIES})
+  SET(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR})
+ENDIF(OPENEXR_FOUND)
+
+MARK_AS_ADVANCED(OPENEXR_INCLUDE_DIR)
+FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
+  STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+  MARK_AS_ADVANCED(OPENEXR_${UPPERCOMPONENT}_LIBRARY)
+ENDFOREACH()
index 8189769cbbcf38af3c4a493e9ca76fc829b3a786..7a8158227a91b2e995a674296eccd3368f0450d6 100644 (file)
@@ -150,15 +150,22 @@ macro(setup_liblinks
        target)
        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ")
 
-       target_link_libraries(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${LLIBS})
+       target_link_libraries(${target}
+                       ${OPENGL_gl_LIBRARY}
+                       ${OPENGL_glu_LIBRARY}
+                       ${JPEG_LIBRARIES}
+                       ${PNG_LIBRARIES}
+                       ${ZLIB_LIBRARIES}
+                       ${LLIBS})
 
        # since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
        if(WITH_PYTHON)  # AND NOT WITH_PYTHON_MODULE  # WIN32 needs
                target_link_libraries(${target} ${PYTHON_LINKFLAGS})
 
                if(WIN32 AND NOT UNIX)
-                       target_link_libraries(${target} debug ${PYTHON_LIBRARY}_d)
-                       target_link_libraries(${target} optimized ${PYTHON_LIBRARY})
+                       target_link_libraries(${target}
+                                       debug ${PYTHON_LIBRARY}_d
+                                       optimized ${PYTHON_LIBRARY})
                else()
                        target_link_libraries(${target} ${PYTHON_LIBRARY})
                endif()
@@ -168,8 +175,12 @@ macro(setup_liblinks
                target_link_libraries(${target} ${GLEW_LIBRARY})
        endif()
 
-       target_link_libraries(${target} ${OPENGL_glu_LIBRARY} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
-       target_link_libraries(${target} ${FREETYPE_LIBRARY})
+       target_link_libraries(${target}
+                       ${OPENGL_glu_LIBRARY}
+                       ${JPEG_LIBRARIES}
+                       ${PNG_LIBRARIES}
+                       ${ZLIB_LIBRARIES}
+                       ${FREETYPE_LIBRARY})
 
        if(WITH_INTERNATIONAL)
                target_link_libraries(${target} ${GETTEXT_LIB})
@@ -205,13 +216,16 @@ macro(setup_liblinks
        endif()
        if(WITH_IMAGE_OPENEXR)
                if(WIN32 AND NOT UNIX)
-                       foreach(_LOOP_VAR ${OPENEXR_LIB})
-                               target_link_libraries(${target} debug ${_LOOP_VAR}_d)
-                               target_link_libraries(${target} optimized ${_LOOP_VAR})
+                       foreach(_LOOP_VAR ${OPENEXR_LIBRARIES})
+                               string(REGEX REPLACE ".lib$" "_d.lib" _LOOP_VAR_DEBUG ${_LOOP_VAR})
+                               target_link_libraries(${target}
+                                               debug ${_LOOP_VAR_DEBUG}
+                                               optimized ${_LOOP_VAR})
                        endforeach()
                        unset(_LOOP_VAR)
+                       unset(_LOOP_VAR_DEBUG)
                else()
-                       target_link_libraries(${target} ${OPENEXR_LIB})
+                       target_link_libraries(${target} ${OPENEXR_LIBRARIES})
                endif()
        endif()
        if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE)
@@ -223,20 +237,24 @@ macro(setup_liblinks
        if(WITH_OPENCOLLADA)
                if(WIN32 AND NOT UNIX)
                        foreach(_LOOP_VAR ${OPENCOLLADA_LIB})
-                               target_link_libraries(${target} debug ${_LOOP_VAR}_d)
-                               target_link_libraries(${target} optimized ${_LOOP_VAR})
+                               target_link_libraries(${target}
+                                               debug ${_LOOP_VAR}_d
+                                               optimized ${_LOOP_VAR})
                        endforeach()
                        unset(_LOOP_VAR)
-                       target_link_libraries(${target} debug ${PCRE_LIB}_d)
-                       target_link_libraries(${target} optimized ${PCRE_LIB})
+                       target_link_libraries(${target}
+                                       debug ${PCRE_LIB}_d
+                                       optimized ${PCRE_LIB})
                        if(EXPAT_LIB)
-                               target_link_libraries(${target} debug ${EXPAT_LIB}_d)
-                               target_link_libraries(${target} optimized ${EXPAT_LIB})
+                               target_link_libraries(${target}
+                                               debug ${EXPAT_LIB}_d
+                                               optimized ${EXPAT_LIB})
                        endif()
                else()
-                       target_link_libraries(${target} ${OPENCOLLADA_LIB})
-                       target_link_libraries(${target} ${PCRE_LIB})
-                       target_link_libraries(${target} ${EXPAT_LIB})
+                       target_link_libraries(${target}
+                                       ${OPENCOLLADA_LIB}
+                                       ${PCRE_LIB}
+                                       ${EXPAT_LIB})
                endif()
        endif()
        if(WITH_MEM_JEMALLOC)
index b5d44db8a92b40d3459aebf7038d93f64e382844..9c21d0d8487224ce67ce0895ea15b62c98dffb98 100644 (file)
@@ -181,7 +181,7 @@ CXX_WARN = []
 
 LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
 
-PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE']
+PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:"msvcrt.lib"', '/NODEFAULTLIB:"msvcmrt.lib"', '/NODEFAULTLIB:"msvcurt.lib"', '/NODEFAULTLIB:"msvcrtd.lib"']
 
 # # Todo
 # BF_PROFILE_CCFLAGS = ['-pg', '-g ']
index 3332a560ed2331508e4e1d2a3d1a3fc79ab04143..a2539337dbf1f3b17a1cab739e5c7523a861638f 100644 (file)
@@ -188,7 +188,7 @@ if BF_DEBUG:
 else:
        BF_NUMJOBS=6
 
-PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO']
+PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:"msvcrt.lib"', '/NODEFAULTLIB:"msvcmrt.lib"', '/NODEFAULTLIB:"msvcurt.lib"', '/NODEFAULTLIB:"msvcrtd.lib"']
 
 BF_BUILDDIR = '..\\build\\blender25-win64-vc'
 BF_INSTALLDIR='..\\install\\blender25-win64-vc'
index a37ed730c22e574e0f007fa1119b2858f1c55745..88db31e15860007061c05be792d054431754452d 100644 (file)
@@ -8,7 +8,7 @@
 
 {%- macro relbar() %}
     <div class="subnav boxheader">
-       <ul class="noprint"><li><a href="http://www.blender.org/development/coding-guides/">Coding Guides</a></li><li>•</li><li><a href="http://www.blender.org/development/report-a-bug/">Report a Bug</a></li><li>•</li><li><a href="http://www.blender.org/development/submit-a-patch/">Submit a Patch</a></li><li>•</li><li><a href="http://www.blender.org/development/release-logs/">Release Logs</a></li><li>•</li><li><a href="http://www.blender.org/development/current-projects/">Current Projects</a></li><li>•</li><li><a href="http://www.blender.org/development/architecture/">Architecture</a></li><li>•</li><li><a href="http://www.blender.org/development/building-blender/">Building Blender</a></li><li>•</li><li class="subnav-active"><a href="http://www.blender.org/documentation/250PythonDoc/contents.html">PyAPI</a></li><li>•</li><li><a href="http://wiki.blender.org/index.php/Main_Page">Wiki</a></li></ul>
+       <ul class="noprint"><li><a href="http://wiki.blender.org/index.php/Dev:Contents">Documentation</a></li><li>•</li><li><a href="http://www.blender.org/development/report-a-bug/">Report a Bug</a></li><li>•</li><li><a href="http://wiki.blender.org/index.php/Dev:Doc/Process/Patches">Submit a Patch</a></li><li>•</li><li><a href="http://www.blender.org/development/release-logs/">Release Logs</a></li><li>•</li><li><a href="http://www.blender.org/development/building-blender/">Building Blender</a></li><li>•</li><li><a href="http://wiki.blender.org/index.php/Dev:Doc/Projects">Current Projects</a></li><li>•</li><li><a href="http://wiki.blender.org/index.php/Dev:Source/Architecture">Architecture</a></li><li>•</li><li><a href="http://www.blender.org/documentation/250PythonDoc/contents.html">Python API</a></li><li>•</li><li><a href="http://wiki.blender.org">Wiki</a></li></ul>
     </div>
     <div class="related subnav">
       <h3>{{ _('Navigation') }}</h3>
index 9311987e2e7ea1a5ad4fa80026036303dd4feeed..b0fb3b66d0aad9d015304a2d04d895daa2e15f95 100644 (file)
@@ -111,12 +111,16 @@ def draw(layout, context, context_member, property_type, use_edit=True):
             continue
 
         row = layout.row()
-        convert_to_pyobject = getattr(val, "convert_to_pyobject", None)
+        to_dict = getattr(val, "to_dict", None)
+        to_list = getattr(val, "to_list", None)
 
         val_orig = val
-        if convert_to_pyobject:
-            val_draw = val = val.convert_to_pyobject()
-            val_draw = str(val_draw)
+        if to_dict:
+            val = to_dict()
+            val_draw = str(val)
+        elif to_list:
+            val = to_list()
+            val_draw = str(val)
         else:
             val_draw = val
 
@@ -131,7 +135,7 @@ def draw(layout, context, context_member, property_type, use_edit=True):
         row.label(text=key)
 
         # explicit exception for arrays
-        if convert_to_pyobject and not hasattr(val_orig, "len"):
+        if to_dict or to_list:
             row.label(text=val_draw)
         else:
             if key in rna_properties:
index 6b32411190364b08d28f857a819836a09899bc20..7cbdaa3ddbfe95207c197b3b05f2d58765beb65b 100644 (file)
@@ -118,8 +118,10 @@ def bake(frame_start,
     # -------------------------------------------------------------------------
     # Create action
 
+    # incase animation data hassnt been created
+    atd = obj.animation_data_create()
     action = bpy.data.actions.new("Action")
-    obj.animation_data.action = action
+    atd.action = action
 
     if do_pose:
         pose_items = pose.bones.items()
index 11a129377e8a7a1976e023a8eb761526401f25a0..cb26b093601cf3b4e75eef78b27521f738dc6cb9 100644 (file)
@@ -112,14 +112,25 @@ class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel):
             sub.prop(curve, "use_fill_front")
             sub.prop(curve, "use_fill_back")
             col.prop(curve, "use_fill_deform", text="Fill Deformed")
+            
+class DATA_PT_curve_texture_space(CurveButtonsPanel, bpy.types.Panel):
+    bl_label = "Texture Space"
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+    
+    def draw(self, context):
+        layout = self.layout
+        
+        ob = context.object
+        curve = context.curve
 
-        col.label(text="Textures:")
-        col.prop(curve, "use_uv_as_generated")
-        col.prop(curve, "use_auto_texspace")
+        row = layout.row()
+        row.prop(curve, "use_auto_texspace")
+        row.prop(curve, "use_uv_as_generated")
         
         row = layout.row()
-        row.column().prop(curve, "texspace_location")
-        row.column().prop(curve, "texspace_size")
+        row.column().prop(curve, "texspace_location", text="Location")
+        row.column().prop(curve, "texspace_size", text="Size")
 
 
 class DATA_PT_geometry_curve(CurveButtonsPanel, bpy.types.Panel):
index c568d10b3b03ad0e5db63e17860ce3b4f98c7d6f..606c13594f3ff8edb4728df1d1216f3a659756e5 100644 (file)
@@ -71,9 +71,22 @@ class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
         layout.label(text="Update:")
         layout.prop(mball, "update_method", expand=True)
         
+        
+class DATA_PT_mball_texture_space(DataButtonsPanel, bpy.types.Panel):
+    bl_label = "Texture Space"
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+    
+    def draw(self, context):
+        layout = self.layout
+
+        mball = context.meta_ball
+
+        layout.prop(mball, "use_auto_texspace")
+        
         row = layout.row()
-        row.column().prop(mball, "texspace_location")
-        row.column().prop(mball, "texspace_size")
+        row.column().prop(mball, "texspace_location", text="Location")
+        row.column().prop(mball, "texspace_size", text="Size")
 
 
 class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
@@ -122,4 +135,4 @@ class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.P
     _property_type = bpy.types.MetaBall
 
 if __name__ == "__main__":  # only for live edit.
-    bpy.utils.register_module(__name__)
+    bpy.utils.register_module(__name__)
\ No newline at end of file
index 2e9448cca27652f058ad75ee27f39e13fe280059..7804a1a3c93560df2c1cc6052635cdb2c4b1a5d5 100644 (file)
@@ -438,6 +438,8 @@ class USERPREF_PT_system(bpy.types.Panel):
         col.label(text="OpenGL:")
         col.prop(system, "gl_clip_alpha", slider=True)
         col.prop(system, "use_mipmaps")
+        col.label(text="Anisotropic Filtering")
+        col.prop(system, "anisotropic_filter", text="")
         col.prop(system, "use_vertex_buffer_objects")
         #Anti-aliasing is disabled as it breaks broder/lasso select
         #col.prop(system, "use_antialiasing")
index 62e37b996cc7ce8010c9f3ba2a6dee3111f5ad46..8daf7280678859afd4800d0455e1967348950429 100644 (file)
@@ -98,6 +98,8 @@ class VIEW3D_HT_header(bpy.types.Header):
             row.prop(toolsettings, "use_snap_peel_object", text="")
         elif toolsettings.snap_element == 'FACE':
             row.prop(toolsettings, "use_snap_project", text="")
+            if toolsettings.use_snap_project and obj.mode == 'EDIT':
+                row.prop(toolsettings, "use_snap_project_self", text="")
 
         # OpenGL render
         row = layout.row(align=True)
index 698f0f0fecf8459378c875b59f7c6b7e67f2a83f..7d3de68c005e608d784ddcaa28b2f9d930849532 100644 (file)
@@ -216,7 +216,7 @@ void pose_remove_group(struct Object *ob);
 /* Assorted Evaluation ----------------- */    
 
 /* Used for the Action Constraint */
-void what_does_obaction(struct Scene *scene, struct Object *ob, struct Object *workob, struct bPose *pose, struct bAction *act, char groupname[], float cframe);
+void what_does_obaction(struct Object *ob, struct Object *workob, struct bPose *pose, struct bAction *act, char groupname[], float cframe);
 
 /* for proxy */
 void copy_pose_result(struct bPose *to, struct bPose *from);
index 68745975dae17fd41725efd252e170b333830412..b00db53a1991147e3c5dd8e8831b6b90b771302c 100644 (file)
@@ -97,15 +97,10 @@ extern void makeDispListCurveTypes_forRender(struct Scene *scene, struct Object
 extern void makeDispListCurveTypes_forOrco(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
 extern void makeDispListMBall(struct Scene *scene, struct Object *ob);
 extern void makeDispListMBall_forRender(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
-extern void shadeDispList(struct Scene *scene, struct Base *base);
-extern void shadeMeshMCol(struct Scene *scene, struct Object *ob, struct Mesh *me);
 
 int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4);
-void reshadeall_displist(struct Scene *scene);
 void filldisplist(struct ListBase *dispbase, struct ListBase *to, int flipnormal);
 
-void fastshade_free_render(void);
-
 float calc_taper(struct Scene *scene, struct Object *taperobj, int cur, int tot);
 
 /* add Orco layer to the displist object which has got derived mesh and return orco */
index 1fed115893cdbd74e75fa9e7cb64025dd0eee6e2..ef4f320602b1d7f071d0c83bd0c1c7acd696aed9 100644 (file)
@@ -69,8 +69,9 @@ typedef struct DagNode
        void * ob;
        void * first_ancestor;
        int ancestor_count;
-       unsigned int lay;                       // accumulated layers of its relations + itself
+       unsigned int lay;                               // accumulated layers of its relations + itself
        unsigned int scelay;                    // layers due to being in scene
+       unsigned int customdata_mask;   // customdata mask
        int lasttime;           // if lasttime != DagForest->time, this node was not evaluated yet for flushing
        int BFS_dist;           // BFS distance
        int DFS_dist;           // DFS distance
index 77f56058a4f89755310b9a2e55cb52784658f24a..f7086c817560043fcf03bf5ee3dbb13dbc7ac0d4 100644 (file)
@@ -1128,7 +1128,7 @@ void copy_pose_result(bPose *to, bPose *from)
 /* For the calculation of the effects of an Action at the given frame on an object 
  * This is currently only used for the Action Constraint 
  */
-void what_does_obaction (Scene *UNUSED(scene), Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe)
+void what_does_obaction (Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe)
 {
        bActionGroup *agrp= action_groups_find_named(act, groupname);
        
index fd25ebe266f42ccbdd6e97c4c8647cab5a7ac89a..0b31e51d62e430910dc46551403b62c34d9e1500 100644 (file)
@@ -1343,8 +1343,12 @@ void vec_roll_to_mat3(float *vec, float roll, float mat[][3])
        cross_v3_v3v3(axis,target,nor);
 
        /* was 0.0000000000001, caused bug [#23954], smaller values give unstable
-        * roll when toggling editmode */
-       if (dot_v3v3(axis,axis) > 0.00001f) {
+        * roll when toggling editmode.
+        *
+        * was 0.00001, causes bug [#27675], with 0.00000495,
+        * so a value inbetween these is needed.
+        */
+       if (dot_v3v3(axis,axis) > 0.000001f) {
                /* if nor is *not* a multiple of target ... */
                normalize_v3(axis);
                
index f16b2ae384c12d3a91d5fdcf1d24ab95bd605c45..820533f279729a1dd390e5ed062237cba188d089 100644 (file)
@@ -154,7 +154,6 @@ static void clear_global(void)
 {
 //     extern short winqueue_break;    /* screen.c */
 
-       fastshade_free_render();        /* lamps hang otherwise */
        free_main(G.main);                      /* free all lib data */
        
 //     free_vertexpaint();
index 6218dc9382ca8ca462d8d54ccf9c4241f9f103f5..d44e0b7ea0b2e6db4f9972dc72cad7f60d94119f 100644 (file)
@@ -426,7 +426,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
 /* ------------ General Target Matrix Tools ---------- */
 
 /* function that sets the given matrix based on given vertex group in mesh */
-static void contarget_get_mesh_mat (Scene *scene, Object *ob, const char *substring, float mat[][4])
+static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat[][4])
 {
        DerivedMesh *dm = NULL;
        Mesh *me= ob->data;
@@ -451,16 +451,9 @@ static void contarget_get_mesh_mat (Scene *scene, Object *ob, const char *substr
                freeDM= 1;
        }
        else {
-               /* when not in EditMode, use the 'final' derived mesh 
-                *      - check if the custom data masks for derivedFinal mean that we can just use that
-                *        (this is more effficient + sufficient for most cases)
-                */
-               if (!(ob->lastDataMask & CD_MASK_MDEFORMVERT)) {
-                       dm = mesh_get_derived_final(scene, ob, CD_MASK_MDEFORMVERT);
-                       freeDM= 1;
-               }
-               else 
-                       dm = (DerivedMesh *)ob->derivedFinal;
+               /* when not in EditMode, use the 'final' derived mesh, depsgraph
+                * ensures we build with CD_MDEFORMVERT layer */
+               dm = (DerivedMesh *)ob->derivedFinal;
        }
        
        /* only continue if there's a valid DerivedMesh */
@@ -587,7 +580,7 @@ static void contarget_get_lattice_mat (Object *ob, const char *substring, float
 
 /* generic function to get the appropriate matrix for most target cases */
 /* The cases where the target can be object data have not been implemented */
-static void constraint_target_to_mat4 (Scene *scene, Object *ob, const char *substring, float mat[][4], short from, short to, float headtail)
+static void constraint_target_to_mat4 (Object *ob, const char *substring, float mat[][4], short from, short to, float headtail)
 {
        /*      Case OBJECT */
        if (!strlen(substring)) {
@@ -604,7 +597,7 @@ static void constraint_target_to_mat4 (Scene *scene, Object *ob, const char *sub
         *              way as constraints can only really affect things on object/bone level.
         */
        else if (ob->type == OB_MESH) {
-               contarget_get_mesh_mat(scene, ob, substring, mat);
+               contarget_get_mesh_mat(ob, substring, mat);
                constraint_mat_convertspace(ob, NULL, mat, from, to);
        }
        else if (ob->type == OB_LATTICE) {
@@ -684,10 +677,10 @@ static bConstraintTypeInfo CTI_CONSTRNAME = {
 /* This function should be used for the get_target_matrix member of all 
  * constraints that are not picky about what happens to their target matrix.
  */
-static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
+static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime))
 {
        if (VALID_CONS_TARGET(ct))
-               constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
+               constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
        else if (ct)
                unit_m4(ct->matrix);
 }
@@ -1159,7 +1152,7 @@ static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstra
        bKinematicConstraint *data= con->data;
        
        if (VALID_CONS_TARGET(ct)) 
-               constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
+               constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
        else if (ct) {
                if (data->flag & CONSTRAINT_IK_AUTO) {
                        Object *ob= cob->ob;
@@ -2046,7 +2039,7 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT
                /* firstly calculate the matrix the normal way, then let the py-function override
                 * this matrix if it needs to do so
                 */
-               constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
+               constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
                
                /* only execute target calculation if allowed */
 #ifdef WITH_PYTHON
@@ -2165,7 +2158,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
                unit_m4(ct->matrix);
                
                /* get the transform matrix of the target */
-               constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, tempmat, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
+               constraint_target_to_mat4(ct->tar, ct->subtarget, tempmat, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
                
                /* determine where in transform range target is */
                /* data->type is mapped as follows for backwards compatability:
@@ -2216,7 +2209,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
                        tchan->rotmode= pchan->rotmode;
                        
                        /* evaluate action using workob (it will only set the PoseChannel in question) */
-                       what_does_obaction(cob->scene, cob->ob, &workob, pose, data->act, pchan->name, t);
+                       what_does_obaction(cob->ob, &workob, pose, data->act, pchan->name, t);
                        
                        /* convert animation to matrices for use here */
                        pchan_calc_mat(tchan);
@@ -2230,7 +2223,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
                        
                        /* evaluate using workob */
                        // FIXME: we don't have any consistent standards on limiting effects on object...
-                       what_does_obaction(cob->scene, cob->ob, &workob, NULL, data->act, NULL, t);
+                       what_does_obaction(cob->ob, &workob, NULL, data->act, NULL, t);
                        object_to_mat4(&workob, ct->matrix);
                }
                else {
index 472d7d77b80fd654bf882e56387822d3d643d135..c2800410657a83a602c6309cf34a502321f33e11 100644 (file)
@@ -372,6 +372,9 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
                node2->first_ancestor = ob;
                node2->ancestor_count += 1;
        }
+
+       /* also build a custom data mask for dependencies that need certain layers */
+       node->customdata_mask= 0;
        
        if (ob->type == OB_ARMATURE) {
                if (ob->pose){
@@ -451,8 +454,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
                        case PARSKEL:
                                dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Parent");
                                break;
-                       case PARVERT1: case PARVERT3: case PARBONE:
+                       case PARVERT1: case PARVERT3:
                                dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Vertex Parent");
+                               node2->customdata_mask |= CD_MASK_ORIGINDEX;
+                               break;
+                       case PARBONE:
+                               dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Bone Parent");
                                break;
                        default:
                                if(ob->parent->type==OB_LATTICE) 
@@ -647,8 +654,11 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
                                if (ELEM(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO))
                                        dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name);
                                else {
-                                       if (ELEM3(obt->type, OB_ARMATURE, OB_MESH, OB_LATTICE) && (ct->subtarget[0]))
+                                       if (ELEM3(obt->type, OB_ARMATURE, OB_MESH, OB_LATTICE) && (ct->subtarget[0])) {
                                                dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name);
+                                               if (obt->type == OB_MESH)
+                                                       node2->customdata_mask |= CD_MASK_MDEFORMVERT;
+                                       }
                                        else
                                                dag_add_relation(dag, node2, node, DAG_RL_OB_OB, cti->name);
                                }
@@ -722,6 +732,9 @@ struct DagForest *build_dag(Main *bmain, Scene *sce, short mask)
                                        itA->node->color |= itA->type;
                                }
                        }
+
+                       /* also flush custom data mask */
+                       ((Object*)node->ob)->customdata_mask= node->customdata_mask;
                }
        }
        /* now set relations equal, so that when only one parent changes, the correct recalcs are found */
index c6504ad09c7bfe0fbc4c0ce2748b3db4c2c60b49..8f57490d0575726faa684fb93d9cf62c70eec79f 100644 (file)
@@ -65,9 +65,6 @@
 #include "BKE_lattice.h"
 #include "BKE_modifier.h"
 
-#include "RE_pipeline.h"
-#include "RE_shader_ext.h"
-
 #include "BLO_sys_types.h" // for intptr_t support
 
 #include "ED_curve.h" /* for BKE_curve_nurbs */
@@ -286,499 +283,6 @@ int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, i
        return 1;
 }
 
-/* ***************************** shade displist. note colors now are in rgb(a) order ******************** */
-
-/* create default shade input... save cpu cycles with ugly global */
-/* XXXX bad code warning: local ShadeInput initialize... */
-static ShadeInput shi;
-static void init_fastshade_shadeinput(Render *re)
-{
-       memset(&shi, 0, sizeof(ShadeInput));
-       shi.lay= RE_GetScene(re)->lay;
-       shi.view[2]= -1.0f;
-       shi.passflag= SCE_PASS_COMBINED;
-       shi.combinedflag= -1;
-}
-
-static Render *fastshade_get_render(Scene *UNUSED(scene))
-{
-       // XXX 2.5: this crashes combined with previewrender
-       // due to global R so disabled for now
-#if 0
-       /* XXX ugly global still, but we can't do preview while rendering */
-       if(G.rendering==0) {
-               
-               Render *re= RE_GetRender("_Shade View_");
-               if(re==NULL) {
-                       re= RE_NewRender("_Shade View_");
-               
-                       RE_Database_Baking(re, scene, 0, 0);    /* 0= no faces */
-               }
-               return re;
-       }
-#endif
-       
-       return NULL;
-}
-
-/* called on file reading */
-void fastshade_free_render(void)
-{
-       Render *re= RE_GetRender("_Shade View_");
-       
-       if(re) {
-               RE_Database_Free(re);
-               RE_FreeRender(re);
-       }
-}
-
-
-static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma)
-{
-       CustomDataLayer *layer;
-       MTFace *mtface;
-       int index, needuv= ma->texco & TEXCO_UV;
-       char *vertcol;
-
-       shi.totuv= 0;
-       shi.totcol= 0;
-
-       for(index=0; index<fdata->totlayer; index++) {
-               layer= &fdata->layers[index];
-               
-               if(needuv && layer->type == CD_MTFACE && shi.totuv < MAX_MTFACE) {
-                       mtface= &((MTFace*)layer->data)[a];
-
-                       shi.uv[shi.totuv].uv[0]= 2.0f*mtface->uv[j][0]-1.0f;
-                       shi.uv[shi.totuv].uv[1]= 2.0f*mtface->uv[j][1]-1.0f;
-                       shi.uv[shi.totuv].uv[2]= 1.0f;
-
-                       shi.uv[shi.totuv].name= layer->name;
-                       shi.totuv++;
-               }
-               else if(layer->type == CD_MCOL && shi.totcol < MAX_MCOL) {
-                       vertcol= (char*)&((MCol*)layer->data)[a*4 + j];
-
-                       shi.col[shi.totcol].col[0]= ((float)vertcol[3])/255.0f;
-                       shi.col[shi.totcol].col[1]= ((float)vertcol[2])/255.0f;
-                       shi.col[shi.totcol].col[2]= ((float)vertcol[1])/255.0f;
-
-                       shi.col[shi.totcol].name= layer->name;
-                       shi.totcol++;
-               }
-       }
-
-       if(needuv && shi.totuv == 0)
-               VECCOPY(shi.uv[0].uv, shi.lo);
-
-       if(shi.totcol)
-               VECCOPY(shi.vcol, shi.col[0].col);
-}
-
-static void fastshade(float *co, float *nor, float *orco, Material *ma, char *col1, char *col2)
-{
-       ShadeResult shr;
-       int a;
-       
-       VECCOPY(shi.co, co);
-       shi.vn[0]= -nor[0];
-       shi.vn[1]= -nor[1];
-       shi.vn[2]= -nor[2];
-       VECCOPY(shi.vno, shi.vn);
-       VECCOPY(shi.facenor, shi.vn);
-       
-       if(ma->texco) {
-               VECCOPY(shi.lo, orco);
-               
-               if(ma->texco & TEXCO_GLOB) {
-                       VECCOPY(shi.gl, shi.lo);
-               }
-               if(ma->texco & TEXCO_WINDOW) {
-                       VECCOPY(shi.winco, shi.lo);
-               }
-               if(ma->texco & TEXCO_STICKY) {
-                       VECCOPY(shi.sticky, shi.lo);
-               }
-               if(ma->texco & TEXCO_OBJECT) {
-                       VECCOPY(shi.co, shi.lo);
-               }
-               if(ma->texco & TEXCO_NORM) {
-                       VECCOPY(shi.orn, shi.vn);
-               }
-               if(ma->texco & TEXCO_REFL) {
-                       float inp= 2.0f * (shi.vn[2]);
-                       shi.ref[0]= (inp*shi.vn[0]);
-                       shi.ref[1]= (inp*shi.vn[1]);
-                       shi.ref[2]= (-1.0f + inp*shi.vn[2]);
-               }
-       }
-       
-       shi.mat= ma;    /* set each time... node shaders change it */
-       RE_shade_external(NULL, &shi, &shr);
-       
-       a= 256.0f*(shr.combined[0]);
-       col1[0]= CLAMPIS(a, 0, 255);
-       a= 256.0f*(shr.combined[1]);
-       col1[1]= CLAMPIS(a, 0, 255);
-       a= 256.0f*(shr.combined[2]);
-       col1[2]= CLAMPIS(a, 0, 255);
-       
-       if(col2) {
-               shi.vn[0]= -shi.vn[0];
-               shi.vn[1]= -shi.vn[1];
-               shi.vn[2]= -shi.vn[2];
-               
-               shi.mat= ma;    /* set each time... node shaders change it */
-               RE_shade_external(NULL, &shi, &shr);
-               
-               a= 256.0f*(shr.combined[0]);
-               col2[0]= CLAMPIS(a, 0, 255);
-               a= 256.0f*(shr.combined[1]);
-               col2[1]= CLAMPIS(a, 0, 255);
-               a= 256.0f*(shr.combined[2]);
-               col2[2]= CLAMPIS(a, 0, 255);
-       }
-}
-
-static void init_fastshade_for_ob(Render *re, Object *ob, int *need_orco_r, float mat[4][4], float imat[3][3])
-{
-       float tmat[4][4];
-       float amb[3]= {0.0f, 0.0f, 0.0f};
-       int a;
-       
-       /* initialize globals in render */
-       RE_shade_external(re, NULL, NULL);
-
-       /* initialize global here */
-       init_fastshade_shadeinput(re);
-       
-       RE_DataBase_GetView(re, tmat);
-       mul_m4_m4m4(mat, ob->obmat, tmat);
-       
-       invert_m4_m4(tmat, mat);
-       copy_m3_m4(imat, tmat);
-       if(ob->transflag & OB_NEG_SCALE) mul_m3_fl(imat, -1.0);
-       
-       if (need_orco_r) *need_orco_r= 0;
-       for(a=0; a<ob->totcol; a++) {
-               Material *ma= give_current_material(ob, a+1);
-               if(ma) {
-                       init_render_material(ma, 0, amb);
-
-                       if(ma->texco & TEXCO_ORCO) {
-                               if (need_orco_r) *need_orco_r= 1;
-                       }
-               }
-       }
-}
-
-static void end_fastshade_for_ob(Object *ob)
-{
-       int a;
-       
-       for(a=0; a<ob->totcol; a++) {
-               Material *ma= give_current_material(ob, a+1);
-               if(ma)
-                       end_render_material(ma);
-       }
-}
-
-
-static void mesh_create_shadedColors(Render *re, Object *ob, int onlyForMesh, unsigned int **col1_r, unsigned int **col2_r)
-{
-       Mesh *me= ob->data;
-       DerivedMesh *dm;
-       MVert *mvert;
-       MFace *mface;
-       unsigned int *col1, *col2;
-       float *orco, *vnors, *nors, imat[3][3], mat[4][4], vec[3];
-       int a, i, need_orco, totface, totvert;
-       CustomDataMask dataMask = CD_MASK_BAREMESH | CD_MASK_MCOL
-                                                         | CD_MASK_MTFACE | CD_MASK_NORMAL;
-
-
-       init_fastshade_for_ob(re, ob, &need_orco, mat, imat);
-
-       if(need_orco)
-               dataMask |= CD_MASK_ORCO;
-
-       if (onlyForMesh)
-               dm = mesh_get_derived_deform(RE_GetScene(re), ob, dataMask);
-       else
-               dm = mesh_get_derived_final(RE_GetScene(re), ob, dataMask);
-       
-       mvert = dm->getVertArray(dm);
-       mface = dm->getTessFaceArray(dm);
-       nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
-       totvert = dm->getNumVerts(dm);
-       totface = dm->getNumTessFaces(dm);
-       orco= dm->getVertDataArray(dm, CD_ORCO);
-
-       if (onlyForMesh) {
-               col1 = *col1_r;
-               col2 = NULL;
-       } else {
-               *col1_r = col1 = MEM_mallocN(sizeof(*col1)*totface*4, "col1");
-
-               if (col2_r && (me->flag & ME_TWOSIDED))
-                       col2 = MEM_mallocN(sizeof(*col2)*totface*4, "col2");
-               else
-                       col2 = NULL;
-               
-               if (col2_r) *col2_r = col2;
-       }
-
-               /* vertexnormals */
-       vnors= MEM_mallocN(totvert*3*sizeof(float), "vnors disp");
-       for (a=0; a<totvert; a++) {
-               MVert *mv = &mvert[a];
-               float *vn= &vnors[a*3];
-               float xn= mv->no[0]; 
-               float yn= mv->no[1]; 
-               float zn= mv->no[2];
-               
-                       /* transpose ! */
-               vn[0]= imat[0][0]*xn+imat[0][1]*yn+imat[0][2]*zn;
-               vn[1]= imat[1][0]*xn+imat[1][1]*yn+imat[1][2]*zn;
-               vn[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn;
-               normalize_v3(vn);
-       }               
-
-       for (i=0; i<totface; i++) {
-               MFace *mf= &mface[i];
-               Material *ma= give_current_material(ob, mf->mat_nr+1);
-               int j, vidx[4], nverts= mf->v4?4:3;
-               unsigned char *col1base= (unsigned char*) &col1[i*4];
-               unsigned char *col2base= (unsigned char*) (col2?&col2[i*4]:NULL);
-               float nor[3], n1[3];
-               
-               if(ma==NULL) ma= &defmaterial;
-               
-               vidx[0]= mf->v1;
-               vidx[1]= mf->v2;
-               vidx[2]= mf->v3;
-               vidx[3]= mf->v4;
-
-               if (nors) {
-                       VECCOPY(nor, &nors[i*3]);
-               } else {
-                       if (mf->v4)
-                               normal_quad_v3( nor,mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co, mvert[mf->v4].co);
-                       else
-                               normal_tri_v3( nor,mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co);
-               }
-
-               n1[0]= imat[0][0]*nor[0]+imat[0][1]*nor[1]+imat[0][2]*nor[2];
-               n1[1]= imat[1][0]*nor[0]+imat[1][1]*nor[1]+imat[1][2]*nor[2];
-               n1[2]= imat[2][0]*nor[0]+imat[2][1]*nor[1]+imat[2][2]*nor[2];
-               normalize_v3(n1);
-
-               for (j=0; j<nverts; j++) {
-                       MVert *mv= &mvert[vidx[j]];
-                       char *col1= (char*)&col1base[j*4];
-                       char *col2= (char*)(col2base?&col2base[j*4]:NULL);
-                       float *vn = (mf->flag & ME_SMOOTH)?&vnors[3*vidx[j]]:n1;
-
-                       mul_v3_m4v3(vec, mat, mv->co);
-
-                       mul_v3_v3fl(vec, vn, 0.001f);
-
-                       fastshade_customdata(&dm->faceData, i, j, ma);
-                       fastshade(vec, vn, orco?&orco[vidx[j]*3]:mv->co, ma, col1, col2);
-               }
-       } 
-       MEM_freeN(vnors);
-
-       dm->release(dm);
-
-       end_fastshade_for_ob(ob);
-}
-
-void shadeMeshMCol(Scene *scene, Object *ob, Mesh *me)
-{
-       Render *re= fastshade_get_render(scene);
-       int a;
-       char *cp;
-       unsigned int *mcol= (unsigned int*)me->mcol;
-       
-       if(re) {
-               mesh_create_shadedColors(re, ob, 1, &mcol, NULL);
-               me->mcol= (MCol*)mcol;
-
-               /* swap bytes */
-               for(cp= (char *)me->mcol, a= 4*me->totface; a>0; a--, cp+=4) {
-                       SWAP(char, cp[0], cp[3]);
-                       SWAP(char, cp[1], cp[2]);
-               }
-       }
-}
-
-/* has base pointer, to check for layer */
-/* called from drawobject.c */
-void shadeDispList(Scene *scene, Base *base)
-{
-       Object *ob= base->object;
-       DispList *dl, *dlob;
-       Material *ma = NULL;
-       Render *re;
-       float imat[3][3], mat[4][4], vec[3];
-       float *fp, *nor, n1[3];
-       unsigned int *col1;
-       int a, need_orco;
-       
-       re= fastshade_get_render(scene);
-       if(re==NULL)
-               return;
-       
-       dl = find_displist(&ob->disp, DL_VERTCOL);
-       if (dl) {
-               BLI_remlink(&ob->disp, dl);
-               free_disp_elem(dl);
-       }
-
-       if(ob->type==OB_MESH) {
-               dl= MEM_callocN(sizeof(DispList), "displistshade");
-               dl->type= DL_VERTCOL;
-
-               mesh_create_shadedColors(re, ob, 0, &dl->col1, &dl->col2);
-
-               /* add dl to ob->disp after mesh_create_shadedColors, because it
-                  might indirectly free ob->disp */
-               BLI_addtail(&ob->disp, dl);
-       }
-       else {
-
-               init_fastshade_for_ob(re, ob, &need_orco, mat, imat);
-               
-               if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
-               
-                       /* now we need the normals */
-                       dl= ob->disp.first;
-                       
-                       while(dl) {
-                               dlob= MEM_callocN(sizeof(DispList), "displistshade");
-                               BLI_addtail(&ob->disp, dlob);
-                               dlob->type= DL_VERTCOL;
-                               dlob->parts= dl->parts;
-                               dlob->nr= dl->nr;
-                               
-                               if(dl->type==DL_INDEX3) {
-                                       col1= dlob->col1= MEM_mallocN(sizeof(int)*dl->nr, "col1");
-                               }
-                               else {
-                                       col1= dlob->col1= MEM_mallocN(sizeof(int)*dl->parts*dl->nr, "col1");
-                               }
-                               
-                       
-                               ma= give_current_material(ob, dl->col+1);
-                               if(ma==NULL) ma= &defmaterial;
-                               
-                               if(dl->type==DL_INDEX3) {
-                                       if(dl->nors) {
-                                               /* there's just one normal */
-                                               n1[0]= imat[0][0]*dl->nors[0]+imat[0][1]*dl->nors[1]+imat[0][2]*dl->nors[2];
-                                               n1[1]= imat[1][0]*dl->nors[0]+imat[1][1]*dl->nors[1]+imat[1][2]*dl->nors[2];
-                                               n1[2]= imat[2][0]*dl->nors[0]+imat[2][1]*dl->nors[1]+imat[2][2]*dl->nors[2];
-                                               normalize_v3(n1);
-                                               
-                                               fp= dl->verts;
-                                               
-                                               a= dl->nr;              
-                                               while(a--) {
-                                                       mul_v3_m4v3(vec, mat, fp);
-                                                       
-                                                       fastshade(vec, n1, fp, ma, (char *)col1, NULL);
-                                                       
-                                                       fp+= 3; col1++;
-                                               }
-                                       }
-                               }
-                               else if(dl->type==DL_SURF) {
-                                       if(dl->nors) {
-                                               a= dl->nr*dl->parts;
-                                               fp= dl->verts;
-                                               nor= dl->nors;
-                                               
-                                               while(a--) {
-                                                       mul_v3_m4v3(vec, mat, fp);
-                                                       
-                                                       n1[0]= imat[0][0]*nor[0]+imat[0][1]*nor[1]+imat[0][2]*nor[2];
-                                                       n1[1]= imat[1][0]*nor[0]+imat[1][1]*nor[1]+imat[1][2]*nor[2];
-                                                       n1[2]= imat[2][0]*nor[0]+imat[2][1]*nor[1]+imat[2][2]*nor[2];
-                                                       normalize_v3(n1);
-                               
-                                                       fastshade(vec, n1, fp, ma, (char *)col1, NULL);
-                                                       
-                                                       fp+= 3; nor+= 3; col1++;
-                                               }
-                                       }
-                               }
-                               dl= dl->next;
-                       }
-               }
-               else if(ob->type==OB_MBALL) {
-                       /* there are normals already */
-                       dl= ob->disp.first;
-                       
-                       while(dl) {
-                               
-                               if(dl->type==DL_INDEX4) {
-                                       if(dl->nors) {
-                                               if(dl->col1) MEM_freeN(dl->col1);
-                                               col1= dl->col1= MEM_mallocN(sizeof(int)*dl->nr, "col1");
-                               
-                                               ma= give_current_material(ob, dl->col+1);
-                                               if(ma==NULL) ma= &defmaterial;
-                                               
-                                               fp= dl->verts;
-                                               nor= dl->nors;
-                                               
-                                               a= dl->nr;              
-                                               while(a--) {
-                                                       mul_v3_m4v3(vec, mat, fp);
-                                                       
-                                                       /* transpose ! */
-                                                       n1[0]= imat[0][0]*nor[0]+imat[0][1]*nor[1]+imat[0][2]*nor[2];
-                                                       n1[1]= imat[1][0]*nor[0]+imat[1][1]*nor[1]+imat[1][2]*nor[2];
-                                                       n1[2]= imat[2][0]*nor[0]+imat[2][1]*nor[1]+imat[2][2]*nor[2];
-                                                       normalize_v3(n1);
-                                               
-                                                       fastshade(vec, n1, fp, ma, (char *)col1, NULL);
-                                                       
-                                                       fp+= 3; col1++; nor+= 3;
-                                               }
-                                       }
-                               }
-                               dl= dl->next;
-                       }
-               }
-               
-               end_fastshade_for_ob(ob);
-       }
-}
-
-/* frees render and shade part of displists */
-/* note: dont do a shade again, until a redraw happens */
-void reshadeall_displist(Scene *scene)
-{
-       Base *base;
-       Object *ob;
-       
-       fastshade_free_render();
-       
-       for(base= scene->base.first; base; base= base->next) {
-               ob= base->object;
-
-               if(ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL))
-                       freedisplist(&ob->disp);
-
-               if(base->lay & scene->lay) {
-                       /* Metaballs have standard displist at the Object */
-                       if(ob->type==OB_MBALL) shadeDispList(scene, base);
-               }
-       }
-}
-
 /* ****************** make displists ********************* */
 
 static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, int forRender)
@@ -934,8 +438,6 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
                totvert= 0;
                nextcol= 0;
                
-               BLI_begin_edgefill();
-               
                dl= dispbase->first;
                while(dl) {
        
@@ -1388,7 +890,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 
                        if (dm) {
                                if (vertCos) {
-                                       DerivedMesh *tdm = CDDM_copy(dm, 0);
+                                       DerivedMesh *tdm = CDDM_copy(dm);
                                        dm->release(dm);
                                        dm = tdm;
 
@@ -1429,7 +931,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 
        if (vertCos) {
                if (dm) {
-                       DerivedMesh *tdm = CDDM_copy(dm, 0);
+                       DerivedMesh *tdm = CDDM_copy(dm);
                        dm->release(dm);
                        dm = tdm;
 
index 4b40897af180f436f1a32720917eaf9d7b2e37e2..dff62b05bd35fc0a6763f17448dea71772456f19 100644 (file)
@@ -86,7 +86,6 @@
 #include "BKE_lattice.h"
 #include "BKE_library.h"
 #include "BKE_mesh.h"
-#include "BKE_tessmesh.h"
 #include "BKE_mball.h"
 #include "BKE_modifier.h"
 #include "BKE_object.h"
@@ -969,7 +968,7 @@ void free_lamp(Lamp *la)
        
        BKE_free_animdata((ID *)la);
 
-       curvemapping_free(la->curfalloff); 
+       curvemapping_free(la->curfalloff);
        
        BKE_previewimg_free(&la->preview);
        BKE_icon_delete(&la->id);
@@ -1926,7 +1925,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[][4])
 
 static void give_parvert(Object *par, int nr, float *vec)
 {
-       BMEditMesh *em;
+       EditMesh *em;
        int a, count;
        
        vec[0]=vec[1]=vec[2]= 0.0f;
@@ -1935,22 +1934,7 @@ static void give_parvert(Object *par, int nr, float *vec)
                Mesh *me= par->data;
                DerivedMesh *dm;
 
-               em = me->edit_btmesh;
-
-               if(em) {
-                       BMVert *eve;
-                       BMIter iter;
-
-                       BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                               int *keyindex = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
-                               
-                               if(keyindex && *keyindex==nr) {
-                                       memcpy(vec, eve->co, sizeof(float)*3);
-                                       break;
-                               }
-                       }
-               }
-
+               em = BKE_mesh_get_editmesh(me);
                dm = (em)? em->derivedFinal: par->derivedFinal;
                        
                if(dm) {
@@ -1978,6 +1962,9 @@ static void give_parvert(Object *par, int nr, float *vec)
                                dm->getVertCo(dm, 0, vec);
                        }
                }
+
+               if(em)
+                       BKE_mesh_end_editmesh(me, em);
        }
        else if (ELEM(par->type, OB_CURVE, OB_SURF)) {
                Nurb *nu;
@@ -2632,14 +2619,11 @@ void object_handle_update(Scene *scene, Object *ob)
                        
                        if (G.f & G_DEBUG)
                                printf("recalcdata %s\n", ob->id.name+2);
-                       
 
                        if(adt) {
                                /* evaluate drivers */
                                // XXX: for mesh types, should we push this to derivedmesh instead?
                                BKE_animsys_evaluate_animdata(data_id, adt, ctime, ADT_RECALC_DRIVERS);
-
-                               
                        }
 
                        /* includes all keys and modifiers */
@@ -2647,19 +2631,22 @@ void object_handle_update(Scene *scene, Object *ob)
                        case OB_MESH:
                                {
 #if 0                          // XXX, comment for 2.56a release, background wont set 'scene->customdata_mask'
-                                       BMEditMesh *em = (ob == scene->obedit)? ((Mesh*)ob->data)->edit_btmesh : NULL;
+                                       EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
                                        BLI_assert((scene->customdata_mask & CD_MASK_BAREMESH) == CD_MASK_BAREMESH);
                                        if(em) {
-                                               makeDerivedMesh(scene, ob, em,  scene->customdata_mask, 0); /* was CD_MASK_BAREMESH */
+                                               makeDerivedMesh(scene, ob, em,  scene->customdata_mask); /* was CD_MASK_BAREMESH */
+                                               BKE_mesh_end_editmesh(ob->data, em);
                                        } else
-                                               makeDerivedMesh(scene, ob, NULL, scene->customdata_mask, 0);
+                                               makeDerivedMesh(scene, ob, NULL, scene->customdata_mask);
 
 #else                          /* ensure CD_MASK_BAREMESH for now */
-                                       BMEditMesh *em = (ob == scene->obedit)? ((Mesh*)ob->data)->edit_btmesh : NULL;
+                                       EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
+                                       unsigned int data_mask= scene->customdata_mask | ob->customdata_mask | CD_MASK_BAREMESH;
                                        if(em) {
-                                               makeDerivedMesh(scene, ob, em,  scene->customdata_mask | CD_MASK_BAREMESH, 0); /* was CD_MASK_BAREMESH */
+                                               makeDerivedMesh(scene, ob, em,  data_mask); /* was CD_MASK_BAREMESH */
+                                               BKE_mesh_end_editmesh(ob->data, em);
                                        } else
-                                               makeDerivedMesh(scene, ob, NULL, scene->customdata_mask | CD_MASK_BAREMESH, 0);
+                                               makeDerivedMesh(scene, ob, NULL, data_mask);
 #endif
 
                                }
index 0e975ab2d2fffe71a7e33a4f5c100f2ed916816d..5089be8a5c48f0a56501c27ccbb08e9f9ca19f5e 100644 (file)
@@ -4387,6 +4387,7 @@ static void direct_link_object(FileData *fd, Object *ob)
                MEM_freeN(hook);
        }
        
+       ob->customdata_mask= 0;
        ob->bb= NULL;
        ob->derivedDeform= NULL;
        ob->derivedFinal= NULL;
index 1a26079800c382330c36f525e069f9de92dd6be3..61e19655f8db1f6fe7845146f168815d8a9b7522 100644 (file)
@@ -298,10 +298,12 @@ void uiPupMenuInvoke(struct bContext *C, const char *idname); /* popup registere
  * but allow using all button types and creating an own layout. */
 
 typedef uiBlock* (*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1);
+typedef void (*uiBlockCancelFunc)(void *arg1);
 
 void uiPupBlock(struct bContext *C, uiBlockCreateFunc func, void *arg);
 void uiPupBlockO(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext);
-void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext);
+void uiPupBlockEx(struct bContext *C, uiBlockCreateFunc func, uiBlockCancelFunc cancel_func, void *arg);
+/* void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext); */ /* UNUSED */
 
 void uiPupBlockClose(struct bContext *C, uiBlock *block);
 
index 37e4cc7616b4efb168cb8eac1d27f6e846c8c942..30c0f552b7233e9370128fd0f6fbdcc60d9a540f 100644 (file)
 #define PRECISION_FLOAT_MAX 7
 #define PRECISION_FLOAT_MAX_POW 10000000 /* pow(10, PRECISION_FLOAT_MAX)  */
 
+/* avoid unneeded calls to ui_get_but_val */
+#define UI_BUT_VALUE_UNSET DBL_MAX
+#define UI_GET_BUT_VALUE_INIT(_but, _value) if(_value == DBL_MAX) {  (_value)= ui_get_but_val(_but); }
+
 /* 
  * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt
  * 
@@ -967,17 +971,16 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
 
 /* ************* EVENTS ************* */
 
-static void ui_is_but_sel(uiBut *but)
+static void ui_is_but_sel(uiBut *but, double *value)
 {
-       double value; /* only initialized when needed, to avoid calling when not used */
        short push=0, true=1;
 
        if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) true= 0;
 
        if( but->bit ) {
                int lvalue;
-               value= ui_get_but_val(but);
-               lvalue= (int)value;
+               UI_GET_BUT_VALUE_INIT(but, *value)
+               lvalue= (int)*value;
                if( BTST(lvalue, (but->bitnr)) ) push= true;
                else push= !true;
        }
@@ -997,24 +1000,24 @@ static void ui_is_but_sel(uiBut *but)
                case BUT_TOGDUAL:
                case ICONTOG:
                case OPTION:
-                       value= ui_get_but_val(but);
-                       if(value != (double)but->hardmin) push= 1;
+                       UI_GET_BUT_VALUE_INIT(but, *value)
+                       if(*value != (double)but->hardmin) push= 1;
                        break;
                case ICONTOGN:
                case TOGN:
                case OPTIONN:
-                       value= ui_get_but_val(but);
-                       if(value==0.0) push= 1;
+                       UI_GET_BUT_VALUE_INIT(but, *value)
+                       if(*value==0.0) push= 1;
                        break;
                case ROW:
                case LISTROW:
-                       value= ui_get_but_val(but);
+                       UI_GET_BUT_VALUE_INIT(but, *value)
                        /* support for rna enum buts */
                        if(but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
-                               if((int)value & (int)but->hardmax) push= 1;
+                               if((int)*value & (int)but->hardmax) push= 1;
                        }
                        else {
-                               if(value == (double)but->hardmax) push= 1;
+                               if(*value == (double)but->hardmax) push= 1;
                        }
                        break;
                case COL:
@@ -1385,6 +1388,10 @@ void ui_set_but_val(uiBut *but, double value)
                                        break;
                        }
                }
+
+               /* we can't be sure what RNA set functions actually do,
+                * so leave this unset */
+               value= UI_BUT_VALUE_UNSET;
        }
        else if(but->pointype==0);
        else if(but->type==HSVSLI ) {
@@ -1425,19 +1432,19 @@ void ui_set_but_val(uiBut *but, double value)
                
                /* then set value with possible edit override */
                if(but->editval)
-                       *but->editval= value;
+                       value= *but->editval= value;
                else if(but->pointype==CHA)
-                       *((char *)but->poin)= (char)value;
+                       value= *((char *)but->poin)= (char)value;
                else if(but->pointype==SHO)
-                       *((short *)but->poin)= (short)value;
+                       value= *((short *)but->poin)= (short)value;
                else if(but->pointype==INT)
-                       *((int *)but->poin)= (int)value;
+                       value= *((int *)but->poin)= (int)value;
                else if(but->pointype==FLO)
-                       *((float *)but->poin)= (float)value;
+                       value= *((float *)but->poin)= (float)value;
        }
 
        /* update select flag */
-       ui_is_but_sel(but);
+       ui_is_but_sel(but, &value);
 }
 
 int ui_get_but_string_max_length(uiBut *but)
@@ -1758,50 +1765,70 @@ static double soft_range_round_down(double value, double max)
 
 void ui_set_but_soft_range(uiBut *but, double value)
 {
-       PropertyType type;
-       double softmin, softmax /*, step, precision*/;
-       
+       /* ideally we would not limit this but practially, its more then
+        * enough worst case is very long vectors wont use a smart soft-range
+        * which isnt so bad. */
+
        if(but->rnaprop) {
-               type= RNA_property_type(but->rnaprop);
+               const PropertyType type= RNA_property_type(but->rnaprop);
+               double softmin, softmax /*, step, precision*/;
+               double value_min= value;
+               double value_max= value;
 
                /* clamp button range to something reasonable in case
                 * we get -inf/inf from RNA properties */
                if(type == PROP_INT) {
                        int imin, imax, istep;
+                       const int array_len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
 
                        RNA_property_int_ui_range(&but->rnapoin, but->rnaprop, &imin, &imax, &istep);
                        softmin= (imin == INT_MIN)? -1e4: imin;
                        softmax= (imin == INT_MAX)? 1e4: imax;
                        /*step= istep;*/ /*UNUSED*/
                        /*precision= 1;*/ /*UNUSED*/
+
+                       if(array_len >= 2) {
+                               int value_range[2];
+                               RNA_property_int_get_array_range(&but->rnapoin, but->rnaprop, value_range);
+                               value_min= (double)value_range[0];
+                               value_max= (double)value_range[1];
+                       }
                }
                else if(type == PROP_FLOAT) {
                        float fmin, fmax, fstep, fprecision;
+                       const int array_len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
 
                        RNA_property_float_ui_range(&but->rnapoin, but->rnaprop, &fmin, &fmax, &fstep, &fprecision);
                        softmin= (fmin == -FLT_MAX)? (float)-1e4: fmin;
                        softmax= (fmax == FLT_MAX)? (float)1e4: fmax;
                        /*step= fstep;*/ /*UNUSED*/
                        /*precision= fprecision;*/ /*UNUSED*/
+
+                       if(array_len >= 2) {
+                               float value_range[2];
+                               RNA_property_float_get_array_range(&but->rnapoin, but->rnaprop, value_range);
+                               value_min= (double)value_range[0];
+                               value_max= (double)value_range[1];
+                       }
                }
                else
                        return;
 
                /* if the value goes out of the soft/max range, adapt the range */
-               if(value+1e-10 < softmin) {
-                       if(value < 0.0)
-                               softmin= -soft_range_round_up(-value, -softmin);
+               if(value_min+1e-10 < softmin) {
+                       if(value_min < 0.0)
+                               softmin= -soft_range_round_up(-value_min, -softmin);
                        else
-                               softmin= soft_range_round_down(value, softmin);
+                               softmin= soft_range_round_down(value_min, softmin);
 
                        if(softmin < (double)but->hardmin)
                                softmin= (double)but->hardmin;
                }
-               else if(value-1e-10 > softmax) {
-                       if(value < 0.0)
-                               softmax= -soft_range_round_down(-value, -softmax);
+               else if(value_max-1e-10 > softmax) {
+                       if(value_max < 0.0)
+                               softmax= -soft_range_round_down(-value_max, -softmax);
                        else
-                               softmax= soft_range_round_up(value, softmax);
+                               softmax= soft_range_round_up(value_max, softmax);
 
                        if(softmax > (double)but->hardmax)
                                softmax= but->hardmax;
@@ -1974,17 +2001,19 @@ void uiBlockSetEmboss(uiBlock *block, char dt)
 void ui_check_but(uiBut *but)
 {
        /* if something changed in the button */
-       double value;
+       double value= UI_BUT_VALUE_UNSET;
 //     float okwidth; // UNUSED
 //     int transopts= ui_translate_buttons();
        
-       ui_is_but_sel(but);
+       ui_is_but_sel(but, &value);
        
 //     if(but->type==TEX || but->type==IDPOIN) transopts= 0;
 
        /* only update soft range while not editing */
-       if(but->rnaprop && !(but->editval || but->editstr || but->editvec))
-               ui_set_but_soft_range(but, ui_get_but_val(but));
+       if(but->rnaprop && !(but->editval || but->editstr || but->editvec)) {
+               UI_GET_BUT_VALUE_INIT(but, value)
+               ui_set_but_soft_range(but, value);
+       }
 
        /* test for min and max, icon sliders, etc */
        switch( but->type ) {
@@ -1993,17 +2022,20 @@ void ui_check_but(uiBut *but)
                case SCROLL:
                case NUMSLI:
                case HSVSLI:
-                       value= ui_get_but_val(but);
+                       UI_GET_BUT_VALUE_INIT(but, value)
                        if(value < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
                        else if(value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
                        break;
                        
                case NUMABS:
-                       value= fabs( ui_get_but_val(but) );
-                       if(value < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
-                       else if(value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
+               {
+                       double value_abs;
+                       UI_GET_BUT_VALUE_INIT(but, value)
+                       value_abs= fabs(value);
+                       if(value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
+                       else if(value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
                        break;
-                       
+               }
                case ICONTOG: 
                case ICONTOGN:
                        if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
@@ -2014,14 +2046,14 @@ void ui_check_but(uiBut *but)
                        
                case ICONROW:
                        if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
-                               value= ui_get_but_val(but);
+                               UI_GET_BUT_VALUE_INIT(but, value)
                                but->iconadd= (int)value- (int)(but->hardmin);
                        }
                        break;
                        
                case ICONTEXTROW:
                        if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
-                               value= ui_get_but_val(but);
+                               UI_GET_BUT_VALUE_INIT(but, value)
                                but->iconadd= (int)value- (int)(but->hardmin);
                        }
                        break;
@@ -2038,7 +2070,7 @@ void ui_check_but(uiBut *but)
        case ICONTEXTROW:
                
                if(but->x2 - but->x1 > 24) {
-                       value= ui_get_but_val(but);
+                       UI_GET_BUT_VALUE_INIT(but, value)
                        ui_set_name_menu(but, (int)value);
                }
                break;
@@ -2048,7 +2080,7 @@ void ui_check_but(uiBut *but)
        case HSVSLI:
        case NUMABS:
 
-               value= ui_get_but_val(but);
+               UI_GET_BUT_VALUE_INIT(but, value)
 
                if(ui_is_but_float(but)) {
                        if(value == (double) FLT_MAX) sprintf(but->drawstr, "%sinf", but->str);
@@ -2079,7 +2111,7 @@ void ui_check_but(uiBut *but)
        case LABEL:
                if(ui_is_but_float(but)) {
                        int prec;
-                       value= ui_get_but_val(but);
+                       UI_GET_BUT_VALUE_INIT(but, value)
                        prec= ui_but_float_precision(but, value);
                        BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value);
                }
@@ -2105,8 +2137,10 @@ void ui_check_but(uiBut *but)
                strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
                if (but->flag & UI_SELECT) {
                        strcat(but->drawstr, "Press a key");
-               } else {
-                       strcat(but->drawstr, WM_key_event_string((short) ui_get_but_val(but)));
+               }
+               else {
+                       UI_GET_BUT_VALUE_INIT(but, value)
+                       strcat(but->drawstr, WM_key_event_string((short)value));
                }
                break;
                
index 55c1488291bac10007a72a2b52ac617531e1fb21..79a90fb9d1dd11fd70e8381149a66e7a42c40b21 100644 (file)
@@ -534,7 +534,10 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n
                uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w-UI_UNIT_X, h);
 
                /* BUTTONS_OT_file_browse calls uiFileBrowseContextProperty */
-               but= uiDefIconButO(block, BUT, "BUTTONS_OT_file_browse", WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
+               but= uiDefIconButO(block, BUT, subtype==PROP_DIRPATH ?
+                                      "BUTTONS_OT_directory_browse" :
+                                      "BUTTONS_OT_file_browse",
+                                  WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
        }
        else if(flag & UI_ITEM_R_EVENT) {
                uiDefButR(block, KEYEVT, 0, name, x, y, w, h, ptr, RNA_property_identifier(prop), index, 0, 0, -1, -1, NULL);
index 623651083d24c470405b90f4135cfa58349c168c..62043f240e453fb6c44b4e38578edbb196226cb8 100644 (file)
@@ -2582,6 +2582,25 @@ void uiPupBlock(bContext *C, uiBlockCreateFunc func, void *arg)
        uiPupBlockO(C, func, arg, NULL, 0);
 }
 
+void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockCancelFunc cancel_func, void *arg)
+{
+       wmWindow *window= CTX_wm_window(C);
+       uiPopupBlockHandle *handle;
+       
+       handle= ui_popup_block_create(C, NULL, NULL, func, NULL, arg);
+       handle->popup= 1;
+       handle->retvalue= 1;
+
+       handle->popup_arg= arg;
+       // handle->popup_func= operator_cb;
+       handle->cancel_func= cancel_func;
+       // handle->opcontext= opcontext;
+       
+       UI_add_popup_handlers(C, &window->modalhandlers, handle);
+       WM_event_add_mousemove(C);
+}
+
+#if 0 /* UNUSED */
 void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int opcontext)
 {
        wmWindow *window= CTX_wm_window(C);
@@ -2599,6 +2618,7 @@ void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int
        UI_add_popup_handlers(C, &window->modalhandlers, handle);
        WM_event_add_mousemove(C);
 }
+#endif
 
 void uiPupBlockClose(bContext *C, uiBlock *block)
 {
index 6527e0140b83da92bd7a9f815680ec3a7c550c28..3f825762d74b41fba94dc0e78e47b0d5ac63aa61 100644 (file)
@@ -1580,6 +1580,8 @@ void init_userdef_do_versions(void)
                U.dragthreshold= 5;
        if (U.widget_unit==0)
                U.widget_unit= (U.dpi * 20 + 36)/72;
+       if (U.anisotropic_filter <= 0)
+               U.anisotropic_filter = 1;
 
        /* funny name, but it is GE stuff, moves userdef stuff to engine */
 // XXX space_set_commmandline_options();
index 7fb622e41be8cf58952dddde0bd415b3c8ee2a5d..c4a302d4d188d15ba0de0295f97eff8a943e7ab6 100644 (file)
@@ -43,7 +43,6 @@
 #include "DNA_scene_types.h"
 #include "DNA_view3d_types.h"
 
-#include "BLI_utildefines.h"
 #include "BLI_math.h"
 #include "BLI_editVert.h"
 #include "BLI_edgehash.h"
@@ -57,7 +56,6 @@
 #include "BKE_material.h"
 #include "BKE_mesh.h"
 #include "BKE_report.h"
-#include "BKE_tessmesh.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
 
 #include "mesh_intern.h"
 
-#define GET_CD_DATA(me, data) (me->edit_btmesh ? &me->edit_btmesh->bm->data : &me->data)
-
 static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *layer)
 {
        Mesh *me = ob->data;
-       CustomData *data;
+       CustomData *data= (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
        void *actlayerdata, *rndlayerdata, *clonelayerdata, *stencillayerdata, *layerdata=layer->data;
        int type= layer->type;
-       int index;
-       int i, actindex, rndindex, cloneindex, stencilindex, tot;
-       
-       if (layer->type == CD_MLOOPCOL || layer->type == CD_MLOOPUV) {
-               data = (me->edit_btmesh)? &me->edit_btmesh->bm->ldata: &me->ldata;
-               tot = me->totloop;
-       } else {
-               data = (me->edit_btmesh)? &me->edit_btmesh->bm->pdata: &me->pdata;
-               tot = me->totpoly;
-       }
+       int index= CustomData_get_layer_index(data, type);
+       int i, actindex, rndindex, cloneindex, stencilindex;
        
-       index = CustomData_get_layer_index(data, type);
-
        /* ok, deleting a non-active layer needs to preserve the active layer indices.
          to do this, we store a pointer to the .data member of both layer and the active layer,
          (to detect if we're deleting the active layer or not), then use the active
@@ -108,15 +94,15 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
        stencillayerdata = data->layers[CustomData_get_stencil_layer_index(data, type)].data;
        CustomData_set_layer_active(data, type, layer - &data->layers[index]);
 
-       if(me->edit_btmesh) {
-               BM_free_data_layer(me->edit_btmesh->bm, data, type);
+       if(me->edit_mesh) {
+               EM_free_data_layer(me->edit_mesh, data, type);
        }
        else {
-               CustomData_free_layer_active(data, type, tot);
+               CustomData_free_layer_active(data, type, me->totface);
                mesh_update_customdata_pointers(me);
        }
 
-       if(!CustomData_has_layer(data, type) && (type == CD_MLOOPCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
+       if(!CustomData_has_layer(data, type) && (type == CD_MCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
                ED_object_toggle_modes(C, OB_MODE_VERTEX_PAINT);
 
        /* reconstruct active layer */
@@ -177,13 +163,8 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
        }
 }
 
-static void copy_editface_active_customdata(BMEditMesh *em, int type, int index)
+static void copy_editface_active_customdata(EditMesh *em, int type, int index)
 {
-#if 1 /*BMESH_TODO*/
-       (void)em;
-       (void)type;
-       (void)index;
-#else
        EditFace *efa;
        int n= CustomData_get_active_layer(&em->fdata, type);
 
@@ -191,56 +172,41 @@ static void copy_editface_active_customdata(BMEditMesh *em, int type, int index)
                void *data= CustomData_em_get_n(&em->fdata, efa->data, type, n);
                CustomData_em_set_n(&em->fdata, efa->data, type, index, data);
        }
-#endif
 }
 
 int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_set)
 {
-       BMEditMesh *em;
+       EditMesh *em;
        int layernum;
 
-       if(me->edit_btmesh) {
-               em= me->edit_btmesh;
+       if(me->edit_mesh) {
+               em= me->edit_mesh;
 
-               layernum= CustomData_number_of_layers(&em->bm->pdata, CD_MTEXPOLY);
+               layernum= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
                if(layernum >= MAX_MTFACE)
                        return 0;
 
-               BM_add_data_layer(em->bm, &em->bm->pdata, CD_MTEXPOLY);
-               CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum);
-               CustomData_set_layer_name(&em->bm->pdata, CD_MTEXPOLY, layernum, name);
+               EM_add_data_layer(em, &em->fdata, CD_MTFACE, name);
 
                if(layernum) /* copy data from active UV */
                        copy_editface_active_customdata(em, CD_MTFACE, layernum);
 
                if(active_set || layernum==0)
-                       CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum);
-
-               BM_add_data_layer(em->bm, &em->bm->ldata, CD_MLOOPUV);
-               CustomData_set_layer_name(&em->bm->ldata, CD_MLOOPUV, layernum, name);
-               
-               CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPUV, layernum);
-               if(active_set || layernum==0)
-                       CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPUV, layernum);
+                       CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum);
        }
        else {
-               layernum= CustomData_number_of_layers(&me->pdata, CD_MTEXPOLY);
+               layernum= CustomData_number_of_layers(&me->fdata, CD_MTFACE);
                if(layernum >= MAX_MTFACE)
                        return 0;
 
-               if(me->mtpoly) {
-                       CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DUPLICATE, me->mtpoly, me->totpoly, name);
-                       CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DUPLICATE, me->mloopuv, me->totloop, name);
-               } else {
-                       CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DEFAULT, NULL, me->totpoly, name);
-                       CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, me->totloop, name);
-               }
-               
-               if(active_set || layernum==0) {
-                       CustomData_set_layer_active(&me->pdata, CD_MTEXPOLY, layernum);
-                       CustomData_set_layer_active(&me->ldata, CD_MLOOPUV, layernum);
-               }
-               
+               if(me->mtface)
+                       CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DUPLICATE, me->mtface, me->totface, name);
+               else
+                       CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface, name);
+
+               if(active_set || layernum==0)
+                       CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum);
+
                mesh_update_customdata_pointers(me);
        }
 
@@ -252,22 +218,17 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
 
 int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
 {
-       CustomData *pdata = GET_CD_DATA(me, pdata), *ldata = GET_CD_DATA(me, ldata);
-       CustomDataLayer *cdlp, *cdlu;
+       CustomData *data= (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
+       CustomDataLayer *cdl;
        int index;
 
-       index= CustomData_get_active_layer_index(pdata, CD_MTEXPOLY);
-       cdlp= (index == -1)? NULL: &pdata->layers[index];
+       index= CustomData_get_active_layer_index(data, CD_MTFACE);
+       cdl= (index == -1) ? NULL: &data->layers[index];
 
-       index= CustomData_get_active_layer_index(ldata, CD_MLOOPUV);
-       cdlu= (index == -1)? NULL: &ldata->layers[index];
-       
-       if (!cdlp || !cdlu)
+       if(!cdl)
                return 0;
 
-       delete_customdata_layer(C, ob, cdlp);
-       delete_customdata_layer(C, ob, cdlu);
-       
+       delete_customdata_layer(C, ob, cdl);
        DAG_id_tag_update(&me->id, 0);
        WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
 
@@ -276,49 +237,41 @@ int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
 
 int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mesh *me, const char *name, int active_set)
 {
-       BMEditMesh *em;
-       MLoopCol *mcol;
+       EditMesh *em;
+       MCol *mcol;
        int layernum;
 
-       if(me->edit_btmesh) {
-               em= me->edit_btmesh;
+       if(me->edit_mesh) {
+               em= me->edit_mesh;
 
-               layernum= CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL);
+               layernum= CustomData_number_of_layers(&em->fdata, CD_MCOL);
                if(layernum >= MAX_MCOL)
                        return 0;
 
-               BM_add_data_layer(em->bm, &em->bm->pdata, CD_MLOOPCOL);
-               CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum);
-
+               EM_add_data_layer(em, &em->fdata, CD_MCOL, name);
 
                if(layernum) /* copy data from active vertex color layer */
                        copy_editface_active_customdata(em, CD_MCOL, layernum);
 
                if(active_set || layernum==0)
-                       CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum);
-
+                       CustomData_set_layer_active(&em->fdata, CD_MCOL, layernum);
        }
        else {
-               layernum= CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL);
-               if(layernum >= CD_MLOOPCOL)
+               layernum= CustomData_number_of_layers(&me->fdata, CD_MCOL);
+               if(layernum >= MAX_MCOL)
                        return 0;
 
-               mcol= me->mloopcol;
+               mcol= me->mcol;
 
-               if(me->mloopcol)
-                       CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop, name);
+               if(me->mcol)
+                       CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mcol, me->totface, name);
                else
-                       CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name);
+                       CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface, name);
 
                if(active_set || layernum==0)
-                       CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum);
+                       CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
 
                mesh_update_customdata_pointers(me);
-
-               /*BMESH_TODO
-               if(!mcol)
-                       shadeMeshMCol(scene, ob, me);
-               */
        }
 
        DAG_id_tag_update(&me->id, 0);
@@ -329,11 +282,12 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes
 
 int ED_mesh_color_remove(bContext *C, Object *ob, Mesh *me)
 {
+       CustomData *data= (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
        CustomDataLayer *cdl;
        int index;
 
-       index= CustomData_get_active_layer_index(&me->ldata, CD_MLOOPCOL);
-       cdl= (index == -1)? NULL: &me->ldata.layers[index];
+        index= CustomData_get_active_layer_index(data, CD_MCOL);
+       cdl= (index == -1)? NULL: &data->layers[index];
 
        if(!cdl)
                return 0;
@@ -414,25 +368,25 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
                return OPERATOR_CANCELLED;
        }
        
-       /* put mesh in editmode */
+       /* turn mesh in editmode */
+       /* BKE_mesh_get/end_editmesh: ED_uvedit_assign_image also calls this */
 
        obedit= base->object;
        me= obedit->data;
-       if(me->edit_btmesh==NULL) {
-               EDBM_MakeEditBMesh(scene->toolsettings, scene, obedit);
+       if(me->edit_mesh==NULL) {
+               make_editMesh(scene, obedit);
                exitmode= 1;
        }
-
-       if(me->edit_btmesh==NULL)
+       if(me->edit_mesh==NULL)
                return OPERATOR_CANCELLED;
        
        ED_uvedit_assign_image(scene, obedit, ima, NULL);
 
        if(exitmode) {
-               EDBM_LoadEditBMesh(scene, obedit);
-               EDBM_FreeEditBMesh(me->edit_btmesh);
-               MEM_freeN(me->edit_btmesh);
-               me->edit_btmesh= NULL;
+               load_editMesh(scene, obedit);
+               free_editMesh(me->edit_mesh);
+               MEM_freeN(me->edit_mesh);
+               me->edit_mesh= NULL;
        }
 
        /* dummie drop support; ensure view shows a result :) */
@@ -618,7 +572,7 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges)
        if(calc_edges || (mesh->totface && mesh->totedge == 0))
                BKE_mesh_calc_edges(mesh, calc_edges);
 
-       mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
+       mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mface, mesh->totface, NULL);
 
        DAG_id_tag_update(&mesh->id, 0);
        WM_event_add_notifier(C, NC_GEOM|ND_DATA, mesh);
@@ -654,15 +608,15 @@ static void mesh_add_verts(Mesh *mesh, int len)
        mesh->totvert= totvert;
 }
 
-void ED_mesh_transform(Mesh *mesh, float *mat)
+void ED_mesh_transform(Mesh *me, float *mat)
 {
        int i;
-       MVert *mvert= mesh->mvert;
+       MVert *mvert= me->mvert;
 
-       for(i= 0; i < mesh->totvert; i++, mvert++)
+       for(i= 0; i < me->totvert; i++, mvert++)
                mul_m4_v3((float (*)[4])mat, mvert->co);
 
-       mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
+       mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
 }
 
 static void mesh_add_edges(Mesh *mesh, int len)
@@ -728,7 +682,7 @@ static void mesh_add_faces(Mesh *mesh, int len)
 /*
 void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
 {
-       if(mesh->edit_btmesh) {
+       if(mesh->edit_mesh) {
                BKE_report(reports, RPT_ERROR, "Can't add geometry in edit mode.");
                return;
        }
@@ -744,18 +698,19 @@ void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges,
 
 void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
 {
-       if(mesh->edit_btmesh) {
+       if(mesh->edit_mesh) {
                BKE_report(reports, RPT_ERROR, "Can't add faces in edit mode.");
                return;
        }
+
        mesh_add_faces(mesh, count);
 }
 
 void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
 {
-       if(mesh->edit_btmesh) {
+       if(mesh->edit_mesh) {
                BKE_report(reports, RPT_ERROR, "Can't add edges in edit mode.");
-                       return;
+               return;
        }
 
        mesh_add_edges(mesh, count);
@@ -763,7 +718,7 @@ void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
 
 void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
 {
-       if(mesh->edit_btmesh) {
+       if(mesh->edit_mesh) {
                BKE_report(reports, RPT_ERROR, "Can't add vertices in edit mode.");
                return;
        }
@@ -771,8 +726,7 @@ void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
        mesh_add_verts(mesh, count);
 }
 
-void ED_mesh_calc_normals(Mesh *mesh)
+void ED_mesh_calc_normals(Mesh *me)
 {
-       mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, NULL, NULL, 0, NULL, NULL);
+       mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
 }
-
index d267ac8565cc9fd0602366eb5a3852b1e7e588cb..c758954b235c1517ecf1bd1b25996577dc227130 100644 (file)
@@ -827,8 +827,6 @@ static int object_delete_exec(bContext *C, wmOperator *UNUSED(op))
        }
        CTX_DATA_END;
 
-       if(islamp) reshadeall_displist(scene);  /* only frees displist */
-
        DAG_scene_sort(bmain, scene);
        DAG_ids_flush_update(bmain, 0);
        
index a43ad05e236657d130332c3e3029e1793ffb8a23..1ba2f3541ece709e74fa614b84fe3bdae6716cc7 100644 (file)
@@ -1124,8 +1124,6 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
                }
                CTX_DATA_END;
        }
-
-       if(islamp) reshadeall_displist(scene);  /* only frees */
        
        /* warning, active object may be hidden now */
        
index 925223b43ea92a8fa43ad7f1eb4efe7fa752c54f..d25bd7940ab68c77fb73c03a8ebd1ca5f00eaea1 100644 (file)
@@ -71,6 +71,7 @@ extern const char *buttons_context_dir[]; /* doc access */
 
 /* buttons_ops.c */
 void BUTTONS_OT_file_browse(struct wmOperatorType *ot);
+void BUTTONS_OT_directory_browse(struct wmOperatorType *ot);
 void BUTTONS_OT_toolbox(struct wmOperatorType *ot);
 
 #endif /* ED_BUTTONS_INTERN_H */
index 9b914df1b3c85a7cb67ed60ee0f7d6f682709395..99e5c6d693ee978d3d9dbd070605bf739a8b078a 100644 (file)
@@ -104,11 +104,12 @@ static int file_browse_exec(bContext *C, wmOperator *op)
        FileBrowseOp *fbo= op->customdata;
        ID *id;
        char *base, *str, path[FILE_MAX];
+       const char *path_prop= RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath";
        
-       if (RNA_property_is_set(op->ptr, "filepath")==0 || fbo==NULL)
+       if (RNA_property_is_set(op->ptr, path_prop)==0 || fbo==NULL)
                return OPERATOR_CANCELLED;
        
-       str= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
+       str= RNA_string_get_alloc(op->ptr, path_prop, NULL, 0);
 
        /* add slash for directories, important for some properties */
        if(RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
@@ -191,12 +192,13 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
                return OPERATOR_CANCELLED;
        }
        else {
+               const char *path_prop= RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath";
                fbo= MEM_callocN(sizeof(FileBrowseOp), "FileBrowseOp");
                fbo->ptr= ptr;
                fbo->prop= prop;
                op->customdata= fbo;
 
-               RNA_string_set(op->ptr, "filepath", str);
+               RNA_string_set(op->ptr, path_prop, str);
                MEM_freeN(str);
 
                if(RNA_struct_find_property(op->ptr, "relative_path")) {
@@ -227,3 +229,19 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot)
        WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
 }
 
+/* second operator, only difference from BUTTONS_OT_file_browse is WM_FILESEL_DIRECTORY */
+void BUTTONS_OT_directory_browse(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Accept";
+       ot->description="Open a directory browser, Hold Shift to open the file, Alt to browse containing directory";
+       ot->idname= "BUTTONS_OT_directory_browse";
+
+       /* api callbacks */
+       ot->invoke= file_browse_invoke;
+       ot->exec= file_browse_exec;
+       ot->cancel= file_browse_cancel;
+
+       /* properties */
+       WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH);
+}
index 16c4df59420f770be488ca058aff1bf128beddcd..e2d80e9e7758a8b02693ba095a0298dcf696cdbf 100644 (file)
@@ -187,6 +187,7 @@ static void buttons_operatortypes(void)
 {
        WM_operatortype_append(BUTTONS_OT_toolbox);
        WM_operatortype_append(BUTTONS_OT_file_browse);
+       WM_operatortype_append(BUTTONS_OT_directory_browse);
 }
 
 static void buttons_keymap(struct wmKeyConfig *keyconf)
index a6fee35919755d2a29ab53a26cb3059e22a7455b..9fecfda7764f96481551feca21eb463c1a4aeca8 100644 (file)
@@ -185,16 +185,18 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
                uiButSetCompleteFunc(but, autocomplete_directory, NULL);
                uiButSetFlag(but, UI_BUT_NO_UTF8);
 
-               but = uiDefBut(block, TEX, B_FS_FILENAME, "",
-                                min_x, line2_y, line2_w-chan_offs, btn_h,
-                                params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, 
-                                overwrite_alert ?"File name, overwrite existing." : "File name.");
-               uiButSetCompleteFunc(but, autocomplete_file, NULL);
-               uiButSetFlag(but, UI_BUT_NO_UTF8);
-               
-               /* check if this overrides a file and if the operator option is used */
-               if(overwrite_alert) {
-                       uiButSetFlag(but, UI_BUT_REDALERT);
+               if((params->flag & FILE_DIRSEL_ONLY) == 0) {
+                       but = uiDefBut(block, TEX, B_FS_FILENAME, "",
+                                        min_x, line2_y, line2_w-chan_offs, btn_h,
+                                        params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0,
+                                        overwrite_alert ?"File name, overwrite existing." : "File name.");
+                       uiButSetCompleteFunc(but, autocomplete_file, NULL);
+                       uiButSetFlag(but, UI_BUT_NO_UTF8);
+
+                       /* check if this overrides a file and if the operator option is used */
+                       if(overwrite_alert) {
+                               uiButSetFlag(but, UI_BUT_REDALERT);
+                       }
                }
                
                /* clear func */
@@ -202,7 +204,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
        }
        
        /* Filename number increment / decrement buttons. */
-       if (fnumbuttons) {
+       if (fnumbuttons && (params->flag & FILE_DIRSEL_ONLY) == 0) {
                uiBlockBeginAlign(block);
                but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMOUT,
                                min_x + line2_w + separator - chan_offs, line2_y, 
index a5d516a14175fac69e3708c8aa633f248af3feaf..11e7040d4c9e172ca67f4d095932e68c33f14288 100644 (file)
@@ -205,9 +205,10 @@ static FileSelect file_select(bContext* C, const rcti* rect, FileSelType select,
        SpaceFile *sfile= CTX_wm_space_file(C);
        FileSelect retval = FILE_SELECT_NOTHING;
        FileSelection sel= file_selection_get(C, rect, fill); /* get the selection */
+       const FileCheckType check_type= (sfile->params->flag & FILE_DIRSEL_ONLY) ? CHECK_DIRS : CHECK_ALL;
        
        /* flag the files as selected in the filelist */
-       filelist_select(sfile->files, &sel, select, SELECTED_FILE, CHECK_ALL);
+       filelist_select(sfile->files, &sel, select, SELECTED_FILE, check_type);
        
        /* Don't act on multiple selected files */
        if (sel.first != sel.last) select = 0;
@@ -216,7 +217,7 @@ static FileSelect file_select(bContext* C, const rcti* rect, FileSelType select,
        if ( (sel.last >= 0) && ((select == FILE_SEL_ADD) || (select == FILE_SEL_TOGGLE)) )
        {
                /* Check last selection, if selected, act on the file or dir */
-               if (filelist_is_selected(sfile->files, sel.last, CHECK_ALL)) {
+               if (filelist_is_selected(sfile->files, sel.last, check_type)) {
                        retval = file_select_do(C, sel.last);
                }
        }
@@ -378,8 +379,10 @@ static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op))
        /* select all only if previously no file was selected */
        if (is_selected) {
                filelist_select(sfile->files, &sel, FILE_SEL_REMOVE, SELECTED_FILE, CHECK_ALL);
-       } else {
-               filelist_select(sfile->files, &sel, FILE_SEL_ADD, SELECTED_FILE, CHECK_FILES);
+       }
+       else {
+               const FileCheckType check_type= (sfile->params->flag & FILE_DIRSEL_ONLY) ? CHECK_DIRS : CHECK_FILES;
+               filelist_select(sfile->files, &sel, FILE_SEL_ADD, SELECTED_FILE, check_type);
        }
        ED_area_tag_redraw(sa);
        return OPERATOR_FINISHED;
index 32b725e0b1f40fc3e67ec6d5498aa801b1f07bc8..6736230e84fc28568112a1f9b864be312bb0b67c 100644 (file)
@@ -915,6 +915,8 @@ void filelist_select_file(struct FileList* filelist, int index, FileSelType sele
                int check_ok = 0; 
                switch (check) {
                        case CHECK_DIRS:
+                               check_ok = S_ISDIR(file->type);
+                               break;
                        case CHECK_ALL:
                                check_ok = 1;
                                break;
index 45193a38ef5de0d6ec5a3343911102d3dd745a6d..3dbfdc9f7d003178c30cd5a67df43f6e610e919e 100644 (file)
@@ -121,6 +121,9 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 
        /* set the parameters from the operator, if it exists */
        if (op) {
+               short is_filename= FALSE;
+               short is_dir= FALSE;
+
                BLI_strncpy(params->title, op->type->name, sizeof(params->title));
 
                if(RNA_struct_find_property(op->ptr, "filemode"))
@@ -128,7 +131,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                else
                        params->type = FILE_SPECIAL;
 
-               if (RNA_struct_find_property(op->ptr, "filepath") && RNA_property_is_set(op->ptr, "filepath")) {
+               if ((is_dir= is_filename= RNA_struct_find_property(op->ptr, "filepath")!=NULL) && RNA_property_is_set(op->ptr, "filepath")) {
                        char name[FILE_MAX];
                        RNA_string_get(op->ptr, "filepath", name);
                        if (params->type == FILE_LOADLIB) {
@@ -140,12 +143,13 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                        }
                }
                else {
-                       if (RNA_struct_find_property(op->ptr, "directory") && RNA_property_is_set(op->ptr, "directory")) {
+                       if ((is_dir= RNA_struct_find_property(op->ptr, "directory")!=NULL) && RNA_property_is_set(op->ptr, "directory")) {
                                RNA_string_get(op->ptr, "directory", params->dir);
                                sfile->params->file[0]= '\0';
+                               is_dir= TRUE;
                        }
 
-                       if (RNA_struct_find_property(op->ptr, "filename") && RNA_property_is_set(op->ptr, "filename")) {
+                       if ((is_filename= RNA_struct_find_property(op->ptr, "filename")!=NULL) && RNA_property_is_set(op->ptr, "filename")) {
                                RNA_string_get(op->ptr, "filename", params->file);
                        }
                }
@@ -155,6 +159,13 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                        BLI_path_abs(params->dir, G.main->name);
                }
 
+               if(is_dir==TRUE && is_filename==FALSE) {
+                       params->flag |= FILE_DIRSEL_ONLY;
+               }
+               else {
+                       params->flag &= ~FILE_DIRSEL_ONLY;
+               }
+
                params->filter = 0;
                if(RNA_struct_find_property(op->ptr, "filter_blender"))
                        params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
@@ -216,10 +227,12 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                        params->display= FILE_SHORTDISPLAY;
                }
 
-       } else {
+       }
+       else {
                /* default values, if no operator */
                params->type = FILE_UNIX;
                params->flag |= FILE_HIDE_DOT;
+               params->flag &= ~FILE_DIRSEL_ONLY;
                params->display = FILE_SHORTDISPLAY;
                params->filter = 0;
                params->filter_glob[0] = '\0';
index 46c66c55d51663296c5a151506e8689b02c8291d..71dd7b02e1cdbc6d9ab4d533e6c477f75619fbdb 100644 (file)
@@ -504,14 +504,7 @@ void node_set_active(SpaceNode *snode, bNode *node)
                                        ED_node_changed_update(snode->id, node);
                        }
 
-                       // XXX
-#if 0
-                       if(node->id)
-                               ; // XXX BIF_preview_changed(-1);       /* temp hack to force texture preview to update */
-                       
-                       // allqueue(REDRAWBUTSSHADING, 1);
-                       // allqueue(REDRAWIPO, 0);
-#endif
+                       WM_main_add_notifier(NC_MATERIAL|ND_NODES, node->id);
                }
                else if(snode->treetype==NTREE_COMPOSIT) {
                        Scene *scene= (Scene*)snode->id;
index 29316c5645ac1558ab2e64c99feece58b3daaf2f..029c55d08513aa085c29b5c6f4135a18200fd43b 100644 (file)
@@ -200,6 +200,9 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
                                        ED_area_tag_refresh(sa);
                                else if(wmn->data==ND_SHADING_DRAW)
                                        ED_area_tag_refresh(sa);
+                               else if(wmn->action==NA_ADDED && snode->edittree)
+                                       nodeSetActiveID(snode->edittree, ID_MA, wmn->reference);
+                                       
                        }
                        break;
                case NC_TEXTURE:
index bd2d591a8c8c2df602191ef0c00fe27670ac2bbe..57dec68f68feed129ff957cd9679f0853ed5de41 100644 (file)
@@ -1763,7 +1763,7 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
        ot->exec= outliner_toggle_expanded_exec;
        ot->poll= ED_operator_outliner_active;
        
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       /* no undo or registry, UI option */
 }
 
 /* --- */
@@ -1798,7 +1798,7 @@ void OUTLINER_OT_selected_toggle(wmOperatorType *ot)
        ot->exec= outliner_toggle_selected_exec;
        ot->poll= ED_operator_outliner_active;
        
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       /* no undo or registry, UI option */
 }
 
 /* --- */
@@ -1855,7 +1855,7 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot)
        ot->exec= outliner_one_level_exec;
        ot->poll= ED_operator_outliner_active;
        
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       /* no undo or registry, UI option */
        
        /* properties */
        RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep.");
@@ -3050,7 +3050,7 @@ void OUTLINER_OT_show_hierarchy(wmOperatorType *ot)
        ot->exec= outliner_show_hierarchy_exec;
        ot->poll= ED_operator_outliner_active; //  TODO: shouldn't be allowed in RNA views...
        
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       /* no undo or registry, UI option */
 }
 
 void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
index 7c66cec5730e9e6c4f11ba32b106f9eee948406e..02a7ea890f5b9f7b473f87c20a43e2c5017b96ff 100644 (file)
@@ -1577,7 +1577,7 @@ static void bone_matrix_translate_y(float mat[][4], float y)
 }
 
 /* assumes object is Armature with pose */
-static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, short ghost)
+static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, const short is_ghost, const short is_outline)
 {
        RegionView3D *rv3d= ar->regiondata;
        Object *ob= base->object;
@@ -1737,7 +1737,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                                                        }
                                                        
                                                        /* prepare colors */
-                                                       if(ghost) {
+                                                       if(is_ghost) {
                                                                /* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */
                                                        }
                                                        else if (arm->flag & ARM_POSEMODE)      
@@ -1905,7 +1905,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                draw_pose_dofs(ob);
 
        /* finally names and axes */
-       if (arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES)) {
+       if (arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES) && is_outline == 0) {
                /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
                if ((G.f & G_PICKSEL) == 0) {
                        float vec[3];
@@ -2259,7 +2259,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
                
                BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
                where_is_pose(scene, ob);
-               draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
+               draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE);
        }
        glDisable(GL_BLEND);
        if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2338,7 +2338,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
                
                BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
                where_is_pose(scene, ob);
-               draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
+               draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE);
        }
        glDisable(GL_BLEND);
        if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2408,7 +2408,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
                        if (CFRA != cfrao) {
                                BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
                                where_is_pose(scene, ob);
-                               draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
+                               draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE);
                        }
                }
                
@@ -2423,7 +2423,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
                        if (CFRA != cfrao) {
                                BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
                                where_is_pose(scene, ob);
-                               draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
+                               draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE);
                        }
                }
        }
@@ -2444,7 +2444,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
 /* ********************************** Armature Drawing - Main ************************* */
 
 /* called from drawobject.c, return 1 if nothing was drawn */
-int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag)
+int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline)
 {
        Object *ob= base->object;
        bArmature *arm= ob->data;
@@ -2510,7 +2510,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
                                        }
                                }       
                        }
-                       draw_pose_bones(scene, v3d, ar, base, dt, FALSE);
+                       draw_pose_bones(scene, v3d, ar, base, dt, FALSE, is_outline);
                        arm->flag &= ~ARM_POSEMODE; 
                        
                        if(ob->mode & OB_MODE_POSE)
index d6beadf9e841ba7a15bfa43365b5b61fb6ac3c22..e9ad8d770dbc583413923649976dfe44ffb2bf62 100644 (file)
@@ -218,7 +218,7 @@ int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt)
        if(ob==OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
                return 0;
        
-       return (scene->gm.matmode == GAME_MAT_GLSL) && (dt >= OB_SHADED);
+       return (scene->gm.matmode == GAME_MAT_GLSL) && (dt > OB_SOLID);
 }
 
 static int check_material_alpha(Base *base, Mesh *me, int glsl)
@@ -2654,7 +2654,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
        const short is_paint_sel= (ob==OBACT && paint_facesel_test(ob));
        int draw_wire = 0;
        int /* totvert,*/ totedge, totface;
-       DispList *dl;
        DerivedMesh *dm= mesh_get_derived_final(scene, ob, scene->customdata_mask);
 
        if(!dm)
@@ -2788,10 +2787,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
                }
        }
        else if(dt==OB_SHADED) {
-               int do_draw= 1; /* to resolve all G.f settings below... */
-               
                if(ob==OBACT) {
-                       do_draw= 0;
                        if(ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
                                /* enforce default material settings */
                                GPU_enable_material(0, NULL);
@@ -2820,38 +2816,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
                                        dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material);
                                }
                        }
-                       else do_draw= 1;
-               }
-               if(do_draw) {
-                       dl = ob->disp.first;
-                       if (!dl || !dl->col1) {
-                               /* release and reload derivedmesh because it might be freed in
-                                  shadeDispList due to a different datamask */
-                               dm->release(dm);
-                               shadeDispList(scene, base);
-                               dl = find_displist(&ob->disp, DL_VERTCOL);
-                               dm= mesh_get_derived_final(scene, ob, scene->customdata_mask);
-                       }
-
-                       if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !draw_wire) {
-                               draw_mesh_object_outline(v3d, ob, dm);
-                       }
-
-                               /* False for dupliframe objects */
-                       if (dl) {
-                               unsigned int *obCol1 = dl->col1;
-                               unsigned int *obCol2 = dl->col2;
-
-                               dm->drawFacesColored(dm, me->flag&ME_TWOSIDED, (unsigned char*) obCol1, (unsigned char*) obCol2);
-                       }
-
-                       if(base->flag & SELECT) {
-                               UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
-                       } else {
-                               UI_ThemeColor(TH_WIRE);
-                       }
-                       if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
-                               dm->drawLooseEdges(dm);
                }
        }
        
@@ -3209,57 +3173,6 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
        glFrontFace(GL_CCW);
 }
 
-static void drawDispListshaded(ListBase *lb, Object *ob)
-{
-       DispList *dl, *dlob;
-       unsigned int *cdata;
-
-       if(lb==NULL) return;
-
-       glShadeModel(GL_SMOOTH);
-       glEnableClientState(GL_VERTEX_ARRAY);
-       glEnableClientState(GL_COLOR_ARRAY);
-       
-       dl= lb->first;
-       dlob= ob->disp.first;
-       while(dl && dlob) {
-               
-               cdata= dlob->col1;
-               if(cdata==NULL) break;
-               
-               switch(dl->type) {
-               case DL_SURF:
-                       if(dl->index) {
-                               glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-                               glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
-                               glDrawElements(GL_QUADS, 4*dl->totindex, GL_UNSIGNED_INT, dl->index);
-                       }                       
-                       break;
-
-               case DL_INDEX3:
-                       
-                       glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-                       glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
-                       glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
-                       break;
-
-               case DL_INDEX4:
-                       
-                       glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-                       glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
-                       glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
-                       break;
-               }
-               
-               dl= dl->next;
-               dlob= dlob->next;
-       }
-       
-       glShadeModel(GL_FLAT);
-       glDisableClientState(GL_VERTEX_ARRAY);
-       glDisableClientState(GL_COLOR_ARRAY);
-}
-
 static void drawCurveDMWired(Object *ob)
 {
        DerivedMesh *dm = ob->derivedFinal;
@@ -3340,10 +3253,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
                                        drawDispListsolid(lb, ob, 1);
                                        GPU_end_object_materials();
                                }
-                               else if(dt == OB_SHADED) {
-                                       if(ob->disp.first==NULL) shadeDispList(scene, base);
-                                       drawDispListshaded(lb, ob);
-                               }
                                else {
                                        GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
                                        glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
@@ -3382,10 +3291,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
                                drawDispListsolid(lb, ob, 1);
                                GPU_end_object_materials();
                        }
-                       else if(dt==OB_SHADED) {
-                               if(ob->disp.first==NULL) shadeDispList(scene, base);
-                               drawDispListshaded(lb, ob);
-                       }
                        else {
                                GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
                                glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
@@ -3411,11 +3316,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
                                        drawDispListsolid(lb, ob, 1);
                                        GPU_end_object_materials();
                                }
-                               else if(dt == OB_SHADED) {
-                                       dl= lb->first;
-                                       if(dl && dl->col1==NULL) shadeDispList(scene, base);
-                                       drawDispListshaded(lb, ob);
-                               }
                                else {
                                        GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
                                        glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
@@ -5611,7 +5511,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
        }
        else if(ob->type==OB_ARMATURE) {
                if(!(ob->mode & OB_MODE_POSE))
-                       draw_armature(scene, v3d, ar, base, OB_WIRE, 0);
+                       draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, TRUE);
        }
 
        glLineWidth(1.0);
@@ -6147,7 +6047,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
                case OB_ARMATURE:
                        if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
                                if(dt>OB_WIRE) GPU_enable_material(0, NULL); // we use default material
-                               empty_object= draw_armature(scene, v3d, ar, base, dt, flag);
+                               empty_object= draw_armature(scene, v3d, ar, base, dt, flag, FALSE);
                                if(dt>OB_WIRE) GPU_disable_material();
                        }
                        break;
@@ -6381,7 +6281,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
                }
        }
 
-       if(dt<OB_SHADED && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+       if(dt<=OB_SOLID && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
                if((ob->gameflag & OB_DYNAMIC) || 
                        ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) {
                        float imat[4][4], vec[3]= {0.0f, 0.0f, 0.0f};
index 573951da4cab7acdf6a62bc18fd11b48620833f7..d316ef50679fad63ae4fd4a2973dab518fb877f5 100644 (file)
@@ -2074,10 +2074,6 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
 CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d)
 {
        CustomDataMask mask= 0;
-       if(v3d->drawtype == OB_SHADED) {
-               /* this includes normals for mesh_create_shadedColors */
-               mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL | CD_MASK_ORCO;
-       }
        if((v3d->drawtype == OB_TEXTURE) || ((v3d->drawtype == OB_SOLID) && (v3d->flag2 & V3D_SOLID_TEX))) {
                mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
 
index cd6bff1ebba17a3517f25053d4ed80a17e04a549..aa92f0d0a590dc0aac6da7929cdbd85757d0afa0 100644 (file)
@@ -120,7 +120,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
 #define V3D_CACHE_TEXT_ASCII           (1<<2)
 
 /* drawarmature.c */
-int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag);
+int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline);
 
 /* drawmesh.c */
 void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect);
index 708a59d65362ae8d1183dc2e8458e87e3ce6018f..b5541feb9aaa558185c1c863a48cd7443c5a6d95 100644 (file)
@@ -98,7 +98,8 @@ typedef struct TransSnap {
        short   modePoint;
        short   modeSelect;
        short   align;
-       short   project;
+       char    project;
+       char    project_self;
        short   peel;
        short   status;
        float   snapPoint[3]; /* snapping from this point */
index a514a6a523c2b2cf8bebbff9407f7a743ec4fa18..e9bced385c4dba106fa18ff763876e4a1da7af97 100644 (file)
@@ -3858,27 +3858,8 @@ void flushTransGraphData(TransInfo *t)
  * seq->depth must be set before running this function so we know if the strips
  * are root level or not
  */
-#define XXX_DURIAN_ANIM_TX_HACK
 static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count, int *flag)
 {
-#ifdef XXX_DURIAN_ANIM_TX_HACK
-       /* hack */
-       if((seq->flag & SELECT)==0 && seq->type & SEQ_EFFECT) {
-               Sequence *seq_t[3];
-               int i;
-
-               seq_t[0]= seq->seq1;
-               seq_t[1]= seq->seq2;
-               seq_t[2]= seq->seq3;
-
-               for(i=0; i<3; i++) {
-                       if (seq_t[i] && ((seq_t[i])->flag & SELECT) && !(seq_t[i]->flag & SEQ_LOCK) && !(seq_t[i]->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)))
-                               seq->flag |= SELECT;
-               }
-       }
-#endif
-
        /* for extend we need to do some tricks */
        if (t->mode == TFM_TIME_EXTEND) {
 
@@ -4238,6 +4219,7 @@ static void freeSeqData(TransInfo *t)
 
 static void createTransSeqData(bContext *C, TransInfo *t)
 {
+#define XXX_DURIAN_ANIM_TX_HACK
 
        View2D *v2d= UI_view2d_fromcontext(C);
        Scene *scene= t->scene;
@@ -4268,6 +4250,24 @@ static void createTransSeqData(bContext *C, TransInfo *t)
                t->frame_side = 'B';
        }
 
+#ifdef XXX_DURIAN_ANIM_TX_HACK
+       {
+               Sequence *seq;
+               for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+                       /* hack */
+                       if((seq->flag & SELECT)==0 && seq->type & SEQ_EFFECT) {
+                               Sequence *seq_user;
+                               int i;
+                               for(i=0; i<3; i++) {
+                                       seq_user= *((&seq->seq1) + i);
+                                       if (seq_user && (seq_user->flag & SELECT) && !(seq_user->flag & SEQ_LOCK) && !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL))) {
+                                               seq->flag |= SELECT;
+                                       }
+                               }
+                       }
+               }
+       }
+#endif
 
        count = SeqTransCount(t, ed->seqbasep, 0);
 
@@ -4287,6 +4287,8 @@ static void createTransSeqData(bContext *C, TransInfo *t)
 
        /* loop 2: build transdata array */
        SeqToTransData_Recursive(t, ed->seqbasep, td, td2d, tdsq);
+
+#undef XXX_DURIAN_ANIM_TX_HACK
 }
 
 
@@ -5210,10 +5212,6 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 #if 0 // TRANSFORM_FIX_ME
        if(resetslowpar)
                reset_slowparents();
-
-       /* note; should actually only be done for all objects when a lamp is moved... (ton) */
-       if(t->spacetype==SPACE_VIEW3D && G.vd->drawtype == OB_SHADED)
-               reshadeall_displist();
 #endif
 }
 
index 7969187d3ec7bb5414c36b9358cbdfc94bf13578..ef96e92222a1c36344b916b9566ced94eeba54ec 100644 (file)
@@ -842,9 +842,6 @@ void recalcData(TransInfo *t)
                                DAG_id_tag_update(&ob->id, OB_RECALC_OB);
                        }
                }
-               
-               if(((View3D*)t->view)->drawtype == OB_SHADED)
-                       reshadeall_displist(t->scene);
        }
 }
 
index 193113a568e3f4a8d6bfacdcaebcbc0df1a6704d..5bf97fd947a88a7adc6ce04f0f724af8dc9ea98a 100644 (file)
@@ -394,7 +394,7 @@ static void initSnappingMode(TransInfo *t)
                        }
                        else
                        {
-                               t->tsnap.modeSelect = SNAP_ALL;
+                               t->tsnap.modeSelect = t->tsnap.project_self ? SNAP_ALL : SNAP_NOT_OBEDIT;
                        }
                }
                /* Particles edit mode*/
@@ -459,6 +459,11 @@ void initSnapping(TransInfo *t, wmOperator *op)
                        {
                                t->tsnap.project = RNA_boolean_get(op->ptr, "use_snap_project");
                        }
+
+                       if (RNA_struct_find_property(op->ptr, "use_snap_project_self"))
+                       {
+                               t->tsnap.project = RNA_boolean_get(op->ptr, "use_snap_project_self");
+                       }
                }
        }
        /* use scene defaults only when transform is modal */
@@ -470,6 +475,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
 
                t->tsnap.align = ((t->settings->snap_flag & SCE_SNAP_ROTATE) == SCE_SNAP_ROTATE);
                t->tsnap.project = ((t->settings->snap_flag & SCE_SNAP_PROJECT) == SCE_SNAP_PROJECT);
+               t->tsnap.project_self = !((t->settings->snap_flag & SCE_SNAP_PROJECT_NO_SELF) == SCE_SNAP_PROJECT_NO_SELF);
                t->tsnap.peel = ((t->settings->snap_flag & SCE_SNAP_PROJECT) == SCE_SNAP_PROJECT);
        }
        
index 18a6f1ba73dfd82737b80e0ce0361389fce7d60f..d75b8db2c4e2f7dc65d0bfd7af6a5108844a4c39 100644 (file)
@@ -112,6 +112,11 @@ void GPU_set_mipmap(int mipmap);
 void GPU_set_linear_mipmap(int linear);
 void GPU_paint_set_mipmap(int mipmap);
 
+/* Anisotropic filtering settings
+ * - these will free textures on changes */
+void GPU_set_anisotropic(float value);
+float GPU_get_anisotropic(void);
+
 /* Image updates and free
  * - these deal with images bound as opengl textures */
 
index 7dfbc52819ef3c8749e8efcea5e914e3c711cc29..87d25ac850aebc0c78a78d90cbb2ef735957a64b 100644 (file)
@@ -246,8 +246,9 @@ static struct GPUTextureState {
        int domipmap, linearmipmap;
 
        int alphamode;
+       float anisotropic;
        MTFace *lasttface;
-} GTS = {0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 1, 0, -1, NULL};
+} GTS = {0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, 1, 0, -1, 1.f, NULL};
 
 /* Mipmap settings */
 
@@ -292,6 +293,26 @@ static GLenum gpu_get_mipmap_filter(int mag)
        }
 }
 
+/* Anisotropic filtering settings */
+void GPU_set_anisotropic(float value)
+{
+       if (GTS.anisotropic != value)
+       {
+               GPU_free_images();
+
+               /* Clamp value to the maximum value the graphics card supports */
+               if (value > GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)
+                       value = GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT;
+
+               GTS.anisotropic = value;
+       }
+}
+
+float GPU_get_anisotropic()
+{
+       return GTS.anisotropic;
+}
+
 /* Set OpenGL state for an MTFace */
 
 static void gpu_make_repbind(Image *ima)
@@ -559,6 +580,8 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
                ima->tpageflag |= IMA_MIPMAP_COMPLETE;
        }
 
+       if (GLEW_EXT_texture_filter_anisotropic)
+               glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic());
        /* set to modulate with vertex color */
        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
                
index c1140bc59a97a0c0d99f7e6b6839d409928cbebc..9ca4dff5bc851917692dbae7d324c06e87856072 100644 (file)
@@ -44,7 +44,7 @@ set(SRC
 )
 
 if(WITH_IMAGE_OPENEXR)
-       list(APPEND INC_SYS ${OPENEXR_INC})
+       list(APPEND INC_SYS ${OPENEXR_INCLUDE_DIRS})
        add_definitions(-DWITH_OPENEXR)
 endif()
 
index 9fd6cd1c3fa6d37399f382f5ce22535953ee9350..7b528ed962452c176260399755e603e620211957 100644 (file)
@@ -76,18 +76,18 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
 #include <IlmImf/ImfStringAttribute.h>
 #include <Imath/ImathBox.h>
 #else
-#include <OpenEXR/half.h>
-#include <OpenEXR/ImfVersion.h>
-#include <OpenEXR/ImathBox.h>
-#include <OpenEXR/ImfArray.h>
-#include <OpenEXR/ImfIO.h>
-#include <OpenEXR/ImfChannelList.h>
-#include <OpenEXR/ImfPixelType.h>
-#include <OpenEXR/ImfInputFile.h>
-#include <OpenEXR/ImfOutputFile.h>
-#include <OpenEXR/ImfCompression.h>
-#include <OpenEXR/ImfCompressionAttribute.h>
-#include <OpenEXR/ImfStringAttribute.h>
+#include <half.h>
+#include <ImfVersion.h>
+#include <ImathBox.h>
+#include <ImfArray.h>
+#include <ImfIO.h>
+#include <ImfChannelList.h>
+#include <ImfPixelType.h>
+#include <ImfInputFile.h>
+#include <ImfOutputFile.h>
+#include <ImfCompression.h>
+#include <ImfCompressionAttribute.h>
+#include <ImfStringAttribute.h>
 #endif
 
 using namespace Imf;
index 6e5e87d7e5c0187683695b490a0372a144a10b8c..fe85f63e109d048c3e3d1db15ee21c0b690c4bde 100644 (file)
@@ -142,6 +142,9 @@ const char *imb_ext_audio[] = {
        ".flac",
        ".wma",
        ".eac3",
+       ".aif",
+       ".aiff",
+       ".m4a",
        NULL};
 
 static int IMB_ispic_name(const char *name)
index e4b37feb7caa3cee964570a6fb1ec3576c93d607..f1400bc5062c56ea37ee05b1ee92dbb5cda8fe79 100644 (file)
@@ -250,12 +250,11 @@ typedef struct Object {
        struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
 
        struct DerivedMesh *derivedDeform, *derivedFinal;
-       int lastDataMask;                       /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
+       unsigned int lastDataMask;   /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
+       unsigned int customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
        unsigned int state;                     /* bit masks of game controllers that are active */
        unsigned int init_state;        /* bit masks of initial state as recorded by the users */
 
-       int pad2;
-
        ListBase gpulamp;               /* runtime, for lamps only */
        ListBase pc_ids;
        ListBase *duplilist;    /* for temporary dupli list storage, only for use by RNA API */
@@ -291,10 +290,6 @@ typedef struct DupliObject {
        float orco[3], uv[2];
 } DupliObject;
 
-/* this work object is defined in object.c */
-extern Object workob;
-
-
 /* **************** OBJECT ********************* */
 
 /* used many places... should be specialized  */
index c6fa07482c5936cd1369654cc439734b34d1016d..100a66d209fc9179bb459124b510330b2787289e 100644 (file)
@@ -1071,6 +1071,7 @@ typedef struct Scene {
 #define SCE_SNAP_ROTATE                        2
 #define SCE_SNAP_PEEL_OBJECT   4
 #define SCE_SNAP_PROJECT               8
+#define SCE_SNAP_PROJECT_NO_SELF       16
 /* toolsettings->snap_target */
 #define SCE_SNAP_TARGET_CLOSEST        0
 #define SCE_SNAP_TARGET_CENTER 1
index e120cd1477567c32ee1237fbd52e178cf73d6251..2b039060e47b20a6f5f91e8193cb2108eb23470e 100644 (file)
@@ -696,18 +696,19 @@ enum FileSortTypeE {
 #define FILE_OPENFILE          0
 #define FILE_SAVE                      1
 
-/* sfile->flag and simasel->flag */
-#define FILE_SHOWSHORT         1
-#define FILE_RELPATH           2 /* was FILE_STRINGCODE */
-#define FILE_LINK                      4
-#define FILE_HIDE_DOT          8
-#define FILE_AUTOSELECT                16
-#define FILE_ACTIVELAY         32
-#define FILE_ATCURSOR          64
-#define FILE_SYNCPOSE          128
-#define FILE_FILTER                    256
-#define FILE_BOOKMARKS         512
-#define FILE_GROUP_INSTANCE    1024
+/* sfile->params->flag and simasel->flag */
+#define FILE_SHOWSHORT         (1<<0)
+#define FILE_RELPATH           (1<<1) /* was FILE_STRINGCODE */
+#define FILE_LINK                      (1<<2)
+#define FILE_HIDE_DOT          (1<<3)
+#define FILE_AUTOSELECT                (1<<4)
+#define FILE_ACTIVELAY         (1<<5)
+#define FILE_ATCURSOR          (1<<6)
+#define FILE_DIRSEL_ONLY       (1<<7)
+#define FILE_FILTER                    (1<<8)
+#define FILE_BOOKMARKS         (1<<9)
+#define FILE_GROUP_INSTANCE    (1<<10)
+
 
 /* files in filesel list: file types */
 #define BLENDERFILE                    (1<<2)
index b57e78a896c8c75b3d95032681ebfa78b97bc5ea..f388cf7a412a9c34fb31946b5082e36d48a57c00 100644 (file)
@@ -375,7 +375,7 @@ typedef struct UserDef {
        short scrcastwait;              /* milliseconds between screencast snapshots */
        
        short widget_unit;              /* defaults to 20 for 72 DPI setting */
-       short pad[3];                   
+       short anisotropic_filter;
 
        char versemaster[160];
        char verseuser[160];
@@ -385,7 +385,6 @@ typedef struct UserDef {
        short autokey_flag;             /* flags for autokeying */
        
        short text_render, pad9;                /*options for text rendering*/
-       float pad10;
 
        struct ColorBand coba_weight;   /* from texture.h */
 
index ca19a86e42cd231c16d51542d6d5470a6df254a4..882fbce9271360b4bda2a6976f056bacb911ab74 100644 (file)
@@ -716,6 +716,7 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i
 int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop);
 void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value);
 void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values);
+void RNA_property_int_get_array_range(PointerRNA *ptr, PropertyRNA *prop, int values[2]);
 int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index);
 void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values);
 void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value);
@@ -726,6 +727,7 @@ int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int i
 float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop);
 void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value);
 void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values);
+void RNA_property_float_get_array_range(PointerRNA *ptr, PropertyRNA *prop, float values[2]);
 float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index);
 void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values);
 void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value);
index ab11f88e0f620bb945a57b4e25006bf5bf529287..8fbee8ea74068403f29c448e02ee521ed2dad7e3 100644 (file)
@@ -1643,6 +1643,43 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
                memset(values, 0, sizeof(int)*prop->totarraylength);
 }
 
+void RNA_property_int_get_array_range(PointerRNA *ptr, PropertyRNA *prop, int values[2])
+{
+       const int array_len= RNA_property_array_length(ptr, prop);
+
+       if(array_len <= 0) {
+               values[0]= 0;
+               values[1]= 0;
+       }
+       else if (array_len == 1) {
+               RNA_property_int_get_array(ptr, prop, values);
+               values[1]= values[0];
+       }
+       else {
+               int arr_stack[32];
+               int *arr;
+               int i;
+
+               if(array_len > 32) {
+                       arr= MEM_mallocN(sizeof(int) * array_len, "RNA_property_int_get_array_range");
+               }
+               else {
+                       arr= arr_stack;
+               }
+
+               RNA_property_int_get_array(ptr, prop, arr);
+               values[0]= values[1]= arr[0];
+               for(i= 1; i < array_len; i++) {
+                       values[0]= MIN2(values[0], arr[i]);
+                       values[1]= MAX2(values[1], arr[i]);
+               }
+
+               if(arr != arr_stack) {
+                       MEM_freeN(arr);
+               }
+       }
+}
+
 int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 {
        int tmp[RNA_MAX_ARRAY_LENGTH];
@@ -1839,6 +1876,43 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val
                memset(values, 0, sizeof(float)*prop->totarraylength);
 }
 
+void RNA_property_float_get_array_range(PointerRNA *ptr, PropertyRNA *prop, float values[2])
+{
+       const int array_len= RNA_property_array_length(ptr, prop);
+
+       if(array_len <= 0) {
+               values[0]= 0.0f;
+               values[1]= 0.0f;
+       }
+       else if (array_len == 1) {
+               RNA_property_float_get_array(ptr, prop, values);
+               values[1]= values[0];
+       }
+       else {
+               float arr_stack[32];
+               float *arr;
+               int i;
+
+               if(array_len > 32) {
+                       arr= MEM_mallocN(sizeof(float) * array_len, "RNA_property_float_get_array_range");
+               }
+               else {
+                       arr= arr_stack;
+               }
+
+               RNA_property_float_get_array(ptr, prop, arr);
+               values[0]= values[1]= arr[0];
+               for(i= 1; i < array_len; i++) {
+                       values[0]= MIN2(values[0], arr[i]);
+                       values[1]= MAX2(values[1], arr[i]);
+               }
+
+               if(arr != arr_stack) {
+                       MEM_freeN(arr);
+               }
+       }
+}
+
 float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 {
        float tmp[RNA_MAX_ARRAY_LENGTH];
index 641ac8a9882b5cafd9cf87e919e802d9324df19c..c21ddad01451880bde32e2f1d5c355b1f046eb83 100644 (file)
@@ -1175,6 +1175,12 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
        RNA_def_property_ui_text(prop, "Project Individual Elements", "Project individual elements on the surface of other objects");
        RNA_def_property_ui_icon(prop, ICON_RETOPO, 0);
        RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
+
+       prop= RNA_def_property(srna, "use_snap_project_self", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT_NO_SELF);
+       RNA_def_property_ui_text(prop, "Project to Self", "Project into its self (editmode)");
+       RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
+       RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
        
        /* Grease Pencil */
        prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE);
index 14af5ed7a3f470a1a398256ec753206fb066905a..cf371fbf9bc0fbfe0d4fa4ac0135758fe3f9138a 100644 (file)
@@ -117,6 +117,12 @@ static void rna_userdef_mipmap_update(Main *bmain, Scene *scene, PointerRNA *ptr
        rna_userdef_update(bmain, scene, ptr);
 }
 
+static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+       GPU_set_anisotropic(U.anisotropic_filter);
+       rna_userdef_update(bmain, scene, ptr);
+}
+
 static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
        GPU_free_images();
@@ -2346,6 +2352,14 @@ static void rna_def_userdef_system(BlenderRNA *brna)
                {128, "CLAMP_128", 0, "128", ""},
                {0, NULL, 0, NULL, NULL}};
 
+       static EnumPropertyItem anisotropic_items[]  ={
+               {1, "FILTER_0", 0, "Off", ""},
+               {2, "FILTER_2", 0, "2x", ""},
+               {4, "FILTER_4", 0, "4x", ""},
+               {8, "FILTER_8", 0, "8x", ""},
+               {16, "FILTER_16", 0, "16x", ""},
+               {0, NULL, 0, NULL, NULL}};
+
        static EnumPropertyItem audio_mixing_samples_items[] = {
                {256, "SAMPLES_256", 0, "256", "Set audio mixing buffer size to 256 samples"},
                {512, "SAMPLES_512", 0, "512", "Set audio mixing buffer size to 512 samples"},
@@ -2568,6 +2582,13 @@ static void rna_def_userdef_system(BlenderRNA *brna)
        prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_AA);
        RNA_def_property_ui_text(prop, "Anti-aliasing", "Use anti-aliasing for the 3D view (may impact redraw performance)");
+
+       prop= RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter");
+       RNA_def_property_enum_items(prop, anisotropic_items);
+       RNA_def_property_enum_default(prop, 1);
+       RNA_def_property_ui_text(prop, "Anisotropic Filter", "The quality of the anisotropic filtering (values greater than 1.0 enable anisotropic filtering)");
+       RNA_def_property_update(prop, 0, "rna_userdef_anisotropic_update");
        
        prop= RNA_def_property(srna, "gl_texture_limit", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "glreslimit");
index a807624187adbc74a8b7b72a9389529727d796b9..2543d34f58c63657a9dda1a8b8e322ce802d218c 100644 (file)
 #include "py_capi_utils.h"
 #endif
 
-extern PyTypeObject IDArray_Type;
-extern PyTypeObject IDGroup_Iter_Type;
+extern PyTypeObject BPy_IDArray_Type;
+extern PyTypeObject BPy_IDGroup_Iter_Type;
+extern PyTypeObject BPy_IDGroup_Type;
 
 /*********************** ID Property Main Wrapper Stuff ***************/
 
-static PyObject *IDGroup_repr( BPy_IDProperty *self )
+/* use for both array and group */
+static long BPy_IDGroup_hash(BPy_IDProperty *self)
 {
-       return PyUnicode_FromFormat( "<bpy ID property from \"%s\">", self->id->name);
+       return _Py_HashPointer(self->prop);
 }
 
-extern PyTypeObject IDGroup_Type;
+static PyObject *BPy_IDGroup_repr(BPy_IDProperty *self)
+{
+       return PyUnicode_FromFormat( "<bpy id property from \"%s\">", self->id->name);
+}
 
 PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop )
 {
        switch ( prop->type ) {
                case IDP_STRING:
 #ifdef USE_STRING_COERCE
-                       return PyC_UnicodeFromByte(prop->data.pointer);
+                       return PyC_UnicodeFromByte(IDP_Array(prop));
 #else
-                       return PyUnicode_FromString(prop->data.pointer);
+                       return PyUnicode_FromString(IDP_Array(prop));
 #endif
                case IDP_INT:
                        return PyLong_FromLong( (long)prop->data.val );
@@ -75,14 +80,14 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop )
                case IDP_GROUP:
                        /*blegh*/
                        {
-                               BPy_IDProperty *group = PyObject_New(BPy_IDProperty, &IDGroup_Type);
+                               BPy_IDProperty *group = PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type);
                                group->id = id;
                                group->prop = prop;
                                return (PyObject*) group;
                        }
                case IDP_ARRAY:
                        {
-                               BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &IDArray_Type);
+                               BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &BPy_IDArray_Type);
                                array->id = id;
                                array->prop = prop;
                                return (PyObject*) array;
@@ -135,13 +140,13 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
 
                                st = _PyUnicode_AsString(value);
                                IDP_ResizeArray(prop, alloc_len);
-                               memcpy(prop->data.pointer, st, alloc_len);
+                               memcpy(IDP_Array(prop), st, alloc_len);
                                Py_XDECREF(value_coerce);
                        }
 #else
                        st = _PyUnicode_AsString(value);
                        IDP_ResizeArray(prop, strlen(st)+1);
-                       strcpy(prop->data.pointer, st);
+                       strcpy(IDP_Array(prop), st);
 #endif
 
                        return 0;
@@ -344,7 +349,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
                        prop = IDP_New(IDP_ARRAY, val, name);
                        for (i=0; i<val.array.len; i++) {
                                item = PySequence_GetItem(ob, i);
-                               ((double*)prop->data.pointer)[i] = (float)PyFloat_AsDouble(item);
+                               ((double*)IDP_Array(prop))[i] = (float)PyFloat_AsDouble(item);
                                Py_DECREF(item);
                        }
                        break;
@@ -352,7 +357,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
                        prop = IDP_New(IDP_ARRAY, val, name);
                        for (i=0; i<val.array.len; i++) {
                                item = PySequence_GetItem(ob, i);
-                               ((int*)prop->data.pointer)[i] = (int)PyLong_AsSsize_t(item);
+                               ((int*)IDP_Array(prop))[i] = (int)PyLong_AsSsize_t(item);
                                Py_DECREF(item);
                        }
                        break;
@@ -465,9 +470,9 @@ static int BPy_IDGroup_Map_SetItem(BPy_IDProperty *self, PyObject *key, PyObject
        return BPy_Wrap_SetMapItem(self->prop, key, val);
 }
 
-static PyObject *BPy_IDGroup_SpawnIterator(BPy_IDProperty *self)
+static PyObject *BPy_IDGroup_iter(BPy_IDProperty *self)
 {
-       BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &IDGroup_Iter_Type);
+       BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &BPy_IDGroup_Iter_Type);
        iter->group = self;
        iter->mode = IDPROP_ITER_KEYS;
        iter->cur = self->prop->data.group.first;
@@ -480,9 +485,9 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
        switch (prop->type) {
                case IDP_STRING:
 #ifdef USE_STRING_COERCE
-                       return PyC_UnicodeFromByte(prop->data.pointer);
+                       return PyC_UnicodeFromByte(IDP_Array(prop));
 #else
-                       return PyUnicode_FromString(prop->data.pointer);
+                       return PyUnicode_FromString(IDP_Array(prop));
 #endif
                        break;
                case IDP_FLOAT:
@@ -504,20 +509,37 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
                                return NULL;
                        }
 
-                       for (i=0; i<prop->len; i++) {
-                               if (prop->subtype == IDP_FLOAT) {
-                                       PyList_SET_ITEM(seq, i,
-                                                       PyFloat_FromDouble(((float*)prop->data.pointer)[i]));
+                       switch(prop->subtype) {
+                               case IDP_FLOAT:
+                               {
+                                       float *array= (float*)IDP_Array(prop);
+                                       for (i=0; i<prop->len; i++) {
+                                               PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
+                                       }
+                                       break;
                                }
-                               else if (prop->subtype == IDP_DOUBLE) {
-                                       PyList_SET_ITEM(seq, i,
-                                                       PyFloat_FromDouble(((double*)prop->data.pointer)[i]));
+                               case IDP_DOUBLE:
+                               {
+                                       double *array= (double*)IDP_Array(prop);
+                                       for (i=0; i<prop->len; i++) {
+                                               PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
+                                       }
+                                       break;
                                }
-                               else    {
-                                       PyList_SET_ITEM(seq, i,
-                                                       PyLong_FromLong(((int*)prop->data.pointer)[i]));
+                               case IDP_INT:
+                               {
+                                       int *array= (int*)IDP_Array(prop);
+                                       for (i=0; i<prop->len; i++) {
+                                               PyList_SET_ITEM(seq, i, PyLong_FromLong(array[i]));
+                                       }
+                                       break;
                                }
+                               default:
+                                       PyErr_SetString(PyExc_RuntimeError, "invalid/corrupt array type!");
+                                       Py_DECREF(seq);
+                                       return NULL;
                        }
+
                        return seq;
                }
                case IDP_IDPARRAY:
@@ -553,6 +575,7 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
                                        return NULL;
 
                                PyDict_SetItemString(dict, loop->name, wrap);
+                               Py_DECREF(wrap);
                        }
                        return dict;
                }
@@ -595,7 +618,7 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
 
 static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
 {
-       BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &IDGroup_Iter_Type);
+       BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &BPy_IDGroup_Iter_Type);
        iter->group = self;
        iter->mode = IDPROP_ITER_ITEMS;
        iter->cur = self->prop->data.group.first;
@@ -731,7 +754,7 @@ static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *value)
        Py_RETURN_NONE;
 }
 
-static PyObject *BPy_IDGroup_ConvertToPy(BPy_IDProperty *self)
+static PyObject *BPy_IDGroup_to_dict(BPy_IDProperty *self)
 {
        return BPy_IDGroup_MapDataToPy(self->prop);
 }
@@ -773,7 +796,7 @@ static struct PyMethodDef BPy_IDGroup_methods[] = {
                "updates the values in the group with the values of another or a dict"},
        {"get", (PyCFunction)BPy_IDGroup_Get, METH_VARARGS,
                "idprop.get(k[,d]) -> idprop[k] if k in idprop, else d.  d defaults to None"},
-       {"convert_to_pyobject", (PyCFunction)BPy_IDGroup_ConvertToPy, METH_NOARGS,
+       {"to_dict", (PyCFunction)BPy_IDGroup_to_dict, METH_NOARGS,
                "return a purely python version of the group"},
        {NULL, NULL, 0, NULL}
 };
@@ -792,16 +815,16 @@ static PySequenceMethods BPy_IDGroup_Seq = {
 };
 
 static PyMappingMethods BPy_IDGroup_Mapping = {
-       (lenfunc)BPy_IDGroup_Map_Len,                   /*inquiry mp_length */
-       (binaryfunc)BPy_IDGroup_Map_GetItem,            /*binaryfunc mp_subscript */
+       (lenfunc)BPy_IDGroup_Map_Len,           /*inquiry mp_length */
+       (binaryfunc)BPy_IDGroup_Map_GetItem,/*binaryfunc mp_subscript */
        (objobjargproc)BPy_IDGroup_Map_SetItem, /*objobjargproc mp_ass_subscript */
 };
 
-PyTypeObject IDGroup_Type = {
+PyTypeObject BPy_IDGroup_Type = {
        PyVarObject_HEAD_INIT(NULL, 0)
        /*  For printing, in format "<module>.<name>" */
-       "Blender IDProperty",           /* char *tp_name; */
-       sizeof( BPy_IDProperty ),       /* int tp_basicsize; */
+       "Blender IDProperty",           /* char *tp_name; */
+       sizeof(BPy_IDProperty),         /* int tp_basicsize; */
        0,                          /* tp_itemsize;  For allocation */
 
        /* Methods to implement standard operations */
@@ -811,7 +834,7 @@ PyTypeObject IDGroup_Type = {
        NULL,     /* getattrfunc tp_getattr; */
        NULL,     /* setattrfunc tp_setattr; */
        NULL,                       /* cmpfunc tp_compare; */
-       ( reprfunc ) IDGroup_repr,     /* reprfunc tp_repr; */
+       (reprfunc)BPy_IDGroup_repr,     /* reprfunc tp_repr; */
 
        /* Method suites for standard classes */
 
@@ -821,7 +844,7 @@ PyTypeObject IDGroup_Type = {
 
        /* More standard operations (here for binary compatibility) */
 
-       NULL,                       /* hashfunc tp_hash; */
+       (hashfunc)BPy_IDGroup_hash, /* hashfunc tp_hash; */
        NULL,                       /* ternaryfunc tp_call; */
        NULL,                       /* reprfunc tp_str; */
        NULL,                       /* getattrofunc tp_getattro; */
@@ -850,7 +873,7 @@ PyTypeObject IDGroup_Type = {
 
   /*** Added in release 2.2 ***/
        /*   Iterators */
-       (getiterfunc)BPy_IDGroup_SpawnIterator, /* getiterfunc tp_iter; */
+       (getiterfunc)BPy_IDGroup_iter, /* getiterfunc tp_iter; */
        NULL,                       /* iternextfunc tp_iternext; */
   /*** Attribute descriptor and subclassing stuff ***/
        BPy_IDGroup_methods,        /* struct PyMethodDef *tp_methods; */
@@ -861,7 +884,7 @@ PyTypeObject IDGroup_Type = {
 /*********** Main external wrapping function *******/
 PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent)
 {
-       BPy_IDProperty *wrap = PyObject_New(BPy_IDProperty, &IDGroup_Type);
+       BPy_IDProperty *wrap = PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type);
        wrap->prop = prop;
        wrap->parent = parent;
        wrap->id = id;
@@ -872,36 +895,58 @@ PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent)
 
 /********Array Wrapper********/
 
-static PyObject *IDArray_repr(BPy_IDArray *self)
+static PyTypeObject *idp_array_py_type(BPy_IDArray *self, short *is_double)
 {
-       return PyUnicode_FromFormat("(ID Array [%d])", self->prop->len);
-}
+       switch (self->prop->subtype) {
+               case IDP_FLOAT:
+                       *is_double= 0;
+                       return &PyFloat_Type;
+               case IDP_DOUBLE:
+                       *is_double= 1;
+                       return &PyFloat_Type;
+               case IDP_INT:
+                       *is_double= 0;
+                       return &PyLong_Type;
+       }
 
+       *is_double= 0;
+       return NULL;
+}
 
-static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
+static PyObject *BPy_IDArray_repr(BPy_IDArray *self)
 {
-       return PyLong_FromSsize_t( self->prop->subtype );
+       return PyUnicode_FromFormat("<bpy id property array [%d]>", self->prop->len);
 }
 
-static PyObject *BPy_IDArray_GetLen(BPy_IDArray *self)
+static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
 {
-       return PyLong_FromSsize_t( self->prop->len );
+       switch(self->prop->subtype) {
+       case IDP_FLOAT:
+               return PyUnicode_FromString("f");
+       case IDP_DOUBLE:
+               return PyUnicode_FromString("d");
+       case IDP_INT:
+               return PyUnicode_FromString("i");
+       }
+
+       PyErr_SetString(PyExc_RuntimeError, "invalid/corrupt array type!");
+       return NULL;
 }
 
 static PyGetSetDef BPy_IDArray_getseters[] = {
-       {(char *)"len", (getter)BPy_IDArray_GetLen, (setter)NULL, (char *)"The length of the array, can also be gotten with len(array).", NULL},
-       {(char *)"type", (getter)BPy_IDArray_GetType, (setter)NULL, (char *)"The type of the data in the array, is an ant.", NULL},
+    /* matches pythons array.typecode */
+       {(char *)"typecode", (getter)BPy_IDArray_GetType, (setter)NULL, (char *)"The type of the data in the array, is an int.", NULL},
        {NULL, NULL, NULL, NULL, NULL},
 };
 
-static PyObject *BPy_IDArray_ConvertToPy(BPy_IDArray *self)
+static PyObject *BPy_IDArray_to_list(BPy_IDArray *self)
 {
        return BPy_IDGroup_MapDataToPy(self->prop);
 }
 
 static PyMethodDef BPy_IDArray_methods[] = {
-       {"convert_to_pyobject", (PyCFunction)BPy_IDArray_ConvertToPy, METH_NOARGS,
-               "return a purely python version of the group"},
+       {"to_list", (PyCFunction)BPy_IDArray_to_list, METH_NOARGS,
+               "return the array as a list"},
        {NULL, NULL, 0, NULL}
 };
 
@@ -919,14 +964,11 @@ static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
 
        switch (self->prop->subtype) {
                case IDP_FLOAT:
-                       return PyFloat_FromDouble( (double)(((float*)self->prop->data.pointer)[index]));
-                       break;
+                       return PyFloat_FromDouble(((float*)IDP_Array(self->prop))[index]);
                case IDP_DOUBLE:
-                       return PyFloat_FromDouble( (((double*)self->prop->data.pointer)[index]));
-                       break;
+                       return PyFloat_FromDouble(((double*)IDP_Array(self->prop))[index]);
                case IDP_INT:
-                       return PyLong_FromLong( (long)((int*)self->prop->data.pointer)[index] );
-                       break;
+                       return PyLong_FromLong((long)((int*)IDP_Array(self->prop))[index]);
        }
 
        PyErr_SetString(PyExc_RuntimeError, "invalid/corrupt array type!");
@@ -951,7 +993,7 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
                                PyErr_SetString(PyExc_TypeError, "expected a float");
                                return -1;
                        }
-                       ((float*)self->prop->data.pointer)[index] = f;
+                       ((float*)IDP_Array(self->prop))[index] = f;
                        break;
                case IDP_DOUBLE:
                        d= PyFloat_AsDouble(value);
@@ -959,7 +1001,7 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
                                PyErr_SetString(PyExc_TypeError, "expected a float");
                                return -1;
                        }
-                       ((double*)self->prop->data.pointer)[index] = d;
+                       ((double*)IDP_Array(self->prop))[index] = d;
                        break;
                case IDP_INT:
                        i= PyLong_AsSsize_t(value);
@@ -968,7 +1010,7 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
                                return -1;
                        }
 
-                       ((int*)self->prop->data.pointer)[index] = i;
+                       ((int*)IDP_Array(self->prop))[index] = i;
                        break;
        }
        return 0;
@@ -988,11 +1030,156 @@ static PySequenceMethods BPy_IDArray_Seq = {
        NULL,                                                           /* intargfunc sq_inplace_repeat */
 };
 
-PyTypeObject IDArray_Type = {
+
+
+/* sequence slice (get): idparr[a:b] */
+static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
+{
+       IDProperty *prop= self->prop;
+       PyObject *tuple;
+       int count;
+
+       CLAMP(begin, 0, prop->len);
+       if (end<0) end= prop->len+end+1;
+       CLAMP(end, 0, prop->len);
+       begin= MIN2(begin, end);
+
+       tuple= PyTuple_New(end - begin);
+
+       switch (prop->subtype) {
+               case IDP_FLOAT:
+               {
+                       float *array= (float*)IDP_Array(prop);
+                       for(count = begin; count < end; count++) {
+                               PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
+                       }
+                       break;
+               }
+               case IDP_DOUBLE:
+               {
+                       double *array= (double*)IDP_Array(prop);
+                       for(count = begin; count < end; count++) {
+                               PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
+                       }
+                       break;
+               }
+               case IDP_INT:
+               {
+                       int *array= (int*)IDP_Array(prop);
+                       for(count = begin; count < end; count++) {
+                               PyTuple_SET_ITEM(tuple, count - begin, PyLong_FromLong(array[count]));
+                       }
+                       break;
+               }
+       }
+
+       return tuple;
+}
+/* sequence slice (set): idparr[a:b] = value */
+static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject *seq)
+{
+       IDProperty *prop= self->prop;
+       short is_double= 0;
+       const PyTypeObject *py_type= idp_array_py_type(self, &is_double);
+       const size_t elem_size= is_double ? sizeof(double) : sizeof(float);
+       size_t alloc_len;
+       size_t size;
+       void *vec;
+
+       CLAMP(begin, 0, prop->len);
+       CLAMP(end, 0, prop->len);
+       begin = MIN2(begin, end);
+
+       size = (end - begin);
+       alloc_len= size * elem_size;
+
+       vec= MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */
+       if(PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) {
+               MEM_freeN(vec);
+               return -1;
+       }
+
+       memcpy((void *)(((char *)IDP_Array(prop)) + (begin * elem_size)), vec, alloc_len);
+
+       MEM_freeN(vec);
+       return 0;
+}
+
+static PyObject *BPy_IDArray_subscript(BPy_IDArray* self, PyObject* item)
+{
+       if (PyIndex_Check(item)) {
+               Py_ssize_t i;
+               i = PyNumber_AsSsize_t(item, PyExc_IndexError);
+               if (i == -1 && PyErr_Occurred())
+                       return NULL;
+               if (i < 0)
+                       i += self->prop->len;
+               return BPy_IDArray_GetItem(self, i);
+       }
+       else if (PySlice_Check(item)) {
+               Py_ssize_t start, stop, step, slicelength;
+
+               if (PySlice_GetIndicesEx((void *)item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
+                       return NULL;
+
+               if (slicelength <= 0) {
+                       return PyTuple_New(0);
+               }
+               else if (step == 1) {
+                       return BPy_IDArray_slice(self, start, stop);
+               }
+               else {
+                       PyErr_SetString(PyExc_TypeError, "slice steps not supported with vectors");
+                       return NULL;
+               }
+       }
+       else {
+               PyErr_Format(PyExc_TypeError, "vector indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
+               return NULL;
+       }
+}
+
+static int BPy_IDArray_ass_subscript(BPy_IDArray* self, PyObject* item, PyObject* value)
+{
+       if (PyIndex_Check(item)) {
+               Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
+               if (i == -1 && PyErr_Occurred())
+                       return -1;
+               if (i < 0)
+                       i += self->prop->len;
+               return BPy_IDArray_SetItem(self, i, value);
+       }
+       else if (PySlice_Check(item)) {
+               Py_ssize_t start, stop, step, slicelength;
+
+               if (PySlice_GetIndicesEx((void *)item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
+                       return -1;
+
+               if (step == 1)
+                       return BPy_IDArray_ass_slice(self, start, stop, value);
+               else {
+                       PyErr_SetString(PyExc_TypeError, "slice steps not supported with vectors");
+                       return -1;
+               }
+       }
+       else {
+               PyErr_Format(PyExc_TypeError, "vector indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
+               return -1;
+       }
+}
+
+static PyMappingMethods BPy_IDArray_AsMapping = {
+       (lenfunc)BPy_IDArray_Len,
+       (binaryfunc)BPy_IDArray_subscript,
+       (objobjargproc)BPy_IDArray_ass_subscript
+};
+
+
+PyTypeObject BPy_IDArray_Type = {
        PyVarObject_HEAD_INIT(NULL, 0)
        /*  For printing, in format "<module>.<name>" */
        "Blender IDArray",           /* char *tp_name; */
-       sizeof( BPy_IDArray ),       /* int tp_basicsize; */
+       sizeof(BPy_IDArray),       /* int tp_basicsize; */
        0,                          /* tp_itemsize;  For allocation */
 
        /* Methods to implement standard operations */
@@ -1002,17 +1189,17 @@ PyTypeObject IDArray_Type = {
        NULL,     /* getattrfunc tp_getattr; */
        NULL,     /* setattrfunc tp_setattr; */
        NULL,                       /* cmpfunc tp_compare; */
-       ( reprfunc ) IDArray_repr,     /* reprfunc tp_repr; */
+       (reprfunc)BPy_IDArray_repr,     /* reprfunc tp_repr; */
 
        /* Method suites for standard classes */
 
        NULL,                       /* PyNumberMethods *tp_as_number; */
-       &BPy_IDArray_Seq,                       /* PySequenceMethods *tp_as_sequence; */
-       NULL,                       /* PyMappingMethods *tp_as_mapping; */
+       &BPy_IDArray_Seq,               /* PySequenceMethods *tp_as_sequence; */
+       &BPy_IDArray_AsMapping,     /* PyMappingMethods *tp_as_mapping; */
 
        /* More standard operations (here for binary compatibility) */
 
-       NULL,                       /* hashfunc tp_hash; */
+       NULL,                                           /* hashfunc tp_hash; */
        NULL,                       /* ternaryfunc tp_call; */
        NULL,                       /* reprfunc tp_str; */
        NULL,                       /* getattrofunc tp_getattro; */
@@ -1106,7 +1293,7 @@ static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
        }
 }
 
-PyTypeObject IDGroup_Iter_Type = {
+PyTypeObject BPy_IDGroup_Iter_Type = {
        PyVarObject_HEAD_INIT(NULL, 0)
        /*  For printing, in format "<module>.<name>" */
        "Blender IDGroup_Iter",           /* char *tp_name; */
@@ -1165,7 +1352,7 @@ PyTypeObject IDGroup_Iter_Type = {
 
 void IDProp_Init_Types(void)
 {
-       PyType_Ready( &IDGroup_Type );
-       PyType_Ready( &IDGroup_Iter_Type );
-       PyType_Ready( &IDArray_Type );
+       PyType_Ready(&BPy_IDGroup_Type);
+       PyType_Ready(&BPy_IDGroup_Iter_Type);
+       PyType_Ready(&BPy_IDArray_Type);
 }
index 0ca8af81f7c5fdada96c22237a4a7ae6a04510c1..aca5c0195ccd0709426953c7b2218ae7e61d2338 100644 (file)
@@ -37,14 +37,15 @@ struct BPy_IDGroup_Iter;
 typedef struct BPy_IDProperty {
        PyObject_VAR_HEAD
        struct ID *id;
-       struct IDProperty *prop, *parent;
+       struct IDProperty *prop; /* must be second member */
+       struct IDProperty *parent;
        PyObject *data_wrap;
 } BPy_IDProperty;
 
 typedef struct BPy_IDArray {
        PyObject_VAR_HEAD
        struct ID *id;
-       struct IDProperty *prop;
+       struct IDProperty *prop;  /* must be second member */
 } BPy_IDArray;
 
 typedef struct BPy_IDGroup_Iter {
index ec774f440757cae1eb91eb705cb0f5149919de22..801e44bd0086ab6987dfcf5567c8929462db21d5 100644 (file)
 
 #define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
 
+/* array utility function */
+int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix)
+{
+       PyObject *value_fast;
+       int value_len;
+       int i;
+
+       if(!(value_fast=PySequence_Fast(value, error_prefix))) {
+               return -1;
+       }
+
+       value_len= PySequence_Fast_GET_SIZE(value_fast);
+
+       if(value_len != length) {
+               Py_DECREF(value);
+               PyErr_Format(PyExc_TypeError,
+                            "%.200s: invalid sequence length. expected %d, got %d",
+                            error_prefix, length, value_len);
+               return -1;
+       }
+
+       /* for each type */
+       if(type == &PyFloat_Type) {
+               if(is_double) {
+                       double *array_double= array;
+                       for(i=0; i<length; i++) {
+                               array_double[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
+                       }
+               }
+               else {
+                       float *array_float= array;
+                       for(i=0; i<length; i++) {
+                               array_float[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
+                       }
+               }
+       }
+       else if(type == &PyLong_Type) {
+               /* could use is_double for 'long int' but no use now */
+               int *array_int= array;
+               for(i=0; i<length; i++) {
+                       array_int[i]= PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
+               }
+       }
+       else if(type == &PyBool_Type) {
+               int *array_bool= array;
+               for(i=0; i<length; i++) {
+                       array_bool[i]= (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
+               }
+       }
+       else {
+               Py_DECREF(value_fast);
+               PyErr_Format(PyExc_TypeError,
+                            "%s: internal error %s is invalid",
+                            error_prefix, type->tp_name);
+               return -1;
+       }
+
+       Py_DECREF(value_fast);
+
+       if(PyErr_Occurred()) {
+               PyErr_Format(PyExc_TypeError,
+                            "%s: one or more items could not be used as a %s",
+                            error_prefix, type->tp_name);
+               return -1;
+       }
+
+       return 0;
+}
+
+
 /* for debugging */
 void PyC_ObSpit(const char *name, PyObject *var) {
        fprintf(stderr, "<%s> : ", name);
index 1730ad7172121606a9710d808135018d03376aac..bf2eb17588289210215b6c45f0c36912278f1aef 100644 (file)
@@ -35,7 +35,7 @@ void                  PyC_LineSpit(void);
 PyObject *             PyC_ExceptionBuffer(void);
 PyObject *             PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
 void                   PyC_FileAndNum(const char **filename, int *lineno);
-int                            PyC_AsArray(void *array, PyObject *value, int length, PyTypeObject *type, const char *error_prefix);
+int                            PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix);
 
 /* follow http://www.python.org/dev/peps/pep-0383/ */
 PyObject *             PyC_UnicodeFromByte(const char *str);
index 8ed4e41de3ea66f07f646979c3db6576a4eedd69..0ba80bf0850f1a69559ca44c146f99bae986566b 100644 (file)
@@ -459,7 +459,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
                        return NULL;
                }
 
-               if(pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, "BoolVectorProperty(default=sequence)") < 0)
+               if(pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, FALSE, "BoolVectorProperty(default=sequence)") < 0)
                        return NULL;
 
                if (bpy_prop_callback_check(update_cb, 2) == -1) {
@@ -603,7 +603,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
                        return NULL;
                }
 
-               if(pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, "IntVectorProperty(default=sequence)") < 0)
+               if(pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, FALSE, "IntVectorProperty(default=sequence)") < 0)
                        return NULL;
 
                if (bpy_prop_callback_check(update_cb, 2) == -1) {
@@ -759,7 +759,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
                        return NULL;
                }
 
-               if(pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, "FloatVectorProperty(default=sequence)") < 0)
+               if(pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, FALSE, "FloatVectorProperty(default=sequence)") < 0)
                        return NULL;
 
                if (bpy_prop_callback_check(update_cb, 2) == -1) {
index 38cc3edd8f6397b2a69704de72920dd64c646b4a..00325446e614ec415a6aaf9a2fb9b95e04e467c9 100644 (file)
@@ -1380,12 +1380,8 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
 
 
        if (RNA_property_array_check(ptr, prop)) {
-               int ok= 1;
-
                /* done getting the length */
-               ok= pyrna_py_to_array(ptr, prop, data, value, error_prefix);
-
-               if (!ok) {
+               if(pyrna_py_to_array(ptr, prop, data, value, error_prefix) == -1) {
                        return -1;
                }
        }
@@ -1767,8 +1763,8 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
 
        if (totdim > 1) {
                /* char error_str[512]; */
-               if (!pyrna_py_to_array_index(&self->ptr, self->prop, self->arraydim, self->arrayoffset, index, value, "")) {
-                       /* PyErr_SetString(PyExc_AttributeError, error_str); */
+               if (pyrna_py_to_array_index(&self->ptr, self->prop, self->arraydim, self->arrayoffset, index, value, "") == -1) {
+                       /* error is set */
                        ret= -1;
                }
        }
index df295e812be8f9a9a8a8ee3cb50a97e368a21137..9843a57e0f25be6229b27756d937d16a4a7de03f 100644 (file)
@@ -68,17 +68,24 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
                /* check that a sequence contains dimsize[dim] items */
                const int seq_size= PySequence_Size(seq);
                if(seq_size == -1) {
-                       PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not %s", error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name);
-                       return 0;
+                       PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not '%s'",
+                                    error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name);
+                       return -1;
                }
                for (i= 0; i < seq_size; i++) {
                        PyObject *item;
                        int ok= 1;
                        item= PySequence_GetItem(seq, i);
 
-                       if (!PySequence_Check(item)) {
+                       if(item == NULL) {
+                               PyErr_Format(PyExc_TypeError, "%s sequence type '%s' failed to retrieve index %d",
+                                            error_prefix, Py_TYPE(seq)->tp_name, i);
+                               ok= 0;
+                       }
+                       else if (!PySequence_Check(item)) {
                                /* BLI_snprintf(error_str, error_str_size, "expected a sequence of %s", item_type_str); */
-                               PyErr_Format(PyExc_TypeError, "%s expected a sequence of %s, not %s", error_prefix, item_type_str, Py_TYPE(item)->tp_name);
+                               PyErr_Format(PyExc_TypeError, "%s expected a sequence of %s, not %s",
+                                            error_prefix, item_type_str, Py_TYPE(item)->tp_name);
                                ok= 0;
                        }
                        /* arr[3][4][5]
@@ -88,42 +95,50 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
                           dim=0 */
                        else if (PySequence_Size(item) != dimsize[dim + 1]) {
                                /* BLI_snprintf(error_str, error_str_size, "sequences of dimension %d should contain %d items", (int)dim + 1, (int)dimsize[dim + 1]); */
-                               PyErr_Format(PyExc_ValueError, "%s sequences of dimension %d should contain %d items", error_prefix, (int)dim + 1, (int)dimsize[dim + 1]);
+                               PyErr_Format(PyExc_ValueError, "%s sequences of dimension %d should contain %d items",
+                                            error_prefix, (int)dim + 1, (int)dimsize[dim + 1]);
                                ok= 0;
                        }
-                       else if (!validate_array_type(item, dim + 1, totdim, dimsize, check_item_type, item_type_str, error_prefix)) {
+                       else if (validate_array_type(item, dim + 1, totdim, dimsize, check_item_type, item_type_str, error_prefix) == -1) {
                                ok= 0;
                        }
 
-                       Py_DECREF(item);
+                       Py_XDECREF(item);
 
                        if (!ok)
-                               return 0;
+                               return -1;
                }
        }
        else {
                /* check that items are of correct type */
                const int seq_size= PySequence_Size(seq);
                if(seq_size == -1) {
-                       PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not %s", error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name);
-                       return 0;
+                       PyErr_Format(PyExc_ValueError, "%s sequence expected at dimension %d, not '%s'",
+                                    error_prefix, (int)dim + 1, Py_TYPE(seq)->tp_name);
+                       return -1;
                }
                for (i= 0; i < seq_size; i++) {
                        PyObject *item= PySequence_GetItem(seq, i);
 
-                       if (!check_item_type(item)) {
+                       if(item == NULL) {
+                               PyErr_Format(PyExc_TypeError, "%s sequence type '%s' failed to retrieve index %d",
+                                            error_prefix, Py_TYPE(seq)->tp_name, i);
+                               return -1;
+                       }
+                       else if (!check_item_type(item)) {
                                Py_DECREF(item);
 
                                /* BLI_snprintf(error_str, error_str_size, "sequence items should be of type %s", item_type_str); */
-                               PyErr_Format(PyExc_TypeError, "%s expected sequence items of type %s, not %s", error_prefix, item_type_str, Py_TYPE(item)->tp_name);
-                               return 0;
+                               PyErr_Format(PyExc_TypeError, "%s expected sequence items of type %s, not %s",
+                                            error_prefix, item_type_str, Py_TYPE(item)->tp_name);
+                               return -1;
                        }
 
                        Py_DECREF(item);
                }
        }
 
-       return 1;
+       return 0; /* ok */
 }
 
 /* Returns the number of items in a single- or multi-dimensional sequence. */
@@ -136,8 +151,21 @@ static int count_items(PyObject *seq, int dim)
                int i;
                for (i= 0; i < seq_size; i++) {
                        PyObject *item= PySequence_GetItem(seq, i);
-                       totitem += count_items(item, dim - 1);
-                       Py_DECREF(item);
+                       if(item) {
+                               const int tot= count_items(item, dim - 1);
+                               Py_DECREF(item);
+                               if(tot != -1) {
+                                       totitem += tot;
+                               }
+                               else {
+                                       totitem= -1;
+                                       break;
+                               }
+                       }
+                       else {
+                               totitem= -1;
+                               break;
+                       }
                }
        }
        else {
@@ -156,18 +184,24 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
        totdim= RNA_property_array_dimension(ptr, prop, dimsize);
        tot= count_items(rvalue, totdim - lvalue_dim);
 
-       if ((RNA_property_flag(prop) & PROP_DYNAMIC) && lvalue_dim == 0) {
+       if(tot == -1) {
+               PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, error validating the sequence length",
+                            error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
+               return -1;
+       }
+       else if ((RNA_property_flag(prop) & PROP_DYNAMIC) && lvalue_dim == 0) {
                if (RNA_property_array_length(ptr, prop) != tot) {
 #if 0
                        /* length is flexible */
                        if (!RNA_property_dynamic_array_set_length(ptr, prop, tot)) {
                                /* BLI_snprintf(error_str, error_str_size, "%s.%s: array length cannot be changed to %d", RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */
-                               PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot);
-                               return 0;
+                               PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d",
+                                            error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot);
+                               return -1;
                        }
 #else
                        *totitem= tot;
-                       return 1;
+                       return 0;
 
 #endif
                }
@@ -204,14 +238,15 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
 
                if (tot != len) {
                        /* BLI_snprintf(error_str, error_str_size, "sequence must have length of %d", len); */
-                       PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, sequence must have %d items total, not %d", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), len, tot);
-                       return 0;
+                       PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, sequence must have %d items total, not %d",
+                                    error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), len, tot);
+                       return -1;
                }
        }
 
        *totitem= len;
 
-       return 1;
+       return 0;
 }
 
 static int validate_array(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, ItemTypeCheckFunc check_item_type, const char *item_type_str, int *totitem, const char *error_prefix)
@@ -221,8 +256,8 @@ static int validate_array(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop,
 
        /* validate type first because length validation may modify property array length */
 
-       if (!validate_array_type(rvalue, lvalue_dim, totdim, dimsize, check_item_type, item_type_str, error_prefix))
-               return 0;
+       if (validate_array_type(rvalue, lvalue_dim, totdim, dimsize, check_item_type, item_type_str, error_prefix) == -1)
+               return -1;
 
        return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix);
 }
@@ -250,25 +285,39 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int
        int totdim= RNA_property_array_dimension(ptr, prop, NULL);
        const int seq_size= PySequence_Size(seq);
 
-       assert(seq_size != -1);
+       /* General note for 'data' being NULL or PySequence_GetItem() failing.
+        *
+        * This should never be NULL since we validated it, _but_ some triky python
+        * developer could write their own sequence type which succeeds on
+        * validating but fails later somehow, so include checks for safety. */
+
+       if(seq_size == -1) {
+               return NULL;
+       }
 
-       for (i= 0; i < seq_size; i++) {
+       for (i= 0; (i < seq_size) && data; i++) {
                PyObject *item= PySequence_GetItem(seq, i);
+               if(item) {
+                       if (dim + 1 < totdim) {
+                               data= copy_values(item, ptr, prop, dim + 1, data, item_size, index, convert_item, rna_set_index);
+                       }
+                       else {
+                               data= copy_value_single(item, ptr, prop, data, item_size, index, convert_item, rna_set_index);
+                       }
+
+                       Py_DECREF(item);
 
-               if (dim + 1 < totdim) {
-                       data= copy_values(item, ptr, prop, dim + 1, data, item_size, index, convert_item, rna_set_index);
+                       /* data may be NULL, but the for loop checks */
                }
                else {
-                       data= copy_value_single(item, ptr, prop, data, item_size, index, convert_item, rna_set_index);
+                       return NULL;
                }
-
-               Py_DECREF(item);
        }
 
        return data;
 }
 
-static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix)
+static int py_to_array(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix)
 {
        /*int totdim, dim_size[MAX_ARRAY_DIMENSION];*/
        int totitem;
@@ -276,8 +325,8 @@ static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, char *p
 
        /*totdim= RNA_property_array_dimension(ptr, prop, dim_size);*/ /*UNUSED*/
 
-       if (!validate_array(py, ptr, prop, 0, check_item_type, item_type_str, &totitem, error_prefix)) {
-               return 0;
+       if (validate_array(seq, ptr, prop, 0, check_item_type, item_type_str, &totitem, error_prefix) == -1) {
+               return -1;
        }
 
        if (totitem) {
@@ -297,16 +346,27 @@ static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, char *p
                        data= PyMem_MALLOC(item_size * totitem);
                }
 
-               copy_values(py, ptr, prop, 0, data, item_size, NULL, convert_item, NULL);
+               /* will only fail in very rare cases since we already validated the
+                * python data, the check here is mainly for completeness. */
+               if(copy_values(seq, ptr, prop, 0, data, item_size, NULL, convert_item, NULL) != NULL) {
+                       if (param_data==NULL) {
+                               /* NULL can only pass through in case RNA property arraylength is 0 (impossible?) */
+                               rna_set_array(ptr, prop, data);
+                               PyMem_FREE(data);
+                       }
+               }
+               else {
+                       if (param_data==NULL) {
+                               PyMem_FREE(data);
+                       }
 
-               if (param_data==NULL) {
-                       /* NULL can only pass through in case RNA property arraylength is 0 (impossible?) */
-                       rna_set_array(ptr, prop, data);
-                       PyMem_FREE(data);
+                       PyErr_Format(PyExc_TypeError, "%s internal error parsing sequence of type '%s' after successful validation",
+                                    error_prefix, Py_TYPE(seq)->tp_name);
+                       return -1;
                }
        }
 
-       return 1;
+       return 0;
 }
 
 static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, int arrayoffset, int index, ItemTypeCheckFunc check_item_type, const char *item_type_str, ItemConvertFunc convert_item, RNA_SetIndexFunc rna_set_index, const char *error_prefix)
@@ -335,21 +395,24 @@ static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, i
 
        if(lvalue_dim == totdim) { /* single item, assign directly */
                if(!check_item_type(py)) {
-                       PyErr_Format(PyExc_TypeError, "%s %.200s.%.200s, expected a %s type, not %s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), item_type_str, Py_TYPE(py)->tp_name);
-                       return 0;
+                       PyErr_Format(PyExc_TypeError, "%s %.200s.%.200s, expected a %s type, not %s",
+                                    error_prefix, RNA_struct_identifier(ptr->type),
+                                    RNA_property_identifier(prop), item_type_str,
+                                    Py_TYPE(py)->tp_name);
+                       return -1;
                }
                copy_value_single(py, ptr, prop, NULL, 0, &index, convert_item, rna_set_index);
        }
        else {
-               if (!validate_array(py, ptr, prop, lvalue_dim, check_item_type, item_type_str, &totitem, error_prefix)) {
-                       return 0;
+               if (validate_array(py, ptr, prop, lvalue_dim, check_item_type, item_type_str, &totitem, error_prefix) == -1) {
+                       return -1;
                }
 
                if (totitem) {
                        copy_values(py, ptr, prop, lvalue_dim, NULL, 0, &index, convert_item, rna_set_index);
                }
        }
-       return 1;
+       return 0;
 }
 
 static void py_to_float(PyObject *py, char *data)
@@ -414,7 +477,7 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyOb
                break;
        default:
                PyErr_SetString(PyExc_TypeError, "not an array type");
-               ret= 0;
+               ret= -1;
        }
 
        return ret;
@@ -435,7 +498,7 @@ int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, in
                break;
        default:
                PyErr_SetString(PyExc_TypeError, "not an array type");
-               ret= 0;
+               ret= -1;
        }
 
        return ret;
index 6e321015bc673c0ed7fd483b1d7fb5638254dd84..1450621d59e3a3c21ba4c31744e18057d85bf61a 100644 (file)
@@ -122,63 +122,3 @@ short BPy_errors_to_report(ReportList *reports)
        Py_DECREF(pystring_format); // workaround
        return 1;
 }
-
-/* array utility function */
-int PyC_AsArray(void *array, PyObject *value, int length, PyTypeObject *type, const char *error_prefix)
-{
-       PyObject *value_fast;
-       int value_len;
-       int i;
-
-       if(!(value_fast=PySequence_Fast(value, error_prefix))) {
-               return -1;
-       }
-
-       value_len= PySequence_Fast_GET_SIZE(value_fast);
-
-       if(value_len != length) {
-               Py_DECREF(value);
-               PyErr_Format(PyExc_TypeError,
-                            "%.200s: invalid sequence length. expected %d, got %d",
-                            error_prefix, length, value_len);
-               return -1;
-       }
-
-       /* for each type */
-       if(type == &PyFloat_Type) {
-               float *array_float= array;
-               for(i=0; i<length; i++) {
-                       array_float[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
-               }
-       }
-       else if(type == &PyLong_Type) {
-               int *array_int= array;
-               for(i=0; i<length; i++) {
-                       array_int[i]= PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
-               }
-       }
-       else if(type == &PyBool_Type) {
-               int *array_bool= array;
-               for(i=0; i<length; i++) {
-                       array_bool[i]= (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
-               }
-       }
-       else {
-               Py_DECREF(value_fast);
-               PyErr_Format(PyExc_TypeError,
-                            "%s: internal error %s is invalid",
-                            error_prefix, type->tp_name);
-               return -1;
-       }
-
-       Py_DECREF(value_fast);
-
-       if(PyErr_Occurred()) {
-               PyErr_Format(PyExc_TypeError,
-                            "%s: one or more items could not be used as a %s",
-                            error_prefix, type->tp_name);
-               return -1;
-       }
-
-       return 0;
-}
index a59ebdaa5a219bab6e1eeb9d529b0c10a75507d8..b6af781f4d4b6242eb65dda8c2abd250067c6ff4 100644 (file)
@@ -208,7 +208,6 @@ struct Render;
 struct Image;
 struct Object;
 
-void RE_shade_external(struct Render *re, struct ShadeInput *shi, struct ShadeResult *shr);
 int RE_bake_shade_all_selected(struct Render *re, int type, struct Object *actob, short *do_update, float *progress);
 struct Image *RE_bake_shade_get_image(void);
 void RE_bake_ibuf_filter(struct ImBuf *ibuf, unsigned char *mask, const int filter);
index 6b50ba417eb2cda1cb05ecafbbe56ce443d19b86..7c197bb440e779c7a5ee14547fbab19c7f9e56b2 100644 (file)
@@ -1956,40 +1956,6 @@ void add_halo_flare(Render *re)
        R.r.mode= mode; 
 }
 
-/* ************************* used for shaded view ************************ */
-
-/* if *re, then initialize, otherwise execute */
-void RE_shade_external(Render *re, ShadeInput *shi, ShadeResult *shr)
-{
-       static VlakRen vlr;
-       static ObjectRen obr;
-       static ObjectInstanceRen obi;
-       
-       /* init */
-       if(re) {
-               R= *re;
-               
-               /* fake render face */
-               memset(&vlr, 0, sizeof(VlakRen));
-               memset(&obr, 0, sizeof(ObjectRen));
-               memset(&obi, 0, sizeof(ObjectInstanceRen));
-               obr.lay= -1;
-               obi.obr= &obr;
-               
-               return;
-       }
-       shi->vlr= &vlr;
-       shi->obr= &obr;
-       shi->obi= &obi;
-       
-       if(shi->mat->nodetree && shi->mat->use_nodes)
-               ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
-       else {
-               shade_input_init_material(shi);
-               shade_material_loop(shi, shr);
-       }
-}
-
 /* ************************* bake ************************ */
 
 
index c801ca58b71361fc85b600d28933d9a19505bf04..094eb2d03b5b73d9982a55aa7cbae9ab71ed2f5e 100644 (file)
@@ -170,6 +170,7 @@ void WM_init(bContext *C, int argc, const char **argv)
        if (!G.background) {
                GPU_extensions_init();
                GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
+               GPU_set_anisotropic(U.anisotropic_filter);
        
                UI_init();
        }
@@ -380,7 +381,6 @@ void WM_exit(bContext *C)
        
        BKE_freecubetable();
        
-       fastshade_free_render();        /* shaded view */
        ED_preview_free_dbase();        /* frees a Main dbase, before free_blender! */
 
        if(C && CTX_wm_manager(C))
index 06d049d2cb5121a207b9153f847f0780fa6aa884..e840aca4a6a5204d0f6ceeae8498e079b3cdee7c 100644 (file)
@@ -938,13 +938,28 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
        return block;
 }
 
-/* Only invoked by OK button in popups created with wm_block_create_dialog() */
+typedef struct wmOpPopUp
+{
+       wmOperator *op;
+       int width;
+       int height;
+       int free_op;
+} wmOpPopUp;
+
+/* Only invoked by OK button in popups created with wm_block_dialog_create() */
 static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
 {
-       wmOperator *op= arg1;
+       wmOpPopUp *data= arg1;
        uiBlock *block= arg2;
 
-       WM_operator_call(C, op);
+       WM_operator_call(C, data->op);
+
+       /* let execute handle freeing it */
+       //data->free_op= FALSE;
+       //data->op= NULL;
+
+       /* in this case, wm_operator_ui_popup_cancel wont run */
+       MEM_freeN(data);
 
        uiPupBlockClose(C, block);
 }
@@ -960,9 +975,9 @@ static void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg))
 }
 
 /* Dialogs are popups that require user verification (click OK) before exec */
-static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData)
+static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
 {
-       struct { wmOperator *op; int width; int height; } * data = userData;
+       wmOpPopUp *data= userData;
        wmOperator *op= data->op;
        uiBlock *block;
        uiLayout *layout;
@@ -991,7 +1006,7 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData)
                col_block= uiLayoutGetBlock(col);
                /* Create OK button, the callback of which will execute op */
                btn= uiDefBut(col_block, BUT, 0, "OK", 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
-               uiButSetFunc(btn, dialog_exec_cb, op, col_block);
+               uiButSetFunc(btn, dialog_exec_cb, data, col_block);
        }
 
        /* center around the mouse */
@@ -1001,9 +1016,9 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData)
        return block;
 }
 
-static uiBlock *wm_operator_create_ui(bContext *C, ARegion *ar, void *userData)
+static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
 {
-       struct { wmOperator *op; int width; int height; } * data = userData;
+       wmOpPopUp *data= userData;
        wmOperator *op= data->op;
        uiBlock *block;
        uiLayout *layout;
@@ -1024,6 +1039,28 @@ static uiBlock *wm_operator_create_ui(bContext *C, ARegion *ar, void *userData)
        return block;
 }
 
+static void wm_operator_ui_popup_cancel(void *userData)
+{
+       wmOpPopUp *data= userData;
+       if(data->free_op && data->op) {
+               wmOperator *op= data->op;
+               WM_operator_free(op);
+       }
+
+       MEM_freeN(data);
+}
+
+int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
+{
+       wmOpPopUp *data= MEM_callocN(sizeof(wmOpPopUp), "WM_operator_ui_popup");
+       data->op= op;
+       data->width= width;
+       data->height= height;
+       data->free_op= TRUE; /* if this runs and gets registered we may want not to free it */
+       uiPupBlockEx(C, wm_operator_ui_create, wm_operator_ui_popup_cancel, data);
+       return OPERATOR_RUNNING_MODAL;
+}
+
 /* operator menu needs undo, for redo callback */
 int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
@@ -1043,28 +1080,19 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 
 int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height)
 {
-       struct { wmOperator *op; int width; int height; } data;
+       wmOpPopUp *data= MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup");
        
-       data.op= op;
-       data.width= width;
-       data.height= height;
+       data->op= op;
+       data->width= width;
+       data->height= height;
+       data->free_op= TRUE; /* if this runs and gets registered we may want not to free it */
 
        /* op is not executed until popup OK but is clicked */
-       uiPupBlock(C, wm_block_create_dialog, &data);
+       uiPupBlockEx(C, wm_block_dialog_create, wm_operator_ui_popup_cancel, data);
 
        return OPERATOR_RUNNING_MODAL;
 }
 
-int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
-{
-       struct { wmOperator *op; int width; int height; } data;
-       data.op = op;
-       data.width = width;
-       data.height = height;
-       uiPupBlock(C, wm_operator_create_ui, &data);
-       return OPERATOR_RUNNING_MODAL;
-}
-
 int WM_operator_redo_popup(bContext *C, wmOperator *op)
 {
        /* CTX_wm_reports(C) because operator is on stack, not active in event system */
index c00e7ec7e2916d6977ac74ff9945f8ca90ebff00..7e353d590bb1ffcbe13c6515528b97d3679a4e3b 100644 (file)
@@ -405,7 +405,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
                        
 // 2.5x - could also do this but looks too high level, constraints use this, it works ok.
 //                             Object workob; /* evaluate using workob */
-//                             what_does_obaction((Scene *)obj->GetScene(), obj->GetArmatureObject(), &workob, m_pose, m_action, NULL, m_localtime);
+//                             what_does_obaction(obj->GetArmatureObject(), &workob, m_pose, m_action, NULL, m_localtime);
                        }
 
                        // done getting the pose from the action
index 121f38eef028900d90311b54f9d1cd12b501f1cc..14048c70516d18d12bca6f9a2b753cadb362d645 100644 (file)
@@ -408,6 +408,7 @@ int main(int argc, char** argv)
 
        // We load our own G.main, so free the one that initglobals() gives us
        free_main(G.main);
+       G.main = NULL;
 
        IMB_init();
 
@@ -450,6 +451,9 @@ int main(int argc, char** argv)
        U.audioformat = 0x24;
        U.audiochannels = 2;
 
+       // XXX this one too
+       U.anisotropic_filter = 2;
+
        sound_init_once();
 
        /* if running blenderplayer the last argument can't be parsed since it has to be the filename. */
@@ -705,6 +709,8 @@ int main(int argc, char** argv)
                {
                        GPU_set_mipmap(0);
                }
+
+               GPU_set_anisotropic(U.anisotropic_filter);
                
                // Create the system
                if (GHOST_ISystem::createSystem() == GHOST_kSuccess)
index d2438a66367e96800c3bb726a2813b9f08085499..a306e059442e435bb2ca246f31051be9500b6dc1 100644 (file)
@@ -28,6 +28,7 @@
 #define spit(x) std::cout << x << std::endl;
 
 #include "MEM_guardedalloc.h"
+#include "GPU_draw.h"
 
 extern "C" {
        // envmaps
@@ -175,6 +176,8 @@ void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap)
                glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, pix );
        }
 
+       if (GLEW_EXT_texture_filter_anisotropic)
+               glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic());
        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 }
 
@@ -199,6 +202,9 @@ void BL_Texture::InitNonPow2Tex(unsigned int *pix,int x,int y,bool mipmap)
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
                glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nx, ny, 0, GL_RGBA, GL_UNSIGNED_BYTE, newPixels );
        }
+
+       if (GLEW_EXT_texture_filter_anisotropic)
+               glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, GPU_get_anisotropic());
        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
        free(newPixels);
 }
index 98ea25c135ac5fcb4dca76f412e5cb080274a3e5..473ebbd74bfe38d9f211c875b6c02e224b497601 100644 (file)
@@ -923,6 +923,8 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, getScreenPosition,
 
        if (!PyVecTo(value, vect))
        {
+               PyErr_Clear();
+
                if(ConvertPythonToGameObject(value, &obj, true, ""))
                {
                        PyErr_Clear();