Merge with trunk r36987.
authorJoerg Mueller <nexyon@gmail.com>
Sun, 29 May 2011 00:48:03 +0000 (00:48 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Sun, 29 May 2011 00:48:03 +0000 (00:48 +0000)
168 files changed:
CMakeLists.txt
build_files/cmake/cmake_netbeans_project.py
build_files/cmake/cmake_qtcreator_project.py
build_files/cmake/macros.cmake
build_files/cmake/project_info.py
build_files/scons/tools/Blender.py
build_files/scons/tools/btools.py
doc/python_api/examples/bpy.types.BlendDataLibraries.load.py
doc/python_api/sphinx_doc_gen.py
extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h
extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
intern/audaspace/CMakeLists.txt
intern/audaspace/SConscript
intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
intern/bsp/CMakeLists.txt
intern/bsp/SConscript
intern/container/CTR_TaggedIndex.h
intern/decimation/CMakeLists.txt
intern/decimation/SConscript
intern/ffmpeg/ffmpeg_compat.h [new file with mode: 0644]
intern/ghost/intern/GHOST_SystemX11.cpp
intern/ghost/intern/GHOST_WindowCocoa.mm
intern/ghost/intern/GHOST_WindowX11.cpp
intern/ghost/intern/GHOST_WindowX11.h
release/scripts/modules/bpy_extras/image_utils.py
release/scripts/modules/bpy_extras/io_utils.py
release/scripts/modules/bpy_extras/mesh_utils.py
release/scripts/modules/bpy_extras/object_utils.py
release/scripts/modules/bpy_extras/view3d_utils.py
release/scripts/modules/bpy_types.py
release/scripts/startup/bl_operators/mesh.py
release/scripts/startup/bl_operators/uvcalc_follow_active.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/__init__.py
release/scripts/startup/bl_ui/properties_data_empty.py
release/scripts/startup/bl_ui/properties_object_constraint.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_userpref.py
release/windows/installer/00.sconsblender.nsi
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenlib/BLI_path_util.h
source/blender/blenlib/BLI_string.h
source/blender/blenlib/intern/BLI_kdopbvh.c
source/blender/blenlib/intern/math_color.c
source/blender/blenlib/intern/path_util.c
source/blender/blenlib/intern/pbvh.c
source/blender/blenlib/intern/rct.c
source/blender/blenlib/intern/string.c
source/blender/blenloader/BLO_readfile.h
source/blender/blenloader/intern/readfile.c
source/blender/editors/animation/keyframes_draw.c
source/blender/editors/animation/keyingsets.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/editarmature_sketch.c
source/blender/editors/armature/poselib.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/include/ED_keyframing.h
source/blender/editors/include/ED_view3d.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_relations.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_fly.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/util/undo.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/gpu/intern/gpu_material.c
source/blender/imbuf/CMakeLists.txt
source/blender/imbuf/SConscript
source/blender/imbuf/intern/anim_movie.c
source/blender/imbuf/intern/imageprocess.c
source/blender/imbuf/intern/scaling.c
source/blender/imbuf/intern/targa.c
source/blender/imbuf/intern/util.c
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_define.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_actuator.c
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_internal_types.h
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_rna.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/makesrna/intern/rna_sensor.c
source/blender/makesrna/intern/rna_sequencer.c
source/blender/makesrna/intern/rna_sequencer_api.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_texture.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/modifiers/intern/MOD_armature.c
source/blender/modifiers/intern/MOD_displace.c
source/blender/python/generic/IDProp.c
source/blender/python/generic/bgl.c
source/blender/python/generic/blf_py_api.c
source/blender/python/generic/bpy_internal_import.h
source/blender/python/generic/mathutils.c
source/blender/python/generic/mathutils_Color.c
source/blender/python/generic/mathutils_Euler.c
source/blender/python/generic/mathutils_Matrix.c
source/blender/python/generic/mathutils_Quaternion.c
source/blender/python/generic/mathutils_Vector.c
source/blender/python/generic/mathutils_geometry.c
source/blender/python/generic/noise_py_api.c
source/blender/python/intern/bpy.c
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_library.c
source/blender/python/intern/bpy_props.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna.h
source/blender/render/intern/source/shadeinput.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_operators.c
source/creator/CMakeLists.txt
source/creator/creator.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/VideoTexture/CMakeLists.txt
source/gameengine/VideoTexture/SConscript
source/gameengine/VideoTexture/VideoFFmpeg.cpp
source/gameengine/VideoTexture/VideoFFmpeg.h

index 83e6705e4981238571c5623e177b1957e371bb41..dae8a37e5721fb9e149bbd646e6d0936806a61ba 100644 (file)
@@ -55,33 +55,19 @@ set(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)
 
-# ignore system set flag, use our own
-# must be before project(...)
-# if the user wants to add their own its ok after first run.
-if(DEFINED CMAKE_C_STANDARD_LIBRARIES)
-       set(_reset_standard_libraries OFF)
-else()
-       set(_reset_standard_libraries ON)
-endif()
+#-----------------------------------------------------------------------------
+# Load some macros.
+include(build_files/cmake/macros.cmake)
 
 
-project(Blender)
+#-----------------------------------------------------------------------------
+# Initialize project.
 
+blender_project_hack_pre()
 
-if (_reset_standard_libraries)
-       # Must come after project(...)
-       #
-       # MINGW workaround for -ladvapi32 being included which surprisingly causes
-       # string formatting of floats, eg: printf("%.*f", 3, value). to crash blender
-       # with a meaningless stack trace. by overriding this flag we ensure we only
-       # have libs we define and that cmake & scons builds match.
-       set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
-       set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
-       mark_as_advanced(CMAKE_C_STANDARD_LIBRARIES)
-       mark_as_advanced(CMAKE_CXX_STANDARD_LIBRARIES)
-endif()
-unset(_reset_standard_libraries)
+project(Blender)
 
+blender_project_hack_post()
 
 enable_testing()
 
@@ -91,10 +77,6 @@ enable_testing()
 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE )
 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE )
 
-#-----------------------------------------------------------------------------
-# Load some macros.
-include(build_files/cmake/macros.cmake)
-
 #-----------------------------------------------------------------------------
 # Set default config options
 
@@ -106,7 +88,7 @@ option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
 option(WITH_PYTHON        "Enable Embedded Python API  (only disable for development)" ON)
 option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF)
 mark_as_advanced(WITH_PYTHON)  # dont want people disabling this unless they really know what they are doing.
-mark_as_advanced(WITH_PYTHON_SECURITY)  # some distrobutions see this as a security issue, rather then have them patch it, make a build option.
+mark_as_advanced(WITH_PYTHON_SECURITY)  # some distrobutions see this as a security issue, rather than have them patch it, make a build option.
 
 option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
 option(WITH_PYTHON_MODULE "Enable building as a python module (experemental, only enable for development)" OFF)
@@ -984,6 +966,12 @@ endif()
 #-----------------------------------------------------------------------------
 # Common.
 
+if(APPLE OR WIN32)
+       if(NOT IS_DIRECTORY "${LIBDIR}")
+               message(FATAL_ERROR "Apple and Windows require pre-compiled libs at: '${LIBDIR}'")
+       endif()
+endif()
+
 if(WITH_RAYOPTIMIZATION)
        if(CMAKE_COMPILER_IS_GNUCC)
                if(SUPPORT_SSE_BUILD)
@@ -1144,9 +1132,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
 #-------------------------------------------------------------------------------
 # Global Defines
 
-# better not define flags here but this is a debugging option thats off by default.
+# better not set includes here but this debugging option is off by default.
 if(WITH_CXX_GUARDEDALLOC)
-       set(CMAKE_CXX_FLAGS " -DWITH_CXX_GUARDEDALLOC -I${CMAKE_SOURCE_DIR}/intern/guardedalloc ${CMAKE_CXX_FLAGS}")
+       include_directories(${CMAKE_SOURCE_DIR}/intern/guardedalloc)
 endif()
 
 if(WITH_ASSERT_ABORT)
index c8bedb551481b0fce9cd8ec572dce2e5297fea85..6afca8f3b6a1712daf0cfc2146198f9a8c0b78f4 100755 (executable)
@@ -33,7 +33,7 @@ Windows not supported so far
 from project_info import *
 
 import os
-from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
+from os.path import join, dirname, normpath, relpath, exists
 
 
 def create_nb_project_main():
@@ -50,7 +50,6 @@ def create_nb_project_main():
         includes.sort()
 
         PROJECT_NAME = "Blender"
-        FILE_NAME = PROJECT_NAME.lower()
 
         # --------------- NB spesific
         defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
@@ -76,7 +75,7 @@ def create_nb_project_main():
         if not exists(PROJECT_DIR_NB):
             os.mkdir(PROJECT_DIR_NB)
 
-        SOURCE_DIR_REL = relpath(SOURCE_DIR, PROJECT_DIR)
+        SOURCE_DIR_REL = relpath(SOURCE_DIR, PROJECT_DIR)
 
         f = open(join(PROJECT_DIR_NB, "project.xml"), 'w')
 
index e38b2228ccac615f8234e25f68c7d3eb62490f18..3de15567727433787e5e997adecfee76690db74d 100755 (executable)
@@ -34,54 +34,52 @@ example linux usage
 from project_info import *
 
 import os
-from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
-
 import sys
 
 
 def create_qtc_project_main():
     files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
-    files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
+    files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
     files_rel.sort()
 
     # --- qtcreator specific, simple format
     if SIMPLE_PROJECTFILE:
         # --- qtcreator specific, simple format
         PROJECT_NAME = "Blender"
-        f = open(join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w')
+        f = open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w')
         f.write("\n".join(files_rel))
 
-        f = open(join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w')
-        f.write("\n".join(sorted(list(set(dirname(f) for f in files_rel if is_c_header(f))))))
+        f = open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w')
+        f.write("\n".join(sorted(list(set(os.path.dirname(f) for f in files_rel if is_c_header(f))))))
 
-        qtc_prj = join(PROJECT_DIR, "%s.creator" % PROJECT_NAME)
+        qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME)
         f = open(qtc_prj, 'w')
         f.write("[General]\n")
 
-        qtc_cfg = join(PROJECT_DIR, "%s.config" % PROJECT_NAME)
-        if not exists(qtc_cfg):
+        qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME)
+        if not os.path.exists(qtc_cfg):
             f = open(qtc_cfg, 'w')
             f.write("// ADD PREDEFINED MACROS HERE!\n")
     else:
         includes, defines = cmake_advanced_info()
 
         # for some reason it doesnt give all internal includes
-        includes = list(set(includes) | set(dirname(f) for f in files_rel if is_c_header(f)))
+        includes = list(set(includes) | set(os.path.dirname(f) for f in files_rel if is_c_header(f)))
         includes.sort()
 
         PROJECT_NAME = "Blender"
         FILE_NAME = PROJECT_NAME.lower()
-        f = open(join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
+        f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
         f.write("\n".join(files_rel))
 
-        f = open(join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w')
+        f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w')
         f.write("\n".join(sorted(includes)))
 
-        qtc_prj = join(PROJECT_DIR, "%s.creator" % FILE_NAME)
+        qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
         f = open(qtc_prj, 'w')
         f.write("[General]\n")
 
-        qtc_cfg = join(PROJECT_DIR, "%s.config" % FILE_NAME)
+        qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
         f = open(qtc_cfg, 'w')
         f.write("// ADD PREDEFINED MACROS HERE!\n")
         defines_final = [("#define %s %s" % item) for item in defines]
@@ -95,21 +93,21 @@ def create_qtc_project_main():
 
 def create_qtc_project_python():
     files = list(source_list(SOURCE_DIR, filename_check=is_py))
-    files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
+    files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
     files_rel.sort()
 
     # --- qtcreator specific, simple format
     PROJECT_NAME = "Blender_Python"
     FILE_NAME = PROJECT_NAME.lower()
-    f = open(join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
+    f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
     f.write("\n".join(files_rel))
 
-    qtc_prj = join(PROJECT_DIR, "%s.creator" % FILE_NAME)
+    qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
     f = open(qtc_prj, 'w')
     f.write("[General]\n")
 
-    qtc_cfg = join(PROJECT_DIR, "%s.config" % FILE_NAME)
-    if not exists(qtc_cfg):
+    qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
+    if not os.path.exists(qtc_cfg):
         f = open(qtc_cfg, 'w')
         f.write("// ADD PREDEFINED MACROS HERE!\n")
 
index 14bed8874fa6b660dc583ca3ce2fa87a6ccd8cb3..6e4aaa51a4959a568010f689372edde5be30df06 100644 (file)
@@ -13,19 +13,13 @@ macro(blender_include_dirs
        include_directories(${all_incs})
 endmacro()
 
-# only MSVC uses SOURCE_GROUP
-macro(blender_add_lib_nolist
-       name
-       sources
-       includes)
-
-       # message(STATUS "Configuring library ${name}")
 
-       blender_include_dirs("${includes}")
-       add_library(${name} ${sources})
+macro(blender_source_group
+       sources)
 
        # Group by location on disk
        source_group("Source Files" FILES CMakeLists.txt)
+
        foreach(SRC ${sources})
                get_filename_component(SRC_EXT ${SRC} EXT)
                if(${SRC_EXT} MATCHES ".h" OR ${SRC_EXT} MATCHES ".hpp")
@@ -36,16 +30,26 @@ macro(blender_add_lib_nolist
        endforeach()
 endmacro()
 
-#      # works fine but having the includes listed is helpful for IDE's (QtCreator/MSVC)
-#      macro(blender_add_lib_nolist
-#              name
-#              sources
-#              includes)
-#
-#              message(STATUS "Configuring library ${name}")
-#              include_directories(${includes})
-#              add_library(${name} ${sources})
-#      endmacro()
+
+# only MSVC uses SOURCE_GROUP
+macro(blender_add_lib_nolist
+       name
+       sources
+       includes)
+
+       # message(STATUS "Configuring library ${name}")
+
+       # include_directories(${includes})
+       blender_include_dirs("${includes}")
+
+       add_library(${name} ${sources})
+
+       # works fine without having the includes
+       # listed is helpful for IDE's (QtCreator/MSVC)
+       blender_source_group("${sources}")
+
+endmacro()
+
 
 macro(blender_add_lib
        name
@@ -55,9 +59,9 @@ macro(blender_add_lib
        blender_add_lib_nolist(${name} "${sources}" "${includes}")
 
        set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
-
 endmacro()
 
+
 macro(SETUP_LIBDIRS)
        # see "cmake --help-policy CMP0003"
        if(COMMAND cmake_policy)
@@ -388,3 +392,71 @@ macro(get_blender_version)
 
        # message(STATUS "Version (Internal): ${BLENDER_VERSION}.${BLENDER_SUBVERSION}, Version (external): ${BLENDER_VERSION}${BLENDER_VERSION_CHAR}-${BLENDER_VERSION_CYCLE}")
 endmacro()
+
+
+# hacks to override initial project settings
+# these macros must be called directly before/after project(Blender) 
+macro(blender_project_hack_pre)
+       # ----------------
+       # MINGW HACK START
+       # ignore system set flag, use our own
+       # must be before project(...)
+       # if the user wants to add their own its ok after first run.
+       if(DEFINED CMAKE_C_STANDARD_LIBRARIES)
+               set(_reset_standard_libraries OFF)
+       else()
+               set(_reset_standard_libraries ON)
+       endif()
+
+       # ------------------
+       # GCC -O3 HACK START
+       # needed because O3 can cause problems but
+       # allow the builder to set O3 manually after.
+       if(DEFINED CMAKE_C_FLAGS_RELEASE)
+               set(_reset_standard_cflags_rel OFF)
+       else()
+               set(_reset_standard_cflags_rel ON)
+       endif()
+       if(DEFINED CMAKE_CXX_FLAGS_RELEASE)
+               set(_reset_standard_cxxflags_rel OFF)
+       else()
+               set(_reset_standard_cxxflags_rel ON)
+       endif()
+endmacro()
+
+
+macro(blender_project_hack_post)
+       # --------------
+       # MINGW HACK END
+       if (_reset_standard_libraries)
+               # Must come after project(...)
+               #
+               # MINGW workaround for -ladvapi32 being included which surprisingly causes
+               # string formatting of floats, eg: printf("%.*f", 3, value). to crash blender
+               # with a meaningless stack trace. by overriding this flag we ensure we only
+               # have libs we define and that cmake & scons builds match.
+               set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
+               set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
+               mark_as_advanced(CMAKE_C_STANDARD_LIBRARIES)
+               mark_as_advanced(CMAKE_CXX_STANDARD_LIBRARIES)
+       endif()
+       unset(_reset_standard_libraries)
+
+
+       # ----------------
+       # GCC -O3 HACK END
+       if(_reset_standard_cflags_rel)
+               string(REGEX REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+               set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
+               mark_as_advanced(CMAKE_C_FLAGS_RELEASE)
+       endif()
+
+       if(_reset_standard_cxxflags_rel)
+               string(REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+               set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "" FORCE)
+               mark_as_advanced(CMAKE_CXX_FLAGS_RELEASE)
+       endif()
+
+       unset(_reset_standard_cflags_rel)
+       unset(_reset_standard_cxxflags_rel)
+endmacro()
index c25fbf4128d7e9be00a53ae4df13687c651d5aee..db12884469b0de0eeff32f5957b1890b5dfacf57 100755 (executable)
@@ -46,7 +46,7 @@ __all__ = (
 
 import sys
 import os
-from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
+from os.path import join, dirname, normpath, abspath, splitext, exists
 
 SOURCE_DIR = join(dirname(__file__), "..", "..")
 SOURCE_DIR = normpath(SOURCE_DIR)
index 4bfa1851acb1853998ffb659496eed0f7632527b..8dbed82ed84a54de44a9ec6d639a9011c5d71797 100644 (file)
@@ -449,10 +449,16 @@ def WinPyBundle(target=None, source=None, env=None):
     shutil.rmtree(py_target, False, printexception)
     exclude_re=[re.compile('.*/test/.*'),
                 re.compile('^config/.*'),
+                re.compile('^config-*/.*'),
                 re.compile('^distutils/.*'),
                 re.compile('^idlelib/.*'),
                 re.compile('^lib2to3/.*'),
-                re.compile('^tkinter/.*')]
+                re.compile('^tkinter/.*'),
+                re.compile('^_tkinter_d.pyd'),
+                re.compile('^turtledemo'),
+                re.compile('^turtle.py'),
+                ]
+
     print "Unpacking '" + py_tar + "' to '" + py_target + "'"
     untar_pybundle(py_tar,py_target,exclude_re)
 
@@ -569,17 +575,17 @@ def UnixPyBundle(target=None, source=None, env=None):
     run("cp -R '%s' '%s'" % (py_src, os.path.dirname(py_target)))
     run("rm -rf '%s/distutils'" % py_target)
     run("rm -rf '%s/lib2to3'" % py_target)
-    run("rm -rf '%s/idlelib'" % py_target)
-    run("rm -rf '%s/tkinter'" % py_target)
     run("rm -rf '%s/config'" % py_target)
-
+    run("rm -rf '%s/config-*'" % py_target)
     run("rm -rf '%s/site-packages'" % py_target)
     run("mkdir '%s/site-packages'" % py_target)    # python needs it.'
-
+    run("rm -rf '%s/idlelib'" % py_target)
+    run("rm -rf '%s/tkinter'" % py_target)
+    run("rm -rf '%s/turtledemo'" % py_target)
+    run("rm -r '%s/turtle.py'" % py_target)
     run("rm -f '%s/lib-dynload/_tkinter.so'" % py_target)
+
     run("find '%s' -type d -name 'test' -prune -exec rm -rf {} ';'" % py_target)
-    run("find '%s' -type d -name 'config-*' -prune -exec rm -rf {} ';'" % py_target)
-    run("find '%s' -type d -name 'turtledemo' -prune -exec rm -rf {} ';'" % py_target)
     run("find '%s' -type d -name '__pycache__' -exec rm -rf {} ';'" % py_target)
     run("find '%s' -name '*.py[co]' -exec rm -rf {} ';'" % py_target)
     run("find '%s' -name '*.so' -exec strip -s {} ';'" % py_target)
index fe6b092598cd50ef34607b03af3ac5788cf6d4b6..accdde0d2cf0171f83c808a975e9e0fa364544e2 100644 (file)
@@ -615,10 +615,7 @@ def NSIS_Installer(target=None, source=None, env=None):
         else:
             if len(df)>0:
                 dp_tmp = dp[l:]
-                if dp_tmp.find('python\\lib') > -1:
-                    datafiles += "\n" +r'SetOutPath $INSTDIR'+dp[l:]+"\n\n"
-                else:
-                    datafiles += "\n"+r'SetOutPath $BLENDERHOME'+dp[l:]+"\n\n"
+                datafiles += "\n" +r'SetOutPath $INSTDIR'+dp[l:]+"\n\n"
 
                 for f in df:
                     outfile = os.path.join(dp,f)
index 43e6ac90ae7bbe977dd29560b3733960c304cdbb..42e2a71cc70893af22deb0b5d232fbbe8a6bf137 100644 (file)
@@ -21,3 +21,19 @@ with bpy.data.libraries.load(filepath, link=True) as (data_from, data_to):
 with bpy.data.libraries.load(filepath) as (data_from, data_to):
     for attr in dir(data_to):
         setattr(data_to, attr, getattr(data_from, attr))
+
+
+# the 'data_to' variables lists are
+with bpy.data.libraries.load(filepath) as (data_from, data_to):
+    data_to.scenes = ["Scene"]
+
+
+# the loaded objects can be accessed from 'data_to' outside of the context
+# since loading the data replaces the strings for the datablocks or None
+# if the datablock could not be loaded.
+with bpy.data.libraries.load(filepath) as (data_from, data_to):
+    data_to.meshes = data_from.meshes
+# now operate directly on the loaded data
+for mesh in data_to.meshes:
+    if mesh is not None:
+        print(mesh.name)
index 03c8fe1b4ff28dbaca891efa282bda1b01a933e9..e96b4d363b41022a0f8758cad1a1a24e4c267fd2 100644 (file)
@@ -34,7 +34,8 @@ For HTML generation
 
 - Generate html docs by running...
 
-    sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
+    cd doc/python_api
+    sphinx-build sphinx-in sphinx-out
 
   assuming that you have sphinx 1.0.7 installed
 
@@ -64,8 +65,9 @@ else:
         "bpy.props",
         "bpy.utils",
         "bpy.context",
-        "bpy.types",  # supports filtering
+        "bpy.types",  # supports filtering
         "bpy.ops",  # supports filtering
+        #"bpy_extras",
         "bge",
         "aud",
         "bgl",
@@ -204,10 +206,24 @@ def write_indented_lines(ident, fn, text, strip=True):
     '''
     if text is None:
         return
-    for l in text.split("\n"):
-        if strip:
-            fn(ident + l.strip() + "\n")
-        else:
+
+    lines = text.split("\n")
+
+    # strip empty lines from the start/end
+    while lines and not lines[0].strip():
+        del lines[0]
+    while lines and not lines[-1].strip():
+        del lines[-1]
+
+    if strip:
+        ident_strip = 1000
+        for l in lines:
+            if l.strip():
+                ident_strip = min(ident_strip, len(l) - len(l.lstrip()))
+        for l in lines:
+            fn(ident + l[ident_strip:] + "\n")
+    else:
+        for l in lines:
             fn(ident + l + "\n")
 
 
@@ -252,7 +268,7 @@ def pyfunc2sphinx(ident, fw, identifier, py_func, is_class=True):
 
     fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str))
     if py_func.__doc__:
-        write_indented_lines(ident + "   ", fw, py_func.__doc__.strip())
+        write_indented_lines(ident + "   ", fw, py_func.__doc__)
         fw("\n")
 
 
@@ -267,8 +283,10 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):
     if type(descr) == GetSetDescriptorType:
         fw(ident + ".. attribute:: %s\n\n" % identifier)
         write_indented_lines(ident + "   ", fw, doc, False)
+        fw("\n")
     elif type(descr) in (MethodDescriptorType, ClassMethodDescriptorType):
         write_indented_lines(ident, fw, doc, False)
+        fw("\n")
     else:
         raise TypeError("type was not GetSetDescriptorType, MethodDescriptorType or ClassMethodDescriptorType")
 
@@ -316,11 +334,17 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
     attribute_set = set()
     filepath = os.path.join(BASEPATH, module_name + ".rst")
 
+    module_all = getattr(module, "__all__", None)
+    module_dir = sorted(dir(module))
+
+    if module_all:
+        module_dir = module_all
+
     file = open(filepath, "w")
 
     fw = file.write
 
-    write_title(fw, title, "=")
+    write_title(fw, "%s (%s)" % (title, module_name), "=")
 
     fw(".. module:: %s\n\n" % module_name)
 
@@ -331,6 +355,35 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
 
     write_example_ref("", fw, module_name)
 
+    # write submodules
+    # we could also scan files but this ensures __all__ is used correctly
+    if module_all is not None:
+        submod_name = None
+        submod = None
+        submod_ls = []
+        for submod_name in module_all:
+            ns = {}
+            exec_str = "from %s import %s as submod" % (module.__name__, submod_name)
+            exec(exec_str, ns, ns)
+            submod = ns["submod"]
+            if type(submod) == types.ModuleType:
+                submod_ls.append((submod_name, submod))
+
+        del submod_name
+        del submod
+
+        if submod_ls:
+            fw(".. toctree::\n")
+            fw("   :maxdepth: 1\n\n")
+
+            for submod_name, submod in submod_ls:
+                submod_name_full = "%s.%s" % (module_name, submod_name)
+                fw("   %s.rst\n\n" % submod_name_full)
+
+                pymodule2sphinx(BASEPATH, submod_name_full, submod, "%s submodule" % module_name)
+        del submod_ls
+    # done writing submodules!
+
     # write members of the module
     # only tested with PyStructs which are not exactly modules
     for key, descr in sorted(type(module).__dict__.items()):
@@ -348,15 +401,15 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
             if descr.__doc__:
                 fw(".. data:: %s\n\n" % key)
                 write_indented_lines("   ", fw, descr.__doc__, False)
-                attribute_set.add(key)
                 fw("\n")
+                attribute_set.add(key)
+
     del key, descr
 
     classes = []
 
-    for attribute in sorted(dir(module)):
+    for attribute in module_dir:
         if not attribute.startswith("_"):
-
             if attribute in attribute_set:
                 continue
 
@@ -972,6 +1025,8 @@ def rna2sphinx(BASEPATH):
         fw("   blf.rst\n\n")
     if "aud" not in EXCLUDE_MODULES:
         fw("   aud.rst\n\n")
+    if "bpy_extras" not in EXCLUDE_MODULES:
+        fw("   bpy_extras.rst\n\n")
 
     # game engine
     if "bge" not in EXCLUDE_MODULES:
@@ -1068,41 +1123,45 @@ def rna2sphinx(BASEPATH):
     # python modules
     if "bpy.utils" not in EXCLUDE_MODULES:
         from bpy import utils as module
-        pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
+        pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities")
 
     if "bpy.path" not in EXCLUDE_MODULES:
         from bpy import path as module
-        pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities (bpy.path)")
+        pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities")
+
+    if "bpy_extras" not in EXCLUDE_MODULES:
+        import bpy_extras as module
+        pymodule2sphinx(BASEPATH, "bpy_extras", module, "Extra Utilities")
 
     # C modules
     if "bpy.app" not in EXCLUDE_MODULES:
         from bpy import app as module
-        pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data (bpy.app)")
+        pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data")
 
     if "bpy.props" not in EXCLUDE_MODULES:
         from bpy import props as module
-        pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions (bpy.props)")
+        pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions")
 
     if "mathutils" not in EXCLUDE_MODULES:
         import mathutils as module
-        pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)")
+        pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities")
 
     if "mathutils.geometry" not in EXCLUDE_MODULES:
         import mathutils.geometry as module
-        pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities (mathutils.geometry)")
+        pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities")
 
     if "mathutils.geometry" not in EXCLUDE_MODULES:
         import blf as module
-        pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
+        pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing")
 
     # XXX TODO
     #import bgl as module
-    #pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper (bgl)")
+    #pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper")
     #del module
 
     if "aud" not in EXCLUDE_MODULES:
         import aud as module
-        pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)")
+        pymodule2sphinx(BASEPATH, "aud", module, "Audio System")
     del module
 
     ## game engine
index 07167af3baf540eef6a5f1cf5cd38c68cd03958e..70cf3e4ace83778ca830ad2b0c6c7b6883c6005f 100644 (file)
@@ -1026,7 +1026,7 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMaxUp(int axis, BP_FP_INT_TYPE ed
 
 
 /// The btAxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase.
-/// It uses arrays rather then lists for storage of the 3 axis. Also it operates using 16 bit integer coordinates instead of floats.
+/// It uses arrays rather than lists for storage of the 3 axis. Also it operates using 16 bit integer coordinates instead of floats.
 /// For large worlds and many objects, use bt32BitAxisSweep3 or btDbvtBroadphase instead. bt32BitAxisSweep3 has higher precision and allows more then 16384 objects at the cost of more memory and bit of performance.
 class btAxisSweep3 : public btAxisSweep3Internal<unsigned short int>
 {
@@ -1038,7 +1038,7 @@ public:
 
 /// The bt32BitAxisSweep3 allows higher precision quantization and more objects compared to the btAxisSweep3 sweep and prune.
 /// This comes at the cost of more memory per handle, and a bit slower performance.
-/// It uses arrays rather then lists for storage of the 3 axis.
+/// It uses arrays rather than lists for storage of the 3 axis.
 class bt32BitAxisSweep3 : public btAxisSweep3Internal<unsigned int>
 {
 public:
index ede1afb2a036202e477839a51adca65b7140c627..94385fed909f6c059d0759421032798dd659fe40 100644 (file)
@@ -487,7 +487,7 @@ btScalar    btConvexConvexAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,
 {
        (void)resultOut;
        (void)dispatchInfo;
-       ///Rather then checking ALL pairs, only calculate TOI when motion exceeds threshold
+       ///rather than checking ALL pairs, only calculate TOI when motion exceeds threshold
     
        ///Linear motion for one of objects needs to exceed m_ccdSquareMotionThreshold
        ///col0->m_worldTransform,
index 74f483eab05c29ee9a12c4a9c44d8e042acbe5d7..a2468d0071e6dbf88b777f62317e973d063c7597 100644 (file)
@@ -26,6 +26,7 @@ set(INC
        FX SRC
        ${PTHREADS_INC}
        ${LIBSAMPLERATE_INC}
+       ../ffmpeg
 )
 
 set(SRC
index ecc9498718532806764134b71661b384868084d8..67f859b0e5f2c7c282ff97ed951a7968bbc1bb62 100644 (file)
@@ -8,7 +8,7 @@ defs = []
 
 if env['WITH_BF_FFMPEG']:
     sources += env.Glob('ffmpeg/*.cpp')
-    incs += ' ffmpeg ' + env['BF_FFMPEG_INC']
+    incs += ' ffmpeg  #/intern/ffmpeg ' + env['BF_FFMPEG_INC']
     defs.append('WITH_FFMPEG')
 
 if env['WITH_BF_SDL']:
index ea6e0c549fa871f606b55aeccd2c80bd378bf1de..4597432e7d14b500a11f786167d649cfb191fa92 100644 (file)
@@ -39,6 +39,7 @@
 extern "C" {
 #include <libavcodec/avcodec.h>
 #include <libavformat/avformat.h>
+#include "ffmpeg_compat.h"
 }
 
 int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
@@ -52,6 +53,10 @@ int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
 
        int read_length, data_size;
 
+       AVPacket tmp_pkt;
+       
+       av_init_packet(&tmp_pkt);
+
        // as long as there is still data in the package
        while(audio_pkg_size > 0)
        {
@@ -64,15 +69,14 @@ int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
 
                // read samples from the packet
                data_size = buf_size - buf_pos;
-               /*read_length = avcodec_decode_audio3(m_codecCtx,
-                       (int16_t*)(((data_t*)buffer.getBuffer())+buf_pos),
-                       &data_size,
-                       packet);*/
-               read_length = avcodec_decode_audio2(m_codecCtx,
-                                               (int16_t*)(((data_t*)buffer.getBuffer()) + buf_pos),
-                                               &data_size,
-                                               audio_pkg_data,
-                                               audio_pkg_size);
+
+               tmp_pkt.data = audio_pkg_data;
+               tmp_pkt.size = audio_pkg_size;
+
+               read_length = avcodec_decode_audio3(
+                       m_codecCtx,
+                       (int16_t*)(((data_t*)buffer.getBuffer()) + buf_pos),
+                       &data_size, &tmp_pkt);
 
                // read error, next packet!
                if(read_length < 0)
@@ -112,7 +116,7 @@ void AUD_FFMPEGReader::init()
 
        for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
        {
-               if((m_formatCtx->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO)
+               if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
                        && (m_stream < 0))
                {
                        m_stream=i;
index 2e615314543a8e55b6735b17e141ff7f5e7e7fb8..9f281586867a47181f665e2cb004017e1da0bffc 100644 (file)
@@ -27,6 +27,7 @@
 set(INC
        ./intern
        ../container
+       ../guardedalloc
        ../moto/include
        ../memutil
 )
index 43952f4ff1811707efaddb93fe7227da516313fb..4927c33dc8a652e059f8b98d323086d0cb215bc3 100644 (file)
@@ -3,7 +3,7 @@ Import ('env')
 
 sources = env.Glob('intern/*.cpp')
 
-incs = 'intern ../container ../moto/include ../memutil'
+incs = 'intern ../container ../moto/include ../memutil ../guardedalloc'
 
 env.BlenderLib ('bf_intern_bsp', sources, Split(incs), [], libtype=['core','player'], priority=[200,100] )
 
index 0a57ce11d19d516ac0aaefaa9e2731fd8d5368d0..b5284a5da306785ff9c1f5376179edfdbcfeaf5e 100644 (file)
@@ -52,6 +52,8 @@
 
 #include <functional>
 
+#include "MEM_sys_types.h"
+
 enum {
 
        empty_tag = 0x0,
@@ -100,9 +102,9 @@ public:
 
 #if defined(_WIN64)
        CTR_TaggedIndex(
-               const unsigned __int64 val
+               const uint64_t val
        ) :
-               m_val ( ((unsigned __int64)val & index_mask)
+               m_val ( ((uint64_t)val & index_mask)
                                | ( (empty_tag << tag_shift)
                                        & (~index_mask) ) ) {
        }
@@ -140,8 +142,8 @@ public:
        }
 
 #if defined(_WIN64)
-       operator unsigned __int64 () const {
-                       return (unsigned __int64)(m_val & index_mask);
+       operator uint64_t () const {
+                       return (uint64_t)(m_val & index_mask);
                }
 #endif
 
index b726a8cd6a163378a98b6578e82abfdec22251ef..6f9137b7189520b5ee2d5eb2da92d61117442675 100644 (file)
@@ -27,6 +27,7 @@
 set(INC
        .
        ../container
+       ../guardedalloc
        ../memutil
        ../moto/include
 )
index 6e2929cb650a1d48a444d0aa43c1c11eeb387341..6f4befb3ffa2b6a1183bc0c9f2dcd600073c909d 100644 (file)
@@ -3,6 +3,6 @@ Import ('env')
 
 sources = env.Glob('intern/*.cpp')
 
-incs = '. ../moto/include ../container ../memutil'
+incs = '. ../moto/include ../container ../memutil ../guardedalloc'
 
 env.BlenderLib ('bf_intern_decimate', sources, Split(incs) , [], libtype=['core', 'player'], priority = [200, 100] )
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
new file mode 100644 (file)
index 0000000..ab819f4
--- /dev/null
@@ -0,0 +1,133 @@
+#ifndef __ffmpeg_compat_h_included__
+#define __ffmpeg_compat_h_included__ 1
+
+/*
+ * $Id$
+ *
+ * compatibility macros to make every ffmpeg installation appear
+ * like the most current installation (wrapping some functionality sometimes)
+ * it also includes all ffmpeg header files at once, no need to do it 
+ * seperately.
+ *
+ * Copyright (c) 2011 Peter Schlaile
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+
+#include <libavformat/avformat.h>
+#include <libavcodec/avcodec.h>
+#include <libavutil/rational.h>
+
+#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101))
+#define FFMPEG_HAVE_PARSE_UTILS 1
+#include <libavutil/parseutils.h>
+#endif
+
+#include <libswscale/swscale.h>
+#include <libavcodec/opt.h>
+
+#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 105))
+#define FFMPEG_HAVE_AVIO 1
+#endif
+
+#if (LIBAVCODEC_VERSION_MAJOR > 53) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR > 1)) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR == 1) && (LIBAVCODEC_VERSION_MICRO >= 1))
+#define FFMPEG_HAVE_DEFAULT_VAL_UNION 1
+#endif
+
+#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101))
+#define FFMPEG_HAVE_AV_DUMP_FORMAT 1
+#endif
+
+#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 45))
+#define FFMPEG_HAVE_AV_GUESS_FORMAT 1
+#endif
+
+#if (LIBAVCODEC_VERSION_MAJOR > 52) || ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 23))
+#define FFMPEG_HAVE_DECODE_AUDIO3 1
+#define FFMPEG_HAVE_DECODE_VIDEO2 1
+#endif
+
+#if (LIBAVCODEC_VERSION_MAJOR > 52) || ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 64))
+#define FFMPEG_HAVE_AVMEDIA_TYPES 1
+#endif
+
+#if ((LIBAVCODEC_VERSION_MAJOR > 52) || (LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 29)) && \
+       ((LIBSWSCALE_VERSION_MAJOR > 0) || (LIBSWSCALE_VERSION_MAJOR >= 0) && (LIBSWSCALE_VERSION_MINOR >= 10))
+#define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
+#endif
+
+#ifndef FFMPEG_HAVE_AVIO
+#define AVIO_FLAG_WRITE URL_WRONLY
+#define avio_open url_fopen
+#define avio_tell url_ftell
+#define avio_close url_fclose
+#endif
+
+/* there are some version inbetween, which have avio_... functions but no
+   AVIO_FLAG_... */
+#ifndef AVIO_FLAG_WRITE
+#define AVIO_FLAG_WRITE URL_WRONLY
+#endif
+
+#ifndef AV_PKT_FLAG_KEY
+#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
+#endif
+
+#ifndef FFMPEG_HAVE_AV_DUMP_FORMAT
+#define av_dump_format dump_format
+#endif
+
+#ifndef FFMPEG_HAVE_AV_GUESS_FORMAT
+#define av_guess_format guess_format
+#endif
+
+#ifndef FFMPEG_HAVE_PARSE_UTILS
+#define av_parse_video_rate av_parse_video_frame_rate
+#endif
+
+#ifdef FFMPEG_HAVE_DEFAULT_VAL_UNION
+#define FFMPEG_DEF_OPT_VAL_INT(OPT) OPT->default_val.i64
+#define FFMPEG_DEF_OPT_VAL_DOUBLE(OPT) OPT->default_val.dbl
+#else
+#define FFMPEG_DEF_OPT_VAL_INT(OPT) OPT->default_val
+#define FFMPEG_DEF_OPT_VAL_DOUBLE(OPT) OPT->default_val
+#endif
+
+#ifndef FFMPEG_HAVE_AVMEDIA_TYPES
+#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
+#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
+#endif
+
+#ifndef FFMPEG_HAVE_DECODE_AUDIO3
+static inline 
+int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
+                         int *frame_size_ptr, AVPacket *avpkt)
+{
+       return avcodec_decode_audio2(avctx, samples,
+                                    frame_size_ptr, avpkt->data,
+                                    avpkt->size);
+}
+#endif
+
+#ifndef FFMPEG_HAVE_DECODE_VIDEO2
+static inline
+int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
+                         int *got_picture_ptr,
+                         AVPacket *avpkt)
+{
+       return avcodec_decode_video(avctx, picture, got_picture_ptr,
+                                   avpkt->data, avpkt->size);
+}
+#endif
+
+#endif
index b44f2b1822507bab2fd46c3d5678718d01d683d6..c53bf7de36c3afbf58fcdb5dbddaf80d2678c69f 100644 (file)
@@ -795,6 +795,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
                }
                
                default: {
+#ifdef WITH_X11_XINPUT
                        if(xe->type == window->GetXTablet().MotionEvent) 
                        {
                                XDeviceMotionEvent* data = (XDeviceMotionEvent*)xe;
@@ -818,7 +819,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
                        }
                        else if(xe->type == window->GetXTablet().ProxOutEvent)
                                window->GetXTablet().CommonData.Active= GHOST_kTabletModeNone;
-
+#endif // WITH_X11_XINPUT
                        break;
                }
        }
index 8d28c9d5b17941ea2e21935cef34ca1e222f2ca2..fb7d4a459c7497c3ef170d8f25da0c237783131b 100644 (file)
@@ -461,9 +461,13 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
 
 GHOST_WindowCocoa::~GHOST_WindowCocoa()
 {
-       if (m_customCursor) delete m_customCursor;
-
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+       if (m_customCursor) {
+               [m_customCursor release];
+               m_customCursor = nil;
+       }
+
        [m_openGLView release];
        
        if (m_window) {
index aea5b5156d9d9a72a5d76694259d545f2055a9e5..fc72ea09f4072a32b36dd4fff0fb27bf95222e07 100644 (file)
@@ -182,9 +182,12 @@ GHOST_WindowX11(
        Atom atoms[2];
        int natom;
        int glxVersionMajor, glxVersionMinor; // As in GLX major.minor
-       
+
+#ifdef WITH_X11_XINPUT
        /* initialize incase X11 fails to load */
        memset(&m_xtablet, 0, sizeof(m_xtablet));
+#endif
+
        m_visual= NULL;
 
        if (!glXQueryVersion(m_display, &glxVersionMajor, &glxVersionMinor)) {
index 96d8ad77d10a1663c73cd08088f62a4bc8b0b123..2cb269ea91976cf58a99ce2b2c394f430b35ca01 100644 (file)
@@ -38,7 +38,9 @@
 #include <X11/Xlib.h>
 #include <GL/glx.h>
 // For tablets
-#include <X11/extensions/XInput.h>
+#ifdef WITH_X11_XINPUT
+#  include <X11/extensions/XInput.h>
+#endif
 
 #include <map>
 
@@ -190,7 +192,7 @@ public:
                Window 
        getXWindow(
        );      
-
+#ifdef WITH_X11_XINPUT
        class XTablet
        {
        public:
@@ -214,6 +216,10 @@ public:
 
        const GHOST_TabletData* GetTabletData()
        { return &m_xtablet.CommonData; }
+#else // WITH_X11_XINPUT
+       const GHOST_TabletData* GetTabletData()
+       { return NULL; }
+#endif // WITH_X11_XINPUT
 
        /*
         * Need this in case that we want start the window
@@ -321,7 +327,9 @@ private :
        getEmptyCursor(
        );
 
+#ifdef WITH_X11_XINPUT
        void initXInputDevices();
+#endif
        
        GLXContext      m_context;
        Window  m_window;
@@ -350,8 +358,10 @@ private :
        /** Cache of XC_* ID's to XCursor structures */
        std::map<unsigned int, Cursor> m_standard_cursors;
 
+#ifdef WITH_X11_XINPUT
        /* Tablet devices */
        XTablet m_xtablet;
+#endif
 
        void icccmSetState(int state);
        int icccmGetState() const;
index 39e49ee1f96b0e1766fa1a8023f7203aa1b5219f..a7d0226fa23103c95b35c14294075a6e47aaf6d2 100644 (file)
 
 # <pep8 compliant>
 
+__all__ = (
+    "load_image",
+)
 
-def image_load(filepath, dirpath, place_holder=False, recursive=False, convert_callback=None):
-    import bpy
-    try:
-        return bpy.data.images.load(filepath)
-    except RuntimeError:
-        return bpy.data.images.new("Untitled", 128, 128)
+# limited replacement for BPyImage.comprehensiveImageLoad
+def load_image(imagepath,
+               dirname="",
+               place_holder=False,
+               recursive=False,
+               ncase_cmp=True,
+               convert_callback=None,
+               verbose=False,
+               ):
+    """
+    Return an image from the file path with options to search multiple paths and
+    return a placeholder if its not found.
+
+    :arg filepath: The image filename
+       If a path precedes it, this will be searched as well.
+    :type filepath: string
+    :arg dirname: is the directory where the image may be located - any file at
+       the end will be ignored.
+    :type dirname: string
+    :arg place_holder: if True a new place holder image will be created.
+       this is usefull so later you can relink the image to its original data.
+    :type place_holder: bool
+    :arg recursive: If True, directories will be recursivly searched.
+       Be carefull with this if you have files in your root directory because
+       it may take a long time.
+    :type recursive: bool
+    :arg ncase_cmp: on non windows systems, find the correct case for the file.
+    :type ncase_cmp: bool
+    :arg convert_callback: a function that takes an existing path and returns a new one.
+       Use this when loading image formats blender may not support, the CONVERT_CALLBACK
+       can take the path for a GIF (for example), convert it to a PNG and return the PNG's path.
+       For formats blender can read, simply return the path that is given.
+    :type convert_callback: function
+    :return: an image or None
+    :rtype: :class:`Image`
+    """
+    import os
+
+    # TODO: recursive
+
+    def _image_load(path):
+        import bpy
+
+        if convert_callback:
+            path = convert_callback(path)
+
+        image = bpy.data.images.load(path)
+
+        if verbose:
+            print("    image loaded '%s'" % path)
+
+        return image
+
+    if verbose:
+        print("load_image('%s', '%s', ...)" % (imagepath, dirname))
+
+    if os.path.exists(imagepath):
+        return _image_load(imagepath)
+
+    variants = [imagepath]
+
+    if dirname:
+        variants += [os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
+
+    for filepath_test in variants:
+        if ncase_cmp:
+            ncase_variants = filepath_test, bpy.path.resolve_ncase(filepath)
+        else:
+            ncase_variants = (filepath_test, )
+
+        for nfilepath in ncase_variants:
+            if os.path.exists(nfilepath):
+                return _image_load(nfilepath)
+
+    if place_holder:
+        image = bpy.data.images.new(os.path.basename(filepath), 128, 128)
+        # allow the path to be resolved later
+        image.filepath = imagepath
+        return image
+
+    # TODO comprehensiveImageLoad also searched in bpy.config.textureDir
+    return None
index 820d7cfa39d18b1dd4d65d7a18f16a514508e610..c444fd618a83c7e1b6f84ea5ec6ac3534712c427 100644 (file)
 
 # <pep8 compliant>
 
+__all__ = (
+    "ExportHelper",
+    "ImportHelper",
+    "axis_conversion",
+    "create_derived_objects",
+    "free_derived_objects",
+    "unpack_list",
+    "unpack_face_list",
+    "path_reference",
+    "path_reference_copy",
+    "path_reference_mode",
+)
+
 import bpy
 from bpy.props import StringProperty, BoolProperty, EnumProperty
 
@@ -101,29 +114,29 @@ _axis_convert_matrix = (
 # where all 4 values are or'd into a single value...
 #    (i1<<0 | i1<<3 | i1<<6 | i1<<9)
 _axis_convert_lut = (
-    {0x5c, 0x9a, 0x119, 0x15d, 0x20b, 0x2a2, 0x2c8, 0x365, 0x413, 0x46c, 0x4d0, 0x529, 0x644, 0x682, 0x701, 0x745, 0x823, 0x88a, 0x8e0, 0x94d, 0xa2b, 0xa54, 0xae8, 0xb11},
-    {0x9c, 0xac, 0x159, 0x169, 0x22b, 0x2e8, 0x40b, 0x465, 0x4c8, 0x522, 0x684, 0x694, 0x741, 0x751, 0x813, 0x8d0, 0xa23, 0xa4d, 0xae0, 0xb0a},
-    {0x99, 0xa9, 0x15c, 0x16c, 0x213, 0x2d0, 0x423, 0x44a, 0x4e0, 0x50d, 0x681, 0x691, 0x744, 0x754, 0x82b, 0x8e8, 0xa0b, 0xa62, 0xac8, 0xb25},
-    {0x59, 0x85, 0x11c, 0x142, 0x223, 0x28d, 0x2e0, 0x34a, 0x42b, 0x469, 0x4e8, 0x52c, 0x641, 0x69d, 0x704, 0x75a, 0x80b, 0x8a5, 0x8c8, 0x962, 0xa13, 0xa51, 0xad0, 0xb14},
-    {0xa5, 0x162, 0x21c, 0x285, 0x2d9, 0x342, 0x463, 0x46b, 0x520, 0x528, 0x68d, 0x74a, 0x804, 0x89d, 0x8c1, 0x95a, 0xa4b, 0xa53, 0xb08, 0xb10},
-    {0x4b, 0x53, 0x108, 0x110, 0x29c, 0x2ac, 0x359, 0x369, 0x41a, 0x422, 0x4dd, 0x4e5, 0x663, 0x66b, 0x720, 0x728, 0x884, 0x894, 0x941, 0x951, 0xa02, 0xa0a, 0xac5, 0xacd},
-    {0x63, 0x6b, 0x120, 0x128, 0x299, 0x2a9, 0x35c, 0x36c, 0x405, 0x40d, 0x4c2, 0x4ca, 0x64b, 0x653, 0x708, 0x710, 0x881, 0x891, 0x944, 0x954, 0xa1d, 0xa25, 0xada, 0xae2},
-    {0x8a, 0x14d, 0x219, 0x29a, 0x2dc, 0x35d, 0x44b, 0x453, 0x508, 0x510, 0x6a2, 0x765, 0x801, 0x882, 0x8c4, 0x945, 0xa63, 0xa6b, 0xb20, 0xb28},
-    {0x5a, 0x62, 0x8b, 0x11d, 0x125, 0x148, 0x22c, 0x28b, 0x293, 0x2e9, 0x348, 0x350, 0x41c, 0x42c, 0x45a, 0x4d9, 0x4e9, 0x51d, 0x642, 0x64a, 0x6a3, 0x705, 0x70d, 0x760, 0x814, 0x8a3, 0x8ab, 0x8d1, 0x960, 0x968, 0xa04, 0xa14, 0xa42, 0xac1, 0xad1, 0xb05},
-    {0x54, 0xab, 0x111, 0x168, 0x21d, 0x225, 0x2da, 0x2e2, 0x45c, 0x519, 0x66c, 0x693, 0x729, 0x750, 0x805, 0x80d, 0x8c2, 0x8ca, 0xa44, 0xb01},
-    {0x51, 0x93, 0x114, 0x150, 0x202, 0x20a, 0x2c5, 0x2cd, 0x459, 0x51c, 0x669, 0x6ab, 0x72c, 0x768, 0x81a, 0x822, 0x8dd, 0x8e5, 0xa41, 0xb04},
-    {0x45, 0x4d, 0xa3, 0x102, 0x10a, 0x160, 0x229, 0x2a3, 0x2ab, 0x2ec, 0x360, 0x368, 0x419, 0x429, 0x445, 0x4dc, 0x4ec, 0x502, 0x65d, 0x665, 0x68b, 0x71a, 0x722, 0x748, 0x811, 0x88b, 0x893, 0x8d4, 0x948, 0x950, 0xa01, 0xa11, 0xa5d, 0xac4, 0xad4, 0xb1a},
-    {0x5d, 0x65, 0xa0, 0x11a, 0x122, 0x163, 0x214, 0x2a0, 0x2a8, 0x2d1, 0x363, 0x36b, 0x404, 0x414, 0x45d, 0x4c1, 0x4d1, 0x51a, 0x645, 0x64d, 0x688, 0x702, 0x70a, 0x74b, 0x82c, 0x888, 0x890, 0x8e9, 0x94b, 0x953, 0xa1c, 0xa2c, 0xa45, 0xad9, 0xae9, 0xb02},
-    {0x6c, 0x90, 0x129, 0x153, 0x21a, 0x222, 0x2dd, 0x2e5, 0x444, 0x501, 0x654, 0x6a8, 0x711, 0x76b, 0x802, 0x80a, 0x8c5, 0x8cd, 0xa5c, 0xb19},
-    {0x69, 0xa8, 0x12c, 0x16b, 0x205, 0x20d, 0x2c2, 0x2ca, 0x441, 0x504, 0x651, 0x690, 0x714, 0x753, 0x81d, 0x825, 0x8da, 0x8e2, 0xa59, 0xb1c},
-    {0x42, 0x4a, 0x88, 0x105, 0x10d, 0x14b, 0x211, 0x288, 0x290, 0x2d4, 0x34b, 0x353, 0x401, 0x411, 0x442, 0x4c4, 0x4d4, 0x505, 0x65a, 0x662, 0x6a0, 0x71d, 0x725, 0x763, 0x829, 0x8a0, 0x8a8, 0x8ec, 0x963, 0x96b, 0xa19, 0xa29, 0xa5a, 0xadc, 0xaec, 0xb1d},
-    {0xa2, 0x165, 0x204, 0x282, 0x2c1, 0x345, 0x448, 0x450, 0x50b, 0x513, 0x68a, 0x74d, 0x81c, 0x89a, 0x8d9, 0x95d, 0xa60, 0xa68, 0xb23, 0xb2b},
-    {0x60, 0x68, 0x123, 0x12b, 0x284, 0x294, 0x341, 0x351, 0x41d, 0x425, 0x4da, 0x4e2, 0x648, 0x650, 0x70b, 0x713, 0x89c, 0x8ac, 0x959, 0x969, 0xa05, 0xa0d, 0xac2, 0xaca},
-    {0x48, 0x50, 0x10b, 0x113, 0x281, 0x291, 0x344, 0x354, 0x402, 0x40a, 0x4c5, 0x4cd, 0x660, 0x668, 0x723, 0x72b, 0x899, 0x8a9, 0x95c, 0x96c, 0xa1a, 0xa22, 0xadd, 0xae5},
-    {0x8d, 0x14a, 0x201, 0x29d, 0x2c4, 0x35a, 0x460, 0x468, 0x523, 0x52b, 0x6a5, 0x762, 0x819, 0x885, 0x8dc, 0x942, 0xa48, 0xa50, 0xb0b, 0xb13},
-    {0x44, 0x9d, 0x101, 0x15a, 0x220, 0x2a5, 0x2e3, 0x362, 0x428, 0x454, 0x4eb, 0x511, 0x65c, 0x685, 0x719, 0x742, 0x808, 0x88d, 0x8cb, 0x94a, 0xa10, 0xa6c, 0xad3, 0xb29},
-    {0x84, 0x94, 0x141, 0x151, 0x210, 0x2d3, 0x420, 0x462, 0x4e3, 0x525, 0x69c, 0x6ac, 0x759, 0x769, 0x828, 0x8eb, 0xa08, 0xa4a, 0xacb, 0xb0d},
-    {0x81, 0x91, 0x144, 0x154, 0x228, 0x2eb, 0x408, 0x44d, 0x4cb, 0x50a, 0x699, 0x6a9, 0x75c, 0x76c, 0x810, 0x8d3, 0xa20, 0xa65, 0xae3, 0xb22},
+    {0x8C8, 0x4D0, 0x2E0, 0xAE8, 0x701, 0x511, 0x119, 0xB29, 0x682, 0x88A, 0x09A, 0x2A2, 0x80B, 0x413, 0x223, 0xA2B, 0x644, 0x454, 0x05C, 0xA6C, 0x745, 0x94D, 0x15D, 0x365},
+    {0xAC8, 0x8D0, 0x4E0, 0x2E8, 0x741, 0x951, 0x159, 0x369, 0x702, 0xB0A, 0x11A, 0x522, 0xA0B, 0x813, 0x423, 0x22B, 0x684, 0x894, 0x09C, 0x2AC, 0x645, 0xA4D, 0x05D, 0x465},
+    {0x4C8, 0x2D0, 0xAE0, 0x8E8, 0x681, 0x291, 0x099, 0x8A9, 0x642, 0x44A, 0x05A, 0xA62, 0x40B, 0x213, 0xA23, 0x82B, 0x744, 0x354, 0x15C, 0x96C, 0x705, 0x50D, 0x11D, 0xB25},
+    {0x2C8, 0xAD0, 0x8E0, 0x4E8, 0x641, 0xA51, 0x059, 0x469, 0x742, 0x34A, 0x15A, 0x962, 0x20B, 0xA13, 0x823, 0x42B, 0x704, 0xB14, 0x11C, 0x52C, 0x685, 0x28D, 0x09D, 0x8A5},
+    {0x708, 0xB10, 0x120, 0x528, 0x8C1, 0xAD1, 0x2D9, 0x4E9, 0x942, 0x74A, 0x35A, 0x162, 0x64B, 0xA53, 0x063, 0x46B, 0x804, 0xA14, 0x21C, 0x42C, 0x885, 0x68D, 0x29D, 0x0A5},
+    {0xB08, 0x110, 0x520, 0x728, 0x941, 0x151, 0x359, 0x769, 0x802, 0xA0A, 0x21A, 0x422, 0xA4B, 0x053, 0x463, 0x66B, 0x884, 0x094, 0x29C, 0x6AC, 0x8C5, 0xACD, 0x2DD, 0x4E5},
+    {0x508, 0x710, 0xB20, 0x128, 0x881, 0x691, 0x299, 0x0A9, 0x8C2, 0x4CA, 0x2DA, 0xAE2, 0x44B, 0x653, 0xA63, 0x06B, 0x944, 0x754, 0x35C, 0x16C, 0x805, 0x40D, 0x21D, 0xA25},
+    {0x108, 0x510, 0x720, 0xB28, 0x801, 0x411, 0x219, 0xA29, 0x882, 0x08A, 0x29A, 0x6A2, 0x04B, 0x453, 0x663, 0xA6B, 0x8C4, 0x4D4, 0x2DC, 0xAEC, 0x945, 0x14D, 0x35D, 0x765},
+    {0x748, 0x350, 0x160, 0x968, 0xAC1, 0x2D1, 0x4D9, 0x8E9, 0xA42, 0x64A, 0x45A, 0x062, 0x68B, 0x293, 0x0A3, 0x8AB, 0xA04, 0x214, 0x41C, 0x82C, 0xB05, 0x70D, 0x51D, 0x125},
+    {0x948, 0x750, 0x360, 0x168, 0xB01, 0x711, 0x519, 0x129, 0xAC2, 0x8CA, 0x4DA, 0x2E2, 0x88B, 0x693, 0x2A3, 0x0AB, 0xA44, 0x654, 0x45C, 0x06C, 0xA05, 0x80D, 0x41D, 0x225},
+    {0x348, 0x150, 0x960, 0x768, 0xA41, 0x051, 0x459, 0x669, 0xA02, 0x20A, 0x41A, 0x822, 0x28B, 0x093, 0x8A3, 0x6AB, 0xB04, 0x114, 0x51C, 0x72C, 0xAC5, 0x2CD, 0x4DD, 0x8E5},
+    {0x148, 0x950, 0x760, 0x368, 0xA01, 0x811, 0x419, 0x229, 0xB02, 0x10A, 0x51A, 0x722, 0x08B, 0x893, 0x6A3, 0x2AB, 0xAC4, 0x8D4, 0x4DC, 0x2EC, 0xA45, 0x04D, 0x45D, 0x665},
+    {0x688, 0x890, 0x0A0, 0x2A8, 0x4C1, 0x8D1, 0xAD9, 0x2E9, 0x502, 0x70A, 0xB1A, 0x122, 0x74B, 0x953, 0x163, 0x36B, 0x404, 0x814, 0xA1C, 0x22C, 0x445, 0x64D, 0xA5D, 0x065},
+    {0x888, 0x090, 0x2A0, 0x6A8, 0x501, 0x111, 0xB19, 0x729, 0x402, 0x80A, 0xA1A, 0x222, 0x94B, 0x153, 0x363, 0x76B, 0x444, 0x054, 0xA5C, 0x66C, 0x4C5, 0x8CD, 0xADD, 0x2E5},
+    {0x288, 0x690, 0x8A0, 0x0A8, 0x441, 0x651, 0xA59, 0x069, 0x4C2, 0x2CA, 0xADA, 0x8E2, 0x34B, 0x753, 0x963, 0x16B, 0x504, 0x714, 0xB1C, 0x12C, 0x405, 0x20D, 0xA1D, 0x825},
+    {0x088, 0x290, 0x6A0, 0x8A8, 0x401, 0x211, 0xA19, 0x829, 0x442, 0x04A, 0xA5A, 0x662, 0x14B, 0x353, 0x763, 0x96B, 0x4C4, 0x2D4, 0xADC, 0x8EC, 0x505, 0x10D, 0xB1D, 0x725},
+    {0x648, 0x450, 0x060, 0xA68, 0x2C1, 0x4D1, 0x8D9, 0xAE9, 0x282, 0x68A, 0x89A, 0x0A2, 0x70B, 0x513, 0x123, 0xB2B, 0x204, 0x414, 0x81C, 0xA2C, 0x345, 0x74D, 0x95D, 0x165},
+    {0xA48, 0x650, 0x460, 0x068, 0x341, 0x751, 0x959, 0x169, 0x2C2, 0xACA, 0x8DA, 0x4E2, 0xB0B, 0x713, 0x523, 0x12B, 0x284, 0x694, 0x89C, 0x0AC, 0x205, 0xA0D, 0x81D, 0x425},
+    {0x448, 0x050, 0xA60, 0x668, 0x281, 0x091, 0x899, 0x6A9, 0x202, 0x40A, 0x81A, 0xA22, 0x50B, 0x113, 0xB23, 0x72B, 0x344, 0x154, 0x95C, 0x76C, 0x2C5, 0x4CD, 0x8DD, 0xAE5},
+    {0x048, 0xA50, 0x660, 0x468, 0x201, 0xA11, 0x819, 0x429, 0x342, 0x14A, 0x95A, 0x762, 0x10B, 0xB13, 0x723, 0x52B, 0x2C4, 0xAD4, 0x8DC, 0x4EC, 0x285, 0x08D, 0x89D, 0x6A5},
+    {0x808, 0xA10, 0x220, 0x428, 0x101, 0xB11, 0x719, 0x529, 0x142, 0x94A, 0x75A, 0x362, 0x8CB, 0xAD3, 0x2E3, 0x4EB, 0x044, 0xA54, 0x65C, 0x46C, 0x085, 0x88D, 0x69D, 0x2A5},
+    {0xA08, 0x210, 0x420, 0x828, 0x141, 0x351, 0x759, 0x969, 0x042, 0xA4A, 0x65A, 0x462, 0xACB, 0x2D3, 0x4E3, 0x8EB, 0x084, 0x294, 0x69C, 0x8AC, 0x105, 0xB0D, 0x71D, 0x525},
+    {0x408, 0x810, 0xA20, 0x228, 0x081, 0x891, 0x699, 0x2A9, 0x102, 0x50A, 0x71A, 0xB22, 0x4CB, 0x8D3, 0xAE3, 0x2EB, 0x144, 0x954, 0x75C, 0x36C, 0x045, 0x44D, 0x65D, 0xA65},
     )
 
 _axis_convert_num = {'X': 0, 'Y': 1, 'Z': 2, '-X': 3, '-Y': 4, '-Z': 5}
@@ -141,30 +154,13 @@ def axis_conversion(from_forward='Y', from_up='Z', to_forward='Y', to_up='Z'):
         return Matrix().to_3x3()
 
     value = reduce(int.__or__, (_axis_convert_num[a] << (i * 3) for i, a in enumerate((from_forward, from_up, to_forward, to_up))))
+
     for i, axis_lut in enumerate(_axis_convert_lut):
         if value in axis_lut:
             return Matrix(_axis_convert_matrix[i])
     assert("internal error")
 
 
-# limited replacement for BPyImage.comprehensiveImageLoad
-def load_image(imagepath, dirname):
-    import os
-
-    if os.path.exists(imagepath):
-        return bpy.data.images.load(imagepath)
-
-    variants = [imagepath, os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]
-
-    for filepath in variants:
-        for nfilepath in (filepath, bpy.path.resolve_ncase(filepath)):
-            if os.path.exists(nfilepath):
-                return bpy.data.images.load(nfilepath)
-
-    # TODO comprehensiveImageLoad also searched in bpy.config.textureDir
-    return None
-
-
 # return a tuple (free, object list), free is True if memory should be freed later with free_derived_objects()
 def create_derived_objects(scene, ob):
     if ob.parent and ob.parent.dupli_type != 'NONE':
index 5bacff7b0ccdfef1d845408754eb4d6ddc9dc1ee..b6d8a1fcf16a0a3550353d08231ccb0fed815d1c 100644 (file)
 
 # <pep8 compliant>
 
+__all__ = (
+    "mesh_linked_faces",
+    "edge_face_count_dict",
+    "edge_face_count",
+    "edge_loops_from_faces",
+    "edge_loops_from_edges",
+    "ngon_tesselate",
+)
 
 def mesh_linked_faces(mesh):
-    '''
-    Splits the mesh into connected parts,
-    these parts are returned as lists of faces.
-    used for seperating cubes from other mesh elements in the 1 mesh
-    '''
+    """
+    Splits the mesh into connected faces, use this for seperating cubes from
+    other mesh elements within 1 mesh datablock.
+
+    :arg mesh: the mesh used to group with.
+    :type mesh: :class:`Mesh`
+    :return: lists of lists containing faces.
+    :rtype: list
+    """
 
     # Build vert face connectivity
     vert_faces = [[] for i in range(len(mesh.vertices))]
@@ -67,3 +79,357 @@ def mesh_linked_faces(mesh):
     # return all face groups that are not null
     # this is all the faces that are connected in their own lists.
     return [fg for fg in face_groups if fg]
+
+
+def edge_face_count_dict(mesh):
+    """
+    :return: dict of edge keys with their value set to the number of
+       faces using each edge.
+    :rtype: dict
+    """
+    face_edge_keys = [face.edge_keys for face in mesh.faces]
+    face_edge_count = {}
+    for face_keys in face_edge_keys:
+        for key in face_keys:
+            try:
+                face_edge_count[key] += 1
+            except:
+                face_edge_count[key] = 1
+
+    return face_edge_count
+
+
+def edge_face_count(mesh):
+    """
+    :return: list face users for each item in mesh.edges.
+    :rtype: list
+    """
+    edge_face_count_dict = edge_face_count_dict(mesh)
+    get = dict.get
+    return [get(edge_face_count_dict, ed.key, 0) for ed in mesh.edges]
+
+
+def edge_loops_from_faces(mesh, faces=None, seams=()):
+    """
+    Edge loops defined by faces
+
+    Takes me.faces or a list of faces and returns the edge loops
+    These edge loops are the edges that sit between quads, so they dont touch
+    1 quad, note: not connected will make 2 edge loops,
+    both only containing 2 edges.
+
+    return a list of edge key lists
+    [[(0, 1), (4, 8), (3, 8)], ...]
+
+    :arg mesh: the mesh used to get edge loops from.
+    :type mesh: :class:`Mesh`
+    :arg faces: optional face list to only use some of the meshes faces.
+    :type faces: :class:`MeshFaces`, sequence or or NoneType
+    :return: return a list of edge vertex index lists.
+    :rtype: list
+    """
+
+    OTHER_INDEX = 2, 3, 0, 1  # opposite face index
+
+    if faces is None:
+        faces = mesh.faces
+
+    edges = {}
+
+    for f in faces:
+#        if len(f) == 4:
+        if f.vertices_raw[3] != 0:
+            edge_keys = f.edge_keys
+            for i, edkey in enumerate(f.edge_keys):
+                edges.setdefault(edkey, []).append(edge_keys[OTHER_INDEX[i]])
+
+    for edkey in seams:
+        edges[edkey] = []
+
+    # Collect edge loops here
+    edge_loops = []
+
+    for edkey, ed_adj in edges.items():
+        if 0 < len(ed_adj) < 3:  # 1 or 2
+            # Seek the first edge
+            context_loop = [edkey, ed_adj[0]]
+            edge_loops.append(context_loop)
+            if len(ed_adj) == 2:
+                other_dir = ed_adj[1]
+            else:
+                other_dir = None
+
+            ed_adj[:] = []
+
+            flipped = False
+
+            while 1:
+                # from knowing the last 2, look for th next.
+                ed_adj = edges[context_loop[-1]]
+                if len(ed_adj) != 2:
+
+                    if other_dir and flipped == False:  # the original edge had 2 other edges
+                        flipped = True  # only flip the list once
+                        context_loop.reverse()
+                        ed_adj[:] = []
+                        context_loop.append(other_dir)  # save 1 lookiup
+
+                        ed_adj = edges[context_loop[-1]]
+                        if len(ed_adj) != 2:
+                            ed_adj[:] = []
+                            break
+                    else:
+                        ed_adj[:] = []
+                        break
+
+                i = ed_adj.index(context_loop[-2])
+                context_loop.append(ed_adj[not  i])
+
+                # Dont look at this again
+                ed_adj[:] = []
+
+    return edge_loops
+
+
+def edge_loops_from_edges(mesh, edges=None):
+    """
+    Edge loops defined by edges
+
+    Takes me.edges or a list of edges and returns the edge loops
+
+    return a list of vertex indices.
+    [ [1, 6, 7, 2], ...]
+
+    closed loops have matching start and end values.
+    """
+    line_polys = []
+
+    # Get edges not used by a face
+    if edges is None:
+        edges = mesh.edges
+
+    if not hasattr(edges, "pop"):
+        edges = edges[:]
+
+    edge_dict = {ed.key: ed for ed in mesh.edges if ed.select}
+
+    while edges:
+        current_edge = edges.pop()
+        vert_end, vert_start = current_edge.vertices[:]
+        line_poly = [vert_start, vert_end]
+
+        ok = True
+        while ok:
+            ok = False
+            #for i, ed in enumerate(edges):
+            i = len(edges)
+            while i:
+                i -= 1
+                ed = edges[i]
+                v1, v2 = ed.vertices
+                if v1 == vert_end:
+                    line_poly.append(v2)
+                    vert_end = line_poly[-1]
+                    ok = 1
+                    del edges[i]
+                    # break
+                elif v2 == vert_end:
+                    line_poly.append(v1)
+                    vert_end = line_poly[-1]
+                    ok = 1
+                    del edges[i]
+                    #break
+                elif v1 == vert_start:
+                    line_poly.insert(0, v2)
+                    vert_start = line_poly[0]
+                    ok = 1
+                    del edges[i]
+                    # break
+                elif v2 == vert_start:
+                    line_poly.insert(0, v1)
+                    vert_start = line_poly[0]
+                    ok = 1
+                    del edges[i]
+                    #break
+        line_polys.append(line_poly)
+
+    return line_polys
+
+
+def ngon_tesselate(from_data, indices, fix_loops=True):
+    '''
+    Takes a polyline of indices (fgon)
+    and returns a list of face indicie lists.
+    Designed to be used for importers that need indices for an fgon to create from existing verts.
+
+    from_data: either a mesh, or a list/tuple of vectors.
+    indices: a list of indices to use this list is the ordered closed polyline to fill, and can be a subset of the data given.
+    fix_loops: If this is enabled polylines that use loops to make multiple polylines are delt with correctly.
+    '''
+
+    from mathutils import Vector
+    vector_to_tuple = Vector.to_tuple
+
+    if not indices:
+        return []
+
+    def mlen(co):
+        return abs(co[0]) + abs(co[1]) + abs(co[2])  # manhatten length of a vector, faster then length
+
+    def vert_treplet(v, i):
+        return v, vector_to_tuple(v, 6), i, mlen(v)
+
+    def ed_key_mlen(v1, v2):
+        if v1[3] > v2[3]:
+            return v2[1], v1[1]
+        else:
+            return v1[1], v2[1]
+
+    if not PREF_FIX_LOOPS:
+        '''
+        Normal single concave loop filling
+        '''
+        if type(from_data) in (tuple, list):
+            verts = [Vector(from_data[i]) for ii, i in enumerate(indices)]
+        else:
+            verts = [from_data.vertices[i].co for ii, i in enumerate(indices)]
+
+        for i in range(len(verts) - 1, 0, -1):  # same as reversed(xrange(1, len(verts))):
+            if verts[i][1] == verts[i - 1][0]:
+                verts.pop(i - 1)
+
+        fill = fill_polygon([verts])
+
+    else:
+        '''
+        Seperate this loop into multiple loops be finding edges that are used twice
+        This is used by lightwave LWO files a lot
+        '''
+
+        if type(from_data) in (tuple, list):
+            verts = [vert_treplet(Vector(from_data[i]), ii) for ii, i in enumerate(indices)]
+        else:
+            verts = [vert_treplet(from_data.vertices[i].co, ii) for ii, i in enumerate(indices)]
+
+        edges = [(i, i - 1) for i in range(len(verts))]
+        if edges:
+            edges[0] = (0, len(verts) - 1)
+
+        if not verts:
+            return []
+
+        edges_used = set()
+        edges_doubles = set()
+        # We need to check if any edges are used twice location based.
+        for ed in edges:
+            edkey = ed_key_mlen(verts[ed[0]], verts[ed[1]])
+            if edkey in edges_used:
+                edges_doubles.add(edkey)
+            else:
+                edges_used.add(edkey)
+
+        # Store a list of unconnected loop segments split by double edges.
+        # will join later
+        loop_segments = []
+
+        v_prev = verts[0]
+        context_loop = [v_prev]
+        loop_segments = [context_loop]
+
+        for v in verts:
+            if v != v_prev:
+                # Are we crossing an edge we removed?
+                if ed_key_mlen(v, v_prev) in edges_doubles:
+                    context_loop = [v]
+                    loop_segments.append(context_loop)
+                else:
+                    if context_loop and context_loop[-1][1] == v[1]:
+                        #raise "as"
+                        pass
+                    else:
+                        context_loop.append(v)
+
+                v_prev = v
+        # Now join loop segments
+
+        def join_seg(s1, s2):
+            if s2[-1][1] == s1[0][1]:
+                s1, s2 = s2, s1
+            elif s1[-1][1] == s2[0][1]:
+                pass
+            else:
+                return False
+
+            # If were stuill here s1 and s2 are 2 segments in the same polyline
+            s1.pop()  # remove the last vert from s1
+            s1.extend(s2)  # add segment 2 to segment 1
+
+            if s1[0][1] == s1[-1][1]:  # remove endpoints double
+                s1.pop()
+
+            s2[:] = []  # Empty this segment s2 so we dont use it again.
+            return True
+
+        joining_segments = True
+        while joining_segments:
+            joining_segments = False
+            segcount = len(loop_segments)
+
+            for j in range(segcount - 1, -1, -1):  # reversed(range(segcount)):
+                seg_j = loop_segments[j]
+                if seg_j:
+                    for k in range(j - 1, -1, -1):  # reversed(range(j)):
+                        if not seg_j:
+                            break
+                        seg_k = loop_segments[k]
+
+                        if seg_k and join_seg(seg_j, seg_k):
+                            joining_segments = True
+
+        loop_list = loop_segments
+
+        for verts in loop_list:
+            while verts and verts[0][1] == verts[-1][1]:
+                verts.pop()
+
+        loop_list = [verts for verts in loop_list if len(verts) > 2]
+        # DONE DEALING WITH LOOP FIXING
+
+        # vert mapping
+        vert_map = [None] * len(indices)
+        ii = 0
+        for verts in loop_list:
+            if len(verts) > 2:
+                for i, vert in enumerate(verts):
+                    vert_map[i + ii] = vert[2]
+                ii += len(verts)
+
+        fill = tesselate_polygon([[v[0] for v in loop] for loop in loop_list])
+        #draw_loops(loop_list)
+        #raise 'done loop'
+        # map to original indices
+        fill = [[vert_map[i] for i in reversed(f)] for f in fill]
+
+    if not fill:
+        print('Warning Cannot scanfill, fallback on a triangle fan.')
+        fill = [[0, i - 1, i] for i in range(2, len(indices))]
+    else:
+        # Use real scanfill.
+        # See if its flipped the wrong way.
+        flip = None
+        for fi in fill:
+            if flip != None:
+                break
+            for i, vi in enumerate(fi):
+                if vi == 0 and fi[i - 1] == 1:
+                    flip = False
+                    break
+                elif vi == 1 and fi[i - 1] == 0:
+                    flip = True
+                    break
+
+        if not flip:
+            for i, fi in enumerate(fill):
+                fill[i] = tuple([ii for ii in reversed(fi)])
+
+    return fill
index 1cf7fc2f4d50e06e27eb3b5c5ea2c54b1d7e9322..51a8d4b5e23288d8bf1a0f6d4792056cd7d08955 100644 (file)
 
 # <pep8 compliant>
 
+__all__ = (
+    "add_object_align_init",
+    "object_data_add",
+)
+
+
 import bpy
 import mathutils
 
 
 def add_object_align_init(context, operator):
+    """
+    Return a matrix using the operator settings and view context.
+
+    :arg context: The context to use.
+    :type context: :class:`Context`
+    :arg operator: The operator, checked for location and rotation properties.
+    :type operator: :class:`Operator`
+    :return: the matrix from the context and settings.
+    :rtype: :class:`Matrix`
+    """
     space_data = context.space_data
     if space_data.type != 'VIEW_3D':
         space_data = None
@@ -64,7 +80,19 @@ def add_object_align_init(context, operator):
 
 
 def object_data_add(context, obdata, operator=None):
-
+    """
+    Add an object using the view context and preference to to initialize the
+    location, rotation and layer.
+
+    :arg context: The context to use.
+    :type context: :class:`Context`
+    :arg obdata: the data used for the new object.
+    :type obdata: valid object data type or None.
+    :arg operator: The operator, checked for location and rotation properties.
+    :type operator: :class:`Operator`
+    :return: the newly created object in the scene.
+    :rtype: :class:`ObjectBase`
+    """
     scene = context.scene
 
     # ugh, could be made nicer
index 7d37b94982fa0e43c7ff05be894b831dee72b644..45f537ebd2fb4ce9a77a4ab2746bb2574653838c 100644 (file)
 
 # <pep8 compliant>
 
+__all__ = (
+    "region_2d_to_vector_3d",
+    "region_2d_to_location_3d",
+    "location_3d_to_region_2d",
+    "location_3d_to_region_2d",
+)
 
 def region_2d_to_vector_3d(region, rv3d, coord):
     """
@@ -28,7 +34,7 @@ def region_2d_to_vector_3d(region, rv3d, coord):
     :type region: :class:`Region`
     :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d.
     :type rv3d: :class:`RegionView3D`
-    :arg coord: 2d coordinates relative to the region;
+    :arg coord: 2d coordinates relative to the region:
        (event.mouse_region_x, event.mouse_region_y) for example.
     :type coord: 2d vector
     :return: normalized 3d vector.
@@ -44,8 +50,10 @@ def region_2d_to_vector_3d(region, rv3d, coord):
                       -0.5
                     ))        
 
-        w = (out[0] * persinv[0][3]) + (out[1] * persinv[1][3]) + (out[2] * persinv[2][3]) + persinv[3][3]
-        
+        w = (out[0] * persinv[0][3]) + \
+            (out[1] * persinv[1][3]) + \
+            (out[2] * persinv[2][3]) + persinv[3][3]
+
         return ((out * persinv) / w) - rv3d.view_matrix.inverted()[3].xyz
     else:
         return rv3d.view_matrix.inverted()[2].xyz.normalized()
index c3352dd33ad6a5009dad0acaa09e6fe9a775942f..3c1b454e72ee0cd7a68a8b0341d23bd7221c100f 100644 (file)
@@ -356,163 +356,6 @@ class Mesh(bpy_types.ID):
     def edge_keys(self):
         return [edge_key for face in self.faces for edge_key in face.edge_keys]
 
-    @property
-    def edge_face_count_dict(self):
-        face_edge_keys = [face.edge_keys for face in self.faces]
-        face_edge_count = {}
-        for face_keys in face_edge_keys:
-            for key in face_keys:
-                try:
-                    face_edge_count[key] += 1
-                except:
-                    face_edge_count[key] = 1
-
-        return face_edge_count
-
-    @property
-    def edge_face_count(self):
-        edge_face_count_dict = self.edge_face_count_dict
-        return [edge_face_count_dict.get(ed.key, 0) for ed in self.edges]
-
-    def edge_loops_from_faces(self, faces=None, seams=()):
-        """
-        Edge loops defined by faces
-
-        Takes me.faces or a list of faces and returns the edge loops
-        These edge loops are the edges that sit between quads, so they dont touch
-        1 quad, note: not connected will make 2 edge loops, both only containing 2 edges.
-
-        return a list of edge key lists
-        [ [(0,1), (4, 8), (3,8)], ...]
-
-        return a list of edge vertex index lists
-        """
-
-        OTHER_INDEX = 2, 3, 0, 1  # opposite face index
-
-        if faces is None:
-            faces = self.faces
-
-        edges = {}
-
-        for f in faces:
-#            if len(f) == 4:
-            if f.vertices_raw[3] != 0:
-                edge_keys = f.edge_keys
-                for i, edkey in enumerate(f.edge_keys):
-                    edges.setdefault(edkey, []).append(edge_keys[OTHER_INDEX[i]])
-
-        for edkey in seams:
-            edges[edkey] = []
-
-        # Collect edge loops here
-        edge_loops = []
-
-        for edkey, ed_adj in edges.items():
-            if 0 < len(ed_adj) < 3:  # 1 or 2
-                # Seek the first edge
-                context_loop = [edkey, ed_adj[0]]
-                edge_loops.append(context_loop)
-                if len(ed_adj) == 2:
-                    other_dir = ed_adj[1]
-                else:
-                    other_dir = None
-
-                ed_adj[:] = []
-
-                flipped = False
-
-                while 1:
-                    # from knowing the last 2, look for th next.
-                    ed_adj = edges[context_loop[-1]]
-                    if len(ed_adj) != 2:
-
-                        if other_dir and flipped == False:  # the original edge had 2 other edges
-                            flipped = True  # only flip the list once
-                            context_loop.reverse()
-                            ed_adj[:] = []
-                            context_loop.append(other_dir)  # save 1 lookiup
-
-                            ed_adj = edges[context_loop[-1]]
-                            if len(ed_adj) != 2:
-                                ed_adj[:] = []
-                                break
-                        else:
-                            ed_adj[:] = []
-                            break
-
-                    i = ed_adj.index(context_loop[-2])
-                    context_loop.append(ed_adj[not  i])
-
-                    # Dont look at this again
-                    ed_adj[:] = []
-
-        return edge_loops
-
-    def edge_loops_from_edges(self, edges=None):
-        """
-        Edge loops defined by edges
-
-        Takes me.edges or a list of edges and returns the edge loops
-
-        return a list of vertex indices.
-        [ [1, 6, 7, 2], ...]
-
-        closed loops have matching start and end values.
-        """
-        line_polys = []
-
-        # Get edges not used by a face
-        if edges is None:
-            edges = self.edges
-
-        if not hasattr(edges, "pop"):
-            edges = edges[:]
-
-        edge_dict = {ed.key: ed for ed in self.edges if ed.select}
-
-        while edges:
-            current_edge = edges.pop()
-            vert_end, vert_start = current_edge.vertices[:]
-            line_poly = [vert_start, vert_end]
-
-            ok = True
-            while ok:
-                ok = False
-                #for i, ed in enumerate(edges):
-                i = len(edges)
-                while i:
-                    i -= 1
-                    ed = edges[i]
-                    v1, v2 = ed.vertices
-                    if v1 == vert_end:
-                        line_poly.append(v2)
-                        vert_end = line_poly[-1]
-                        ok = 1
-                        del edges[i]
-                        # break
-                    elif v2 == vert_end:
-                        line_poly.append(v1)
-                        vert_end = line_poly[-1]
-                        ok = 1
-                        del edges[i]
-                        #break
-                    elif v1 == vert_start:
-                        line_poly.insert(0, v2)
-                        vert_start = line_poly[0]
-                        ok = 1
-                        del edges[i]
-                        # break
-                    elif v2 == vert_start:
-                        line_poly.insert(0, v1)
-                        vert_start = line_poly[0]
-                        ok = 1
-                        del edges[i]
-                        #break
-            line_polys.append(line_poly)
-
-        return line_polys
-
 
 class MeshEdge(StructRNA):
     __slots__ = ()
index 44d81ba53df5ac5eaa79c3a2f477525d5cf8589f..89802d7ba5cf759dfe98109b00b43dfd94209ed5 100644 (file)
@@ -36,6 +36,7 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
         return (ob and ob.type == 'MESH')
 
     def execute(self, context):
+        from bpy_extras import mesh_utils
         ob = context.active_object
         context.tool_settings.mesh_select_mode = False, False, True
         is_editmode = (ob.mode == 'EDIT')
@@ -47,7 +48,7 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
         face_list = mesh.faces[:]
         face_edge_keys = [face.edge_keys for face in face_list]
 
-        edge_face_count = mesh.edge_face_count_dict
+        edge_face_count = mesh_utils.edge_face_count_dict(mesh)
 
         def test_interior(index):
             for key in face_edge_keys[index]:
index ad5ec15ff805d28d3cbaaac0658bc2e424013961..edd09d9c66b2cee8d5acd16e55019ca1ff9ee1b9 100644 (file)
@@ -25,6 +25,8 @@ import bpy
 
 
 def extend(obj, operator, EXTEND_MODE):
+    from bpy_extras import mesh_utils
+
     me = obj.data
     me_verts = me.vertices
     # script will fail without UVs
@@ -170,7 +172,7 @@ def extend(obj, operator, EXTEND_MODE):
                 edge_faces[edkey] = [i]
 
     if EXTEND_MODE == 'LENGTH':
-        edge_loops = me.edge_loops_from_faces(face_sel, [ed.key for ed in me.edges if ed.use_seam])
+        edge_loops = mesh_utils.edge_loops_from_faces(me, face_sel, [ed.key for ed in me.edges if ed.use_seam])
         me_verts = me.vertices
         for loop in edge_loops:
             looplen = [0.0]
index 53c8d56229717ee43a6cd3b263ad3a4a54e61297..3f4a061c4ac4c39d1b90716b2f3718d9458d0b71 100644 (file)
@@ -940,6 +940,14 @@ class WM_OT_copy_prev_settings(bpy.types.Operator):
             self.report({'ERROR'}, "Source path %r exists" % path_src)
         else:
             shutil.copytree(path_src, path_dst)
+
+            # in 2.57 and earlier windows installers, system scripts were copied
+            # into the configuration directory, don't want to copy those
+            system_script = os.path.join(path_dst, 'scripts/modules/bpy_types.py')
+            if os.path.isfile(system_script):
+                shutil.rmtree(os.path.join(path_dst, 'scripts'))
+                shutil.rmtree(os.path.join(path_dst, 'plugins'))
+
             # dont loose users work if they open the splash later.
             if bpy.data.is_saved is bpy.data.is_dirty is False:
                 bpy.ops.wm.read_homefile()
index 2f933fb57716b1802274897f1580abaa3d2f1faf..bf63c6071b99695bcf068a30a94785f9cb7fafe3 100644 (file)
@@ -85,26 +85,26 @@ def register():
     from bpy.props import StringProperty, EnumProperty
     WindowManager = bpy.types.WindowManager
 
+    def addon_filter_items(self, context):
+        import addon_utils
+
+        items = [('All', "All", ""),
+                 ('Enabled', "Enabled", ""),
+                 ('Disabled', "Disabled", ""),
+                ]
+
+        items_unique = set()
+
+        for mod in addon_utils.modules(space_userpref.USERPREF_PT_addons._addons_fake_modules):
+            info = addon_utils.module_bl_info(mod)
+            items_unique.add(info["category"])
+
+        items.extend([(cat, cat, "") for cat in sorted(items_unique)])
+        return items
+
     WindowManager.addon_search = StringProperty(name="Search", description="Search within the selected filter")
     WindowManager.addon_filter = EnumProperty(
-            items=[('All', "All", ""),
-                   ('Enabled', "Enabled", ""),
-                   ('Disabled', "Disabled", ""),
-                   ('3D View', "3D View", ""),
-                   ('Add Curve', "Add Curve", ""),
-                   ('Add Mesh', "Add Mesh", ""),
-                   ('Animation', "Animation", ""),
-                   ('Development', "Development", ""),
-                   ('Game Engine', "Game Engine", ""),
-                   ('Import-Export', "Import-Export", ""),
-                   ('Mesh', "Mesh", ""),
-                   ('Object', "Object", ""),
-                   ('Render', "Render", ""),
-                   ('Rigging', "Rigging", ""),
-                   ('Text Editor', "Text Editor", ""),
-                   ('System', "System", ""),
-                   ('Other', "Other", ""),
-                   ],
+            items=addon_filter_items,
             name="Category",
             description="Filter add-ons by category",
             )
index 80f83e7fabefa4b75fa8540bda59a1d23e6f94df..5a0d327f90d1064bd2da09b5dc73b9f8d11ed262 100644 (file)
@@ -44,9 +44,9 @@ class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel):
             # layout.template_image(ob, "data", None)
             layout.template_ID(ob, "data", open="image.open", unlink="image.unlink")
 
-            row = layout.row(align = True)
+            row = layout.row(align=True)
             row.prop(ob, "color", text="Transparency", index=3, slider=True)
-            row = layout.row(align = True)
+            row = layout.row(align=True)
             row.prop(ob, "empty_image_offset", text="Offset X", index=0)
             row.prop(ob, "empty_image_offset", text="Offset Y", index=1)
 
index 900570c9664df1d3782c6aeded2fd28501730797..70121a12caaca6e5225878a42c0a6320eeb23551 100644 (file)
@@ -671,9 +671,9 @@ class ConstraintButtonsPanel():
         row = col.row()
         row.prop(con, "map_to_z_from", expand=False, text="")
         row.label(text=" -> Z")
-        
+
         split = layout.split()
-        
+
         col = split.column()
         col.label(text="Destination:")
         col.row().prop(con, "map_to", expand=True)
index 44a1c814e28ab50d70e2d74f440b8699e831dfff..9f69ca170764e90bf4a0f429879e5721d1c79d58 100644 (file)
@@ -437,7 +437,7 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
         rd = context.scene.render
         sima = context.space_data
         # display even when not in game mode because these settings effect the 3d view
-        return (sima and sima.image)  and (rd.engine == 'BLENDER_GAME')
+        return (sima and sima.image)  # and (rd.engine == 'BLENDER_GAME')
 
     def draw(self, context):
         layout = self.layout
index d4ebae04c3423a4308682867d080447d8b9be062..e34755ae72eb7aff6fb8ab83d7f5dde3df3c160a 100644 (file)
@@ -889,7 +889,8 @@ class USERPREF_PT_addons(bpy.types.Panel):
         split = layout.split(percentage=0.2)
         col = split.column()
         col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
-        col.prop(context.window_manager, "addon_filter", expand=True)
+        col.label(text="Categories")
+        col.prop(context.window_manager, "addon_filter", text="")  # , expand=True, too slow with dynamic enum.
 
         col.label(text="Supported Level")
         col.prop(context.window_manager, "addon_support", expand=True)
index 03f62f0df489f08679fc9cb0fea48f3967c8aeeb..42a9b1c13b6814466748c1c77809f2790dc4ebc4 100644 (file)
@@ -33,11 +33,11 @@ RequestExecutionLevel admin
 !insertmacro MUI_PAGE_COMPONENTS
     
 !insertmacro MUI_PAGE_DIRECTORY
-Page custom DataLocation DataLocationOnLeave
 !insertmacro MUI_PAGE_INSTFILES
 !insertmacro MUI_PAGE_FINISH
   
 !insertmacro MUI_UNPAGE_WELCOME
+UninstPage custom un.OptionalRemoveConfig un.OptionalRemoveConfigOnLeave
 !insertmacro MUI_UNPAGE_CONFIRM
 !insertmacro MUI_UNPAGE_INSTFILES
 !insertmacro MUI_UNPAGE_FINISH
@@ -62,7 +62,6 @@ UninstallIcon "[RELDIR]\00.installer.ico"
   LangString DESC_StartMenu ${LANG_ENGLISH} "Add shortcut items to the Start Menu. (Recommended)"
   LangString DESC_DesktopShortcut ${LANG_ENGLISH} "Add a shortcut to Blender on your desktop."
   LangString DESC_BlendRegister ${LANG_ENGLISH} "Blender can register itself with .blend files to allow double-clicking from Windows Explorer, etc."
-  LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Specify User Data Location"
 ;--------------------------------
 ;Data
 
@@ -76,15 +75,15 @@ DirText "Use the field below to specify the folder where you want Blender to be
 
 SilentUnInstall normal
 
-Var BLENDERHOME
 Var SHORTVERSION ; This is blender_version_decimal() from path_util.c
+Var BLENDERCONFIG
+Var REMOVECONFIG
 
 ; Custom controls
 Var HWND
 
-Var HWND_APPDATA
-Var HWND_INSTDIR
-Var HWND_HOMEDIR
+Var HWND_KEEPCONFIG
+Var HWND_REMOVECONFIG
 
 Function .onInit
   ClearErrors
@@ -103,9 +102,12 @@ Function .onInit
 FunctionEnd
 
 Function un.onInit
+  SetShellVarContext current
+  StrCpy $BLENDERCONFIG "$APPDATA\Blender Foundation\Blender"
+  SetShellVarContext all
 FunctionEnd
 
-Function DataLocation
+Function un.OptionalRemoveConfig
   nsDialogs::Create /NOUNLOAD 1018
   Pop $HWND
   
@@ -113,45 +115,27 @@ Function DataLocation
     Abort
   ${EndIf}
   
-  ${NSD_CreateLabel} 0 0 100% 24u "Please specify where you wish to install Blender's user data files. Be aware that if you choose to use your Application Data directory, your preferences and scripts will only be accessible by the current user account."
-  ${NSD_CreateRadioButton} 0 50 100% 12u "Use Application Data directory (recommended)"
-  Pop $HWND_APPDATA
-  ${NSD_CreateRadioButton} 0 80 100% 12u "Use installation directory"
-  Pop $HWND_INSTDIR
-  ${NSD_CreateRadioButton} 0 110 100% 12u "I have defined a %HOME% variable, please install files there"
-  Pop $HWND_HOMEDIR
-  
-  ${If} ${AtMostWinME}
-    GetDlgItem $0 $HWND $HWND_APPDATA
-    EnableWindow $0 0
-    SendMessage $HWND_INSTDIR ${BM_SETCHECK} 1 0
-  ${Else}
-    SendMessage $HWND_APPDATA ${BM_SETCHECK} 1 0
-  ${EndIf}
+  ${NSD_CreateRadioButton} 0 50 100% 12u "Keep configuration files, autosaved .blend files and installed addons (recommended)"
+  Pop $HWND_KEEPCONFIG
+  ${NSD_CreateRadioButton} 0 80 100% 12u "Remove all files, including configuration files, autosaved .blend files and installed addons"
+  Pop $HWND_REMOVECONFIG
+
+  SendMessage $HWND_KEEPCONFIG ${BM_SETCHECK} 1 0
   
   nsDialogs::Show
   
 FunctionEnd
 
-Function DataLocationOnLeave
-  ${NSD_GetState} $HWND_APPDATA $R0
+Function un.OptionalRemoveConfigOnLeave
+  ${NSD_GetState} $HWND_REMOVECONFIG $R0
   ${If} $R0 == "1"
-    SetShellVarContext current
-    StrCpy $BLENDERHOME "$APPDATA\Blender Foundation\Blender"
-    SetShellVarContext all
+    StrCpy $REMOVECONFIG "1"
   ${Else}
-    ${NSD_GetState} $HWND_INSTDIR $R0
-    ${If} $R0 == "1"
-      StrCpy $BLENDERHOME $INSTDIR
-    ${Else}
-      ${NSD_GetState} $HWND_HOMEDIR $R0
-      ${If} $R0 == "1"
-        ReadEnvStr $BLENDERHOME "HOME"
-      ${EndIf}
-    ${EndIf}
+    StrCpy $REMOVECONFIG "0"
   ${EndIf}
 FunctionEnd
 
+
 Section "Blender [VERSION] (required)" InstallFiles
   SectionIn RO
 
@@ -160,7 +144,7 @@ Section "Blender [VERSION] (required)" InstallFiles
   ; The contents of Blender installation root dir
   [ROOTDIRCONTS]
   
-  ; All datafiles (python, scripts, config)
+  ; All datafiles (python, scripts, datafiles)
   [DODATAFILES]
   
   SetOutPath $INSTDIR
@@ -169,7 +153,6 @@ Section "Blender [VERSION] (required)" InstallFiles
   ${EndIf}
   ; Write the installation path into the registry
   WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "Install_Dir" "$INSTDIR"
-  WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir" "$BLENDERHOME"
   WriteRegStr HKLM "SOFTWARE\BlenderFoundation" "ShortVersion" "[SHORTVERSION]"
   ; Write the uninstall keys for Windows
   WriteRegStr   HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "DisplayName" "Blender"
@@ -204,7 +187,7 @@ Section "Open .blend files with Blender" BlendRegister
   ExecWait '"$INSTDIR\blender.exe" -r'
 SectionEnd
 
-UninstallText "This will uninstall Blender [VERSION], and all installed files. Before continuing make sure you have created backup of all the files you may want to keep: startup.blend, bookmarks.txt, recent-files.txt. Hit 'Uninstall' to continue."
+UninstallText "This will uninstall Blender [VERSION], and all installed files. Hit 'Uninstall' to continue."
 
 Section "Uninstall"
   ; Remove registry keys
@@ -212,7 +195,6 @@ Section "Uninstall"
     SetRegView 64
   ${EndIf}
   
-  ReadRegStr $BLENDERHOME HKLM "SOFTWARE\BlenderFoundation" "ConfigData_Dir"
   ReadRegStr $SHORTVERSION HKLM "SOFTWARE\BlenderFoundation" "ShortVersion"
   DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Blender"
   DeleteRegKey HKLM "SOFTWARE\BlenderFoundation"
@@ -226,21 +208,10 @@ Section "Uninstall"
 
   Delete "$INSTDIR\uninstall.exe"
 
-  MessageBox MB_YESNO "Recursively erase contents of $BLENDERHOME\$SHORTVERSION\scripts? NOTE: This includes all installed scripts and *any* file and directory you have manually created, installed later or copied. This also including .blend files." IDNO NextNoScriptRemove
-  RMDir /r "$BLENDERHOME\$SHORTVERSION\scripts"
-NextNoScriptRemove:
-  MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\config? NOTE: This includes your startup.blend, bookmarks and any other file and directory you may have created in that directory" IDNO NextNoConfigRemove
-  RMDir /r "$BLENDERHOME\$SHORTVERSION\config"
-NextNoConfigRemove:
-  MessageBox MB_YESNO "Recursively erase contents from $BLENDERHOME\$SHORTVERSION\plugins? NOTE: This includes files and subdirectories in this directory" IDNO NextNoPluginRemove
-  RMDir /r "$BLENDERHOME\$SHORTVERSION\plugins"
-NextNoPluginRemove:
-  ; Try to remove dirs, but leave them if they contain anything
-  RMDir "$BLENDERHOME\$SHORTVERSION\plugins"
-  RMDir "$BLENDERHOME\$SHORTVERSION\config"
-  RMDir "$BLENDERHOME\$SHORTVERSION\scripts"
-  RMDir "$BLENDERHOME\$SHORTVERSION"
-  RMDir "$BLENDERHOME"
+  ${If} $REMOVECONFIG == "1"
+    RMDir /r "$BLENDERCONFIG\$SHORTVERSION"
+  ${Endif}
+
   ; Remove shortcuts
   Delete "$SMPROGRAMS\Blender Foundation\Blender\*.*"
   Delete "$DESKTOP\Blender.lnk"
index 7e9f531162b6173eec6015f80fdfb290783074df..a45e9a17dc9415f4d4712483ff7806eae5ac5e43 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
 
 /* these lines are grep'd, watch out for our not-so-awesome regex
  * and keep comment above the defines.
- * Use STRINGIFY() rather then defining with quotes */
+ * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION                        257
 #define BLENDER_SUBVERSION             1
 
index 94c474c668fd34c19a5bf907a34ab87a785f9a68..bedd58876bc1926e87384146449944ec332cd515 100644 (file)
@@ -279,7 +279,7 @@ int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene);
 int seqbase_isolated_sel_check(struct ListBase *seqbase);
 void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage, int keep_file_handles);
 struct Sequence        *seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, struct Sequence * seq, int dupe_flag);
-int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b);
+int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str);
 
 void seq_update_sound(struct Scene* scene, struct Sequence *seq);
 void seq_update_muting(struct Scene* scene, struct Editing *ed);
index 2831636361f5aceb5994753b048909d2a97876a8..44d20b6c651038897988f3b9580fa935134b4161 100644 (file)
@@ -44,6 +44,7 @@ set(INC
        ../editors/include
        ../render/extern/include
        ../../../intern/audaspace/intern
+       ../../../intern/ffmpeg
        ../../../intern/bsp/extern ../blenfont
        ../../../intern/decimation/extern
        ../../../intern/elbeem/extern
index ea19b51c0444b77ac2692d46c06bef527b1d43a3..b5f845acacb4ebc4aac3ca83eda08d3c0749ace5 100644 (file)
@@ -14,6 +14,7 @@ incs += ' ../gpu #/extern/glew/include'
 incs += ' #/intern/smoke/extern'
 incs += ' #/intern/mikktspace'
 incs += ' #/intern/audaspace/intern'
+incs += ' #/intern/ffmpeg'
 
 incs += ' ' + env['BF_OPENGL_INC']
 incs += ' ' + env['BF_ZLIB_INC']
index 5198172c2059ae9115c787b3925753dd56bc5d8f..fdc102bf779f0fac3a6632ee1e7402058f9345d1 100644 (file)
@@ -1043,6 +1043,9 @@ static short animsys_remap_path (AnimMapper *UNUSED(remap), char *path, char **d
 }
 
 
+/* less then 1.0 evaluates to false, use epsilon to avoid float error */
+#define ANIMSYS_FLOAT_AS_BOOL(value) ((value) > ((1.0f-FLT_EPSILON)))
+
 /* Write the given value to a setting using RNA, and return success */
 static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value)
 {
@@ -1074,9 +1077,9 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
                        {
                                case PROP_BOOLEAN:
                                        if (array_len)
-                                               RNA_property_boolean_set_index(&new_ptr, prop, array_index, (int)value);
+                                               RNA_property_boolean_set_index(&new_ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
                                        else
-                                               RNA_property_boolean_set(&new_ptr, prop, (int)value);
+                                               RNA_property_boolean_set(&new_ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
                                        break;
                                case PROP_INT:
                                        if (array_len)
@@ -1867,9 +1870,9 @@ void nladata_flush_channels (ListBase *channels)
                {
                        case PROP_BOOLEAN:
                                if (RNA_property_array_length(ptr, prop))
-                                       RNA_property_boolean_set_index(ptr, prop, array_index, (int)value);
+                                       RNA_property_boolean_set_index(ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
                                else
-                                       RNA_property_boolean_set(ptr, prop, (int)value);
+                                       RNA_property_boolean_set(ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
                                break;
                        case PROP_INT:
                                if (RNA_property_array_length(ptr, prop))
index 98c540f53b72ff1680b4d03b40c715c8bbf32362..25b60fef6ddc77ee8f1855c4024f24887483aafd 100644 (file)
@@ -1251,6 +1251,19 @@ static short unified_settings(Brush *brush)
        return 0;
 }
 
+// XXX: be careful about setting size and unprojected radius
+// because they depend on one another
+// these functions do not set the other corresponding value
+// this can lead to odd behavior if size and unprojected
+// radius become inconsistent.
+// the biggest problem is that it isn't possible to change
+// unprojected radius because a view context is not
+// available.  my ussual solution to this is to use the
+// ratio of change of the size to change the unprojected
+// radius.  Not completely convinced that is correct.
+// In anycase, a better solution is needed to prevent
+// inconsistency.
+
 static void set_unified_size(Brush *brush, int value)
 {
        Scene *sce;
index b104c6c9b30b76bdd2d6e8d6c41d61f3443cf52a..704af73dd10fc4f70b23a425ab61979564b88328 100644 (file)
@@ -1859,7 +1859,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
                 * do this by calculating the tilt angle difference, then apply
                 * the rotation gradually over the entire curve
                 *
-                * note that the split is between last and second last, rather then first/last as youd expect.
+                * note that the split is between last and second last, rather than first/last as youd expect.
                 *
                 * real order is like this
                 * 0,1,2,3,4 --> 1,2,3,4,0
index 22d19c5484f349802b0545075ad90f5308261908..c48497c45a12c82bda4bb9ab669a93ac1031e168 100644 (file)
@@ -381,9 +381,7 @@ Image *BKE_add_image_file(const char *name)
        ima= image_alloc(libname, IMA_SRC_FILE, IMA_TYPE_IMAGE);
        BLI_strncpy(ima->name, name, sizeof(ima->name));
        
-       /* do a wild guess! */
-       if(BLI_testextensie(name, ".avi") || BLI_testextensie(name, ".mov")
-                       || BLI_testextensie(name, ".mpg")  || BLI_testextensie(name, ".mp4"))
+       if(BLI_testextensie_array(name, imb_ext_movie))
                ima->source= IMA_SRC_MOVIE;
        
        return ima;
@@ -1031,7 +1029,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
        BLF_buffer_col(mono, scene->r.fg_stamp[0], scene->r.fg_stamp[1], scene->r.fg_stamp[2], 1.0);
        pad= BLF_width_max(mono);
 
-       /* use 'h_fixed' rather then 'h', aligns better */
+       /* use 'h_fixed' rather than 'h', aligns better */
        h_fixed= BLF_height_max(mono);
        y_ofs = -BLF_descender(mono);
 
index f0ac7040deb1b60ddf214b74484713dfc585ac61..094214858f9825a85a7e762e2227eb26716bcffe 100644 (file)
@@ -607,7 +607,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C
 
                if(cd->no_rot_axis) {   /* set by caller */
 
-                       /* this is not exactly the same as 2.4x, since the axis is having rotation removed rather then
+                       /* this is not exactly the same as 2.4x, since the axis is having rotation removed rather than
                         * changing the axis before calculating the tilt but serves much the same purpose */
                        float dir_flat[3]={0,0,0}, q[4];
                        copy_v3_v3(dir_flat, dir);
index 3523d1812a04ca357cf022074803e519dc316e41..d0fbc6247b54285b9388258d3ae70e48d31d6858 100644 (file)
@@ -1764,7 +1764,7 @@ void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const
                mul_m4_m4m4(rmat, mat, imat); /* get the parent relative matrix */
                object_apply_mat4(ob, rmat, use_compat, FALSE);
                
-               /* same as below, use rmat rather then mat */
+               /* same as below, use rmat rather than mat */
                mat4_to_loc_rot_size(ob->loc, rot, ob->size, rmat);
                object_mat3_to_rot(ob, rot, use_compat);
        }
@@ -3037,9 +3037,14 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
 
        if(newkey || from_mix==FALSE) {
                kb= add_keyblock(key, name);
-
-               /* create from lattice */
-               latt_to_key(lt, kb);
+               if (!newkey) {
+                       KeyBlock *basekb= (KeyBlock *)key->block.first;
+                       kb->data= MEM_dupallocN(basekb->data);
+                       kb->totelem= basekb->totelem;
+               }
+               else {
+                       latt_to_key(lt, kb);
+               }
        }
        else {
                /* copy from current values */
@@ -3075,7 +3080,10 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
                        KeyBlock *basekb= (KeyBlock *)key->block.first;
                        kb->data= MEM_dupallocN(basekb->data);
                        kb->totelem= basekb->totelem;
-               } else curve_to_key(cu, kb, lb);
+               }
+               else {
+                       curve_to_key(cu, kb, lb);
+               }
        }
        else {
                /* copy from current values */
index 30abb6278a75abc50898d1b530e543be714c2ffe..009665f3a1fddb22f31e4aa96967887aaf2e510f 100644 (file)
@@ -3207,26 +3207,30 @@ Sequence *seq_metastrip(ListBase * seqbase, Sequence * meta, Sequence *seq)
        return NULL;
 }
 
-int seq_swap(Sequence *seq_a, Sequence *seq_b)
+int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
 {
        char name[sizeof(seq_a->name)];
 
        if(seq_a->len != seq_b->len)
+               *error_str= "Strips must be the same length";
                return 0;
 
        /* type checking, could be more advanced but disalow sound vs non-sound copy */
        if(seq_a->type != seq_b->type) {
                if(seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) {
+                       *error_str= "Strips were not compatible";
                        return 0;
                }
 
                /* disallow effects to swap with non-effects strips */
                if((seq_a->type & SEQ_EFFECT) != (seq_b->type & SEQ_EFFECT)) {
+                       *error_str= "Strips were not compatible";
                        return 0;
                }
 
                if((seq_a->type & SEQ_EFFECT) && (seq_b->type & SEQ_EFFECT)) {
                        if(get_sequence_effect_num_inputs(seq_a->type) != get_sequence_effect_num_inputs(seq_b->type)) {
+                               *error_str= "Strips must have the same number of inputs";
                                return 0;
                        }
                }
index 40eb86f25bea2c22f995cb556c8b3873ee24efe2..da329503c9f161b2fa6632ca4cee684797dc8fec 100644 (file)
@@ -238,7 +238,7 @@ static void cleanup_textline(TextLine * tl)
 int reopen_text(Text *text)
 {
        FILE *fp;
-       int i, llen, len, res;
+       int i, llen, len;
        unsigned char *buffer;
        TextLine *tmp;
        char str[FILE_MAXDIR+FILE_MAXFILE];
@@ -281,7 +281,7 @@ int reopen_text(Text *text)
 
        fclose(fp);
 
-       res= stat(str, &st);
+       stat(str, &st);
        text->mtime= st.st_mtime;
        
        text->nlines=0;
@@ -334,7 +334,7 @@ Text *add_text(const char *file, const char *relpath)
 {
        Main *bmain= G.main;
        FILE *fp;
-       int i, llen, len, res;
+       int i, llen, len;
        unsigned char *buffer;
        TextLine *tmp;
        Text *ta;
@@ -374,7 +374,7 @@ Text *add_text(const char *file, const char *relpath)
 
        fclose(fp);
 
-       res= stat(str, &st);
+       stat(str, &st);
        ta->mtime= st.st_mtime;
        
        ta->nlines=0;
@@ -1236,14 +1236,11 @@ int txt_find_string(Text *text, char *findstr, int wrap, int match_case)
 {
        TextLine *tl, *startl;
        char *s= NULL;
-       int oldcl, oldsl;
 
        if (!text || !text->curl || !text->sell) return 0;
        
        txt_order_cursors(text);
 
-       oldcl= txt_get_span(text->lines.first, text->curl);
-       oldsl= txt_get_span(text->lines.first, text->sell);
        tl= startl= text->sell;
        
        if(match_case) s= strstr(&tl->line[text->selc], findstr);
@@ -2414,7 +2411,7 @@ static int txt_add_char_intern (Text *text, char add, int replace_tabs)
                return 1;
        }
        
-       /* insert spaces rather then tabs */
+       /* insert spaces rather than tabs */
        if (add == '\t' && replace_tabs) {
                txt_convert_tab_to_spaces(text);
                return 1;
@@ -2512,7 +2509,7 @@ void txt_indent(Text *text)
        /* hardcoded: TXT_TABSIZE = 4 spaces: */
        int spaceslen = TXT_TABSIZE;
 
-       /* insert spaces rather then tabs */
+       /* insert spaces rather than tabs */
        if (text->flags & TXT_TABSTOSPACES){
                add = tab_to_spaces;
                indentlen = spaceslen;
@@ -2573,7 +2570,7 @@ void txt_unindent(Text *text)
        /* hardcoded: TXT_TABSIZE = 4 spaces: */
        int spaceslen = TXT_TABSIZE;
 
-       /* insert spaces rather then tabs */
+       /* insert spaces rather than tabs */
        if (text->flags & TXT_TABSTOSPACES){
                remove = tab_to_spaces;
                indent = spaceslen;
@@ -2759,7 +2756,7 @@ int setcurr_tab_spaces (Text *text, int space)
                                break;
                        } else if (ch==':') {
                                is_indent = 1;
-                       } else if (ch==']' || ch=='}' || ch=='"' || ch=='\'') {
+                       } else if (ch!=' ' && ch!='\t') {
                                is_indent = 0;
                        }
                }
index 9b1c3b2ddb89e7d0a4a0e5188f38ce4918ec03f7..c729565533fd8ae586efb49a4fb311de8f0aeac7 100644 (file)
 #include <libswscale/swscale.h>
 #include <libavcodec/opt.h>
 
-#if LIBAVFORMAT_VERSION_INT < (49 << 16)
-#define FFMPEG_OLD_FRAME_RATE 1
-#else
-#define FFMPEG_CODEC_IS_POINTER 1
-#define FFMPEG_CODEC_TIME_BASE  1
-#endif
-
-#if LIBAVFORMAT_VERSION_INT >= (52 << 16)
-#define OUTFILE_PB (outfile->pb)
-#else
-#define OUTFILE_PB (&outfile->pb)
-#endif
-
 #if defined(WIN32) && (!(defined snprintf))
 #define snprintf _snprintf
 #endif
@@ -74,6 +61,8 @@
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
 
+#include "ffmpeg_compat.h"
+
 extern void do_init_ffmpeg(void);
 
 static int ffmpeg_type = 0;
@@ -114,24 +103,12 @@ static void delete_picture(AVFrame* f)
        }
 }
 
-#ifdef FFMPEG_CODEC_IS_POINTER
-static AVCodecContext* get_codec_from_stream(AVStream* stream)
-{
-       return stream->codec;
-}
-#else
-static AVCodecContext* get_codec_from_stream(AVStream* stream)
-{
-       return &stream->codec;
-}
-#endif
-
 static int write_audio_frame(void) 
 {
        AVCodecContext* c = NULL;
        AVPacket pkt;
 
-       c = get_codec_from_stream(audio_stream);
+       c = audio_stream->codec;
 
        av_init_packet(&pkt);
        pkt.size = 0;
@@ -153,17 +130,15 @@ static int write_audio_frame(void)
 
        if(c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE)
        {
-#ifdef FFMPEG_CODEC_TIME_BASE
                pkt.pts = av_rescale_q(c->coded_frame->pts,
-                                          c->time_base, audio_stream->time_base);
-#else
-               pkt.pts = c->coded_frame->pts;
-#endif
+                                      c->time_base, audio_stream->time_base);
                fprintf(stderr, "Audio Frame PTS: %d\n", (int)pkt.pts);
        }
 
        pkt.stream_index = audio_stream->index;
-       pkt.flags |= PKT_FLAG_KEY;
+
+       pkt.flags |= AV_PKT_FLAG_KEY;
+
        if (av_interleaved_write_frame(outfile, &pkt) != 0) {
                fprintf(stderr, "Error writing audio packet!\n");
                return -1;
@@ -263,10 +238,10 @@ static int write_video_frame(RenderData *rd, AVFrame* frame, ReportList *reports
 {
        int outsize = 0;
        int ret, success= 1;
-       AVCodecContext* c = get_codec_from_stream(video_stream);
-#ifdef FFMPEG_CODEC_TIME_BASE
+       AVCodecContext* c = video_stream->codec;
+
        frame->pts = rd->cfra - rd->sfra;
-#endif
+
        if (rd->mode & R_FIELDS) {
                frame->top_field_first = ((rd->mode & R_ODDFIELD) != 0);
        }
@@ -278,19 +253,15 @@ static int write_video_frame(RenderData *rd, AVFrame* frame, ReportList *reports
                av_init_packet(&packet);
 
                if (c->coded_frame->pts != AV_NOPTS_VALUE) {
-#ifdef FFMPEG_CODEC_TIME_BASE
                        packet.pts = av_rescale_q(c->coded_frame->pts,
                                                  c->time_base,
                                                  video_stream->time_base);
-#else
-                       packet.pts = c->coded_frame->pts;
-#endif
                        fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
                } else {
                        fprintf(stderr, "Video Frame PTS: not set\n");
                }
                if (c->coded_frame->key_frame)
-                       packet.flags |= PKT_FLAG_KEY;
+                       packet.flags |= AV_PKT_FLAG_KEY;
                packet.stream_index = video_stream->index;
                packet.data = video_buffer;
                packet.size = outsize;
@@ -312,7 +283,7 @@ static AVFrame* generate_video_frame(uint8_t* pixels, ReportList *reports)
 {
        uint8_t* rendered_frame;
 
-       AVCodecContext* c = get_codec_from_stream(video_stream);
+       AVCodecContext* c = video_stream->codec;
        int width = c->width;
        int height = c->height;
        AVFrame* rgb_frame;
@@ -396,7 +367,7 @@ static void set_ffmpeg_property_option(AVCodecContext* c, IDProperty * prop)
        switch(prop->type) {
        case IDP_STRING:
                fprintf(stderr, "%s.\n", IDP_String(prop));
-               rv = av_set_string(c, prop->name, IDP_String(prop));
+               av_set_string3(c, prop->name, IDP_String(prop), 1, &rv);
                break;
        case IDP_FLOAT:
                fprintf(stderr, "%g.\n", IDP_Float(prop));
@@ -407,7 +378,7 @@ static void set_ffmpeg_property_option(AVCodecContext* c, IDProperty * prop)
                
                if (param) {
                        if (IDP_Int(prop)) {
-                               rv = av_set_string(c, name, param);
+                               av_set_string3(c, name, param, 1, &rv);
                        } else {
                                return;
                        }
@@ -459,9 +430,9 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
 
        /* Set up the codec context */
        
-       c = get_codec_from_stream(st);
+       c = st->codec;
        c->codec_id = codec_id;
-       c->codec_type = CODEC_TYPE_VIDEO;
+       c->codec_type = AVMEDIA_TYPE_VIDEO;
 
 
        /* Get some values from the current render settings */
@@ -469,7 +440,6 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
        c->width = rectx;
        c->height = recty;
 
-#ifdef FFMPEG_CODEC_TIME_BASE
        /* FIXME: Really bad hack (tm) for NTSC support */
        if (ffmpeg_type == FFMPEG_DV && rd->frs_sec != 25) {
                c->time_base.den = 2997;
@@ -482,20 +452,6 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
                c->time_base.den = rd->frs_sec * 100000;
                c->time_base.num = ((double) rd->frs_sec_base) * 100000;
        }
-#else
-       /* FIXME: Really bad hack (tm) for NTSC support */
-       if (ffmpeg_type == FFMPEG_DV && rd->frs_sec != 25) {
-               c->frame_rate = 2997;
-               c->frame_rate_base = 100;
-       } else if ((double) ((int) rd->frs_sec_base) == 
-                  rd->frs_sec_base) {
-               c->frame_rate = rd->frs_sec;
-               c->frame_rate_base = rd->frs_sec_base;
-       } else {
-               c->frame_rate = rd->frs_sec * 100000;
-               c->frame_rate_base = ((double) rd->frs_sec_base)*100000;
-       }
-#endif
        
        c->gop_size = ffmpeg_gop_size;
        c->bit_rate = ffmpeg_video_bitrate*1000;
@@ -519,7 +475,7 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
                c->pix_fmt = PIX_FMT_YUV422P;
        }
 
-       if (codec_id == CODEC_ID_XVID) {
+       if (ffmpeg_type == FFMPEG_XVID) {
                /* arghhhh ... */
                c->pix_fmt = PIX_FMT_YUV420P;
                c->codec_tag = (('D'<<24) + ('I'<<16) + ('V'<<8) + 'X');
@@ -586,9 +542,9 @@ static AVStream* alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
        st = av_new_stream(of, 1);
        if (!st) return NULL;
 
-       c = get_codec_from_stream(st);
+       c = st->codec;
        c->codec_id = codec_id;
-       c->codec_type = CODEC_TYPE_AUDIO;
+       c->codec_type = AVMEDIA_TYPE_AUDIO;
 
        c->sample_rate = rd->ffcodecdata.audio_mixrate;
        c->bit_rate = ffmpeg_audio_bitrate*1000;
@@ -666,13 +622,13 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
                BKE_report(reports, RPT_ERROR, "No valid formats found.");
                return 0;
        }
-       fmt = guess_format(NULL, exts[0], NULL);
+       fmt = av_guess_format(NULL, exts[0], NULL);
        if (!fmt) {
                BKE_report(reports, RPT_ERROR, "No valid formats found.");
                return 0;
        }
 
-       of = av_alloc_format_context();
+       of = avformat_alloc_context();
        if (!of) {
                BKE_report(reports, RPT_ERROR, "Error opening output file");
                return 0;
@@ -713,7 +669,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
                fmt->video_codec = CODEC_ID_H264;
                break;
        case FFMPEG_XVID:
-               fmt->video_codec = CODEC_ID_XVID;
+               fmt->video_codec = CODEC_ID_MPEG4;
                break;
        case FFMPEG_FLV:
                fmt->video_codec = CODEC_ID_FLV1;
@@ -772,7 +728,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
                return 0;
        }
        if (!(fmt->flags & AVFMT_NOFILE)) {
-               if (url_fopen(&of->pb, name, URL_WRONLY) < 0) {
+               if (avio_open(&of->pb, name, AVIO_FLAG_WRITE) < 0) {
                        BKE_report(reports, RPT_ERROR, "Could not open file for writing.");
                        return 0;
                }
@@ -780,7 +736,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
 
        av_write_header(of);
        outfile = of;
-       dump_format(of, 0, name, 1);
+       av_dump_format(of, 0, name, 1);
 
        return 1;
 }
@@ -807,7 +763,7 @@ void flush_ffmpeg(void)
        int outsize = 0;
        int ret = 0;
        
-       AVCodecContext* c = get_codec_from_stream(video_stream);
+       AVCodecContext* c = video_stream->codec;
        /* get the delayed frames */
        while (1) {
                AVPacket packet;
@@ -822,19 +778,15 @@ void flush_ffmpeg(void)
                        break;
                }
                if (c->coded_frame->pts != AV_NOPTS_VALUE) {
-#ifdef FFMPEG_CODEC_TIME_BASE
                        packet.pts = av_rescale_q(c->coded_frame->pts,
                                                  c->time_base,
                                                  video_stream->time_base);
-#else
-                       packet.pts = c->coded_frame->pts;
-#endif
                        fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
                } else {
                        fprintf(stderr, "Video Frame PTS: not set\n");
                }
                if (c->coded_frame->key_frame) {
-                       packet.flags |= PKT_FLAG_KEY;
+                       packet.flags |= AV_PKT_FLAG_KEY;
                }
                packet.stream_index = video_stream->index;
                packet.data = video_buffer;
@@ -845,7 +797,7 @@ void flush_ffmpeg(void)
                        break;
                }
        }
-       avcodec_flush_buffers(get_codec_from_stream(video_stream));
+       avcodec_flush_buffers(video_stream->codec);
 }
 
 /* **********************************************************************
@@ -902,7 +854,7 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
 
        if(audio_stream)
        {
-               AVCodecContext* c = get_codec_from_stream(audio_stream);
+               AVCodecContext* c = audio_stream->codec;
                AUD_DeviceSpecs specs;
                specs.channels = c->channels;
                specs.format = AUD_FORMAT_S16;
@@ -945,7 +897,7 @@ int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty,
                success= (avframe && write_video_frame(rd, avframe, reports));
 
                if (ffmpeg_autosplit) {
-                       if (url_ftell(OUTFILE_PB) > FFMPEG_AUTOSPLIT_SIZE) {
+                       if (avio_tell(outfile->pb) > FFMPEG_AUTOSPLIT_SIZE) {
                                end_ffmpeg();
                                ffmpeg_autosplit_count++;
                                success &= start_ffmpeg_impl(rd, rectx, recty, reports);
@@ -974,7 +926,7 @@ void end_ffmpeg(void)
                audio_mixdown_device = 0;
        }
        
-       if (video_stream && get_codec_from_stream(video_stream)) {
+       if (video_stream && video_stream->codec) {
                fprintf(stderr, "Flushing delayed frames...\n");
                flush_ffmpeg ();                
        }
@@ -985,8 +937,8 @@ void end_ffmpeg(void)
        
        /* Close the video codec */
 
-       if (video_stream && get_codec_from_stream(video_stream)) {
-               avcodec_close(get_codec_from_stream(video_stream));
+       if (video_stream && video_stream->codec) {
+               avcodec_close(video_stream->codec);
                printf("zero video stream %p\n", video_stream);
                video_stream = 0;
        }
@@ -1007,7 +959,7 @@ void end_ffmpeg(void)
        }
        if (outfile && outfile->oformat) {
                if (!(outfile->oformat->flags & AVFMT_NOFILE)) {
-                       url_fclose(OUTFILE_PB);
+                       avio_close(outfile->pb);
                }
        }
        if (outfile) {
@@ -1101,12 +1053,12 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int
        switch (o->type) {
        case FF_OPT_TYPE_INT:
        case FF_OPT_TYPE_INT64:
-               val.i = o->default_val;
+               val.i = FFMPEG_DEF_OPT_VAL_INT(o);
                idp_type = IDP_INT;
                break;
        case FF_OPT_TYPE_DOUBLE:
        case FF_OPT_TYPE_FLOAT:
-               val.f = o->default_val;
+               val.f = FFMPEG_DEF_OPT_VAL_DOUBLE(o);
                idp_type = IDP_FLOAT;
                break;
        case FF_OPT_TYPE_STRING:
@@ -1314,7 +1266,7 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
        case FFMPEG_PRESET_XVID:
                if(preset == FFMPEG_PRESET_XVID) {
                        rd->ffcodecdata.type = FFMPEG_AVI;
-                       rd->ffcodecdata.codec = CODEC_ID_XVID;
+                       rd->ffcodecdata.codec = CODEC_ID_MPEG4;
                }
                else if(preset == FFMPEG_PRESET_THEORA) {
                        rd->ffcodecdata.type = FFMPEG_OGG; // XXX broken
@@ -1357,7 +1309,7 @@ void ffmpeg_verify_image_type(RenderData *rd)
                }
        }
        else if(rd->imtype == R_XVID) {
-               if(rd->ffcodecdata.codec != CODEC_ID_XVID) {
+               if(rd->ffcodecdata.codec != CODEC_ID_MPEG4) {
                        ffmpeg_set_preset(rd, FFMPEG_PRESET_XVID);
                        audio= 1;
                }
index 360cd1ea9abc78aaecf4abfc6f1d49d08671f2c3..81fc8a50db642adf5f95c03b2e7020942370b19f 100644 (file)
@@ -50,11 +50,7 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check);
 /* folder_id */
 
 /* general, will find based on user/local/system priority */
-#define BLENDER_CONFIG                         1
 #define BLENDER_DATAFILES                      2
-#define BLENDER_SCRIPTS                                3
-#define BLENDER_PLUGINS                                4
-#define BLENDER_PYTHON                         5
 
 /* user-specific */
 #define BLENDER_USER_CONFIG                    31
@@ -64,7 +60,6 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check);
 #define BLENDER_USER_AUTOSAVE          35
 
 /* system */
-#define BLENDER_SYSTEM_CONFIG          51      /* optional */
 #define BLENDER_SYSTEM_DATAFILES       52
 #define BLENDER_SYSTEM_SCRIPTS         53
 #define BLENDER_SYSTEM_PLUGINS         54
index 635c38e1d13cdc9305a3fb7f34ab0fc8f9f6482f..408809661cfbaa91a38d1449f0ebee63f3a3d602 100644 (file)
@@ -122,13 +122,6 @@ __attribute__ ((format (printf, 1, 2)))
 #endif
 ;
 
-       /**
-        * Compare two strings
-        * 
-        * @retval True if the strings are equal, false otherwise.
-        */
-int BLI_streq(const char *a, const char *b);
-
        /**
         * Compare two strings without regard to case.
         * 
@@ -147,6 +140,9 @@ void BLI_timestr(double _time, char *str); /* time var is global */
 int BLI_utf8_invalid_byte(const char *str, int length);
 int BLI_utf8_invalid_strip(char *str, int length);
 
+void BLI_ascii_strtolower(char *str, int len);
+void BLI_ascii_strtoupper(char *str, int len);
+
 #ifdef __cplusplus
 }
 #endif
index f8a85c8ba7672a1891abeeb8b4118c241742dd90..527692348e76add5f22d9d6f0bebdebb9b54af17 100644 (file)
@@ -1687,13 +1687,13 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
 {
        if(node->totnode == 0)
        {
-
+#if 0  /*UNUSED*/
                //Calculate the node min-coords (if the node was a point then this is the point coordinates)
                float co[3];
                co[0] = node->bv[0];
                co[1] = node->bv[2];
                co[2] = node->bv[4];
-
+#endif
        }
        else
        {
index 512086f0e17939e9c7991cdec4edd14ff2d43746..ef1d5da56d82146e477f16e3e1e767580e99afa3 100644 (file)
@@ -194,6 +194,10 @@ void hex_to_rgb(char *hexcol, float *r, float *g, float *b)
                CLAMP(*g, 0.0f, 1.0f);
                CLAMP(*b, 0.0f, 1.0f);
        }
+       else {
+               /* avoid using un-initialized vars */
+               *r= *g= *b= 0.0f;
+       }
 }
 
 void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv)
index 1f4b0ffdd5c6093df531a3e5d9735690c3284cb3..e0a08d0b89015e602fd563c12a42ad7992c90db7 100644 (file)
@@ -736,7 +736,7 @@ int BLI_path_cwd(char *path)
                        * cwd should contain c:\ etc on win32 so the relbase can be NULL
                        * relbase being NULL also prevents // being misunderstood as relative to the current
                        * blend file which isnt a feature we want to use in this case since were dealing
-                       * with a path from the command line, rather then from inside Blender */
+                       * with a path from the command line, rather than from inside Blender */
                        
                        char origpath[FILE_MAXDIR + FILE_MAXFILE];
                        BLI_strncpy(origpath, path, FILE_MAXDIR + FILE_MAXFILE);
@@ -902,10 +902,23 @@ static int get_path_local(char *targetpath, const char *folder_name, const char
        return 0;
 }
 
+static int is_portable_install(void)
+{
+       /* detect portable install by the existance of config folder */
+       const int ver= BLENDER_VERSION;
+       char path[FILE_MAX];
+
+       return get_path_local(path, "config", NULL, ver);
+}
+
 static int get_path_user(char *targetpath, const char *folder_name, const char *subfolder_name, const char *envvar, const int ver)
 {
        char user_path[FILE_MAX];
        const char *user_base_path;
+
+       /* for portable install, user path is always local */
+       if (is_portable_install())
+               return get_path_local(targetpath, folder_name, subfolder_name, ver);
        
        user_path[0] = '\0';
 
@@ -1011,6 +1024,26 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
        }
 }
 
+#if defined(WIN32) && BLENDER_VERSION < 258
+
+static int path_have_257_script_install(void)
+{
+       const int ver= BLENDER_VERSION;
+       char path[FILE_MAX] = "";
+       char system_pyfile[FILE_MAX];
+
+       if (get_path_user(path, "scripts", NULL, "BLENDER_USER_SCRIPTS", ver)) {
+               BLI_join_dirfile(system_pyfile, sizeof(system_pyfile), path, "modules/bpy_types.py");
+
+               if (BLI_exists(system_pyfile))
+                       return 1;
+       }
+
+       return 0;
+}
+
+#endif
+
 /* get a folder out of the 'folder_id' presets for paths */
 /* returns the path if found, NULL string if not */
 char *BLI_get_folder(int folder_id, const char *subfolder)
@@ -1020,13 +1053,12 @@ char *BLI_get_folder(int folder_id, const char *subfolder)
        
        switch (folder_id) {
                case BLENDER_DATAFILES:         /* general case */
-                       if (get_path_local(path, "datafiles", subfolder, ver)) break;
                        if (get_path_user(path, "datafiles", subfolder, "BLENDER_USER_DATAFILES", ver)) break;
+                       if (get_path_local(path, "datafiles", subfolder, ver)) break;
                        if (get_path_system(path, "datafiles", subfolder, "BLENDER_SYSTEM_DATAFILES", ver)) break;
                        return NULL;
                        
                case BLENDER_USER_DATAFILES:
-                       if (get_path_local(path, "datafiles", subfolder, ver)) break;
                        if (get_path_user(path, "datafiles", subfolder, "BLENDER_USER_DATAFILES", ver)) break;
                        return NULL;
                        
@@ -1036,35 +1068,28 @@ char *BLI_get_folder(int folder_id, const char *subfolder)
                        return NULL;
                        
                case BLENDER_USER_AUTOSAVE:
-                       if (get_path_local(path, "autosave", subfolder, ver)) break;
                        if (get_path_user(path, "autosave", subfolder, "BLENDER_USER_DATAFILES", ver))  break;
                        return NULL;
 
-               case BLENDER_CONFIG:            /* general case */
-                       if (get_path_local(path, "config", subfolder, ver)) break;
-                       if (get_path_user(path, "config", subfolder, "BLENDER_USER_CONFIG", ver)) break;
-                       if (get_path_system(path, "config", subfolder, "BLENDER_SYSTEM_CONFIG", ver)) break;
-                       return NULL;
-                       
                case BLENDER_USER_CONFIG:
-                       if (get_path_local(path, "config", subfolder, ver)) break;
                        if (get_path_user(path, "config", subfolder, "BLENDER_USER_CONFIG", ver)) break;
                        return NULL;
                        
-               case BLENDER_SYSTEM_CONFIG:
-                       if (get_path_local(path, "config", subfolder, ver)) break;
-                       if (get_path_system(path, "config", subfolder, "BLENDER_SYSTEM_CONFIG", ver)) break;
-                       return NULL;
-                       
-               case BLENDER_SCRIPTS:           /* general case */
-                       if (get_path_local(path, "scripts", subfolder, ver)) break;
-                       if (get_path_user(path, "scripts", subfolder, "BLENDER_USER_SCRIPTS", ver)) break;
-                       if (get_path_system(path, "scripts", subfolder, "BLENDER_SYSTEM_SCRIPTS", ver)) break;
-                       return NULL;
-                       
                case BLENDER_USER_SCRIPTS:
-                       if (get_path_local(path, "scripts", subfolder, ver)) break;
-                       if (get_path_user(path, "scripts", subfolder, "BLENDER_USER_SCRIPTS", ver)) break;
+#if defined(WIN32) && BLENDER_VERSION < 258
+                       /* if we have a 2.57 installation, then we may have system script
+                        * files in the user configuration folder. avoid using that folder
+                        * if they are there, until the version gets bumped to 2.58, so
+                        * we can be sure that folder only has addons etc. */
+                       if (path_have_257_script_install()) {
+                               if (get_path_local(path, "scripts", subfolder, ver)) break;
+                       }
+                       else
+#endif
+                       {
+                               if (get_path_user(path, "scripts", subfolder, "BLENDER_USER_SCRIPTS", ver)) break;
+                       }
+
                        return NULL;
                        
                case BLENDER_SYSTEM_SCRIPTS:
@@ -1072,11 +1097,6 @@ char *BLI_get_folder(int folder_id, const char *subfolder)
                        if (get_path_system(path, "scripts", subfolder, "BLENDER_SYSTEM_SCRIPTS", ver)) break;
                        return NULL;
                        
-               case BLENDER_PYTHON:            /* general case */
-                       if (get_path_local(path, "python", subfolder, ver)) break;
-                       if (get_path_system(path, "python", subfolder, "BLENDER_SYSTEM_PYTHON", ver)) break;
-                       return NULL;
-                       
                case BLENDER_SYSTEM_PYTHON:
                        if (get_path_local(path, "python", subfolder, ver)) break;
                        if (get_path_system(path, "python", subfolder, "BLENDER_SYSTEM_PYTHON", ver)) break;
@@ -1691,7 +1711,6 @@ void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name)
 
 #ifdef _WIN32
        if(GetModuleFileName(0, fullname, maxlen)) {
-               GetShortPathName(fullname, fullname, maxlen);
                if(!BLI_exists(fullname)) {
                        printf("path can't be found: \"%.*s\"\n", maxlen, fullname);
                        MessageBox(NULL, "path constains invalid characters or is too long (see console)", "Error", MB_OK);
@@ -1744,18 +1763,6 @@ void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name)
                if (strcmp(name, fullname)) {
                        printf("guessing '%s' == '%s'\n", name, fullname);
                }
-#endif
-
-#ifdef _WIN32
-               // in windows change long filename to short filename because
-               // win2k doesn't know how to parse a commandline with lots of
-               // spaces and double-quotes. There's another solution to this
-               // with spawnv(P_WAIT, bprogname, argv) instead of system() but
-               // that's even uglier
-               GetShortPathName(fullname, fullname, maxlen);
-#if defined(DEBUG)
-               printf("Shortname = '%s'\n", fullname);
-#endif
 #endif
        }
 }
index 95a43a998d36f5183f3eed9f92f420c33cc961e2..f7b79b35cbce8a569262d912536022dbcb1afbd7 100644 (file)
@@ -1437,7 +1437,7 @@ int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data)
 {
        float (*planes)[4] = data;
        int i, axis;
-       float vmin[3], vmax[3], bb_min[3], bb_max[3];
+       float vmin[3] /*, vmax[3]*/, bb_min[3], bb_max[3];
 
        BLI_pbvh_node_get_BB(node, bb_min, bb_max);
 
@@ -1445,11 +1445,11 @@ int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data)
                for(axis = 0; axis < 3; ++axis) {
                        if(planes[i][axis] > 0) { 
                                vmin[axis] = bb_min[axis];
-                               vmax[axis] = bb_max[axis];
+                               /*vmax[axis] = bb_max[axis];*/ /*UNUSED*/
                        }
                        else {
                                vmin[axis] = bb_max[axis];
-                               vmax[axis] = bb_min[axis];
+                               /*vmax[axis] = bb_min[axis];*/ /*UNUSED*/
                        }
                }
                
index cf65539bd68d8604a73dc3c748d3fa35fb3fab12..17b07b49309f8b2f6e2f185845764e178cbd0a78 100644 (file)
@@ -241,7 +241,7 @@ void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
 
 void print_rctf(const char *str, rctf *rect)
 {
-       printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str, rect->xmin, rect->xmax, rect->ymin, rect->xmax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
+       printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
 }
 
 void print_rcti(const char *str, rcti *rect)
index ee5bd17c901665bf75a238cf6b815cfc912428b3..8e0314ec17f52f6be388cef87f7bdecd0fa0746f 100644 (file)
@@ -212,11 +212,6 @@ char *BLI_replacestr(char *str, const char *oldText, const char *newText)
        }
 } 
 
-int BLI_streq(const char *a, const char *b) 
-{
-       return (strcmp(a, b)==0);
-}
-
 int BLI_strcaseeq(const char *a, const char *b) 
 {
        return (BLI_strcasecmp(a, b)==0);
@@ -469,3 +464,21 @@ int BLI_utf8_invalid_strip(char *str, int length)
        return tot;
 }
 
+void BLI_ascii_strtolower(char *str, int len)
+{
+       int i;
+
+       for(i=0; i<len; i++)
+               if(str[i] >= 'A' && str[i] <= 'Z')
+                       str[i] += 'a' - 'A';
+}
+
+void BLI_ascii_strtoupper(char *str, int len)
+{
+       int i;
+
+       for(i=0; i<len; i++)
+               if(str[i] >= 'a' && str[i] <= 'z')
+                       str[i] -= 'a' - 'A';
+}
+
index 6267b819c552cd5bb8e12d66f2bde2050f106bcd..85d4b936c518fc6f47eb66611b726cbb574b14cd 100644 (file)
@@ -213,18 +213,32 @@ int BLO_is_a_library(const char *path, char *dir, char *group);
 
 struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, const char *filepath);
 
+
 /**
  * Link/Append a named datablock from an external blend file.
  *
+ * @param mainl The main database to link from (not the active one).
+ * @param bh The blender file handle.
+ * @param idname The name of the datablock (without the 2 char ID prefix)
+ * @param idcode The kind of datablock to link.
+ * @return the appended ID when found.
+ */
+struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle** bh, const char *idname, const int idcode);
+
+/**
+ * Link/Append a named datablock from an external blend file.
+ * optionally instance the object in the scene when the flags are set.
+ *
  * @param C The context, when NULL instancing object in the scene isnt done.
  * @param mainl The main database to link from (not the active one).
  * @param bh The blender file handle.
  * @param idname The name of the datablock (without the 2 char ID prefix)
  * @param idcode The kind of datablock to link.
  * @param flag Options for linking, used for instancing.
- * @return Boolean, 0 when the datablock could not be found.
+ * @return the appended ID when found.
  */
-int BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *idname, int idcode, short flag);
+struct ID *BLO_library_append_named_part_ex(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *idname, const int idcode, const short flag);
+
 void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag);
 
 void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname);
index 93518e993d59191fc3d6be31d1d0e093a6736602..a10c7c6e1ed2e3985c3e1636a2e439980723eb1e 100644 (file)
@@ -1082,7 +1082,7 @@ int BLO_is_a_library(const char *path, char *dir, char *group)
 
                /* now we know that we are in a blend file and it is safe to 
                   assume that gp actually points to a group */
-               if (BLI_streq("Screen", gp)==0)
+               if (strcmp("Screen", gp)!=0)
                        BLI_strncpy(group, gp, GROUP_MAX);
        }
        return 1;
@@ -2115,7 +2115,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
        }
        
        {
-               int has_old_groups=0;
+               /*int has_old_groups=0;*/ /*UNUSED*/
                /* XXX this should actually be part of do_versions, but since we need
                 * finished library linking, it is not possible there. Instead in do_versions
                 * we have set the NTREE_DO_VERSIONS flag, so at this point we can do the
@@ -2125,7 +2125,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
                        if (ntree->flag & NTREE_DO_VERSIONS) {
                                /* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */
                                nodeGroupExposeAllSockets(ntree);
-                               has_old_groups = 1;
+                               /*has_old_groups = 1;*/ /*UNUSED*/
                        }
                }
                /* now verify all types in material trees, groups are set OK now */
@@ -9692,7 +9692,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                        nu->radius_interp = 3;
                                        
                                        /* resolu and resolv are now used differently for surfaces
-                                        * rather then using the resolution to define the entire number of divisions,
+                                        * rather than using the resolution to define the entire number of divisions,
                                         * use it for the number of divisions per segment
                                         */
                                        if (nu->pntsv > 1) {
@@ -11497,7 +11497,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                do_version_bone_roll_256(bone);
 
                /* fix for objects which have zero dquat's
-                * since this is multiplied with the quat rather then added */
+                * since this is multiplied with the quat rather than added */
                for(ob= main->object.first; ob; ob= ob->id.next) {
                        if(is_zero_v4(ob->dquat)) {
                                unit_qt(ob->dquat);
@@ -12200,6 +12200,9 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma)
        
        if(ma->nodetree)
                expand_nodetree(fd, mainvar, ma->nodetree);
+       
+       if(ma->group)
+               expand_doit(fd, mainvar, ma->group);
 }
 
 static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)
@@ -12803,29 +12806,22 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
 }
 
 /* returns true if the item was found
- * but it may already have already been appended/linked */
-static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const char *idname, int idcode, short flag)
+* but it may already have already been appended/linked */
+static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, const short idcode)
 {
-       Scene *scene= CTX_data_scene(C);
-       Object *ob;
-       Base *base;
        BHead *bhead;
-       ID *id;
-       int endloop=0;
+       ID *id= NULL;
        int found=0;
 
-       bhead = blo_firstbhead(fd);
-       while(bhead && endloop==0) {
-
-               if(bhead->code==ENDB) endloop= 1;
-               else if(bhead->code==idcode) {
+       for(bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
+               if(bhead->code==idcode) {
                        const char *idname_test= bhead_id_name(fd, bhead);
-                               
+
                        if(strcmp(idname_test + 2, idname)==0) {
                                found= 1;
                                id= is_yet_read(fd, mainl, bhead);
                                if(id==NULL) {
-                                       read_libblock(fd, mainl, bhead, LIB_TESTEXT, NULL);
+                                       read_libblock(fd, mainl, bhead, LIB_TESTEXT, &id);
                                }
                                else {
                                        printf("append: already linked\n");
@@ -12836,47 +12832,67 @@ static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const
                                        }
                                }
 
-                               if(idcode==ID_OB && scene) {    /* loose object: give a base */
-                                       base= MEM_callocN( sizeof(Base), "app_nam_part");
-                                       BLI_addtail(&scene->base, base);
-
-                                       if(id==NULL) ob= mainl->object.last;
-                                       else ob= (Object *)id;
-                                       
-                                       /* link at active layer (view3d->lay if in context, else scene->lay */
-                                       if((flag & FILE_ACTIVELAY)) {
-                                               View3D *v3d = CTX_wm_view3d(C);
-                                               if (v3d) {
-                                                       ob->lay = v3d->layact;
-                                               } else {
-                                                       ob->lay = scene->lay;
-                                               }
-                                       }
-                                       ob->mode= 0;
-                                       base->lay= ob->lay;
-                                       base->object= ob;
-                                       ob->id.us++;
-                                       
-                                       if(flag & FILE_AUTOSELECT) { 
-                                               base->flag |= SELECT;
-                                               base->object->flag = base->flag;
-                                               /* do NOT make base active here! screws up GUI stuff, if you want it do it on src/ level */
-                                       }
-                               }
-                               endloop= 1;
+                               break;
                        }
                }
+               else if(bhead->code==ENDB) {
+                       break;
+               }
+       }
 
-               bhead = blo_nextbhead(fd, bhead);
+       /* if we found the id but the id is NULL, this is really bad */
+       BLI_assert((found != 0) == (id != NULL));
+
+       return found ? id : NULL;
+}
+
+static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, const char *idname, const int idcode, const int flag)
+{
+       ID *id= append_named_part(mainl, fd, idname, idcode);
+
+       if(id && (GS(id->name) == ID_OB)) {     /* loose object: give a base */
+               Scene *scene= CTX_data_scene(C); /* can be NULL */
+               if(scene) {
+                       Base *base;
+                       Object *ob;
+
+                       base= MEM_callocN( sizeof(Base), "app_nam_part");
+                       BLI_addtail(&scene->base, base);
+
+                       ob= (Object *)id;
+
+                       /* link at active layer (view3d->lay if in context, else scene->lay */
+                       if((flag & FILE_ACTIVELAY)) {
+                               View3D *v3d = CTX_wm_view3d(C);
+                               ob->lay = v3d ? v3d->layact : scene->lay;
+                       }
+
+                       ob->mode= 0;
+                       base->lay= ob->lay;
+                       base->object= ob;
+                       ob->id.us++;
+
+                       if(flag & FILE_AUTOSELECT) {
+                               base->flag |= SELECT;
+                               base->object->flag = base->flag;
+                               /* do NOT make base active here! screws up GUI stuff, if you want it do it on src/ level */
+                       }
+               }
        }
 
-       return found;
+       return id;
 }
 
-int BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, const char *idname, int idcode, short flag)
+ID *BLO_library_append_named_part(Main *mainl, BlendHandle** bh, const char *idname, const int idcode)
 {
        FileData *fd= (FileData*)(*bh);
-       return append_named_part(C, mainl, fd, idname, idcode, flag);
+       return append_named_part(mainl, fd, idname, idcode);
+}
+
+ID *BLO_library_append_named_part_ex(const bContext *C, Main *mainl, BlendHandle** bh, const char *idname, const int idcode, const short flag)
+{
+       FileData *fd= (FileData*)(*bh);
+       return append_named_part_ex(C, mainl, fd, idname, idcode, flag);
 }
 
 static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r)
@@ -12885,8 +12901,8 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r)
 
        for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
                if (bhead->code == GS(id->name)) {
-                       
-                       if (BLI_streq(id->name, bhead_id_name(fd, bhead))) {
+
+                       if (strcmp(id->name, bhead_id_name(fd, bhead))==0) {
                                id->flag &= ~LIB_READ;
                                id->flag |= LIB_TEST;
 //                             printf("read lib block %s\n", id->name);
index c4108e0ce33fb0553134aaca515feeee99d53fa2..00e11d8b1a43b0260c6d245622487f18213287b1 100644 (file)
@@ -372,7 +372,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree,
                blocks->root= (DLRBT_Node *)new_ab;
        }
        else {
-               ActKeyBlock *ab, *abp=NULL, *abn=NULL;
+               ActKeyBlock *ab, *abn=NULL;
                
                /* try to find a keyblock that starts on the previous beztriple, and add a new one if none start there
                 * Note: we can't search from end to try to optimise this as it causes errors there's
@@ -382,7 +382,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree,
                //              A|--------------|A ______________ B|--------------|B
                //              A|------------------------------------------------|A
                //              A|----|A|---|A|-----------------------------------|A
-               for (ab= blocks->root; ab; abp= ab, ab= abn) {
+               for (ab= blocks->root; ab; ab= abn) {
                        /* check if this is a match, or whether we go left or right */
                        if (ab->start == prev->vec[1][0]) {
                                /* set selection status and 'touched' status */
index 10886615976ca121523d1d91d449abcf5f772d89..c525c9af626bfb220178fff1d9acb311f2a44ac4 100644 (file)
@@ -696,7 +696,7 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformK
 /* Menu of All Keying Sets ----------------------------- */
 
 /* Dynamically populate an enum of Keying Sets */
-EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(ptr), int *free)
+EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {
        Scene *scene = CTX_data_scene(C);
        KeyingSet *ks;
index b31bcc710f4bd97a14668d32c447b795ad2d3fc8..abf0839354403c2fad229e291beb635e8de5c5a2 100644 (file)
@@ -2491,14 +2491,12 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e
        Scene *scene;
        ARegion *ar;
        View3D *v3d;
-       RegionView3D *rv3d;
        float *fp = NULL, tvec[3], oldcurs[3], mval_f[2];
        int retv;
 
        scene= CTX_data_scene(C);
        ar= CTX_wm_region(C);
        v3d = CTX_wm_view3d(C);
-       rv3d= CTX_wm_region_view3d(C);
        
        fp= give_cursor(scene, v3d);
        
index ccb9a45af3750a29a1221e77dc2f391731f02854..97f85b92b32261e81d1634ab42888f9e54eb83d5 100644 (file)
@@ -374,16 +374,16 @@ static void sk_autoname(bContext *C, ReebArc *arc)
                        int valid = 0;
                        int caps = 0;
 
-                       if (BLI_streq(side, ""))
+                       if (side[0] == '\0')
                        {
                                valid = 1;
                        }
-                       else if (BLI_streq(side, "R") || BLI_streq(side, "L"))
+                       else if (strcmp(side, "R")==0 || strcmp(side, "L")==0)
                        {
                                valid = 1;
                                caps = 1;
                        }
-                       else if (BLI_streq(side, "r") || BLI_streq(side, "l"))
+                       else if (strcmp(side, "r")==0 || strcmp(side, "l")==0)
                        {
                                valid = 1;
                                caps = 0;
index 9e0e9374d5dd8bde87712dc41fa065787c42f5b7..5b4da1a38df7415f9a70fc37687650358640b589 100644 (file)
@@ -483,7 +483,7 @@ void POSELIB_OT_pose_add (wmOperatorType *ot)
 /* ----- */
 
 /* can be called with C == NULL */
-static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {
        Object *ob = get_poselib_object(C);
        bAction *act = (ob) ? ob->poselib : NULL;
index 27f2598d5157a2fc23142a9c13f7d21078cba058..2860d467cef42b561bb4e1db41f891fc4d32d7ea 100644 (file)
@@ -444,7 +444,6 @@ static void gp_stroke_to_path (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cur
 
 static int gp_camera_view_subrect(bContext *C, rctf *subrect)
 {
-       Scene *scene= CTX_data_scene(C);
        View3D *v3d= CTX_wm_view3d(C);
        ARegion *ar= CTX_wm_region(C);
 
@@ -453,7 +452,8 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
 
                /* for camera view set the subrect */
                if (rv3d->persp == RV3D_CAMOB) {
-                       ED_view3d_calc_camera_border(scene, ar, v3d, NULL, subrect, -1); /* negative shift */
+                       Scene *scene= CTX_data_scene(C);
+                       ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, -1); /* negative shift */
                        return 1;
                }
        }
index 2a4b583276e8136935991742254ef60a824e2878..f4da734473d9d9d1355f64cb2d8686072056cab9 100644 (file)
@@ -1131,7 +1131,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
 
                        /* for camera view set the subrect */
                        if (rv3d->persp == RV3D_CAMOB) {
-                               ED_view3d_calc_camera_border(p->scene, p->ar, v3d, NULL, &p->subrect_data, -1); /* negative shift */
+                               ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, -1); /* negative shift */
                                p->subrect= &p->subrect_data;
                        }
                }
index 6523a89771361f029dcf3008bc286a4eacb68a06..294b9b8475aa55f5ef30e0ebdd6f839fa5196fdf 100644 (file)
@@ -211,7 +211,7 @@ struct KeyingSet *ANIM_get_keyingset_for_autokeying(struct Scene *scene, const c
 void ANIM_keying_sets_menu_setup(struct bContext *C, const char title[], const char op_name[]);
 
 /* Dynamically populate an enum of Keying Sets */
-struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
+struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 
 /* Check if KeyingSet can be used in the current context */
 short ANIM_keyingset_context_ok_poll(struct bContext *C, struct KeyingSet *ks);
index 3145901d45990a6eee333f9cf7b1a8f19eb056d8..0adf6633b059194ceb664ca54d39888fb940ac1b 100644 (file)
@@ -284,6 +284,7 @@ unsigned int ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
 unsigned int ED_viewedit_datamask(struct bScreen *screen);
 
 /* camera lock functions */
+int ED_view3d_camera_lock_check(struct View3D *v3d, struct RegionView3D *rv3d);
 /* copy the camera to the view before starting a view transformation */
 void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d);
 /* copy the view to the camera */
index e70b793cfb01e2510e441b84c8c1ad4d42c704d7..28a874f78dec21182c71a86128fa2fe5ea003c2e 100644 (file)
@@ -556,7 +556,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
 //                             but->flag= oldbut->flag;
 #else
                                /* exception! redalert flag can't be update from old button. 
-                                * perhaps it should only copy spesific flags rather then all. */
+                                * perhaps it should only copy spesific flags rather than all. */
 //                             but->flag= (oldbut->flag & ~UI_BUT_REDALERT) | (but->flag & UI_BUT_REDALERT);
 #endif
 //                             but->active= oldbut->active;
@@ -1848,29 +1848,24 @@ void uiFreeInactiveBlocks(const bContext *C, ListBase *lb)
 
 void uiBlockSetRegion(uiBlock *block, ARegion *region)
 {
-       ListBase *lb;
+       ListBase *lb= &region->uiblocks;
        uiBlock *oldblock= NULL;
 
-       lb= &region->uiblocks;
-       
        /* each listbase only has one block with this name, free block
         * if is already there so it can be rebuilt from scratch */
        if(lb) {
-               for (oldblock= lb->first; oldblock; oldblock= oldblock->next)
-                       if (BLI_streq(oldblock->name, block->name))
-                               break;
+               oldblock= BLI_findstring(lb, block->name, offsetof(uiBlock, name));
 
                if (oldblock) {
                        oldblock->active= 0;
                        oldblock->panel= NULL;
                }
+
+               /* at the beginning of the list! for dynamical menus/blocks */
+               BLI_addhead(lb, block);
        }
 
        block->oldblock= oldblock;
-
-       /* at the beginning of the list! for dynamical menus/blocks */
-       if(lb)
-               BLI_addhead(lb, block);
 }
 
 uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, short dt)
index a62e7b3012062af3276ff74701958cfbcc058eea..b68634acd1e46616b494f75e14272753de6f49a7 100644 (file)
@@ -729,6 +729,9 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
        RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
        prop= RNA_struct_find_property(&ptr, propname);
 
+       /* don't let bad properties slip through */
+       BLI_assert((prop == NULL) || (RNA_property_type(prop) == PROP_ENUM));
+
        if(prop && RNA_property_type(prop) == PROP_ENUM) {
                EnumPropertyItem *item;
                int totitem, i, free;
index 18f3b807f860131e9ab206547e9689703e6ff0c9..b5da36756b591f7d8e82d9dcd2b29221e82c55af 100644 (file)
@@ -1250,7 +1250,7 @@ static int select_similar_exec(bContext *C, wmOperator *op)
                return similar_face_select_exec(C, op);
 }
 
-static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {
        Object *obedit= CTX_data_edit_object(C);
        EnumPropertyItem *item= NULL;
index dfd1ac730ac777e08235bbe122587e0040c3f099..424d3dd5a382184d274ceb09d8da8cd621f2f4fd 100644 (file)
@@ -762,7 +762,7 @@ static EnumPropertyItem extrude_items[] = {
                {0, NULL, 0, NULL, NULL}};
 
 
-static EnumPropertyItem *mesh_extrude_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *mesh_extrude_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {
        EnumPropertyItem *item= NULL;
        Object *obedit= CTX_data_edit_object(C);
@@ -5263,7 +5263,7 @@ static int blend_from_shape_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
-static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {      
        Object *obedit= CTX_data_edit_object(C);
        Mesh *me= (obedit) ? obedit->data : NULL;
@@ -5316,7 +5316,7 @@ void MESH_OT_blend_from_shape(wmOperatorType *ot)
        prop= RNA_def_enum(ot->srna, "shape", shape_items, 0, "Shape", "Shape key to use for blending.");
        RNA_def_enum_funcs(prop, shape_itemf);
        RNA_def_float(ot->srna, "blend", 1.0f, -FLT_MAX, FLT_MAX, "Blend", "Blending factor.", -2.0f, 2.0f);
-       RNA_def_boolean(ot->srna, "add", 0, "Add", "Add rather then blend between shapes.");
+       RNA_def_boolean(ot->srna, "add", 0, "Add", "Add rather than blend between shapes.");
 }
 
 /************************ Merge Operator *************************/
@@ -5975,7 +5975,7 @@ static EnumPropertyItem merge_type_items[]= {
        {5, "COLLAPSE", 0, "Collapse", ""},
        {0, NULL, 0, NULL, NULL}};
 
-static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {      
        Object *obedit= CTX_data_edit_object(C);
        EnumPropertyItem *item= NULL;
index 91980ddf2285f154c4dd8e960c3d9090c301e9ca..527b97a6082ee0a0bc23bba01f153ee89c8c9f79 100644 (file)
@@ -1873,7 +1873,7 @@ static void rand_timeoffs(Scene *scene, View3D *v3d)
 
 }
 
-static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {      
        EnumPropertyItem *input = object_mode_items;
        EnumPropertyItem *item= NULL;
@@ -2119,7 +2119,7 @@ static EnumPropertyItem game_properties_copy_operations[] ={
 static EnumPropertyItem gameprops_items[]= {
        {0, NULL, 0, NULL, NULL}};
 
-static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {      
        Object *ob= ED_object_active_context(C);
        EnumPropertyItem tmp = {0, "", 0, "", ""};
index 78937299645ab20d62daa88aaca103010f36c1f6..2d547da41f6838af0d08904490299f974584e821 100644 (file)
@@ -563,7 +563,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
-static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {      
        Object *ob = CTX_data_edit_object(C);
        EnumPropertyItem tmp = {0, "", 0, "", ""};
index d5bf894ac8c42ed7d868b96d3a3463e1bbfceac9..5996037cd2d486624884a86efb365667e9d02ec2 100644 (file)
@@ -584,7 +584,7 @@ static int modifier_add_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
-static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {      
        Object *ob= ED_object_active_context(C);
        EnumPropertyItem *item= NULL, *md_item;
index 8078bfbeb93da76c78f3220786eb8284e380b43a..f7158e4b4ecf882862cfa27498640b7134454581 100644 (file)
@@ -360,7 +360,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
 }
 
 /* Generic itemf's for operators that take library args */
-static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {
        EnumPropertyItem item_tmp= {0}, *item= NULL;
        int totitem= 0;
index 53562caf1b58fabd5e71007510ca56556d1da30e..43448198ae153eaec46c7127ab60a73bf1601ea5 100644 (file)
@@ -1966,7 +1966,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
-static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
+static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {      
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
        EnumPropertyItem tmp = {0, "", 0, "", ""};
index fa458f4096d81afe29b985a27c738b2f3233223c..c5ab840914e4b88198c15ce63d16aa3fb5a4a850 100644 (file)
@@ -373,7 +373,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
        PE_set_data(C, data);
 
        view3d_set_viewcontext(C, &data->vc);
-       /* note, the object argument means the modelview matrix does not account for the objects matrix, use viewmat rather then (obmat * viewmat) */
+       /* note, the object argument means the modelview matrix does not account for the objects matrix, use viewmat rather than (obmat * viewmat) */
        view3d_get_transformation(data->vc.ar, data->vc.rv3d, NULL, &data->mats);
 
        if((data->vc.v3d->drawtype>OB_WIRE) && (data->vc.v3d->flag & V3D_ZBUF_SELECT)) {
@@ -3460,7 +3460,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
        ParticleBrushData *brush= &pset->brush[pset->brushtype];
        ARegion *ar= CTX_wm_region(C);
        float vec[3], mousef[2];
-       int mval[2], mvalo[2];
+       int mval[2];
        int flip, mouse[2], dx, dy, removed= 0, added=0, selected= 0;
        int lock_root = pset->flag & PE_LOCK_FIRST;
 
@@ -3483,8 +3483,6 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
        mval[0]= mouse[0];
        mval[1]= mouse[1];
 
-       mvalo[0]= bedit->lastmouse[0];
-       mvalo[1]= bedit->lastmouse[1];
 
        /* disable locking temporatily for disconnected hair */
        if(edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
index e942cfc8b1fcd38702e78a1749e9eeb310e0212d..9bc2b1a402c08699b63280a37e6da30a3bc70745 100644 (file)
@@ -1595,12 +1595,12 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
 
        if(sa && sa->full) {
                ScrArea *old;
-               short fulltype;
+               /*short fulltype;*/ /*UNUSED*/
 
                sc= sa->full;           /* the old screen to restore */
                oldscreen= win->screen; /* the one disappearing */
 
-               fulltype = sc->full;
+               /*fulltype = sc->full;*/
                sc->full= 0;
 
                /* removed: SCREENAUTOPLAY exception here */
index b024f22e8dd882d2c7837e27f3cb43d27f7fed26..bb877e4b1ee854309fff1b818be0f6fd7ca04bbf 100644 (file)
@@ -84,6 +84,8 @@ void PAINT_OT_weight_paint_toggle(struct wmOperatorType *ot);
 void PAINT_OT_weight_paint(struct wmOperatorType *ot);
 void PAINT_OT_weight_set(struct wmOperatorType *ot);
 void PAINT_OT_weight_from_bones(struct wmOperatorType *ot);
+void PAINT_OT_weight_sample(struct wmOperatorType *ot);
+void PAINT_OT_weight_sample_group(struct wmOperatorType *ot);
 
 void PAINT_OT_vertex_paint_toggle(struct wmOperatorType *ot);
 void PAINT_OT_vertex_paint(struct wmOperatorType *ot);
index e4a21b1f1a7e0eedc5b0964a28088d2607c27127..69af50415cc283a453485888f7d5047193cd0523 100644 (file)
@@ -370,6 +370,8 @@ void ED_operatortypes_paint(void)
        WM_operatortype_append(PAINT_OT_weight_paint);
        WM_operatortype_append(PAINT_OT_weight_set);
        WM_operatortype_append(PAINT_OT_weight_from_bones);
+       WM_operatortype_append(PAINT_OT_weight_sample);
+       WM_operatortype_append(PAINT_OT_weight_sample_group);
 
        /* vertex */
        WM_operatortype_append(PAINT_OT_vertex_paint_toggle);
@@ -589,6 +591,10 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 
        WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0);
 
+       /* these keys are from 2.4x but could be changed */
+       WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample_group", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
+
        WM_keymap_add_item(keymap,
                        "PAINT_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0);
 
index 692d33bd091ea3438f13a5e5d000962a8c5adb6a..0d79fcc2c58919aaf4a20fa28d44adfb16901644 100644 (file)
@@ -61,6 +61,7 @@
 
 #include "RNA_access.h"
 #include "RNA_define.h"
+#include "RNA_enum_types.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_action.h"
@@ -72,6 +73,7 @@
 #include "BKE_modifier.h"
 #include "BKE_object.h"
 #include "BKE_paint.h"
+#include "BKE_report.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -286,6 +288,43 @@ static void make_vertexcol(Object *ob)     /* single ob */
        
 }
 
+/* mirror_vgroup is set to -1 when invalid */
+static void wpaint_mirror_vgroup_ensure(Object *ob, int *vgroup_mirror)
+{
+       bDeformGroup *defgroup= BLI_findlink(&ob->defbase, ob->actdef - 1);
+
+       if(defgroup) {
+               bDeformGroup *curdef;
+               int mirrdef;
+               char name[MAXBONENAME];
+
+               flip_side_name(name, defgroup->name, FALSE);
+
+               if(strcmp(name, defgroup->name) != 0) {
+                       for (curdef= ob->defbase.first, mirrdef; curdef; curdef=curdef->next, mirrdef++) {
+                               if (!strcmp(curdef->name, name)) {
+                                       break;
+                               }
+                       }
+
+                       if(curdef==NULL) {
+                               int olddef= ob->actdef; /* tsk, ED_vgroup_add sets the active defgroup */
+                               curdef= ED_vgroup_add_name(ob, name);
+                               ob->actdef= olddef;
+                       }
+
+                       /* curdef should never be NULL unless this is
+                        * a  lamp and ED_vgroup_add_name fails */
+                       if(curdef) {
+                               *vgroup_mirror= mirrdef;
+                               return;
+                       }
+               }
+       }
+
+       *vgroup_mirror= -1;
+}
+
 static void copy_vpaint_prev(VPaint *vp, unsigned int *mcol, int tot)
 {
        if(vp->vpaint_prev) {
@@ -381,32 +420,11 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
        }
        
        vgroup= ob->actdef-1;
-       
-       /* directly copied from weight_paint, should probaby split into a separate function */
+
        /* if mirror painting, find the other group */          
        if(me->editflag & ME_EDIT_MIRROR_X) {
-               bDeformGroup *defgroup= BLI_findlink(&ob->defbase, ob->actdef-1);
-               if(defgroup) {
-                       bDeformGroup *curdef;
-                       int actdef= 0;
-                       char name[32];
-
-                       flip_side_name(name, defgroup->name, FALSE);
-
-                       for (curdef = ob->defbase.first; curdef; curdef=curdef->next, actdef++)
-                               if (!strcmp(curdef->name, name))
-                                       break;
-                       if(curdef==NULL) {
-                               int olddef= ob->actdef; /* tsk, ED_vgroup_add sets the active defgroup */
-                               curdef= ED_vgroup_add_name (ob, name);
-                               ob->actdef= olddef;
-                       }
-                       
-                       if(curdef && curdef!=defgroup)
-                               vgroup_mirror= actdef;
-               }
+               wpaint_mirror_vgroup_ensure(ob, &vgroup_mirror);
        }
-       /* end copy from weight_paint*/
        
        copy_wpaint_prev(wp, me->dvert, me->totvert);
        
@@ -855,145 +873,195 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float
 
 /* ----------------------------------------------------- */
 
-/* used for 3d view, on active object, assumes me->dvert exists */
-/* if mode==1: */
-/*     samples cursor location, and gives menu with vertex groups to activate */
-/* else */
-/*     sets wp->weight to the closest weight value to vertex */
-/*     note: we cant sample frontbuf, weight colors are interpolated too unpredictable */
-static void sample_wpaint(Scene *scene, ARegion *ar, View3D *UNUSED(v3d), int mode)
+
+/* sets wp->weight to the closest weight value to vertex */
+/* note: we cant sample frontbuf, weight colors are interpolated too unpredictable */
+static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        ViewContext vc;
-       ToolSettings *ts= scene->toolsettings;
-       Object *ob= OBACT;
-       Mesh *me= get_mesh(ob);
-       int index;
-       int mval[2] = {0, 0}, sco[2];
-       int vgroup= ob->actdef-1;
+       Mesh *me;
+       short change= FALSE;
+
+       view3d_set_viewcontext(C, &vc);
+       me= get_mesh(vc.obact);
+
+       if (me && me->dvert && vc.v3d && vc.rv3d) {
+               int index;
+
+               view3d_operator_needs_opengl(C);
+
+               index= view3d_sample_backbuf(&vc, event->mval[0], event->mval[1]);
+
+               if(index && index<=me->totface) {
+                       DerivedMesh *dm= mesh_get_derived_final(vc.scene, vc.obact, CD_MASK_BAREMESH);
 
-       if (!me) return;
-       
-//     getmouseco_areawin(mval);
-       index= view3d_sample_backbuf(&vc, mval[0], mval[1]);
-       
-       if(index && index<=me->totface) {
-               MFace *mface;
-               
-               mface= ((MFace *)me->mface) + index-1;
-               
-               if(mode==1) {   /* sampe which groups are in here */
-                       MDeformVert *dv;
-                       int a, totgroup;
-                       
-                       totgroup= BLI_countlist(&ob->defbase);
-                       if(totgroup) {
-                               int totmenu=0;
-                               int *groups=MEM_callocN(totgroup*sizeof(int), "groups");
-                               
-                               dv= me->dvert+mface->v1;
-                               for(a=0; a<dv->totweight; a++) {
-                                       if (dv->dw[a].def_nr<totgroup)
-                                               groups[dv->dw[a].def_nr]= 1;
-                               }
-                               dv= me->dvert+mface->v2;
-                               for(a=0; a<dv->totweight; a++) {
-                                       if (dv->dw[a].def_nr<totgroup)
-                                               groups[dv->dw[a].def_nr]= 1;
-                               }
-                               dv= me->dvert+mface->v3;
-                               for(a=0; a<dv->totweight; a++) {
-                                       if (dv->dw[a].def_nr<totgroup)
-                                               groups[dv->dw[a].def_nr]= 1;
-                               }
-                               if(mface->v4) {
-                                       dv= me->dvert+mface->v4;
-                                       for(a=0; a<dv->totweight; a++) {
-                                               if (dv->dw[a].def_nr<totgroup)
-                                                       groups[dv->dw[a].def_nr]= 1;
-                                       }
-                               }
-                               for(a=0; a<totgroup; a++)
-                                       if(groups[a]) totmenu++;
-                               
-                               if(totmenu==0) {
-                                       //notice("No Vertex Group Selected");
-                               }
-                               else {
-                                       bDeformGroup *dg;
-                                       short val;
-                                       char item[40], *str= MEM_mallocN(40*totmenu+40, "menu");
-                                       
-                                       strcpy(str, "Vertex Groups %t");
-                                       for(a=0, dg=ob->defbase.first; dg && a<totgroup; a++, dg= dg->next) {
-                                               if(groups[a]) {
-                                                       sprintf(item, "|%s %%x%d", dg->name, a);
-                                                       strcat(str, item);
-                                               }
-                                       }
-                                       
-                                       val= 0; // XXX pupmenu(str);
-                                       if(val>=0) {
-                                               ob->actdef= val+1;
-                                               DAG_id_tag_update(&me->id, 0);
-                                       }
-                                       MEM_freeN(str);
-                               }
-                               MEM_freeN(groups);
-                       }
-//                     else notice("No Vertex Groups in Object");
-               }
-               else {
-                       DerivedMesh *dm;
-                       float w1, w2, w3, w4, co[3], fac;
-                       
-                       dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
                        if(dm->getVertCo==NULL) {
-                               //notice("Not supported yet");
+                               BKE_report(op->reports, RPT_WARNING, "The modifier used does not support deformed locations");
                        }
                        else {
-                               /* calc 3 or 4 corner weights */
-                               dm->getVertCo(dm, mface->v1, co);
-                               project_int_noclip(ar, co, sco);
-                               w1= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1]));
-                               
-                               dm->getVertCo(dm, mface->v2, co);
-                               project_int_noclip(ar, co, sco);
-                               w2= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1]));
-                               
-                               dm->getVertCo(dm, mface->v3, co);
-                               project_int_noclip(ar, co, sco);
-                               w3= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1]));
-                               
-                               if(mface->v4) {
-                                       dm->getVertCo(dm, mface->v4, co);
-                                       project_int_noclip(ar, co, sco);
-                                       w4= ((mval[0]-sco[0])*(mval[0]-sco[0]) + (mval[1]-sco[1])*(mval[1]-sco[1]));
-                               }
-                               else w4= 1.0e10;
-                               
-                               fac= MIN4(w1, w2, w3, w4);
-                               if(w1==fac) {
-                                       ts->vgroup_weight= defvert_find_weight(me->dvert+mface->v1, vgroup);
-                               }
-                               else if(w2==fac) {
-                                       ts->vgroup_weight= defvert_find_weight(me->dvert+mface->v2, vgroup);
-                               }
-                               else if(w3==fac) {
-                                       ts->vgroup_weight= defvert_find_weight(me->dvert+mface->v3, vgroup);
-                               }
-                               else if(w4==fac) {
-                                       if(mface->v4) {
-                                               ts->vgroup_weight= defvert_find_weight(me->dvert+mface->v4, vgroup);
+                               MFace *mf= ((MFace *)me->mface) + index-1;
+                               const int vgroup= vc.obact->actdef - 1;
+                               ToolSettings *ts= vc.scene->toolsettings;
+                               float mval_f[2];
+                               int v_idx_best= -1;
+                               int fidx;
+                               float len_best= FLT_MAX;
+
+                               mval_f[0]= (float)event->mval[0];
+                               mval_f[1]= (float)event->mval[1];
+
+                               fidx= mf->v4 ? 3:2;
+                               do {
+                                       float co[3], sco[3], len;
+                                       const int v_idx= (*(&mf->v1 + fidx));
+                                       dm->getVertCo(dm, v_idx, co);
+                                       project_float_noclip(vc.ar, co, sco);
+                                       len= len_squared_v2v2(mval_f, sco);
+                                       if(len < len_best) {
+                                               len_best= len;
+                                               v_idx_best= v_idx;
                                        }
+                               } while (fidx--);
+
+                               if(v_idx_best != -1) { /* should always be valid */
+                                       ts->vgroup_weight= defvert_find_weight(&me->dvert[v_idx_best], vgroup);
+                                       change= TRUE;
                                }
                        }
                        dm->release(dm);
-               }               
-               
+               }
        }
-       
+
+       if(change) {
+               /* not really correct since the brush didnt change, but redraws the toolbar */
+               WM_main_add_notifier(NC_BRUSH|NA_EDITED, NULL); /* ts->wpaint->paint.brush */
+
+               return OPERATOR_FINISHED;
+       }
+       else {
+               return OPERATOR_CANCELLED;
+       }
+}
+
+void PAINT_OT_weight_sample(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Weight Paint Sample Weight";
+       ot->idname= "PAINT_OT_weight_sample";
+
+       /* api callbacks */
+       ot->invoke= weight_sample_invoke;
+       ot->poll= weight_paint_mode_poll;
+
+       /* flags */
+       ot->flag= OPTYPE_UNDO;
+}
+
+/* samples cursor location, and gives menu with vertex groups to activate */
+static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+{
+       if (C) {
+               wmWindow *win= CTX_wm_window(C);
+               if(win && win->eventstate) {
+                       ViewContext vc;
+                       Mesh *me;
+
+                       view3d_set_viewcontext(C, &vc);
+                       me= get_mesh(vc.obact);
+
+                       if (me && me->dvert && vc.v3d && vc.rv3d) {
+                               int index;
+
+                               view3d_operator_needs_opengl(C);
+
+                               index= view3d_sample_backbuf(&vc, win->eventstate->x - vc.ar->winrct.xmin, win->eventstate->y - vc.ar->winrct.ymin);
+
+                               if(index && index<=me->totface) {
+                                       const int totgroup= BLI_countlist(&vc.obact->defbase);
+                                       if(totgroup) {
+                                               MFace *mf= ((MFace *)me->mface) + index-1;
+                                               int fidx= mf->v4 ? 3:2;
+                                               int *groups= MEM_callocN(totgroup*sizeof(int), "groups");
+                                               int found= FALSE;
+
+                                               do {
+                                                       MDeformVert *dvert= me->dvert + (*(&mf->v1 + fidx));
+                                                       int i= dvert->totweight;
+                                                       MDeformWeight *dw;
+                                                       for(dw= dvert->dw; i > 0; dw++, i--) {
+                                                               groups[dw->def_nr]= TRUE;
+                                                               found= TRUE;
+                                                       }
+                                               } while (fidx--);
+
+                                               if(found==FALSE) {
+                                                       MEM_freeN(groups);
+                                               }
+                                               else {
+                                                       EnumPropertyItem *item= NULL, item_tmp= {0};
+                                                       int totitem= 0;
+                                                       int i= 0;
+                                                       bDeformGroup *dg;
+                                                       for(dg= vc.obact->defbase.first; dg && i<totgroup; i++, dg= dg->next) {
+                                                               if(groups[i]) {
+                                                                       item_tmp.identifier= item_tmp.name= dg->name;
+                                                                       item_tmp.value= i;
+                                                                       RNA_enum_item_add(&item, &totitem, &item_tmp);
+                                                               }
+                                                       }
+
+                                                       RNA_enum_item_end(&item, &totitem);
+                                                       *free= 1;
+
+                                                       MEM_freeN(groups);
+                                                       return item;
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+
+       return DummyRNA_NULL_items;
 }
 
+static int weight_sample_group_exec(bContext *C, wmOperator *op)
+{
+       int type= RNA_enum_get(op->ptr, "group");
+       ViewContext vc;
+       view3d_set_viewcontext(C, &vc);
+
+       vc.obact->actdef= type + 1;
+
+       DAG_id_tag_update(&vc.obact->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, vc.obact);
+       return OPERATOR_FINISHED;
+}
+
+/* TODO, we could make this a menu into OBJECT_OT_vertex_group_set_active rather than its own operator */
+void PAINT_OT_weight_sample_group(wmOperatorType *ot)
+{
+       PropertyRNA *prop= NULL;
+
+       /* identifiers */
+       ot->name= "Weight Paint Sample Group";
+       ot->idname= "PAINT_OT_weight_sample_group";
+
+       /* api callbacks */
+       ot->exec= weight_sample_group_exec;
+       ot->invoke= WM_menu_invoke;
+       ot->poll= weight_paint_mode_poll;
+
+       /* flags */
+       ot->flag= OPTYPE_UNDO;
+
+       /* keyingset to use (dynamic enum) */
+       prop= RNA_def_enum(ot->srna, "group", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+       RNA_def_enum_funcs(prop, weight_paint_sample_enum_itemf);
+       ot->prop= prop;
+}
+
+
 static void do_weight_paint_auto_normalize(MDeformVert *dvert, 
                                           int paint_nr, char *map)
 {
@@ -1299,26 +1367,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
        
        /* if mirror painting, find the other group */
        if(me->editflag & ME_EDIT_MIRROR_X) {
-               bDeformGroup *defgroup= BLI_findlink(&ob->defbase, ob->actdef-1);
-               if(defgroup) {
-                       bDeformGroup *curdef;
-                       int actdef= 0;
-                       char name[32];
-
-                       flip_side_name(name, defgroup->name, FALSE);
-
-                       for (curdef = ob->defbase.first; curdef; curdef=curdef->next, actdef++)
-                               if (!strcmp(curdef->name, name))
-                                       break;
-                       if(curdef==NULL) {
-                               int olddef= ob->actdef; /* tsk, ED_vgroup_add sets the active defgroup */
-                               curdef= ED_vgroup_add_name (ob, name);
-                               ob->actdef= olddef;
-                       }
-                       
-                       if(curdef && curdef!=defgroup)
-                               wpd->vgroup_mirror= actdef;
-               }
+               wpaint_mirror_vgroup_ensure(ob, &wpd->vgroup_mirror);
        }
        
        return 1;
index ec0d9806bca427227e95f72f76db1d585e9ea566..18270bfaa26e250a06c5a4e87624e5b5b76f1ad9 100644 (file)
@@ -606,7 +606,7 @@ void ED_spacetype_file(void)
 
 void ED_file_init(void)
 {
-       char *cfgdir = BLI_get_folder(BLENDER_CONFIG, NULL);
+       char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
        
        fsmenu_read_system(fsmenu_get());
 
index da7a95cdbf727ea9d64bc0216d6923bf40ad9f8b..76883027df1b9ddb4796c3437dcb9883d77f25a6 100644 (file)
@@ -1291,15 +1291,11 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short
 static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        bAnimContext ac;
-       ARegion *ar;
        short selectmode;
 
        /* get editor data */
        if (ANIM_animdata_get_context(C, &ac) == 0)
                return OPERATOR_CANCELLED;
-       
-       /* get useful pointers from animation context data */
-       ar= ac.ar;
 
        /* select mode is either replace (deselect all, then add) or add/extend */
        if (RNA_boolean_get(op->ptr, "extend"))
index b5bb635b5441a1bb76abf50f9021fd70a32f4a97..17cfc7d8f95a1197910c97c4d497a0b05c2763ff 100644 (file)
@@ -862,7 +862,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C)
 
        uiItemR(col, ptr, "ratio", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
        uiItemR(col, ptr, "use_unspill", 0, NULL, ICON_NONE);
-       if (RNA_enum_get(ptr, "use_unspill")== 1) {
+       if (RNA_boolean_get(ptr, "use_unspill")== 1) {
                uiItemR(col, ptr, "unspill_red", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
                uiItemR(col, ptr, "unspill_green", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
                uiItemR(col, ptr, "unspill_blue", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
index 4b9f87f67d8d47c3b2f95abc52f7059fd603fa65..71ed7928bc8d7780211a26d67719c5181b8b1586 100644 (file)
@@ -2719,14 +2719,15 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
        Scene *scene= CTX_data_scene(C);
        Sequence *seq_act;
        Sequence *seq_other;
+       const char *error_msg;
 
        if(seq_active_pair_get(scene, &seq_act, &seq_other) == 0) {
                BKE_report(op->reports, RPT_ERROR, "Must select 2 strips");
                return OPERATOR_CANCELLED;
        }
 
-       if(seq_swap(seq_act, seq_other) == 0) {
-               BKE_report(op->reports, RPT_ERROR, "Strips were not compatible");
+       if(seq_swap(seq_act, seq_other, &error_msg) == 0) {
+               BKE_report(op->reports, RPT_ERROR, error_msg);
                return OPERATOR_CANCELLED;
        }
 
index 8440a107f3161615b046331e3d4b380e27e1d163..8b4bfb2e04243e77c13eb6c9e348f6f7ee821a6b 100644 (file)
@@ -305,8 +305,6 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
        short linked_handle= RNA_boolean_get(op->ptr, "linked_handle");
        short left_right= RNA_boolean_get(op->ptr, "left_right");
        short linked_time= RNA_boolean_get(op->ptr, "linked_time");
-
-       int mval[2];
        
        Sequence *seq,*neighbor, *act_orig;
        int hand,sel_side;
@@ -343,7 +341,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                /* use different logic for this */
                float x;
                deselect_all_seq(scene);
-               UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, NULL);
+               UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
 
                SEQP_BEGIN(ed, seq) {
                        if (x < CFRA) {
index ccfc45826cf11d17af2fb2575fe83a529cd0dd97..391eecbbbae7da96e5ef4bb05d5b4b1b92e82f35 100644 (file)
@@ -2651,7 +2651,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
        else if(dt==OB_SOLID) {
                if(ob==OBACT && ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
                        /* weight paint in solid mode, special case. focus on making the weights clear
-                        * rather then the shading, this is also forced in wire view */
+                        * rather than the shading, this is also forced in wire view */
                        GPU_enable_material(0, NULL);
                        dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material);
                
@@ -3840,6 +3840,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
                                                case PART_DRAW_COL_ACC:
                                                        intensity = len_v3v3(pa->state.vel, pa->prev_state.vel)/((pa->state.time-pa->prev_state.time)*part->color_vec_max);
                                                        break;
+                                               default:
+                                                       intensity= 1.0f; /* should never happen */
                                        }
                                        CLAMP(intensity, 0.f, 1.f);
                                        weight_to_rgb(intensity, &ma_r, &ma_g, &ma_b);
index 7e9c219fdaab01522b6f765b68bf9b23ae58f02a..573951da4cab7acdf6a62bc18fd11b48620833f7 100644 (file)
@@ -876,9 +876,6 @@ void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, Region
        float dx= 0.0f, dy= 0.0f;
        
        view3d_viewborder_size_get(scene, ar, size);
-       
-       if (rv3d == NULL)
-               rv3d = ar->regiondata;
 
        size[0]= size[0]*zoomfac;
        size[1]= size[1]*zoomfac;
@@ -1156,6 +1153,8 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
        struct Base *base = scene->basact;
        rcti winrct;
 
+       BLI_assert(ar->regiontype == RGN_TYPE_WINDOW);
+
        if(base && (base->object->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) ||
                         paint_facesel_test(base->object)));
        else if((base && (base->object->mode & OB_MODE_TEXTURE_PAINT)) &&
index ecf110b98c97cc72bbabd454f0bf64a74b4319ba..31aae28dd614ad37c4749493054d5cb883668fa1 100644 (file)
 
 /* ********************** view3d_edit: view manipulations ********************* */
 
+int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
+{
+       return ((v3d->camera) &&
+               (v3d->camera->id.lib == NULL) &&
+               (v3d->flag2 & V3D_LOCK_CAMERA) &&
+               (rv3d->persp==RV3D_CAMOB));
+}
+
 void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d)
 {
-       if(v3d->camera && (v3d->flag2 & V3D_LOCK_CAMERA) && (rv3d->persp==RV3D_CAMOB)) {
+       if(ED_view3d_camera_lock_check(v3d, rv3d)) {
                ED_view3d_from_object(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
        }
 }
 
 void ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
 {
-       if(v3d->camera && (v3d->flag2 & V3D_LOCK_CAMERA) && (rv3d->persp==RV3D_CAMOB)) {
+       if(ED_view3d_camera_lock_check(v3d, rv3d)) {
                Object *root_parent;
 
                if((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (root_parent= v3d->camera->parent)) {
@@ -437,7 +445,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
                                sub_v3_v3v3(my_pivot, rv3d->ofs, upvec);
                                negate_v3(my_pivot);                            /* ofs is flipped */
 
-                               /* find a new ofs value that is allong the view axis (rather then the mouse location) */
+                               /* find a new ofs value that is allong the view axis (rather than the mouse location) */
                                closest_to_line_v3(dvec, vod->dyn_ofs, my_pivot, my_origin);
                                vod->dist0 = rv3d->dist = len_v3v3(my_pivot, dvec);
 
@@ -841,7 +849,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
        if(rv3d->persp != RV3D_PERSP) {
 
                if (U.uiflag & USER_AUTOPERSP) {
-                       if(!((rv3d->persp==RV3D_CAMOB) && (vod->v3d->flag2 & V3D_LOCK_CAMERA))) {
+                       if(!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
                                rv3d->persp= RV3D_PERSP;
                        }
                }
@@ -852,7 +860,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
                                ED_view3d_from_object(vod->v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
                        }
 
-                       if(!(vod->v3d->flag2 & V3D_LOCK_CAMERA)) {
+                       if(!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
                                rv3d->persp= rv3d->lpersp;
                        }
                }
@@ -953,7 +961,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
 
 static void viewmove_apply(ViewOpsData *vod, int x, int y)
 {
-       if((vod->rv3d->persp==RV3D_CAMOB) && !(vod->v3d->flag2 & V3D_LOCK_CAMERA)) {
+       if((vod->rv3d->persp==RV3D_CAMOB) && !ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
                const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)vod->rv3d->camzoom) * 2.0f;
                vod->rv3d->camdx += (vod->oldx - x)/(vod->ar->winx * zoomfac);
                vod->rv3d->camdy += (vod->oldy - y)/(vod->ar->winy * zoomfac);
@@ -1284,7 +1292,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
        mx= RNA_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") : ar->winx / 2;
        my= RNA_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") : ar->winy / 2;
 
-       use_cam_zoom= (rv3d->persp==RV3D_CAMOB) && !((v3d->flag2 & V3D_LOCK_CAMERA) && rv3d->is_persp);
+       use_cam_zoom= (rv3d->persp==RV3D_CAMOB) && !(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d));
 
        if(delta < 0) {
                /* this min and max is also in viewmove() */
@@ -1625,7 +1633,7 @@ static int viewdolly_poll(bContext *C)
                }
                else {
                        View3D *v3d= CTX_wm_view3d(C);
-                       if ((rv3d->persp == RV3D_CAMOB) && (v3d->flag2 & V3D_LOCK_CAMERA)) {
+                       if (ED_view3d_camera_lock_check(v3d, rv3d)) {
                                return 1;
                        }
                }
@@ -1664,7 +1672,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
        Scene *scene= CTX_data_scene(C);
        Base *base;
        float *curs;
-       const short skip_camera= ((rv3d->persp==RV3D_CAMOB) && (v3d->flag2 & V3D_LOCK_CAMERA));
+       const short skip_camera= ED_view3d_camera_lock_check(v3d, rv3d);
 
        int center= RNA_boolean_get(op->ptr, "center");
 
@@ -1725,7 +1733,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
                        new_dist*= size;
                }
 
-               if ((rv3d->persp==RV3D_CAMOB) && !(v3d->flag2 & V3D_LOCK_CAMERA)) {
+               if ((rv3d->persp==RV3D_CAMOB) && !ED_view3d_camera_lock_check(v3d, rv3d)) {
                        rv3d->persp= RV3D_PERSP;
                        smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
                }
@@ -1769,7 +1777,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca
        Object *obedit= CTX_data_edit_object(C);
        float size, min[3], max[3], afm[3];
        int ok=0, ok_dist=1;
-       const short skip_camera= ((rv3d->persp==RV3D_CAMOB) && (v3d->flag2 & V3D_LOCK_CAMERA));
+       const short skip_camera= ED_view3d_camera_lock_check(v3d, rv3d);
 
        /* SMOOTHVIEW */
        float new_ofs[3];
@@ -1872,7 +1880,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca
                new_dist*= size;
        }
 
-       if (rv3d->persp==RV3D_CAMOB && !(v3d->flag2 & V3D_LOCK_CAMERA)) {
+       if (rv3d->persp==RV3D_CAMOB && !ED_view3d_camera_lock_check(v3d, rv3d)) {
                rv3d->persp= RV3D_PERSP;
                smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
        }
@@ -2176,7 +2184,7 @@ static int view3d_zoom_border_invoke(bContext *C, wmOperator *op, wmEvent *event
        RegionView3D *rv3d= CTX_wm_region_view3d(C);
 
        /* if in camera view do not exec the operator so we do not conflict with set render border*/
-       if ((rv3d->persp != RV3D_CAMOB) || (v3d->flag2 & V3D_LOCK_CAMERA))
+       if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d))
                return WM_border_select_invoke(C, op, event);
        else
                return OPERATOR_PASS_THROUGH;
@@ -2490,7 +2498,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
        orbitdir = RNA_enum_get(op->ptr, "type");
 
        if(rv3d->viewlock==0) {
-               if((rv3d->persp != RV3D_CAMOB) || (v3d->flag2 & V3D_LOCK_CAMERA)) {
+               if((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
                        if(orbitdir == V3D_VIEW_STEPLEFT || orbitdir == V3D_VIEW_STEPRIGHT) {
                                float si;
                                /* z-axis */
index fdee5c6f6d99b2522aa3a44d51fa35d009cd2da3..ed1ed5b388182fad48e37c29b2f712eab52dee44 100644 (file)
@@ -477,7 +477,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
 
                                /* impliment WASD keys */
                        case FLY_MODAL_DIR_FORWARD:
-                               if (fly->speed < 0.0f) fly->speed= -fly->speed; /* flip speed rather then stopping, game like motion */
+                               if (fly->speed < 0.0f) fly->speed= -fly->speed; /* flip speed rather than stopping, game like motion */
                                else if (fly->axis==2) fly->speed += fly->grid; /* increse like mousewheel if were already moving in that difection*/
                                fly->axis= 2;
                                break;
index 0940734a8e9e1b0c27a74534600ce92d6e93f821..fb3c0a63b7d976824433b1f490322a5b7e07bdd3 100644 (file)
@@ -1234,7 +1234,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
        startbase=  FIRSTBASE;
        if(BASACT && BASACT->next) startbase= BASACT->next;
        
-       /* This block uses the control key to make the object selected by its center point rather then its contents */
+       /* This block uses the control key to make the object selected by its center point rather than its contents */
        /* XXX later on, in editmode do not activate */
        if(vc.obedit==NULL && obcenter) {
                
index 9ac44f482a1fc5de98db8319c51360757b3cf7fc..f4e27a5faf977733b788c3a9ac609f167d306d91 100644 (file)
@@ -344,7 +344,7 @@ void ED_OT_redo(wmOperatorType *ot)
 }
 
 
-/* ui callbacks should call this rather then calling WM_operator_repeat() themselves */
+/* ui callbacks should call this rather than calling WM_operator_repeat() themselves */
 int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
 {
        int ret= 0;
index 1ea2db4c237f96d5f8c4a604ff897006198ac5a2..66b1e7d412bb7fc04baadf3d6c6b8bd0d945ddce 100644 (file)
@@ -1444,7 +1444,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
         * remove doubles and could annoying if it joined points when zoomed out.
         * 'penalty' is in screen pixel space otherwise zooming in on a uv-vert and
         * shift-selecting can consider an adjacent point close enough to add to
-        * the selection rather then de-selecting the closest. */
+        * the selection rather than de-selecting the closest. */
 
        uvedit_pixel_to_float(sima, limit, 0.05f);
        uvedit_pixel_to_float(sima, penalty, 5.0f / sima->zoom);
index 1bf70fbd38b234ee5507756bea136583f7b690d8..e936f35574da8b160c2a6874c27d1d00f5a9a92d 100644 (file)
@@ -900,7 +900,7 @@ static void do_material_tex(GPUShadeInput *shi)
        GPUNodeLink *texco_norm, *texco_orco, *texco_object;
        GPUNodeLink *texco_global, *texco_uv = NULL;
        GPUNodeLink *newnor, *orn;
-       char *lastuvname = NULL;
+       /*char *lastuvname = NULL;*/ /*UNUSED*/
        float one = 1.0f, norfac, ofs[3];
        int tex_nr, rgbnor, talpha;
        int init_done = 0, iBumpSpacePrev;
@@ -947,7 +947,7 @@ static void do_material_tex(GPUShadeInput *shi)
                        else if(mtex->texco==TEXCO_UV) {
                                if(1) { //!(texco_uv && strcmp(mtex->uvname, lastuvname) == 0)) {
                                        GPU_link(mat, "texco_uv", GPU_attribute(CD_MTFACE, mtex->uvname), &texco_uv);
-                                       lastuvname = mtex->uvname;
+                                       /*lastuvname = mtex->uvname;*/ /*UNUSED*/
                                }
                                texco= texco_uv;
                        }
index 6404ae3de75c3b6fa7c97401507b40d0c1e250ce..ed4508053b832ded2c1959cc8bf9b192914213e6 100644 (file)
@@ -38,6 +38,7 @@ set(INC
        ../makesdna
        ../../../intern/memutil
        ../../../intern/guardedalloc
+       ../../../intern/ffmpeg
        ${JPEG_INCLUDE_DIR}
        ${PNG_INCLUDE_DIR}
        ${ZLIB_INCLUDE_DIRS}
@@ -100,6 +101,9 @@ set(SRC
        intern/md5.h
        intern/openexr/openexr_api.h
        intern/openexr/openexr_multi.h
+       
+       # orphan include
+       ../../../intern/ffmpeg/ffmpeg_compat.h
 )
 
 if(WITH_IMAGE_OPENEXR)
index ecb9a89c274d5fd2cd991cb3a7bed0c6e15c0a45..a80f92b4421b32dcd70ab1577bc3ded4e0695165 100644 (file)
@@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c')
 
 incs = '. ../makesdna #/intern/guardedalloc #/intern/memutil ../blenlib'
 incs += ' ../avi ../blenkernel ../blenloader'
-
+incs += ' #/intern/ffmpeg'
 
 incs += ' ' + env['BF_JPEG_INC']
 incs += ' ' + env['BF_PNG_INC']
index 4de96bb17bca11bf6395910e6a42b04b174e456a..919b0eb0c29e736b20f044988ed91277523d7551 100644 (file)
 #include <libavutil/rational.h>
 #include <libswscale/swscale.h>
 
-#if LIBAVFORMAT_VERSION_INT < (49 << 16)
-#define FFMPEG_OLD_FRAME_RATE 1
-#else
-#define FFMPEG_CODEC_IS_POINTER 1
-#endif
-
-#if (LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 29) && \
-        (LIBSWSCALE_VERSION_MAJOR >= 0) && (LIBSWSCALE_VERSION_MINOR >= 10)
-#define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
-#endif
+#include "ffmpeg_compat.h"
 
 #endif //WITH_FFMPEG
 
@@ -520,18 +511,6 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) {
 
 extern void do_init_ffmpeg(void);
 
-#ifdef FFMPEG_CODEC_IS_POINTER
-static AVCodecContext* get_codec_from_stream(AVStream* stream)
-{
-       return stream->codec;
-}
-#else
-static AVCodecContext* get_codec_from_stream(AVStream* stream)
-{
-       return &stream->codec;
-}
-#endif
-
 static int startffmpeg(struct anim * anim) {
        int            i, videoStream;
 
@@ -559,14 +538,14 @@ static int startffmpeg(struct anim * anim) {
                return -1;
        }
 
-       dump_format(pFormatCtx, 0, anim->name, 0);
+       av_dump_format(pFormatCtx, 0, anim->name, 0);
 
 
                /* Find the first video stream */
        videoStream=-1;
        for(i=0; i<pFormatCtx->nb_streams; i++)
-               if(get_codec_from_stream(pFormatCtx->streams[i])->codec_type
-                  == CODEC_TYPE_VIDEO) {
+               if(pFormatCtx->streams[i]->codec->codec_type
+                  == AVMEDIA_TYPE_VIDEO) {
                        videoStream=i;
                        break;
                }
@@ -576,7 +555,7 @@ static int startffmpeg(struct anim * anim) {
                return -1;
        }
 
-       pCodecCtx = get_codec_from_stream(pFormatCtx->streams[videoStream]);
+       pCodecCtx = pFormatCtx->streams[videoStream]->codec;
 
                /* Find the decoder for the video stream */
        pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
@@ -592,19 +571,10 @@ static int startffmpeg(struct anim * anim) {
                return -1;
        }
 
-#ifdef FFMPEG_OLD_FRAME_RATE
-       if(pCodecCtx->frame_rate>1000 && pCodecCtx->frame_rate_base==1)
-               pCodecCtx->frame_rate_base=1000;
-
-
-       anim->duration = pFormatCtx->duration * pCodecCtx->frame_rate 
-               / pCodecCtx->frame_rate_base / AV_TIME_BASE;
-#else
        anim->duration = ceil(pFormatCtx->duration
                * av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate) 
                / AV_TIME_BASE);
 
-#endif
        anim->params = 0;
 
        anim->x = pCodecCtx->width;
@@ -830,10 +800,10 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
                        && position - (anim->curposition + 1) < anim->preseek) {
                        while(av_read_frame(anim->pFormatCtx, &packet)>=0) {
                                if (packet.stream_index == anim->videoStream) {
-                                       avcodec_decode_video(
+                                       avcodec_decode_video2(
                                                anim->pCodecCtx, 
                                                anim->pFrame, &frameFinished, 
-                                               packet.data, packet.size);
+                                               &packet);
 
                                        if (frameFinished) {
                                                anim->curposition++;
@@ -858,15 +828,9 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
 #endif
 
        if (position != anim->curposition + 1) { 
-#ifdef FFMPEG_OLD_FRAME_RATE
-               double frame_rate = 
-                       (double) anim->pCodecCtx->frame_rate
-                       / (double) anim->pCodecCtx->frame_rate_base;
-#else
                double frame_rate = 
                        av_q2d(anim->pFormatCtx->streams[anim->videoStream]
                                   ->r_frame_rate);
-#endif
                double pts_time_base = av_q2d(anim->pFormatCtx->streams[anim->videoStream]->time_base);
                long long pos;
                long long st_time = anim->pFormatCtx->start_time;
@@ -915,9 +879,9 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
 
        while(av_read_frame(anim->pFormatCtx, &packet)>=0) {
                if(packet.stream_index == anim->videoStream) {
-                       avcodec_decode_video(anim->pCodecCtx, 
-                                                anim->pFrame, &frameFinished, 
-                                                packet.data, packet.size);
+                       avcodec_decode_video2(anim->pCodecCtx, 
+                                             anim->pFrame, &frameFinished, 
+                                             &packet);
 
                        if (seek_by_bytes && preseek_count > 0) {
                                preseek_count--;
index fa5e951067d12ba8c3e20fab542aefc33ac80a76..1ac4e4e06cb14d66c4c2318a78135d19c4094354 100644 (file)
@@ -315,7 +315,7 @@ void bilinear_interpolation_color(struct ImBuf *in, unsigned char *outI, float *
 
 /* Note about wrapping, the u/v still needs to be within the image bounds,
  * just the interpolation is wrapped.
- * This the same as bilinear_interpolation_color except it wraps rather then using empty and emptyI */
+ * This the same as bilinear_interpolation_color except it wraps rather than using empty and emptyI */
 void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char *outI, float *outF, float u, float v)
 {
        float *row1, *row2, *row3, *row4, a, b;
index f6a6a6449772f37ae09f9811a5c7277acc3a8d4b..5389d90867ea0e6f10a25cb0e844914454028b55 100644 (file)
@@ -300,17 +300,18 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
        uchar *p1, *p2 = NULL, *dest;
        float *p1f, *destf, *p2f = NULL;
        int x,y;
-       int do_rect, do_float;
+       const short do_rect= (ibuf1->rect != NULL);
+       const short do_float= (ibuf1->rect_float != NULL) && (ibuf2->rect_float != NULL);
+
+       if(do_rect && (ibuf2->rect == NULL)) {
+               imb_addrectImBuf(ibuf2);
+       }
 
-       do_rect= (ibuf1->rect != NULL);
-       
        p1f = ibuf1->rect_float;
        destf=ibuf2->rect_float;
        p1 = (uchar *) ibuf1->rect;
        dest=(uchar *) ibuf2->rect;
 
-       do_float= (ibuf1->rect_float != NULL && ibuf2->rect_float != NULL);
-
        for(y=ibuf2->y;y>0;y--){
                if (do_rect) p2 = p1 + (ibuf1->x << 2);
                if (do_float) p2f = p1f + (ibuf1->x << 2);
index f334409133fc4ed76c91070a03f54951656ac109..5d9f350be486c7b97f681865f54cd37e8ee58891 100644 (file)
@@ -532,7 +532,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
        TARGA tga;
        struct ImBuf * ibuf;
        int col, count, size;
-       unsigned int *rect, *cmap= NULL, mincol= 0, maxcol= 0;
+       unsigned int *rect, *cmap= NULL /*, mincol= 0*/, maxcol= 0;
        uchar * cp = (uchar *) &col;
        
        if (checktarga(&tga,mem) == 0) return(NULL);
@@ -550,7 +550,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
        
        if (tga.mapsize){
                /* load color map */
-               mincol = tga.maporig;
+               /*mincol = tga.maporig;*/ /*UNUSED*/
                maxcol = tga.mapsize;
                cmap = MEM_callocN(sizeof(unsigned int)*maxcol, "targa cmap");
 
index 3e4136cbef9013f106a631c8231f9ecd52f463c0..6e5e87d7e5c0187683695b490a0372a144a10b8c 100644 (file)
 #include <libavdevice/avdevice.h>
 #include <libavutil/log.h>
 
-#if LIBAVFORMAT_VERSION_INT < (49 << 16)
-#define FFMPEG_OLD_FRAME_RATE 1
-#else
-#define FFMPEG_CODEC_IS_POINTER 1
-#endif
+#include "ffmpeg_compat.h"
 
 #endif
 
@@ -241,19 +237,6 @@ void do_init_ffmpeg(void)
        }
 }
 
-#ifdef FFMPEG_CODEC_IS_POINTER
-static AVCodecContext* get_codec_from_stream(AVStream* stream)
-{
-       return stream->codec;
-}
-#else
-static AVCodecContext* get_codec_from_stream(AVStream* stream)
-{
-       return &stream->codec;
-}
-#endif
-
-
 static int isffmpeg (const char *filename) {
        AVFormatContext *pFormatCtx;
        unsigned int i;
@@ -284,15 +267,15 @@ static int isffmpeg (const char *filename) {
                return 0;
        }
 
-       if(UTIL_DEBUG) dump_format(pFormatCtx, 0, filename, 0);
+       if(UTIL_DEBUG) av_dump_format(pFormatCtx, 0, filename, 0);
 
 
                /* Find the first video stream */
        videoStream=-1;
        for(i=0; i<pFormatCtx->nb_streams; i++)
                if(pFormatCtx->streams[i] &&
-                  get_codec_from_stream(pFormatCtx->streams[i]) && 
-                 (get_codec_from_stream(pFormatCtx->streams[i])->codec_type==CODEC_TYPE_VIDEO))
+                  pFormatCtx->streams[i]->codec && 
+                 (pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO))
                {
                        videoStream=i;
                        break;
@@ -303,7 +286,7 @@ static int isffmpeg (const char *filename) {
                return 0;
        }
 
-       pCodecCtx = get_codec_from_stream(pFormatCtx->streams[videoStream]);
+       pCodecCtx = pFormatCtx->streams[videoStream]->codec;
 
                /* Find the decoder for the video stream */
        pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
index 07ee084f9762bed711c95244bb1d83a8b7ed98c6..8b841b67e548ea2c7d9983e023bee59a8c18678b 100644 (file)
@@ -855,12 +855,13 @@ void dna_write(FILE *file, void *pntr, int size)
 
 void printStructLenghts(void)
 {
-       int a, unknown= nr_structs, lastunknown, structtype;
+       int a, unknown= nr_structs, structtype;
+       /*int lastunknown;*/ /*UNUSED*/
        short *structpoin;
        printf("\n\n*** All detected structs:\n");
 
        while(unknown) {
-               lastunknown= unknown;
+               /*lastunknown= unknown;*/ /*UNUSED*/
                unknown= 0;
                
                /* check all structs... */
index a9f7d9f246f24f1e84490538cbbcc008ff053a50..e0feba3f2fd4a49f698678dc88d22fe07cc218e9 100644 (file)
@@ -743,6 +743,7 @@ int RNA_property_string_default_length(PointerRNA *ptr, PropertyRNA *prop);
 int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop);
 void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value);
 int RNA_property_enum_get_default(PointerRNA *ptr, PropertyRNA *prop);
+void *RNA_property_enum_py_data_get(PropertyRNA *prop);
 
 PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop);
 void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value);
index f52a69182b58e5c1e10a64c5eef755f302e23d44..b076393ef3de6acde86944d079440c76a9456db6 100644 (file)
@@ -90,6 +90,7 @@ PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont, const char *ide
 PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
 PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
 void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc);
+void RNA_def_enum_py_data(PropertyRNA *prop, void *py_data);
 
 PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
 PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
index 0bda47b4c7cf46c09c516119116dbab7866bc48e..fc415dc80827a19167650bdc33e09f66c7a963fb 100644 (file)
@@ -112,19 +112,20 @@ extern EnumPropertyItem ramp_blend_items[];
 
 struct bContext;
 struct PointerRNA;
-EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
-EnumPropertyItem *rna_Sensor_type_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
-EnumPropertyItem *rna_Actuator_type_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
+struct PropertyRNA;
+EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *rna_Sensor_type_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *rna_Actuator_type_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 
 /* Generic functions, return an enum from library data, index is the position
  * in the linked list can add more for different types as needed */
-EnumPropertyItem *RNA_action_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
-EnumPropertyItem *RNA_action_local_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
-EnumPropertyItem *RNA_group_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
-EnumPropertyItem *RNA_group_local_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
-EnumPropertyItem *RNA_image_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
-EnumPropertyItem *RNA_image_local_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
-EnumPropertyItem *RNA_scene_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
-EnumPropertyItem *RNA_scene_local_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
+EnumPropertyItem *RNA_action_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_action_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_group_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_group_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_image_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_image_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_scene_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_scene_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 
 #endif /* RNA_ENUM_TYPES_H */
index ec6f05c0e6a6dc6c4d9ef3b1f4bdf163c8f76526..b3f2ae01c9955ac9a39c205f353bb8e97fa79cba 100644 (file)
@@ -39,6 +39,7 @@ extern "C" {
 struct ParameterList;
 struct FunctionRNA;
 struct PropertyRNA;
+struct EnumPropertyRNA;
 struct StructRNA;
 struct BlenderRNA;
 struct IDProperty;
@@ -255,7 +256,8 @@ typedef struct EnumPropertyItem {
        const char *description;
 } EnumPropertyItem;
 
-typedef EnumPropertyItem *(*EnumPropertyItemFunc)(struct bContext *C, PointerRNA *ptr, int *free);
+/* this is a copy of 'PropEnumItemFunc' defined in rna_internal_types.h */
+typedef EnumPropertyItem *(*EnumPropertyItemFunc)(struct bContext *C, PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 
 typedef struct PropertyRNA PropertyRNA;
 
index fe6fc91eff44f45366cfe6f8a9bf23380c7b3ed2..f3f539feb99d6414b587a4bf9095ec26d7066090 100644 (file)
@@ -2223,7 +2223,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        }
                        case PROP_ENUM: {
                                EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
-                               fprintf(f, "\t%s, %s, %s, ", rna_function_string(eprop->get), rna_function_string(eprop->set), rna_function_string(eprop->itemf));
+                               fprintf(f, "\t%s, %s, %s, NULL, ", rna_function_string(eprop->get), rna_function_string(eprop->set), rna_function_string(eprop->itemf));
                                if(eprop->item)
                                        fprintf(f, "rna_%s%s_%s_items, ", srna->identifier, strnest, prop->identifier);
                                else
index ff54ac6254f3726acd50496d497c5b70b0b2b13a..8a7b5bb5966a4353c4ef59081b2952187bab71b1 100644 (file)
@@ -1096,9 +1096,9 @@ void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, En
                int tot= 0;
 
                if (prop->flag & PROP_ENUM_NO_CONTEXT)
-                       *item= eprop->itemf(NULL, ptr, free);
+                       *item= eprop->itemf(NULL, ptr, prop, free);
                else
-                       *item= eprop->itemf(C, ptr, free);
+                       *item= eprop->itemf(C, ptr, prop, free);
 
                if(totitem) {
                        if(*item) {
@@ -2120,6 +2120,14 @@ int RNA_property_enum_get_default(PointerRNA *ptr, PropertyRNA *prop)
        return eprop->defaultvalue;
 }
 
+void *RNA_property_enum_py_data_get(PropertyRNA *prop)
+{
+       EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+
+       BLI_assert(RNA_property_type(prop) == PROP_ENUM);
+
+       return eprop->py_data;
+}
 
 PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
 {
index 2afba954be3790652fb063d1714aece7c75a836b..116f5185980f613d13098d4c5b425bcb74e1345b 100644 (file)
@@ -411,7 +411,7 @@ static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values)
 }
 
 /* Always keep in alphabetical order */
-EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, int *free)
+EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
 {
        EnumPropertyItem *item= NULL;
        Object *ob= NULL;
index 7bb56380ba511aa62a4fc152c4af0375217f15c8..c0c054ea2ac82345aa1908a61a661c1e3bc441c6 100644 (file)
@@ -28,6 +28,7 @@
 
 
 #include <stdlib.h>
+#include <assert.h>
 
 #include "RNA_define.h"
 
@@ -166,6 +167,17 @@ static void rna_Brush_icon_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 static void rna_Brush_set_size(PointerRNA *ptr, int value)
 {
        Brush* me = (Brush*)(ptr->data);
+
+       float size= (float)brush_size(me);
+       float unprojected_radius;
+
+       // paranoia: previous checks should make sure we don't divide by zero
+       assert(size != 0);
+
+       // set unprojected radius, so it remains consistent with size
+       unprojected_radius= (float)(brush_unprojected_radius(me) * value / size);
+       brush_set_unprojected_radius(me, unprojected_radius);
+
        brush_set_size(me, value);
 }
 
@@ -214,6 +226,17 @@ static int rna_Brush_get_use_alpha_pressure(PointerRNA *ptr)
 static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value)
 {
        Brush* me = (Brush*)(ptr->data);
+
+       float unprojected_radius= brush_unprojected_radius(me);