Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Xiangquan <xiaoxiangquan@gmail.com>2011-05-30 14:27:45 +0400
committerXiao Xiangquan <xiaoxiangquan@gmail.com>2011-05-30 14:27:45 +0400
commit682a5acd03959e5ed8ac4ff7b4b02435df19f50d (patch)
tree639de9d0992e147095517fef7b365ac82026680b
parent74f43c20fd601c6acfded12c8f7bcebb8c9d8433 (diff)
parent221472f7b50914801845ec78cae05d1618bd3c0a (diff)
merged to r37017 from trunk
-rw-r--r--CMakeLists.txt46
-rwxr-xr-xbuild_files/cmake/cmake_netbeans_project.py5
-rwxr-xr-xbuild_files/cmake/cmake_qtcreator_project.py36
-rw-r--r--build_files/cmake/macros.cmake112
-rwxr-xr-xbuild_files/cmake/project_info.py2
-rw-r--r--build_files/scons/tools/Blender.py20
-rw-r--r--build_files/scons/tools/btools.py5
-rw-r--r--doc/python_api/examples/bpy.types.BlendDataLibraries.load.py16
-rw-r--r--doc/python_api/sphinx_doc_gen.py99
-rw-r--r--extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h4
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp2
-rw-r--r--intern/audaspace/CMakeLists.txt1
-rw-r--r--intern/audaspace/SConscript2
-rw-r--r--intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp24
-rw-r--r--intern/bsp/CMakeLists.txt1
-rw-r--r--intern/bsp/SConscript2
-rw-r--r--intern/container/CTR_TaggedIndex.h10
-rw-r--r--intern/decimation/CMakeLists.txt1
-rw-r--r--intern/decimation/SConscript2
-rwxr-xr-xintern/ffmpeg/ffmpeg_compat.h133
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp3
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm8
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp5
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.h14
-rw-r--r--release/scripts/modules/bpy_extras/image_utils.py91
-rw-r--r--release/scripts/modules/bpy_extras/io_utils.py78
-rw-r--r--release/scripts/modules/bpy_extras/mesh_utils.py376
-rw-r--r--release/scripts/modules/bpy_extras/object_utils.py30
-rw-r--r--release/scripts/modules/bpy_extras/view3d_utils.py14
-rw-r--r--release/scripts/modules/bpy_types.py157
-rw-r--r--release/scripts/startup/bl_operators/mesh.py3
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_follow_active.py4
-rw-r--r--release/scripts/startup/bl_operators/wm.py8
-rw-r--r--release/scripts/startup/bl_ui/__init__.py36
-rw-r--r--release/scripts/startup/bl_ui/properties_data_empty.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_object_constraint.py4
-rw-r--r--release/scripts/startup/bl_ui/space_image.py2
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py3
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py3
-rw-r--r--release/windows/installer/00.sconsblender.nsi81
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h2
-rw-r--r--source/blender/blenkernel/CMakeLists.txt1
-rw-r--r--source/blender/blenkernel/SConscript1
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c11
-rw-r--r--source/blender/blenkernel/intern/brush.c13
-rw-r--r--source/blender/blenkernel/intern/curve.c2
-rw-r--r--source/blender/blenkernel/intern/image.c6
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/object.c18
-rw-r--r--source/blender/blenkernel/intern/sequencer.c6
-rw-r--r--source/blender/blenkernel/intern/text.c19
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c122
-rw-r--r--source/blender/blenlib/BLI_path_util.h5
-rw-r--r--source/blender/blenlib/BLI_string.h10
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c4
-rw-r--r--source/blender/blenlib/intern/math_color.c4
-rw-r--r--source/blender/blenlib/intern/path_util.c91
-rw-r--r--source/blender/blenlib/intern/pbvh.c6
-rw-r--r--source/blender/blenlib/intern/rct.c2
-rw-r--r--source/blender/blenlib/intern/string.c23
-rw-r--r--source/blender/blenloader/BLO_readfile.h18
-rw-r--r--source/blender/blenloader/intern/readfile.c122
-rw-r--r--source/blender/editors/animation/keyframes_draw.c4
-rw-r--r--source/blender/editors/animation/keyingsets.c2
-rw-r--r--source/blender/editors/armature/editarmature.c2
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c6
-rw-r--r--source/blender/editors/armature/poselib.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c2
-rw-r--r--source/blender/editors/include/ED_keyframing.h2
-rw-r--r--source/blender/editors/include/ED_view3d.h1
-rw-r--r--source/blender/editors/interface/interface.c17
-rw-r--r--source/blender/editors/interface/interface_layout.c3
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c2
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c8
-rw-r--r--source/blender/editors/object/object_edit.c4
-rw-r--r--source/blender/editors/object/object_hook.c2
-rw-r--r--source/blender/editors/object/object_modifier.c2
-rw-r--r--source/blender/editors/object/object_relations.c2
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/physics/particle_edit.c6
-rw-r--r--source/blender/editors/screen/screen_edit.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h2
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c387
-rw-r--r--source/blender/editors/space_file/space_file.c2
-rw-r--r--source/blender/editors/space_graph/graph_select.c4
-rw-r--r--source/blender/editors/space_node/drawnode.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c5
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c4
-rw-r--r--source/blender/editors/space_view3d/drawobject.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c5
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c36
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c2
-rw-r--r--source/blender/editors/util/undo.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c2
-rw-r--r--source/blender/gpu/intern/gpu_material.c4
-rw-r--r--source/blender/imbuf/CMakeLists.txt4
-rw-r--r--source/blender/imbuf/SConscript2
-rw-r--r--source/blender/imbuf/intern/anim_movie.c56
-rw-r--r--source/blender/imbuf/intern/imageprocess.c2
-rw-r--r--source/blender/imbuf/intern/scaling.c11
-rw-r--r--source/blender/imbuf/intern/targa.c4
-rw-r--r--source/blender/imbuf/intern/util.c27
-rw-r--r--source/blender/makesdna/intern/makesdna.c5
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/RNA_define.h1
-rw-r--r--source/blender/makesrna/RNA_enum_types.h23
-rw-r--r--source/blender/makesrna/RNA_types.h4
-rw-r--r--source/blender/makesrna/intern/makesrna.c2
-rw-r--r--source/blender/makesrna/intern/rna_access.c12
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c2
-rw-r--r--source/blender/makesrna/intern/rna_brush.c25
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c4
-rw-r--r--source/blender/makesrna/intern/rna_define.c6
-rw-r--r--source/blender/makesrna/intern/rna_image.c2
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_material.c2
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c6
-rw-r--r--source/blender/makesrna/intern/rna_object.c4
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c2
-rw-r--r--source/blender/makesrna/intern/rna_particle.c8
-rw-r--r--source/blender/makesrna/intern/rna_rna.c6
-rw-r--r--source/blender/makesrna/intern/rna_scene.c7
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c2
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c2
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c25
-rw-r--r--source/blender/makesrna/intern/rna_sequencer_api.c6
-rw-r--r--source/blender/makesrna/intern/rna_space.c6
-rw-r--r--source/blender/makesrna/intern/rna_texture.c2
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c2
-rw-r--r--source/blender/makesrna/intern/rna_wm.c7
-rw-r--r--source/blender/modifiers/intern/MOD_armature.c16
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c49
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c7
-rw-r--r--source/blender/python/generic/IDProp.c2
-rw-r--r--source/blender/python/generic/bgl.c5
-rw-r--r--source/blender/python/generic/blf_py_api.c83
-rw-r--r--source/blender/python/generic/bpy_internal_import.c6
-rw-r--r--source/blender/python/generic/bpy_internal_import.h2
-rw-r--r--source/blender/python/generic/mathutils.c4
-rw-r--r--source/blender/python/generic/mathutils_Color.c11
-rw-r--r--source/blender/python/generic/mathutils_Euler.c42
-rw-r--r--source/blender/python/generic/mathutils_Matrix.c122
-rw-r--r--source/blender/python/generic/mathutils_Quaternion.c78
-rw-r--r--source/blender/python/generic/mathutils_Vector.c103
-rw-r--r--source/blender/python/generic/mathutils_geometry.c56
-rw-r--r--source/blender/python/generic/noise_py_api.c110
-rw-r--r--source/blender/python/intern/bpy.c16
-rw-r--r--source/blender/python/intern/bpy_interface.c2
-rw-r--r--source/blender/python/intern/bpy_library.c77
-rw-r--r--source/blender/python/intern/bpy_props.c195
-rw-r--r--source/blender/python/intern/bpy_rna.c157
-rw-r--r--source/blender/python/intern/bpy_rna.h2
-rw-r--r--source/blender/render/intern/source/shadeinput.c4
-rw-r--r--source/blender/windowmanager/intern/wm_files.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c44
-rw-r--r--source/creator/CMakeLists.txt116
-rw-r--r--source/creator/creator.c4
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp21
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp4
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp5
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp9
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.cpp43
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp2
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp4
-rw-r--r--source/gameengine/VideoTexture/CMakeLists.txt1
-rw-r--r--source/gameengine/VideoTexture/SConscript1
-rw-r--r--source/gameengine/VideoTexture/VideoFFmpeg.cpp16
-rw-r--r--source/gameengine/VideoTexture/VideoFFmpeg.h8
173 files changed, 2626 insertions, 1576 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 83e6705e498..dae8a37e572 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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()
@@ -92,10 +78,6 @@ 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
get_blender_version()
@@ -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)
diff --git a/build_files/cmake/cmake_netbeans_project.py b/build_files/cmake/cmake_netbeans_project.py
index c8bedb55148..6afca8f3b6a 100755
--- a/build_files/cmake/cmake_netbeans_project.py
+++ b/build_files/cmake/cmake_netbeans_project.py
@@ -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')
diff --git a/build_files/cmake/cmake_qtcreator_project.py b/build_files/cmake/cmake_qtcreator_project.py
index e38b2228cca..3de15567727 100755
--- a/build_files/cmake/cmake_qtcreator_project.py
+++ b/build_files/cmake/cmake_qtcreator_project.py
@@ -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")
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 14bed8874fa..6e4aaa51a49 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -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()
diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py
index c25fbf4128d..db12884469b 100755
--- a/build_files/cmake/project_info.py
+++ b/build_files/cmake/project_info.py
@@ -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)
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index 4bfa1851acb..8dbed82ed84 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -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)
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index fe6b092598c..accdde0d2cf 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -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)
diff --git a/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py b/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py
index 43e6ac90ae7..42e2a71cc70 100644
--- a/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py
+++ b/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py
@@ -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)
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 03c8fe1b4ff..e96b4d363b4 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -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
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h
index 07167af3baf..70cf3e4ace8 100644
--- a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h
+++ b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h
@@ -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:
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
index ede1afb2a03..94385fed909 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
@@ -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,
diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt
index 74f483eab05..a2468d0071e 100644
--- a/intern/audaspace/CMakeLists.txt
+++ b/intern/audaspace/CMakeLists.txt
@@ -26,6 +26,7 @@ set(INC
FX SRC
${PTHREADS_INC}
${LIBSAMPLERATE_INC}
+ ../ffmpeg
)
set(SRC
diff --git a/intern/audaspace/SConscript b/intern/audaspace/SConscript
index ecc94987185..67f859b0e5f 100644
--- a/intern/audaspace/SConscript
+++ b/intern/audaspace/SConscript
@@ -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']:
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
index ea6e0c549fa..4597432e7d1 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
@@ -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;
diff --git a/intern/bsp/CMakeLists.txt b/intern/bsp/CMakeLists.txt
index 2e615314543..9f281586867 100644
--- a/intern/bsp/CMakeLists.txt
+++ b/intern/bsp/CMakeLists.txt
@@ -27,6 +27,7 @@
set(INC
./intern
../container
+ ../guardedalloc
../moto/include
../memutil
)
diff --git a/intern/bsp/SConscript b/intern/bsp/SConscript
index 43952f4ff18..4927c33dc8a 100644
--- a/intern/bsp/SConscript
+++ b/intern/bsp/SConscript
@@ -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] )
diff --git a/intern/container/CTR_TaggedIndex.h b/intern/container/CTR_TaggedIndex.h
index 0a57ce11d19..b5284a5da30 100644
--- a/intern/container/CTR_TaggedIndex.h
+++ b/intern/container/CTR_TaggedIndex.h
@@ -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
diff --git a/intern/decimation/CMakeLists.txt b/intern/decimation/CMakeLists.txt
index b726a8cd6a1..6f9137b7189 100644
--- a/intern/decimation/CMakeLists.txt
+++ b/intern/decimation/CMakeLists.txt
@@ -27,6 +27,7 @@
set(INC
.
../container
+ ../guardedalloc
../memutil
../moto/include
)
diff --git a/intern/decimation/SConscript b/intern/decimation/SConscript
index 6e2929cb650..6f4befb3ffa 100644
--- a/intern/decimation/SConscript
+++ b/intern/decimation/SConscript
@@ -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 100755
index 00000000000..238519ebaec
--- /dev/null
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -0,0 +1,133 @@
+#ifndef __ffmpeg_compat_h_included__
+#define __ffmpeg_compat_h_included__ 1
+
+/*
+ * $Id: ffmpeg_compat.h 36982 2011-05-28 14:16:56Z schlaile $
+ *
+ * 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
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index b44f2b18225..c53bf7de36c 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -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;
}
}
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 8d28c9d5b17..fb7d4a459c7 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -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) {
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index aea5b5156d9..fc72ea09f40 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -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)) {
diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h
index 96d8ad77d10..2cb269ea919 100644
--- a/intern/ghost/intern/GHOST_WindowX11.h
+++ b/intern/ghost/intern/GHOST_WindowX11.h
@@ -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;
diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py
index 39e49ee1f96..a7d0226fa23 100644
--- a/release/scripts/modules/bpy_extras/image_utils.py
+++ b/release/scripts/modules/bpy_extras/image_utils.py
@@ -18,10 +18,89 @@
# <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
diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py
index 820d7cfa39d..c444fd618a8 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -18,6 +18,19 @@
# <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':
diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py
index 5bacff7b0cc..b6d8a1fcf16 100644
--- a/release/scripts/modules/bpy_extras/mesh_utils.py
+++ b/release/scripts/modules/bpy_extras/mesh_utils.py
@@ -18,13 +18,25 @@
# <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
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py
index 1cf7fc2f4d5..51a8d4b5e23 100644
--- a/release/scripts/modules/bpy_extras/object_utils.py
+++ b/release/scripts/modules/bpy_extras/object_utils.py
@@ -18,11 +18,27 @@
# <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
diff --git a/release/scripts/modules/bpy_extras/view3d_utils.py b/release/scripts/modules/bpy_extras/view3d_utils.py
index 7d37b94982f..45f537ebd2f 100644
--- a/release/scripts/modules/bpy_extras/view3d_utils.py
+++ b/release/scripts/modules/bpy_extras/view3d_utils.py
@@ -18,6 +18,12 @@
# <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()
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index c3352dd33ad..3c1b454e72e 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -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__ = ()
diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py
index 44d81ba53df..89802d7ba5c 100644
--- a/release/scripts/startup/bl_operators/mesh.py
+++ b/release/scripts/startup/bl_operators/mesh.py
@@ -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]:
diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
index ad5ec15ff80..edd09d9c66b 100644
--- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py
+++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
@@ -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]
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 53c8d562297..3f4a061c4ac 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -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()
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index 2f933fb5771..bf63c6071b9 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -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",
)
diff --git a/release/scripts/startup/bl_ui/properties_data_empty.py b/release/scripts/startup/bl_ui/properties_data_empty.py
index 80f83e7fabe..5a0d327f90d 100644
--- a/release/scripts/startup/bl_ui/properties_data_empty.py
+++ b/release/scripts/startup/bl_ui/properties_data_empty.py
@@ -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)
diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py
index 2ca18744eb6..7c2fe76fe14 100644
--- a/release/scripts/startup/bl_ui/properties_object_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_object_constraint.py
@@ -666,9 +666,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)
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 44a1c814e28..9f69ca17076 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -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
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index d4ebae04c34..e34755ae72e 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -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)
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index e6ce1d4c179..0583dc7e4be 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2318,7 +2318,8 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
col.prop(toolsettings, "use_etch_autoname")
col.prop(toolsettings, "etch_number")
col.prop(toolsettings, "etch_side")
- col.operator("sketch.convert", text="Convert")
+
+ col.operator("sketch.convert", text="Convert")
class VIEW3D_PT_context_properties(bpy.types.Panel):
diff --git a/release/windows/installer/00.sconsblender.nsi b/release/windows/installer/00.sconsblender.nsi
index 03f62f0df48..42a9b1c13b6 100644
--- a/release/windows/installer/00.sconsblender.nsi
+++ b/release/windows/installer/00.sconsblender.nsi
@@ -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"
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 7e9f531162b..a45e9a17dc9 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -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
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 94c474c668f..bedd58876bc 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -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);
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 2831636361f..44d20b6c651 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -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
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index ea19b51c044..b5f845acacb 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -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']
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 5198172c205..fdc102bf779 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -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))
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 98c540f53b7..25b60fef6dd 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -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;
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index b104c6c9b30..704af73dd10 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -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
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 22d19c5484f..c48497c45a1 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index f0ac7040deb..094214858f9 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 3523d1812a0..d0fbc6247b5 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -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 */
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 30abb6278a7..009665f3a1f 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -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;
}
}
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 40eb86f25be..da329503c9f 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -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;
}
}
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 9b1c3b2ddb8..c729565533f 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -39,19 +39,6 @@
#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;
}
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 360cd1ea9ab..81fc8a50db6 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -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
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 635c38e1d13..408809661cf 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -123,13 +123,6 @@ __attribute__ ((format (printf, 1, 2)))
;
/**
- * 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.
*
* @retval True if the strings are equal, false otherwise.
@@ -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
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index f8a85c8ba76..527692348e7 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -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
{
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 512086f0e17..ef1d5da56d8 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -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)
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 1f4b0ffdd5c..e0a08d0b890 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -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);
@@ -1745,18 +1764,6 @@ void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name)
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
}
}
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index 95a43a998d3..f7b79b35cbc 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -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*/
}
}
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index cf65539bd68..17b07b49309 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -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)
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index ee5bd17c901..8e0314ec17f 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -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';
+}
+
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index 6267b819c55..85d4b936c51 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -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);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 93518e993d5..a10c7c6e1ed 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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);
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index c4108e0ce33..00e11d8b1a4 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -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 */
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 10886615976..c525c9af626 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -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;
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index b31bcc710f4..abf08393544 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -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);
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index ccb9a45af37..97f85b92b32 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -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;
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 9e0e9374d5d..5b4da1a38df 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -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;
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 27f2598d515..2860d467cef 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -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;
}
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 2a4b583276e..f4da734473d 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -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;
}
}
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index 6523a897713..294b9b8475a 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -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);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 3145901d459..0adf6633b05 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -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 */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index e70b793cfb0..28a874f78de 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -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)
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index a62e7b30120..b68634acd1e 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -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;
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 18f3b807f86..b5da36756b5 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -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;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index dfd1ac730ac..424d3dd5a38 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -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;
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 91980ddf228..527b97a6082 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -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, "", ""};
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 78937299645..2d547da41f6 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -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, "", ""};
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index d5bf894ac8c..5996037cd2d 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -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;
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 8078bfbeb93..f7158e4b4ec 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -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;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 53562caf1b5..43448198ae1 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -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, "", ""};
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index fa458f4096d..c5ab840914e 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -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)
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index e942cfc8b1f..9bc2b1a402c 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -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 */
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index b024f22e8dd..bb877e4b1ee 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -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);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index e4a21b1f1a7..69af50415cc 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -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);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 692d33bd091..0d79fcc2c58 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -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;
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index ec0d9806bca..18270bfaa26 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -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());
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index da7a95cdbf7..76883027df1 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -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"))
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index b5bb635b544..17cfc7d8f95 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -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);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 4b9f87f67d8..71ed7928bc8 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -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;
}
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 8440a107f31..8b4bfb2e042 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -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) {
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index ccfc45826cf..391eecbbbae 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -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);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 7e9c219fdaa..573951da4ca 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -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)) &&
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index ecf110b98c9..31aae28dd61 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -82,16 +82,24 @@
/* ********************** 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 */
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index fdee5c6f6d9..ed1ed5b3881 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -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;
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 0940734a8e9..fb3c0a63b7d 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -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) {
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 9ac44f482a1..f4e27a5faf9 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -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;
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 1ea2db4c237..66b1e7d412b 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -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);
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 1bf70fbd38b..e936f35574d 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -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;
}
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index 6404ae3de75..ed4508053b8 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -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)
diff --git a/source/blender/imbuf/SConscript b/source/blender/imbuf/SConscript
index ecb9a89c274..a80f92b4421 100644
--- a/source/blender/imbuf/SConscript
+++ b/source/blender/imbuf/SConscript
@@ -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']
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 4de96bb17bc..919b0eb0c29 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -97,16 +97,7 @@
#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--;
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index fa5e951067d..1ac4e4e06cb 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -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;
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index f6a6a644977..5389d90867e 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -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);
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index f334409133f..5d9f350be48 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -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");
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index 3e4136cbef9..6e5e87d7e5c 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -63,11 +63,7 @@
#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);
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 07ee084f976..8b841b67e54 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -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... */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index a9f7d9f246f..e0feba3f2fd 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -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);
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index f52a69182b5..b076393ef3d 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -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);
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 0bda47b4c7c..fc415dc8082 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -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 */
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index ec6f05c0e6a..b3f2ae01c99 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -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;
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index fe6fc91eff4..f3f539feb99 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -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
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index ff54ac6254f..8a7b5bb5966 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -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)
{
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index 2afba954be3..116f5185980 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -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;
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 7bb56380ba5..c0c054ea2ac 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -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);
+ int size;
+
+ // paranoia: previous checks should make sure we don't divide by zero
+ assert(unprojected_radius != 0.0f);
+
+ // set size, so that it is consistent with unprojected_radius
+ size= (int)((float)brush_size(me) * value / unprojected_radius);
+ brush_set_size(me, size);
+
brush_set_unprojected_radius(me, value);
}
@@ -235,7 +258,7 @@ static float rna_Brush_get_alpha(PointerRNA *ptr)
return brush_alpha(me);
}
-static EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
static EnumPropertyItem prop_default_items[]= {
{0, NULL, 0, NULL, NULL}};
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index e7604b2beb4..d90db814329 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -243,7 +243,7 @@ static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)
}
}
-static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
Object *ob= (Object*)ptr->id.data;
bConstraint *con= (bConstraint*)ptr->data;
@@ -254,7 +254,7 @@ static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *C, PointerRN
return space_object_items;
}
-static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
bConstraint *con= (bConstraint*)ptr->data;
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index d66f0042d88..fa3e3fa8ec3 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -2276,6 +2276,12 @@ void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
eprop->itemf= itemfunc;
}
+void RNA_def_enum_py_data(PropertyRNA *prop, void *py_data)
+{
+ EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+ eprop->py_data= 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)
{
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 3db90c2de0e..98a89a2524e 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -143,7 +143,7 @@ char *rna_ImageUser_path(PointerRNA *ptr)
return BLI_strdup("");
}
-static EnumPropertyItem *rna_Image_source_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Image_source_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
Image *ima= (Image*)ptr->data;
EnumPropertyItem *item= NULL;
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index a59db183453..771d2afcd96 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -41,6 +41,7 @@ struct FunctionRNA;
struct ReportList;
struct CollectionPropertyIterator;
struct bContext;
+struct EnumProperty;
struct IDProperty;
struct GHash;
struct Main;
@@ -88,7 +89,7 @@ typedef int (*PropStringLengthFunc)(struct PointerRNA *ptr);
typedef void (*PropStringSetFunc)(struct PointerRNA *ptr, const char *value);
typedef int (*PropEnumGetFunc)(struct PointerRNA *ptr);
typedef void (*PropEnumSetFunc)(struct PointerRNA *ptr, int value);
-typedef EnumPropertyItem *(*PropEnumItemFunc)(struct bContext *C, struct PointerRNA *ptr, int *free);
+typedef EnumPropertyItem *(*PropEnumItemFunc)(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr);
typedef StructRNA* (*PropPointerTypeFunc)(struct PointerRNA *ptr);
typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value);
@@ -250,6 +251,7 @@ typedef struct EnumPropertyRNA {
PropEnumGetFunc get;
PropEnumSetFunc set;
PropEnumItemFunc itemf;
+ void *py_data; /* store py callback here */
EnumPropertyItem *item;
int totitem;
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 0e9629f973d..fdb41295b75 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -272,7 +272,7 @@ static void rna_Material_use_nodes_set(PointerRNA *ptr, int value)
ED_node_shader_default(ma);
}
-static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
Material *ma= (Material*)ptr->id.data;
EnumPropertyItem *item= NULL;
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index d55534bb1b5..d41fb42d1eb 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -367,7 +367,7 @@ static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
return item;
}
-static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
bNode *node= (bNode*)ptr->data;
Image *ima = (Image *)node->id;
@@ -384,7 +384,7 @@ static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *C, PointerRNA *ptr
return item;
}
-static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
bNode *node= (bNode*)ptr->data;
Scene *sce = (Scene *)node->id;
@@ -401,7 +401,7 @@ static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *C, PointerRNA *ptr
return item;
}
-static EnumPropertyItem *rna_Node_channel_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Node_channel_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
bNode *node= (bNode*)ptr->data;
EnumPropertyItem *item= NULL;
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 4407ca8ad4e..5e1b22dbc9e 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -379,7 +379,7 @@ static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
ED_object_parent(ob, ob->parent, value, ob->parsubstr);
}
-static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
Object *ob= (Object*)ptr->data;
EnumPropertyItem *item= NULL;
@@ -410,7 +410,7 @@ static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *C, PointerRNA *p
return item;
}
-static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
Object *ob= (Object*)ptr->data;
EnumPropertyItem *item= NULL;
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 65c7b351622..9df76959122 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -678,7 +678,7 @@ static void rna_softbody_update(Main *bmain, Scene *scene, PointerRNA *ptr)
}
-static EnumPropertyItem *rna_Effector_shape_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Effector_shape_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
Object *ob= NULL;
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index fa69fad253f..6c9540908c5 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -702,7 +702,7 @@ static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
strcpy(str, "No object");
}
-static EnumPropertyItem *rna_Particle_from_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Particle_from_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
//if(part->type==PART_REACTOR)
// return part_reactor_from_items;
@@ -710,7 +710,7 @@ static EnumPropertyItem *rna_Particle_from_itemf(bContext *C, PointerRNA *ptr, i
return part_from_items;
}
-static EnumPropertyItem *rna_Particle_dist_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Particle_dist_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
ParticleSettings *part = ptr->id.data;
@@ -720,7 +720,7 @@ static EnumPropertyItem *rna_Particle_dist_itemf(bContext *C, PointerRNA *ptr, i
return part_dist_items;
}
-static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
ParticleSettings *part = ptr->id.data;
@@ -730,7 +730,7 @@ static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *C, PointerRNA *ptr
return part_draw_as_items;
}
-static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
ParticleSettings *part = ptr->id.data;
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index de2b551909c..84bb624b546 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -341,7 +341,7 @@ int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, Point
/* this was used pre 2.5beta0, now ID property access uses python's
* getitem style access
- * - ob["foo"] rather then ob.foo */
+ * - ob["foo"] rather than ob.foo */
#if 0
if(ptr->data) {
IDProperty *group, *idp;
@@ -697,7 +697,7 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr)
return ((StringPropertyRNA*)prop)->maxlength;
}
-static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
EnumPropertyRNA *eprop;
@@ -713,7 +713,7 @@ static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA
return eprop->item;
}
- return eprop->itemf(C, ptr, free);
+ return eprop->itemf(C, ptr, prop, free);
}
/* XXX - not sure this is needed? */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 44dcabe40f9..79184f1667b 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -597,7 +597,7 @@ static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, in
rd->qtcodecsettings.codecType = quicktime_videocodecType_from_rnatmpvalue(value);
}
-static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
EnumPropertyItem *item= NULL;
EnumPropertyItem tmp = {0, "", 0, "", ""};
@@ -638,7 +638,7 @@ static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *pt
rd->qtcodecsettings.audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value);
}
-static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
EnumPropertyItem *item= NULL;
EnumPropertyItem tmp = {0, "", 0, "", ""};
@@ -709,7 +709,7 @@ static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
BLI_strncpy(rd->engine, type->idname, sizeof(rd->engine));
}
-static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
RenderEngineType *type;
EnumPropertyItem *item= NULL;
@@ -2149,7 +2149,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
{CODEC_ID_HUFFYUV, "HUFFYUV", 0, "HuffYUV", ""},
{CODEC_ID_DVVIDEO, "DV", 0, "DV", ""},
{CODEC_ID_H264, "H264", 0, "H.264", ""},
- {CODEC_ID_XVID, "XVID", 0, "Xvid", ""},
{CODEC_ID_THEORA, "THEORA", 0, "Theora", ""},
{CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""},
{CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""},
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index da536f95cba..452131d829c 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -127,7 +127,7 @@ static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value)
pset->brushtype = value;
}
-static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
Scene *scene= CTX_data_scene(C);
Object *ob= (scene->basact)? scene->basact->object: NULL;
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index 5bf398ae3a7..5cc8539f187 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -115,7 +115,7 @@ static void rna_Sensor_type_set(struct PointerRNA *ptr, int value)
}
/* Always keep in alphabetical order */
-EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, int *free)
+EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
EnumPropertyItem *item= NULL;
Object *ob=NULL;
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 90ae95894b0..8d568cc6b89 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -107,6 +107,23 @@ static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *it
}
/* internal use */
+static int rna_SequenceEditor_elements_length(PointerRNA *ptr)
+{
+ Sequence *seq= (Sequence*)ptr->data;
+
+ /* Hack? copied from sequencer.c::reload_sequence_new_file() */
+ size_t olen = MEM_allocN_len(seq->strip->stripdata)/sizeof(struct StripElem);
+
+ /* the problem with seq->strip->len and seq->len is that it's discounted from the offset (hard cut trim) */
+ return (int) olen;
+}
+
+static void rna_SequenceEditor_elements_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Sequence *seq= (Sequence*)ptr->data;
+ rna_iterator_array_begin(iter, (void*)seq->strip->stripdata, sizeof(StripElem), rna_SequenceEditor_elements_length(ptr), 0, NULL);
+}
+
static void rna_Sequence_frame_change_update(Scene *scene, Sequence *seq)
{
Editing *ed= seq_give_editing(scene, FALSE);
@@ -435,7 +452,7 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value)
if(seq->type == SEQ_SOUND && seq->sound) {
/* for sound strips we need to update the sound as well.
- * arguably, this could load in a new sound rather then modify an existing one.
+ * arguably, this could load in a new sound rather than modify an existing one.
* but while using the sequencer its most likely your not using the sound in the game engine too.
*/
PointerRNA id_ptr;
@@ -1222,9 +1239,10 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", "strip->len");
+ RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
RNA_def_property_struct_type(prop, "SequenceElement");
RNA_def_property_ui_text(prop, "Elements", "");
+ RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", 0, 0);
rna_def_filter_video(srna);
rna_def_proxy(srna);
@@ -1291,9 +1309,10 @@ static void rna_def_movie(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", "strip->len");
+ RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
RNA_def_property_struct_type(prop, "SequenceElement");
RNA_def_property_ui_text(prop, "Elements", "");
+ RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", 0, 0);
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
RNA_def_property_ui_text(prop, "File", "");
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index d2c2787784b..fa240fa225a 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -51,8 +51,10 @@
static void rna_Sequence_swap_internal(Sequence *seq_self, ReportList *reports, Sequence *seq_other)
{
- if(seq_swap(seq_self, seq_other) == 0)
- BKE_report(reports, RPT_ERROR, "both strips must be the same length");
+ const char *error_msg;
+
+ if(seq_swap(seq_self, seq_other, &error_msg) == 0)
+ BKE_report(reports, RPT_ERROR, error_msg);
}
#else
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 5d45a63b05b..463df7ae233 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -218,7 +218,7 @@ static PointerRNA rna_CurrentOrientation_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, BLI_findlink(&scene->transform_spaces, v3d->twmode - V3D_MANIP_CUSTOM));
}
-EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, int *free)
+EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
Scene *scene = NULL;
ListBase *transform_spaces;
@@ -468,7 +468,7 @@ static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
ED_space_image_set(NULL, sima, sc->scene, sc->scene->obedit, (Image*)value.data);
}
-static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
SpaceImage *sima= (SpaceImage*)ptr->data;
EnumPropertyItem *item= NULL;
@@ -840,7 +840,7 @@ static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
bgpic->blend = 1.0f - value;
}
-static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index a750fa3765f..3a80207ba15 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -285,7 +285,7 @@ static int rna_TextureSlot_output_node_get(PointerRNA *ptr)
}
-static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
MTex *mtex= ptr->data;
Tex *tex= mtex->tex;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index cee6b7e2b1e..4e0027acfe5 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2042,7 +2042,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_CAM_LOCK_NO_PARENT);
- RNA_def_property_ui_text(prop, "Camera Parent Lock", "When the camera is locked to the view and in fly mode, transform the parent rather then the camera");
+ RNA_def_property_ui_text(prop, "Camera Parent Lock", "When the camera is locked to the view and in fly mode, transform the parent rather than the camera");
/* view zoom */
prop= RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index e8b127b68bb..8a094d6eef1 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -467,7 +467,7 @@ static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
}
}
-static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
int map_type= rna_wmKeyMapItem_map_type_get(ptr);
@@ -477,7 +477,7 @@ static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *C, PointerRNA *ptr,
else return event_type_items;
}
-static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
int map_type= rna_wmKeyMapItem_map_type_get(ptr);
@@ -486,7 +486,7 @@ static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *C, PointerRNA *ptr
else return event_value_items;
}
-static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmKeyConfig *kc;
@@ -1842,4 +1842,3 @@ void RNA_def_wm(BlenderRNA *brna)
}
#endif /* RNA_RUNTIME */
-
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index 95579147dbb..a0ee047e319 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -127,8 +127,8 @@ static void deformVerts(ModifierData *md, Object *ob,
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
armature_deform_verts(amd->object, ob, derivedData, vertexCos, NULL,
- numVerts, amd->deformflag,
- (float(*)[3])amd->prevCos, amd->defgrp_name);
+ numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
+
/* free cache */
if(amd->prevCos) {
MEM_freeN(amd->prevCos);
@@ -145,8 +145,16 @@ static void deformVertsEM(
if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
- armature_deform_verts(amd->object, ob, dm, vertexCos, NULL, numVerts,
- amd->deformflag, NULL, amd->defgrp_name);
+ modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
+
+ armature_deform_verts(amd->object, ob, dm, vertexCos, NULL,
+ numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
+
+ /* free cache */
+ if(amd->prevCos) {
+ MEM_freeN(amd->prevCos);
+ amd->prevCos= NULL;
+ }
if(!derivedData) dm->release(dm);
}
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index ec6387f44af..4b4d0124aae 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -92,19 +92,56 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
}
#ifdef WITH_MOD_BOOLEAN
+static DerivedMesh *get_quick_derivedMesh(DerivedMesh *derivedData, DerivedMesh *dm, int operation)
+{
+ DerivedMesh *result = NULL;
+
+ if(derivedData->getNumFaces(derivedData) == 0 || dm->getNumFaces(dm) == 0) {
+ switch(operation) {
+ case eBooleanModifierOp_Intersect:
+ result = CDDM_new(0, 0, 0);
+ break;
+
+ case eBooleanModifierOp_Union:
+ if(derivedData->getNumFaces(derivedData)) result = derivedData;
+ else result = CDDM_copy(dm);
+
+ break;
+
+ case eBooleanModifierOp_Difference:
+ result = derivedData;
+ break;
+ }
+ }
+
+ return result;
+}
+
static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
DerivedMesh *derivedData,
int UNUSED(useRenderParams),
int UNUSED(isFinalCalc))
{
BooleanModifierData *bmd = (BooleanModifierData*) md;
- DerivedMesh *dm = bmd->object->derivedFinal;
+ DerivedMesh *dm;
+
+ if(!bmd->object)
+ return derivedData;
+
+ dm = bmd->object->derivedFinal;
+
+ if(dm) {
+ DerivedMesh *result;
+
+ /* when one of objects is empty (has got no faces) we could speed up
+ calculation a bit returning one of objects' derived meshes (or empty one)
+ Returning mesh is depended on modifieier's operation (sergey) */
+ result = get_quick_derivedMesh(derivedData, dm, bmd->operation);
- /* we do a quick sanity check */
- if(dm && (derivedData->getNumFaces(derivedData) > 3)
- && bmd->object && dm->getNumFaces(dm) > 3) {
- DerivedMesh *result = NewBooleanDerivedMesh(dm, bmd->object, derivedData, ob,
- 1 + bmd->operation);
+ if(result == NULL) {
+ result = NewBooleanDerivedMesh(dm, bmd->object, derivedData, ob,
+ 1 + bmd->operation);
+ }
/* if new mesh returned, return it; otherwise there was
* an error, so delete the modifier object */
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 3288c1b5da1..02845ecaab7 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -210,6 +210,7 @@ static void displaceModifier_do(
if(def_weight) strength *= def_weight->weight;
delta *= strength;
+ CLAMP(delta, -10000, 10000);
switch(dmd->direction) {
case MOD_DISP_DIR_X:
@@ -227,9 +228,9 @@ static void displaceModifier_do(
vertexCos[i][2] += (texres.tb - dmd->midlevel) * strength;
break;
case MOD_DISP_DIR_NOR:
- vertexCos[i][0] += delta * mvert[i].no[0] / 32767.0f;
- vertexCos[i][1] += delta * mvert[i].no[1] / 32767.0f;
- vertexCos[i][2] += delta * mvert[i].no[2] / 32767.0f;
+ vertexCos[i][0] += delta * (mvert[i].no[0] / 32767.0f);
+ vertexCos[i][1] += delta * (mvert[i].no[1] / 32767.0f);
+ vertexCos[i][2] += delta * (mvert[i].no[2] / 32767.0f);
break;
}
}
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c
index 8330927d920..a807624187a 100644
--- a/source/blender/python/generic/IDProp.c
+++ b/source/blender/python/generic/IDProp.c
@@ -114,7 +114,7 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop )
Py_RETURN_NONE;
}
-#if 0 /* UNUSED, currenly assignment overwrites into new properties, rather then setting in-place */
+#if 0 /* UNUSED, currenly assignment overwrites into new properties, rather than setting in-place */
static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value)
{
switch (prop->type) {
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 730db73e685..4eb6d78bd7b 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -45,7 +45,7 @@
#include "BLI_utildefines.h"
-static char Method_Buffer_doc[] =
+PyDoc_STRVAR(Method_Buffer_doc,
"(type, dimensions, [template]) - Create a new Buffer object\n\n\
(type) - The format to store data in\n\
(dimensions) - An int or sequence specifying the dimensions of the buffer\n\
@@ -59,7 +59,8 @@ will have len(sequence) dimensions, where the size for each dimension\n\
is determined by the value in the sequence at that index.\n\n\
For example, passing [100, 100] will create a 2 dimensional\n\
square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\
-buffer which is twice as deep as it is wide or high.";
+buffer which is twice as deep as it is wide or high."
+);
static PyObject *Method_Buffer( PyObject * self, PyObject *args );
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 0653f967c14..3cf0b0f1f27 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -36,7 +36,7 @@
-static char py_blf_position_doc[] =
+PyDoc_STRVAR(py_blf_position_doc,
".. function:: position(fontid, x, y, z)\n"
"\n"
" Set the position for drawing text.\n"
@@ -48,7 +48,8 @@ static char py_blf_position_doc[] =
" :arg y: Y axis position to draw the text.\n"
" :type y: float\n"
" :arg z: Z axis position to draw the text.\n"
-" :type z: float\n";
+" :type z: float\n"
+);
static PyObject *py_blf_position(PyObject *UNUSED(self), PyObject *args)
{
@@ -64,7 +65,7 @@ static PyObject *py_blf_position(PyObject *UNUSED(self), PyObject *args)
}
-static char py_blf_size_doc[] =
+PyDoc_STRVAR(py_blf_size_doc,
".. function:: size(fontid, size, dpi)\n"
"\n"
" Set the size and dpi for drawing text.\n"
@@ -74,8 +75,8 @@ static char py_blf_size_doc[] =
" :arg size: Point size of the font.\n"
" :type size: int\n"
" :arg dpi: dots per inch value to use for drawing.\n"
-" :type dpi: int\n";
-
+" :type dpi: int\n"
+);
static PyObject *py_blf_size(PyObject *UNUSED(self), PyObject *args)
{
int fontid, size, dpi;
@@ -89,7 +90,7 @@ static PyObject *py_blf_size(PyObject *UNUSED(self), PyObject *args)
}
-static char py_blf_aspect_doc[] =
+PyDoc_STRVAR(py_blf_aspect_doc,
".. function:: aspect(fontid, aspect)\n"
"\n"
" Set the aspect for drawing text.\n"
@@ -97,8 +98,8 @@ static char py_blf_aspect_doc[] =
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg aspect: The aspect ratio for text drawing to use.\n"
-" :type aspect: float\n";
-
+" :type aspect: float\n"
+);
static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args)
{
float aspect;
@@ -113,7 +114,7 @@ static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args)
}
-static char py_blf_blur_doc[] =
+PyDoc_STRVAR(py_blf_blur_doc,
".. function:: blur(fontid, radius)\n"
"\n"
" Set the blur radius for drawing text.\n"
@@ -121,8 +122,8 @@ static char py_blf_blur_doc[] =
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg radius: The radius for blurring text (in pixels).\n"
-" :type radius: int\n";
-
+" :type radius: int\n"
+);
static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args)
{
int blur, fontid;
@@ -136,7 +137,7 @@ static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args)
}
-static char py_blf_draw_doc[] =
+PyDoc_STRVAR(py_blf_draw_doc,
".. function:: draw(fontid, text)\n"
"\n"
" Draw text in the current context.\n"
@@ -144,8 +145,8 @@ static char py_blf_draw_doc[] =
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg text: the text to draw.\n"
-" :type text: string\n";
-
+" :type text: string\n"
+);
static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args)
{
char *text;
@@ -160,7 +161,7 @@ static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args)
Py_RETURN_NONE;
}
-static char py_blf_dimensions_doc[] =
+PyDoc_STRVAR(py_blf_dimensions_doc,
".. function:: dimensions(fontid, text)\n"
"\n"
" Return the width and height of the text.\n"
@@ -170,8 +171,8 @@ static char py_blf_dimensions_doc[] =
" :arg text: the text to draw.\n"
" :type text: string\n"
" :return: the width and height of the text.\n"
-" :rtype: tuple of 2 floats\n";
-
+" :rtype: tuple of 2 floats\n"
+);
static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
{
char *text;
@@ -190,7 +191,7 @@ static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
return ret;
}
-static char py_blf_clipping_doc[] =
+PyDoc_STRVAR(py_blf_clipping_doc,
".. function:: clipping(fontid, xmin, ymin, xmax, ymax)\n"
"\n"
" Set the clipping, enable/disable using CLIPPING.\n"
@@ -204,8 +205,8 @@ static char py_blf_clipping_doc[] =
" :arg xmax: Clip the drawing area by these bounds.\n"
" :type xmax: float\n"
" :arg ymax: Clip the drawing area by these bounds.\n"
-" :type ymax: float\n";
-
+" :type ymax: float\n"
+);
static PyObject *py_blf_clipping(PyObject *UNUSED(self), PyObject *args)
{
float xmin, ymin, xmax, ymax;
@@ -219,7 +220,7 @@ static PyObject *py_blf_clipping(PyObject *UNUSED(self), PyObject *args)
Py_RETURN_NONE;
}
-static char py_blf_disable_doc[] =
+PyDoc_STRVAR(py_blf_disable_doc,
".. function:: disable(fontid, option)\n"
"\n"
" Disable option.\n"
@@ -227,8 +228,8 @@ static char py_blf_disable_doc[] =
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
-" :type option: int\n";
-
+" :type option: int\n"
+);
static PyObject *py_blf_disable(PyObject *UNUSED(self), PyObject *args)
{
int option, fontid;
@@ -241,7 +242,7 @@ static PyObject *py_blf_disable(PyObject *UNUSED(self), PyObject *args)
Py_RETURN_NONE;
}
-static char py_blf_enable_doc[] =
+PyDoc_STRVAR(py_blf_enable_doc,
".. function:: enable(fontid, option)\n"
"\n"
" Enable option.\n"
@@ -249,8 +250,8 @@ static char py_blf_enable_doc[] =
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
-" :type option: int\n";
-
+" :type option: int\n"
+);
static PyObject *py_blf_enable(PyObject *UNUSED(self), PyObject *args)
{
int option, fontid;
@@ -263,7 +264,7 @@ static PyObject *py_blf_enable(PyObject *UNUSED(self), PyObject *args)
Py_RETURN_NONE;
}
-static char py_blf_rotation_doc[] =
+PyDoc_STRVAR(py_blf_rotation_doc,
".. function:: rotation(fontid, angle)\n"
"\n"
" Set the text rotation angle, enable/disable using ROTATION.\n"
@@ -271,8 +272,8 @@ static char py_blf_rotation_doc[] =
" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
" :type fontid: int\n"
" :arg angle: The angle for text drawing to use.\n"
-" :type angle: float\n";
-
+" :type angle: float\n"
+);
static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
{
float angle;
@@ -286,7 +287,7 @@ static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
Py_RETURN_NONE;
}
-static char py_blf_shadow_doc[] =
+PyDoc_STRVAR(py_blf_shadow_doc,
".. function:: shadow(fontid, level, r, g, b, a)\n"
"\n"
" Shadow options, enable/disable using SHADOW .\n"
@@ -302,8 +303,8 @@ static char py_blf_shadow_doc[] =
" :arg b: Shadow color (blue channel 0.0 - 1.0).\n"
" :type b: float\n"
" :arg a: Shadow color (alpha channel 0.0 - 1.0).\n"
-" :type a: float\n";
-
+" :type a: float\n"
+);
static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args)
{
int level, fontid;
@@ -322,7 +323,7 @@ static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args)
Py_RETURN_NONE;
}
-static char py_blf_shadow_offset_doc[] =
+PyDoc_STRVAR(py_blf_shadow_offset_doc,
".. function:: shadow_offset(fontid, x, y)\n"
"\n"
" Set the offset for shadow text.\n"
@@ -332,8 +333,8 @@ static char py_blf_shadow_offset_doc[] =
" :arg x: Vertical shadow offset value in pixels.\n"
" :type x: float\n"
" :arg y: Horizontal shadow offset value in pixels.\n"
-" :type y: float\n";
-
+" :type y: float\n"
+);
static PyObject *py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args)
{
int x, y, fontid;
@@ -346,7 +347,7 @@ static PyObject *py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args)
Py_RETURN_NONE;
}
-static char py_blf_load_doc[] =
+PyDoc_STRVAR(py_blf_load_doc,
".. function:: load(filename)\n"
"\n"
" Load a new font.\n"
@@ -354,8 +355,8 @@ static char py_blf_load_doc[] =
" :arg filename: the filename of the font.\n"
" :type filename: string\n"
" :return: the new font's fontid or -1 if there was an error.\n"
-" :rtype: integer\n";
-
+" :rtype: integer\n"
+);
static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
{
char* filename;
@@ -384,9 +385,9 @@ static PyMethodDef BLF_methods[] = {
{NULL, NULL, 0, NULL}
};
-static char BLF_doc[] =
-"This module provides access to blenders text drawing functions.\n";
-
+PyDoc_STRVAR(BLF_doc,
+"This module provides access to blenders text drawing functions."
+);
static struct PyModuleDef BLF_module_def = {
PyModuleDef_HEAD_INIT,
"blf", /* m_name */
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 96fe13bf6fc..cb145cc453b 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -34,9 +34,6 @@
#include <Python.h>
#include <stddef.h>
-#include "compile.h" /* for the PyCodeObject */
-#include "eval.h" /* for PyEval_EvalCode */
-
#include "bpy_internal_import.h"
#include "MEM_guardedalloc.h"
@@ -51,7 +48,6 @@
/* UNUSED */
#include "BKE_text.h" /* txt_to_buf */
#include "BKE_main.h"
-#include "BKE_global.h" /* grr, only for G.main->name */
static Main *bpy_import_main= NULL;
@@ -97,7 +93,7 @@ void bpy_import_main_set(struct Main *maggie)
/* returns a dummy filename for a textblock so we can tell what file a text block comes from */
void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
{
- BLI_snprintf(fn, fn_len, "%s%c%s", text->id.lib ? text->id.lib->filepath : G.main->name, SEP, text->id.name+2);
+ BLI_snprintf(fn, fn_len, "%s%c%s", text->id.lib ? text->id.lib->filepath : bpy_import_main->name, SEP, text->id.name+2);
}
PyObject *bpy_text_import(Text *text)
diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h
index 0ef31229f8d..dd1596efe4e 100644
--- a/source/blender/python/generic/bpy_internal_import.h
+++ b/source/blender/python/generic/bpy_internal_import.h
@@ -59,7 +59,7 @@ void bpy_text_filename_get(char *fn, size_t fn_len, struct Text *text);
extern PyMethodDef bpy_import_meth;
extern PyMethodDef bpy_reload_meth;
-/* The game engine has its own Main struct, if this is set search this rather then G.main */
+/* The game engine has its own Main struct, if this is set search this rather than G.main */
struct Main *bpy_import_main_get(void);
void bpy_import_main_set(struct Main *maggie);
diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c
index e94f7f798fc..30f4e5b7ffe 100644
--- a/source/blender/python/generic/mathutils.c
+++ b/source/blender/python/generic/mathutils.c
@@ -38,9 +38,9 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-static char M_Mathutils_doc[] =
+PyDoc_STRVAR(M_Mathutils_doc,
"This module provides access to matrices, eulers, quaternions and vectors."
-;
+);
static int mathutils_array_parse_fast(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix)
{
PyObject *value_fast= NULL;
diff --git a/source/blender/python/generic/mathutils_Color.c b/source/blender/python/generic/mathutils_Color.c
index 2b68828ea0a..09e3493cd09 100644
--- a/source/blender/python/generic/mathutils_Color.c
+++ b/source/blender/python/generic/mathutils_Color.c
@@ -85,7 +85,7 @@ static PyObject *Color_ToTupleExt(ColorObject *self, int ndigits)
return ret;
}
-static char Color_copy_doc[] =
+PyDoc_STRVAR(Color_copy_doc,
".. function:: copy()\n"
"\n"
" Returns a copy of this color.\n"
@@ -93,8 +93,9 @@ static char Color_copy_doc[] =
" :return: A copy of the color.\n"
" :rtype: :class:`Color`\n"
"\n"
-" .. note:: use this to get a copy of a wrapped color with no reference to the original data.\n"
-;
+" .. note:: use this to get a copy of a wrapped color with\n"
+" no reference to the original data.\n"
+);
static PyObject *Color_copy(ColorObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -458,9 +459,9 @@ static struct PyMethodDef Color_methods[] = {
};
//------------------PY_OBECT DEFINITION--------------------------
-static char color_doc[] =
+PyDoc_STRVAR(color_doc,
"This object gives access to Colors in Blender."
-;
+);
PyTypeObject color_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"mathutils.Color", //tp_name
diff --git a/source/blender/python/generic/mathutils_Euler.c b/source/blender/python/generic/mathutils_Euler.c
index d8dd4e5fbb3..9adf0ee905b 100644
--- a/source/blender/python/generic/mathutils_Euler.c
+++ b/source/blender/python/generic/mathutils_Euler.c
@@ -126,14 +126,14 @@ static PyObject *Euler_ToTupleExt(EulerObject *self, int ndigits)
//-----------------------------METHODS----------------------------
//return a quaternion representation of the euler
-static char Euler_to_quaternion_doc[] =
+PyDoc_STRVAR(Euler_to_quaternion_doc,
".. method:: to_quaternion()\n"
"\n"
" Return a quaternion representation of the euler.\n"
"\n"
" :return: Quaternion representation of the euler.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Euler_to_quaternion(EulerObject * self)
{
float quat[4];
@@ -147,14 +147,14 @@ static PyObject *Euler_to_quaternion(EulerObject * self)
}
//return a matrix representation of the euler
-static char Euler_to_matrix_doc[] =
+PyDoc_STRVAR(Euler_to_matrix_doc,
".. method:: to_matrix()\n"
"\n"
" Return a matrix representation of the euler.\n"
"\n"
" :return: A 3x3 roation matrix representation of the euler.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Euler_to_matrix(EulerObject * self)
{
float mat[9];
@@ -167,12 +167,11 @@ static PyObject *Euler_to_matrix(EulerObject * self)
return newMatrixObject(mat, 3, 3 , Py_NEW, NULL);
}
-//sets the euler to 0,0,0
-static char Euler_zero_doc[] =
+PyDoc_STRVAR(Euler_zero_doc,
".. method:: zero()\n"
"\n"
" Set all values to zero.\n"
-;
+);
static PyObject *Euler_zero(EulerObject * self)
{
zero_v3(self->eul);
@@ -183,16 +182,17 @@ static PyObject *Euler_zero(EulerObject * self)
Py_RETURN_NONE;
}
-static char Euler_rotate_axis_doc[] =
+PyDoc_STRVAR(Euler_rotate_axis_doc,
".. method:: rotate_axis(axis, angle)\n"
"\n"
-" Rotates the euler a certain amount and returning a unique euler rotation (no 720 degree pitches).\n"
+" Rotates the euler a certain amount and returning a unique euler rotation\n"
+" (no 720 degree pitches).\n"
"\n"
" :arg axis: single character in ['X, 'Y', 'Z'].\n"
" :type axis: string\n"
" :arg angle: angle in radians.\n"
" :type angle: float\n"
-;
+);
static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args)
{
float angle = 0.0f;
@@ -218,14 +218,14 @@ static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args)
Py_RETURN_NONE;
}
-static char Euler_rotate_doc[] =
+PyDoc_STRVAR(Euler_rotate_doc,
".. method:: rotate(other)\n"
"\n"
" Rotates the euler a by another mathutils value.\n"
"\n"
" :arg other: rotation component of mathutils value\n"
" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
-;
+);
static PyObject *Euler_rotate(EulerObject * self, PyObject *value)
{
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
@@ -245,13 +245,14 @@ static PyObject *Euler_rotate(EulerObject * self, PyObject *value)
Py_RETURN_NONE;
}
-static char Euler_make_compatible_doc[] =
+PyDoc_STRVAR(Euler_make_compatible_doc,
".. method:: make_compatible(other)\n"
"\n"
-" Make this euler compatible with another, so interpolating between them works as intended.\n"
+" Make this euler compatible with another,\n"
+" so interpolating between them works as intended.\n"
"\n"
" .. note:: the rotation order is not taken into account for this function.\n"
-;
+);
static PyObject *Euler_make_compatible(EulerObject * self, PyObject *value)
{
float teul[EULER_SIZE];
@@ -272,7 +273,7 @@ static PyObject *Euler_make_compatible(EulerObject * self, PyObject *value)
//----------------------------Euler.rotate()-----------------------
// return a copy of the euler
-static char Euler_copy_doc[] =
+PyDoc_STRVAR(Euler_copy_doc,
".. function:: copy()\n"
"\n"
" Returns a copy of this euler.\n"
@@ -280,8 +281,9 @@ static char Euler_copy_doc[] =
" :return: A copy of the euler.\n"
" :rtype: :class:`Euler`\n"
"\n"
-" .. note:: use this to get a copy of a wrapped euler with no reference to the original data.\n"
-;
+" .. note:: use this to get a copy of a wrapped euler with\n"
+" no reference to the original data.\n"
+);
static PyObject *Euler_copy(EulerObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -593,9 +595,9 @@ static struct PyMethodDef Euler_methods[] = {
};
//------------------PY_OBECT DEFINITION--------------------------
-static char euler_doc[] =
+PyDoc_STRVAR(euler_doc,
"This object gives access to Eulers in Blender."
-;
+);
PyTypeObject euler_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"mathutils.Euler", //tp_name
diff --git a/source/blender/python/generic/mathutils_Matrix.c b/source/blender/python/generic/mathutils_Matrix.c
index 80f6ddf2d30..982a8e63282 100644
--- a/source/blender/python/generic/mathutils_Matrix.c
+++ b/source/blender/python/generic/mathutils_Matrix.c
@@ -186,7 +186,7 @@ static void matrix_3x3_as_4x4(float mat[16])
/*-----------------------CLASS-METHODS----------------------------*/
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
-static char C_Matrix_Rotation_doc[] =
+PyDoc_STRVAR(C_Matrix_Rotation_doc,
".. classmethod:: Rotation(angle, size, axis)\n"
"\n"
" Create a matrix representing a rotation.\n"
@@ -195,11 +195,12 @@ static char C_Matrix_Rotation_doc[] =
" :type angle: float\n"
" :arg size: The size of the rotation matrix to construct [2, 4].\n"
" :type size: int\n"
-" :arg axis: a string in ['X', 'Y', 'Z'] or a 3D Vector Object (optional when size is 2).\n"
+" :arg axis: a string in ['X', 'Y', 'Z'] or a 3D Vector Object\n"
+" (optional when size is 2).\n"
" :type axis: string or :class:`Vector`\n"
" :return: A new rotation matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
{
PyObject *vec= NULL;
@@ -295,7 +296,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
}
-static char C_Matrix_Translation_doc[] =
+PyDoc_STRVAR(C_Matrix_Translation_doc,
".. classmethod:: Translation(vector)\n"
"\n"
" Create a matrix representing a translation.\n"
@@ -304,7 +305,7 @@ static char C_Matrix_Translation_doc[] =
" :type vector: :class:`Vector`\n"
" :return: An identity matrix with a translation.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value)
{
float mat[16], tvec[3];
@@ -319,7 +320,7 @@ static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value)
}
//----------------------------------mathutils.Matrix.Scale() -------------
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
-static char C_Matrix_Scale_doc[] =
+PyDoc_STRVAR(C_Matrix_Scale_doc,
".. classmethod:: Scale(factor, size, axis)\n"
"\n"
" Create a matrix representing a scaling.\n"
@@ -332,7 +333,7 @@ static char C_Matrix_Scale_doc[] =
" :type axis: :class:`Vector`\n"
" :return: A new scale matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
{
PyObject *vec= NULL;
@@ -402,18 +403,20 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
}
//----------------------------------mathutils.Matrix.OrthoProjection() ---
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
-static char C_Matrix_OrthoProjection_doc[] =
+PyDoc_STRVAR(C_Matrix_OrthoProjection_doc,
".. classmethod:: OrthoProjection(axis, size)\n"
"\n"
" Create a matrix to represent an orthographic projection.\n"
"\n"
-" :arg axis: Can be any of the following: ['X', 'Y', 'XY', 'XZ', 'YZ'], where a single axis is for a 2D matrix. Or a vector for an arbitrary axis\n"
+" :arg axis: Can be any of the following: ['X', 'Y', 'XY', 'XZ', 'YZ'],\n"
+" where a single axis is for a 2D matrix.\n"
+" Or a vector for an arbitrary axis\n"
" :type axis: string or :class:`Vector`\n"
" :arg size: The size of the projection matrix to construct [2, 4].\n"
" :type size: int\n"
" :return: A new projection matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
{
PyObject *axis;
@@ -508,20 +511,22 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
return newMatrixObject(mat, matSize, matSize, Py_NEW, (PyTypeObject *)cls);
}
-static char C_Matrix_Shear_doc[] =
+PyDoc_STRVAR(C_Matrix_Shear_doc,
".. classmethod:: Shear(plane, size, factor)\n"
"\n"
" Create a matrix to represent an shear transformation.\n"
"\n"
-" :arg plane: Can be any of the following: ['X', 'Y', 'XY', 'XZ', 'YZ'], where a single axis is for a 2D matrix only.\n"
+" :arg plane: Can be any of the following: ['X', 'Y', 'XY', 'XZ', 'YZ'],\n"
+" where a single axis is for a 2D matrix only.\n"
" :type plane: string\n"
" :arg size: The size of the shear matrix to construct [2, 4].\n"
" :type size: int\n"
-" :arg factor: The factor of shear to apply. For a 3 or 4 *size* matrix pass a pair of floats corrasponding with the *plane* axis.\n"
+" :arg factor: The factor of shear to apply. For a 3 or 4 *size* matrix\n"
+" pass a pair of floats corrasponding with the *plane* axis.\n"
" :type factor: float or float pair\n"
" :return: A new shear matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
{
int matSize;
@@ -626,14 +631,14 @@ static float matrix_determinant_internal(MatrixObject *self)
/*-----------------------------METHODS----------------------------*/
-static char Matrix_to_quaternion_doc[] =
+PyDoc_STRVAR(Matrix_to_quaternion_doc,
".. method:: to_quaternion()\n"
"\n"
" Return a quaternion representation of the rotation matrix.\n"
"\n"
" :return: Quaternion representation of the rotation matrix.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Matrix_to_quaternion(MatrixObject *self)
{
float quat[4];
@@ -657,18 +662,22 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self)
}
/*---------------------------Matrix.toEuler() --------------------*/
-static char Matrix_to_euler_doc[] =
+PyDoc_STRVAR(Matrix_to_euler_doc,
".. method:: to_euler(order, euler_compat)\n"
"\n"
-" Return an Euler representation of the rotation matrix (3x3 or 4x4 matrix only).\n"
+" Return an Euler representation of the rotation matrix\n"
+" (3x3 or 4x4 matrix only).\n"
"\n"
-" :arg order: Optional rotation order argument in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'].\n"
+" :arg order: Optional rotation order argument in\n"
+" ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'].\n"
" :type order: string\n"
-" :arg euler_compat: Optional euler argument the new euler will be made compatible with (no axis flipping between them). Useful for converting a series of matrices to animation curves.\n"
+" :arg euler_compat: Optional euler argument the new euler will be made\n"
+" compatible with (no axis flipping between them).\n"
+" Useful for converting a series of matrices to animation curves.\n"
" :type euler_compat: :class:`Euler`\n"
" :return: Euler representation of the matrix.\n"
" :rtype: :class:`Euler`\n"
-;
+);
static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
{
const char *order_str= NULL;
@@ -724,11 +733,11 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
return newEulerObject(eul, order, Py_NEW, NULL);
}
-static char Matrix_resize_4x4_doc[] =
+PyDoc_STRVAR(Matrix_resize_4x4_doc,
".. method:: resize_4x4()\n"
"\n"
" Resize the matrix to 4x4.\n"
-;
+);
static PyObject *Matrix_resize_4x4(MatrixObject *self)
{
int x, first_row_elem, curr_pos, new_pos, blank_columns, blank_rows, index;
@@ -781,14 +790,14 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
Py_RETURN_NONE;
}
-static char Matrix_to_4x4_doc[] =
+PyDoc_STRVAR(Matrix_to_4x4_doc,
".. method:: to_4x4()\n"
"\n"
" Return a 4x4 copy of this matrix.\n"
"\n"
" :return: a new matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_to_4x4(MatrixObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -808,14 +817,14 @@ static PyObject *Matrix_to_4x4(MatrixObject *self)
return NULL;
}
-static char Matrix_to_3x3_doc[] =
+PyDoc_STRVAR(Matrix_to_3x3_doc,
".. method:: to_3x3()\n"
"\n"
" Return a 3x3 copy of this matrix.\n"
"\n"
" :return: a new matrix.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_to_3x3(MatrixObject *self)
{
float mat[3][3];
@@ -833,14 +842,14 @@ static PyObject *Matrix_to_3x3(MatrixObject *self)
return newMatrixObject((float *)mat, 3, 3, Py_NEW, Py_TYPE(self));
}
-static char Matrix_to_translation_doc[] =
+PyDoc_STRVAR(Matrix_to_translation_doc,
".. method:: to_translation()\n"
"\n"
" Return a the translation part of a 4 row matrix.\n"
"\n"
" :return: Return a the translation of a matrix.\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Matrix_to_translation(MatrixObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -854,7 +863,7 @@ static PyObject *Matrix_to_translation(MatrixObject *self)
return newVectorObject(self->matrix[3], 3, Py_NEW, NULL);
}
-static char Matrix_to_scale_doc[] =
+PyDoc_STRVAR(Matrix_to_scale_doc,
".. method:: to_scale()\n"
"\n"
" Return a the scale part of a 3x3 or 4x4 matrix.\n"
@@ -863,7 +872,7 @@ static char Matrix_to_scale_doc[] =
" :rtype: :class:`Vector`\n"
"\n"
" .. note:: This method does not return negative a scale on any axis because it is not possible to obtain this data from the matrix alone.\n"
-;
+);
static PyObject *Matrix_to_scale(MatrixObject *self)
{
float rot[3][3];
@@ -888,7 +897,7 @@ static PyObject *Matrix_to_scale(MatrixObject *self)
}
/*---------------------------Matrix.invert() ---------------------*/
-static char Matrix_invert_doc[] =
+PyDoc_STRVAR(Matrix_invert_doc,
".. method:: invert()\n"
"\n"
" Set the matrix to its inverse.\n"
@@ -896,7 +905,7 @@ static char Matrix_invert_doc[] =
" .. note:: :exc:`ValueError` exception is raised.\n"
"\n"
" .. seealso:: <http://en.wikipedia.org/wiki/Inverse_matrix>\n"
-;
+);
static PyObject *Matrix_invert(MatrixObject *self)
{
@@ -950,7 +959,7 @@ static PyObject *Matrix_invert(MatrixObject *self)
Py_RETURN_NONE;
}
-static char Matrix_inverted_doc[] =
+PyDoc_STRVAR(Matrix_inverted_doc,
".. method:: inverted()\n"
"\n"
" Return an inverted copy of the matrix.\n"
@@ -959,13 +968,13 @@ static char Matrix_inverted_doc[] =
" :rtype: :class:`Matrix`\n"
"\n"
" .. note:: :exc:`ValueError` exception is raised.\n"
-;
+);
static PyObject *Matrix_inverted(MatrixObject *self)
{
return matrix__apply_to_copy((PyNoArgsFunction)Matrix_invert, self);
}
-static char Matrix_rotate_doc[] =
+PyDoc_STRVAR(Matrix_rotate_doc,
".. method:: rotate(other)\n"
"\n"
" Rotates the matrix a by another mathutils value.\n"
@@ -974,7 +983,7 @@ static char Matrix_rotate_doc[] =
" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
"\n"
" .. note:: If any of the columns are not unit length this may not have desired results.\n"
-;
+);
static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value)
{
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
@@ -1000,14 +1009,14 @@ static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value)
}
/*---------------------------Matrix.decompose() ---------------------*/
-static char Matrix_decompose_doc[] =
+PyDoc_STRVAR(Matrix_decompose_doc,
".. method:: decompose()\n"
"\n"
" Return the location, rotaion and scale components of this matrix.\n"
"\n"
" :return: loc, rot, scale triple.\n"
" :rtype: (:class:`Vector`, :class:`Quaternion`, :class:`Vector`)"
-;
+);
static PyObject *Matrix_decompose(MatrixObject *self)
{
PyObject *ret;
@@ -1037,7 +1046,7 @@ static PyObject *Matrix_decompose(MatrixObject *self)
-static char Matrix_lerp_doc[] =
+PyDoc_STRVAR(Matrix_lerp_doc,
".. function:: lerp(other, factor)\n"
"\n"
" Returns the interpolation of two matricies.\n"
@@ -1048,7 +1057,7 @@ static char Matrix_lerp_doc[] =
" :type factor: float\n"
" :return: The interpolated rotation.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
{
MatrixObject *mat2 = NULL;
@@ -1081,7 +1090,7 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args)
}
/*---------------------------Matrix.determinant() ----------------*/
-static char Matrix_determinant_doc[] =
+PyDoc_STRVAR(Matrix_determinant_doc,
".. method:: determinant()\n"
"\n"
" Return the determinant of a matrix.\n"
@@ -1090,7 +1099,7 @@ static char Matrix_determinant_doc[] =
" :rtype: float\n"
"\n"
" .. seealso:: <http://en.wikipedia.org/wiki/Determinant>\n"
-;
+);
static PyObject *Matrix_determinant(MatrixObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -1104,13 +1113,13 @@ static PyObject *Matrix_determinant(MatrixObject *self)
return PyFloat_FromDouble((double)matrix_determinant_internal(self));
}
/*---------------------------Matrix.transpose() ------------------*/
-static char Matrix_transpose_doc[] =
+PyDoc_STRVAR(Matrix_transpose_doc,
".. method:: transpose()\n"
"\n"
" Set the matrix to its transpose.\n"
"\n"
" .. seealso:: <http://en.wikipedia.org/wiki/Transpose>\n"
-;
+);
static PyObject *Matrix_transpose(MatrixObject *self)
{
float t = 0.0f;
@@ -1137,28 +1146,28 @@ static PyObject *Matrix_transpose(MatrixObject *self)
Py_RETURN_NONE;
}
-static char Matrix_transposed_doc[] =
+PyDoc_STRVAR(Matrix_transposed_doc,
".. method:: transposed()\n"
"\n"
" Return a new, transposed matrix.\n"
"\n"
" :return: a transposed matrix\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_transposed(MatrixObject *self)
{
return matrix__apply_to_copy((PyNoArgsFunction)Matrix_transpose, self);
}
/*---------------------------Matrix.zero() -----------------------*/
-static char Matrix_zero_doc[] =
+PyDoc_STRVAR(Matrix_zero_doc,
".. method:: zero()\n"
"\n"
" Set all the matrix values to zero.\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_zero(MatrixObject *self)
{
fill_vn(self->contigPtr, self->row_size * self->col_size, 0.0f);
@@ -1169,15 +1178,16 @@ static PyObject *Matrix_zero(MatrixObject *self)
Py_RETURN_NONE;
}
/*---------------------------Matrix.identity(() ------------------*/
-static char Matrix_identity_doc[] =
+PyDoc_STRVAR(Matrix_identity_doc,
".. method:: identity()\n"
"\n"
" Set the matrix to the identity matrix.\n"
"\n"
-" .. note:: An object with zero location and rotation, a scale of one, will have an identity matrix.\n"
+" .. note:: An object with zero location and rotation, a scale of one,\n"
+" will have an identity matrix.\n"
"\n"
" .. seealso:: <http://en.wikipedia.org/wiki/Identity_matrix>\n"
-;
+);
static PyObject *Matrix_identity(MatrixObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -1206,14 +1216,14 @@ static PyObject *Matrix_identity(MatrixObject *self)
}
/*---------------------------Matrix.copy() ------------------*/
-static char Matrix_copy_doc[] =
+PyDoc_STRVAR(Matrix_copy_doc,
".. method:: copy()\n"
"\n"
" Returns a copy of this matrix.\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Matrix_copy(MatrixObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -1780,9 +1790,9 @@ static struct PyMethodDef Matrix_methods[] = {
};
/*------------------PY_OBECT DEFINITION--------------------------*/
-static char matrix_doc[] =
+PyDoc_STRVAR(matrix_doc,
"This object gives access to Matrices in Blender."
-;
+);
PyTypeObject matrix_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"mathutils.Matrix", /*tp_name*/
diff --git a/source/blender/python/generic/mathutils_Quaternion.c b/source/blender/python/generic/mathutils_Quaternion.c
index 9c79ccb442f..90447e7093a 100644
--- a/source/blender/python/generic/mathutils_Quaternion.c
+++ b/source/blender/python/generic/mathutils_Quaternion.c
@@ -67,18 +67,21 @@ static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits)
return ret;
}
-static char Quaternion_to_euler_doc[] =
+PyDoc_STRVAR(Quaternion_to_euler_doc,
".. method:: to_euler(order, euler_compat)\n"
"\n"
" Return Euler representation of the quaternion.\n"
"\n"
-" :arg order: Optional rotation order argument in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'].\n"
+" :arg order: Optional rotation order argument in\n"
+" ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'].\n"
" :type order: string\n"
-" :arg euler_compat: Optional euler argument the new euler will be made compatible with (no axis flipping between them). Useful for converting a series of matrices to animation curves.\n"
+" :arg euler_compat: Optional euler argument the new euler will be made\n"
+" compatible with (no axis flipping between them).\n"
+" Useful for converting a series of matrices to animation curves.\n"
" :type euler_compat: :class:`Euler`\n"
" :return: Euler representation of the quaternion.\n"
" :rtype: :class:`Euler`\n"
-;
+);
static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
{
float tquat[4];
@@ -121,14 +124,14 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
return newEulerObject(eul, order, Py_NEW, NULL);
}
//----------------------------Quaternion.toMatrix()------------------
-static char Quaternion_to_matrix_doc[] =
+PyDoc_STRVAR(Quaternion_to_matrix_doc,
".. method:: to_matrix()\n"
"\n"
" Return a matrix representation of the quaternion.\n"
"\n"
" :return: A 3x3 rotation matrix representation of the quaternion.\n"
" :rtype: :class:`Matrix`\n"
-;
+);
static PyObject *Quaternion_to_matrix(QuaternionObject *self)
{
float mat[9]; /* all values are set */
@@ -141,7 +144,7 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self)
}
//----------------------------Quaternion.cross(other)------------------
-static char Quaternion_cross_doc[] =
+PyDoc_STRVAR(Quaternion_cross_doc,
".. method:: cross(other)\n"
"\n"
" Return the cross product of this quaternion and another.\n"
@@ -150,7 +153,7 @@ static char Quaternion_cross_doc[] =
" :type other: :class:`Quaternion`\n"
" :return: The cross product.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
{
float quat[QUAT_SIZE], tquat[QUAT_SIZE];
@@ -166,7 +169,7 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
}
//----------------------------Quaternion.dot(other)------------------
-static char Quaternion_dot_doc[] =
+PyDoc_STRVAR(Quaternion_dot_doc,
".. method:: dot(other)\n"
"\n"
" Return the dot product of this quaternion and another.\n"
@@ -175,7 +178,7 @@ static char Quaternion_dot_doc[] =
" :type other: :class:`Quaternion`\n"
" :return: The dot product.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_dot(QuaternionObject *self, PyObject *value)
{
float tquat[QUAT_SIZE];
@@ -189,7 +192,7 @@ static PyObject *Quaternion_dot(QuaternionObject *self, PyObject *value)
return PyFloat_FromDouble(dot_qtqt(self->quat, tquat));
}
-static char Quaternion_rotation_difference_doc[] =
+PyDoc_STRVAR(Quaternion_rotation_difference_doc,
".. function:: difference(other)\n"
"\n"
" Returns a quaternion representing the rotational difference.\n"
@@ -198,7 +201,7 @@ static char Quaternion_rotation_difference_doc[] =
" :type other: :class:`Quaternion`\n"
" :return: the rotational difference between the two quat rotations.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject *value)
{
float tquat[QUAT_SIZE], quat[QUAT_SIZE];
@@ -214,7 +217,7 @@ static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject
return newQuaternionObject(quat, Py_NEW, Py_TYPE(self));
}
-static char Quaternion_slerp_doc[] =
+PyDoc_STRVAR(Quaternion_slerp_doc,
".. function:: slerp(other, factor)\n"
"\n"
" Returns the interpolation of two quaternions.\n"
@@ -225,7 +228,7 @@ static char Quaternion_slerp_doc[] =
" :type factor: float\n"
" :return: The interpolated rotation.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args)
{
PyObject *value;
@@ -252,14 +255,14 @@ static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args)
return newQuaternionObject(quat, Py_NEW, Py_TYPE(self));
}
-static char Quaternion_rotate_doc[] =
+PyDoc_STRVAR(Quaternion_rotate_doc,
".. method:: rotate(other)\n"
"\n"
" Rotates the quaternion a by another mathutils value.\n"
"\n"
" :arg other: rotation component of mathutils value\n"
" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
-;
+);
static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
{
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
@@ -284,11 +287,11 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
//----------------------------Quaternion.normalize()----------------
//normalize the axis of rotation of [theta, vector]
-static char Quaternion_normalize_doc[] =
+PyDoc_STRVAR(Quaternion_normalize_doc,
".. function:: normalize()\n"
"\n"
" Normalize the quaternion.\n"
-;
+);
static PyObject *Quaternion_normalize(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -299,25 +302,25 @@ static PyObject *Quaternion_normalize(QuaternionObject *self)
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
-static char Quaternion_normalized_doc[] =
+PyDoc_STRVAR(Quaternion_normalized_doc,
".. function:: normalized()\n"
"\n"
" Return a new normalized quaternion.\n"
"\n"
" :return: a normalized copy.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_normalized(QuaternionObject *self)
{
return quat__apply_to_copy((PyNoArgsFunction)Quaternion_normalize, self);
}
//----------------------------Quaternion.invert()------------------
-static char Quaternion_invert_doc[] =
+PyDoc_STRVAR(Quaternion_invert_doc,
".. function:: invert()\n"
"\n"
" Set the quaternion to its inverse.\n"
-;
+);
static PyObject *Quaternion_invert(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -328,28 +331,28 @@ static PyObject *Quaternion_invert(QuaternionObject *self)
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
-static char Quaternion_inverted_doc[] =
+PyDoc_STRVAR(Quaternion_inverted_doc,
".. function:: inverted()\n"
"\n"
" Return a new, inverted quaternion.\n"
"\n"
" :return: the inverted value.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_inverted(QuaternionObject *self)
{
return quat__apply_to_copy((PyNoArgsFunction)Quaternion_invert, self);
}
//----------------------------Quaternion.identity()-----------------
-static char Quaternion_identity_doc[] =
+PyDoc_STRVAR(Quaternion_identity_doc,
".. function:: identity()\n"
"\n"
" Set the quaternion to an identity quaternion.\n"
"\n"
" :return: an instance of itself.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_identity(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -361,14 +364,14 @@ static PyObject *Quaternion_identity(QuaternionObject *self)
Py_RETURN_NONE;
}
//----------------------------Quaternion.negate()-------------------
-static char Quaternion_negate_doc[] =
+PyDoc_STRVAR(Quaternion_negate_doc,
".. function:: negate()\n"
"\n"
" Set the quaternion to its negative.\n"
"\n"
" :return: an instance of itself.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_negate(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -380,11 +383,11 @@ static PyObject *Quaternion_negate(QuaternionObject *self)
Py_RETURN_NONE;
}
//----------------------------Quaternion.conjugate()----------------
-static char Quaternion_conjugate_doc[] =
+PyDoc_STRVAR(Quaternion_conjugate_doc,
".. function:: conjugate()\n"
"\n"
" Set the quaternion to its conjugate (negate x, y, z).\n"
-;
+);
static PyObject *Quaternion_conjugate(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -395,21 +398,21 @@ static PyObject *Quaternion_conjugate(QuaternionObject *self)
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
-static char Quaternion_conjugated_doc[] =
+PyDoc_STRVAR(Quaternion_conjugated_doc,
".. function:: conjugated()\n"
"\n"
" Return a new conjugated quaternion.\n"
"\n"
" :return: a new quaternion.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Quaternion_conjugated(QuaternionObject *self)
{
return quat__apply_to_copy((PyNoArgsFunction)Quaternion_conjugate, self);
}
//----------------------------Quaternion.copy()----------------
-static char Quaternion_copy_doc[] =
+PyDoc_STRVAR(Quaternion_copy_doc,
".. function:: copy()\n"
"\n"
" Returns a copy of this quaternion.\n"
@@ -417,8 +420,9 @@ static char Quaternion_copy_doc[] =
" :return: A copy of the quaternion.\n"
" :rtype: :class:`Quaternion`\n"
"\n"
-" .. note:: use this to get a copy of a wrapped quaternion with no reference to the original data.\n"
-;
+" .. note:: use this to get a copy of a wrapped quaternion with\n"
+" no reference to the original data.\n"
+);
static PyObject *Quaternion_copy(QuaternionObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -1026,9 +1030,9 @@ static PyGetSetDef Quaternion_getseters[] = {
};
//------------------PY_OBECT DEFINITION--------------------------
-static char quaternion_doc[] =
+PyDoc_STRVAR(quaternion_doc,
"This object gives access to Quaternions in Blender."
-;
+);
PyTypeObject quaternion_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"mathutils.Quaternion", //tp_name
diff --git a/source/blender/python/generic/mathutils_Vector.c b/source/blender/python/generic/mathutils_Vector.c
index 8e0c53be308..fd8d1b5f481 100644
--- a/source/blender/python/generic/mathutils_Vector.c
+++ b/source/blender/python/generic/mathutils_Vector.c
@@ -87,11 +87,11 @@ static PyObject *vec__apply_to_copy(PyNoArgsFunction vec_func, VectorObject *sel
}
/*-----------------------------METHODS---------------------------- */
-static char Vector_zero_doc[] =
+PyDoc_STRVAR(Vector_zero_doc,
".. method:: zero()\n"
"\n"
" Set all values to zero.\n"
-;
+);
static PyObject *Vector_zero(VectorObject *self)
{
fill_vn(self->vec, self->size, 0.0f);
@@ -102,15 +102,17 @@ static PyObject *Vector_zero(VectorObject *self)
Py_RETURN_NONE;
}
-static char Vector_normalize_doc[] =
+PyDoc_STRVAR(Vector_normalize_doc,
".. method:: normalize()\n"
"\n"
" Normalize the vector, making the length of the vector always 1.0.\n"
"\n"
-" .. warning:: Normalizing a vector where all values are zero results in all axis having a nan value (not a number).\n"
+" .. warning:: Normalizing a vector where all values are zero results\n"
+" in all axis having a nan value (not a number).\n"
"\n"
-" .. note:: Normalize works for vectors of all sizes, however 4D Vectors w axis is left untouched.\n"
-;
+" .. note:: Normalize works for vectors of all sizes,\n"
+" however 4D Vectors w axis is left untouched.\n"
+);
static PyObject *Vector_normalize(VectorObject *self)
{
int i;
@@ -130,27 +132,27 @@ static PyObject *Vector_normalize(VectorObject *self)
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
-static char Vector_normalized_doc[] =
+PyDoc_STRVAR(Vector_normalized_doc,
".. method:: normalized()\n"
"\n"
" Return a new, normalized vector.\n"
"\n"
" :return: a normalized copy of the vector\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_normalized(VectorObject *self)
{
return vec__apply_to_copy((PyNoArgsFunction)Vector_normalize, self);
}
-static char Vector_resize_2d_doc[] =
+PyDoc_STRVAR(Vector_resize_2d_doc,
".. method:: resize_2d()\n"
"\n"
" Resize the vector to 2D (x, y).\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_resize_2d(VectorObject *self)
{
if(self->wrapped==Py_WRAP) {
@@ -172,14 +174,14 @@ static PyObject *Vector_resize_2d(VectorObject *self)
Py_RETURN_NONE;
}
-static char Vector_resize_3d_doc[] =
+PyDoc_STRVAR(Vector_resize_3d_doc,
".. method:: resize_3d()\n"
"\n"
" Resize the vector to 3D (x, y, z).\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_resize_3d(VectorObject *self)
{
if (self->wrapped==Py_WRAP) {
@@ -204,14 +206,14 @@ static PyObject *Vector_resize_3d(VectorObject *self)
Py_RETURN_NONE;
}
-static char Vector_resize_4d_doc[] =
+PyDoc_STRVAR(Vector_resize_4d_doc,
".. method:: resize_4d()\n"
"\n"
" Resize the vector to 4D (x, y, z, w).\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_resize_4d(VectorObject *self)
{
if(self->wrapped==Py_WRAP) {
@@ -239,14 +241,14 @@ static PyObject *Vector_resize_4d(VectorObject *self)
self->size = 4;
Py_RETURN_NONE;
}
-static char Vector_to_2d_doc[] =
+PyDoc_STRVAR(Vector_to_2d_doc,
".. method:: to_2d()\n"
"\n"
" Return a 2d copy of the vector.\n"
"\n"
" :return: a new vector\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_to_2d(VectorObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -254,14 +256,14 @@ static PyObject *Vector_to_2d(VectorObject *self)
return newVectorObject(self->vec, 2, Py_NEW, Py_TYPE(self));
}
-static char Vector_to_3d_doc[] =
+PyDoc_STRVAR(Vector_to_3d_doc,
".. method:: to_3d()\n"
"\n"
" Return a 3d copy of the vector.\n"
"\n"
" :return: a new vector\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_to_3d(VectorObject *self)
{
float tvec[3]= {0.0f};
@@ -272,14 +274,14 @@ static PyObject *Vector_to_3d(VectorObject *self)
memcpy(tvec, self->vec, sizeof(float) * MIN2(self->size, 3));
return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(self));
}
-static char Vector_to_4d_doc[] =
+PyDoc_STRVAR(Vector_to_4d_doc,
".. method:: to_4d()\n"
"\n"
" Return a 4d copy of the vector.\n"
"\n"
" :return: a new vector\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_to_4d(VectorObject *self)
{
float tvec[4]= {0.0f, 0.0f, 0.0f, 1.0f};
@@ -291,7 +293,7 @@ static PyObject *Vector_to_4d(VectorObject *self)
return newVectorObject(tvec, 4, Py_NEW, Py_TYPE(self));
}
-static char Vector_to_tuple_doc[] =
+PyDoc_STRVAR(Vector_to_tuple_doc,
".. method:: to_tuple(precision=-1)\n"
"\n"
" Return this vector as a tuple with.\n"
@@ -300,7 +302,7 @@ static char Vector_to_tuple_doc[] =
" :type precision: int\n"
" :return: the values of the vector rounded by *precision*\n"
" :rtype: tuple\n"
-;
+);
/* note: BaseMath_ReadCallback must be called beforehand */
static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits)
{
@@ -344,7 +346,7 @@ static PyObject *Vector_to_tuple(VectorObject *self, PyObject *args)
return Vector_to_tuple_ext(self, ndigits);
}
-static char Vector_to_track_quat_doc[] =
+PyDoc_STRVAR(Vector_to_track_quat_doc,
".. method:: to_track_quat(track, up)\n"
"\n"
" Return a quaternion rotation from the vector and the track and up axis.\n"
@@ -355,7 +357,7 @@ static char Vector_to_track_quat_doc[] =
" :type up: string\n"
" :return: rotation from the vector and the track and up axis.\n"
" :rtype: :class:`Quaternion`\n"
-;
+);
static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
{
float vec[3], quat[4];
@@ -462,7 +464,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
* Vector.reflect(mirror): return a reflected vector on the mirror normal
* vec - ((2 * DotVecs(vec, mirror)) * mirror)
*/
-static char Vector_reflect_doc[] =
+PyDoc_STRVAR(Vector_reflect_doc,
".. method:: reflect(mirror)\n"
"\n"
" Return the reflection vector from the *mirror* argument.\n"
@@ -471,7 +473,7 @@ static char Vector_reflect_doc[] =
" :type mirror: :class:`Vector`\n"
" :return: The reflected vector matching the size of this vector.\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_reflect(VectorObject *self, PyObject *value)
{
int value_size;
@@ -501,7 +503,7 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value)
return newVectorObject(reflect, self->size, Py_NEW, Py_TYPE(self));
}
-static char Vector_cross_doc[] =
+PyDoc_STRVAR(Vector_cross_doc,
".. method:: cross(other)\n"
"\n"
" Return the cross product of this vector and another.\n"
@@ -512,7 +514,7 @@ static char Vector_cross_doc[] =
" :rtype: :class:`Vector`\n"
"\n"
" .. note:: both vectors must be 3D\n"
-;
+);
static PyObject *Vector_cross(VectorObject *self, PyObject *value)
{
VectorObject *ret;
@@ -529,7 +531,7 @@ static PyObject *Vector_cross(VectorObject *self, PyObject *value)
return (PyObject *)ret;
}
-static char Vector_dot_doc[] =
+PyDoc_STRVAR(Vector_dot_doc,
".. method:: dot(other)\n"
"\n"
" Return the dot product of this vector and another.\n"
@@ -538,7 +540,7 @@ static char Vector_dot_doc[] =
" :type other: :class:`Vector`\n"
" :return: The dot product.\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_dot(VectorObject *self, PyObject *value)
{
float tvec[MAX_DIMENSIONS];
@@ -558,20 +560,21 @@ static PyObject *Vector_dot(VectorObject *self, PyObject *value)
return PyFloat_FromDouble(dot);
}
-static char Vector_angle_doc[] =
+PyDoc_STRVAR(Vector_angle_doc,
".. function:: angle(other, fallback)\n"
"\n"
" Return the angle between two vectors.\n"
"\n"
" :arg other: another vector to compare the angle with\n"
" :type other: :class:`Vector`\n"
-" :arg fallback: return this value when the angle cant be calculated (zero length vector)\n"
+" :arg fallback: return this value when the angle cant be calculated\n"
+" (zero length vector)\n"
" :type fallback: any\n"
" :return: angle in radians or fallback when given\n"
" :rtype: float\n"
"\n"
" .. note:: Zero length vectors raise an :exc:`AttributeError`.\n"
-;
+);
static PyObject *Vector_angle(VectorObject *self, PyObject *args)
{
const int size= self->size;
@@ -615,10 +618,11 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
return PyFloat_FromDouble(saacos(dot));
}
-static char Vector_rotation_difference_doc[] =
+PyDoc_STRVAR(Vector_rotation_difference_doc,
".. function:: difference(other)\n"
"\n"
-" Returns a quaternion representing the rotational difference between this vector and another.\n"
+" Returns a quaternion representing the rotational difference between this\n"
+" vector and another.\n"
"\n"
" :arg other: second vector.\n"
" :type other: :class:`Vector`\n"
@@ -626,7 +630,7 @@ static char Vector_rotation_difference_doc[] =
" :rtype: :class:`Quaternion`\n"
"\n"
" .. note:: 2D vectors raise an :exc:`AttributeError`.\n"
-;
+);
static PyObject *Vector_rotation_difference(VectorObject *self, PyObject *value)
{
float quat[4], vec_a[3], vec_b[3];
@@ -650,7 +654,7 @@ static PyObject *Vector_rotation_difference(VectorObject *self, PyObject *value)
return newQuaternionObject(quat, Py_NEW, NULL);
}
-static char Vector_project_doc[] =
+PyDoc_STRVAR(Vector_project_doc,
".. function:: project(other)\n"
"\n"
" Return the projection of this vector onto the *other*.\n"
@@ -659,7 +663,7 @@ static char Vector_project_doc[] =
" :type other: :class:`Vector`\n"
" :return: the parallel projection vector\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_project(VectorObject *self, PyObject *value)
{
const int size= self->size;
@@ -690,7 +694,7 @@ static PyObject *Vector_project(VectorObject *self, PyObject *value)
return newVectorObject(vec, size, Py_NEW, Py_TYPE(self));
}
-static char Vector_lerp_doc[] =
+PyDoc_STRVAR(Vector_lerp_doc,
".. function:: lerp(other, factor)\n"
"\n"
" Returns the interpolation of two vectors.\n"
@@ -701,7 +705,7 @@ static char Vector_lerp_doc[] =
" :type factor: float\n"
" :return: The interpolated rotation.\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_lerp(VectorObject *self, PyObject *args)
{
const int size= self->size;
@@ -727,14 +731,14 @@ static PyObject *Vector_lerp(VectorObject *self, PyObject *args)
return newVectorObject(vec, size, Py_NEW, Py_TYPE(self));
}
-static char Vector_rotate_doc[] =
+PyDoc_STRVAR(Vector_rotate_doc,
".. function:: rotate(other)\n"
"\n"
" Return vector by a rotation value.\n"
"\n"
" :arg other: rotation component of mathutils value\n"
" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n"
-;
+);
static PyObject *Vector_rotate(VectorObject *self, PyObject *value)
{
float other_rmat[3][3];
@@ -756,7 +760,7 @@ static PyObject *Vector_rotate(VectorObject *self, PyObject *value)
Py_RETURN_NONE;
}
-static char Vector_copy_doc[] =
+PyDoc_STRVAR(Vector_copy_doc,
".. function:: copy()\n"
"\n"
" Returns a copy of this vector.\n"
@@ -764,8 +768,9 @@ static char Vector_copy_doc[] =
" :return: A copy of the vector.\n"
" :rtype: :class:`Vector`\n"
"\n"
-" .. note:: use this to get a copy of a wrapped vector with no reference to the original data.\n"
-;
+" .. note:: use this to get a copy of a wrapped vector with\n"
+" no reference to the original data.\n"
+);
static PyObject *Vector_copy(VectorObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -2094,14 +2099,14 @@ static int row_vector_multiplication(float rvec[4], VectorObject* vec, MatrixObj
#endif
/*----------------------------Vector.negate() -------------------- */
-static char Vector_negate_doc[] =
+PyDoc_STRVAR(Vector_negate_doc,
".. method:: negate()\n"
"\n"
" Set all values to their negative.\n"
"\n"
" :return: an instance of itself\n"
" :rtype: :class:`Vector`\n"
-;
+);
static PyObject *Vector_negate(VectorObject *self)
{
if(BaseMath_ReadCallback(self) == -1)
@@ -2153,9 +2158,9 @@ static struct PyMethodDef Vector_methods[] = {
vec*mat and mat*vec both get sent to Vector_mul and it neesd to sort out the order
*/
-static char vector_doc[] =
+PyDoc_STRVAR(vector_doc,
"This object gives access to Vectors in Blender."
-;
+);
PyTypeObject vector_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
/* For printing, in format "<module>.<name>" */
diff --git a/source/blender/python/generic/mathutils_geometry.c b/source/blender/python/generic/mathutils_geometry.c
index 49b5eff3aa8..c4917199e59 100644
--- a/source/blender/python/generic/mathutils_geometry.c
+++ b/source/blender/python/generic/mathutils_geometry.c
@@ -53,11 +53,13 @@
/*-------------------------DOC STRINGS ---------------------------*/
-static char M_Geometry_doc[]= "The Blender geometry module\n\n";
+PyDoc_STRVAR(M_Geometry_doc,
+"The Blender geometry module"
+);
//---------------------------------INTERSECTION FUNCTIONS--------------------
-static char M_Geometry_intersect_ray_tri_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_ray_tri_doc,
".. function:: intersect_ray_tri(v1, v2, v3, ray, orig, clip=True)\n"
"\n"
" Returns the intersection between a ray and a triangle, if possible, returns None otherwise.\n"
@@ -76,7 +78,7 @@ static char M_Geometry_intersect_ray_tri_doc[] =
" :type clip: boolean\n"
" :return: The point of intersection or None if no intersection is found\n"
" :rtype: :class:`mathutils.Vector` or None\n"
-;
+);
static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *ray, *ray_off, *vec1, *vec2, *vec3;
@@ -150,7 +152,7 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject*
/* Line-Line intersection using algorithm from mathworld.wolfram.com */
-static char M_Geometry_intersect_line_line_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_line_line_doc,
".. function:: intersect_line_line(v1, v2, v3, v4)\n"
"\n"
" Returns a tuple with the points on each line respectively closest to the other.\n"
@@ -164,7 +166,7 @@ static char M_Geometry_intersect_line_line_doc[] =
" :arg v4: Second point of the second line\n"
" :type v4: :class:`mathutils.Vector`\n"
" :rtype: tuple of :class:`mathutils.Vector`'s\n"
-;
+);
static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject *args)
{
PyObject * tuple;
@@ -232,7 +234,7 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
//----------------------------geometry.normal() -------------------
-static char M_Geometry_normal_doc[] =
+PyDoc_STRVAR(M_Geometry_normal_doc,
".. function:: normal(v1, v2, v3, v4=None)\n"
"\n"
" Returns the normal of the 3D tri or quad.\n"
@@ -246,7 +248,7 @@ static char M_Geometry_normal_doc[] =
" :arg v4: Point4 (optional)\n"
" :type v4: :class:`mathutils.Vector`\n"
" :rtype: :class:`mathutils.Vector`\n"
-;
+);
static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1, *vec2, *vec3, *vec4;
@@ -294,7 +296,7 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject* args)
//--------------------------------- AREA FUNCTIONS--------------------
-static char M_Geometry_area_tri_doc[] =
+PyDoc_STRVAR(M_Geometry_area_tri_doc,
".. function:: area_tri(v1, v2, v3)\n"
"\n"
" Returns the area size of the 2D or 3D triangle defined.\n"
@@ -306,7 +308,7 @@ static char M_Geometry_area_tri_doc[] =
" :arg v3: Point3\n"
" :type v3: :class:`mathutils.Vector`\n"
" :rtype: float\n"
-;
+);
static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec1, *vec2, *vec3;
@@ -336,14 +338,14 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args)
}
/*----------------------------------geometry.PolyFill() -------------------*/
-static char M_Geometry_tesselate_polygon_doc[] =
+PyDoc_STRVAR(M_Geometry_tesselate_polygon_doc,
".. function:: tesselate_polygon(veclist_list)\n"
"\n"
" Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles.\n"
"\n"
" :arg veclist_list: list of polylines\n"
" :rtype: list\n"
-;
+);
/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */
static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq)
{
@@ -456,7 +458,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
return tri_list;
}
-static char M_Geometry_intersect_line_line_2d_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_line_line_2d_doc,
".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n"
"\n"
" Takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None.\n"
@@ -471,7 +473,7 @@ static char M_Geometry_intersect_line_line_2d_doc[] =
" :type lineB_p2: :class:`mathutils.Vector`\n"
" :return: The point of intersection or None when not found\n"
" :rtype: :class:`mathutils.Vector` or None\n"
-;
+);
static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *line_a1, *line_a2, *line_b1, *line_b2;
@@ -497,7 +499,7 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj
}
-static char M_Geometry_intersect_line_plane_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_line_plane_doc,
".. function:: intersect_line_plane(line_a, line_b, plane_co, plane_no, no_flip=False)\n"
"\n"
" Takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None.\n"
@@ -514,7 +516,7 @@ static char M_Geometry_intersect_line_plane_doc[] =
" :type no_flip: :boolean\n"
" :return: The point of intersection or None when not found\n"
" :rtype: :class:`mathutils.Vector` or None\n"
-;
+);
static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *line_a, *line_b, *plane_co, *plane_no;
@@ -551,7 +553,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
}
}
-static char M_Geometry_intersect_point_line_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_point_line_doc,
".. function:: intersect_point_line(pt, line_p1, line_p2)\n"
"\n"
" Takes a point and a line and returns a tuple with the closest point on the line and its distance from the first point of the line as a percentage of the length of the line.\n"
@@ -563,7 +565,7 @@ static char M_Geometry_intersect_point_line_doc[] =
" :arg line_p1: Second point of the line\n"
" :type line_p1: :class:`mathutils.Vector`\n"
" :rtype: (:class:`mathutils.Vector`, float)\n"
-;
+);
static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt, *line_1, *line_2;
@@ -601,7 +603,7 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
return ret;
}
-static char M_Geometry_intersect_point_tri_2d_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_point_tri_2d_doc,
".. function:: intersect_point_tri_2d(pt, tri_p1, tri_p2, tri_p3)\n"
"\n"
" Takes 4 vectors (using only the x and y coordinates): one is the point and the next 3 define the triangle. Returns 1 if the point is within the triangle, otherwise 0.\n"
@@ -615,7 +617,7 @@ static char M_Geometry_intersect_point_tri_2d_doc[] =
" :arg tri_p3: Third point of the triangle\n"
" :type tri_p3: :class:`mathutils.Vector`\n"
" :rtype: int\n"
-;
+);
static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3;
@@ -635,7 +637,7 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj
return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec));
}
-static char M_Geometry_intersect_point_quad_2d_doc[] =
+PyDoc_STRVAR(M_Geometry_intersect_point_quad_2d_doc,
".. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4)\n"
"\n"
" Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad, only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n"
@@ -651,7 +653,7 @@ static char M_Geometry_intersect_point_quad_2d_doc[] =
" :arg quad_p4: Forth point of the quad\n"
" :type quad_p4: :class:`mathutils.Vector`\n"
" :rtype: int\n"
-;
+);
static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4;
@@ -735,7 +737,7 @@ static void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
MEM_freeN(*boxarray);
}
-static char M_Geometry_box_pack_2d_doc[] =
+PyDoc_STRVAR(M_Geometry_box_pack_2d_doc,
".. function:: box_pack_2d(boxes)\n"
"\n"
" Returns the normal of the 3D tri or quad.\n"
@@ -744,7 +746,7 @@ static char M_Geometry_box_pack_2d_doc[] =
" :type boxes: list\n"
" :return: the width and height of the packed bounding box\n"
" :rtype: tuple, pair of floats\n"
-;
+);
static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlist)
{
float tot_width= 0.0f, tot_height= 0.0f;
@@ -776,7 +778,7 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis
return ret;
}
-static char M_Geometry_interpolate_bezier_doc[] =
+PyDoc_STRVAR(M_Geometry_interpolate_bezier_doc,
".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)\n"
"\n"
" Interpolate a bezier spline segment.\n"
@@ -793,7 +795,7 @@ static char M_Geometry_interpolate_bezier_doc[] =
" :type resolution: int\n"
" :return: The interpolated points\n"
" :rtype: list of :class:`mathutils.Vector`'s\n"
-;
+);
static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* args)
{
VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2;
@@ -847,7 +849,7 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject*
return list;
}
-static char M_Geometry_barycentric_transform_doc[] =
+PyDoc_STRVAR(M_Geometry_barycentric_transform_doc,
".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n"
"\n"
" Return a transformed point, the transformation is defined by 2 triangles.\n"
@@ -868,7 +870,7 @@ static char M_Geometry_barycentric_transform_doc[] =
" :type tri_a3: :class:`mathutils.Vector`\n"
" :return: The transformed point\n"
" :rtype: :class:`mathutils.Vector`'s\n"
-;
+);
static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObject *args)
{
VectorObject *vec_pt;
diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c
index dbae0fb13bc..f5761f713a6 100644
--- a/source/blender/python/generic/noise_py_api.c
+++ b/source/blender/python/generic/noise_py_api.c
@@ -478,111 +478,134 @@ static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args)
In the original module I actually kept the docs stings with the functions themselves,
but I grouped them here so that it can easily be moved to a header if anyone thinks that is necessary. */
-static char random__doc__[] = "() No arguments.\n\n\
-Returns a random floating point number in the range [0, 1)";
+PyDoc_STRVAR(random__doc__,
+"() No arguments.\n\n\
+Returns a random floating point number in the range [0, 1)"
+);
-static char random_unit_vector__doc__[] =
- "() No arguments.\n\nReturns a random unit vector (3-float list).";
+PyDoc_STRVAR(random_unit_vector__doc__,
+"() No arguments.\n\nReturns a random unit vector (3-float list)."
+);
-static char seed_set__doc__[] = "(seed value)\n\n\
+PyDoc_STRVAR(seed_set__doc__,
+"(seed value)\n\n\
Initializes random number generator.\n\
-if seed is zero, the current time will be used instead.";
+if seed is zero, the current time will be used instead."
+);
-static char noise__doc__[] = "((x,y,z) tuple, [noisetype])\n\n\
+PyDoc_STRVAR(noise__doc__,
+"((x,y,z) tuple, [noisetype])\n\n\
Returns general noise of the optional specified type.\n\
-Optional argument noisetype determines the type of noise, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisetype determines the type of noise, STDPERLIN by default, see NoiseTypes."
+);
-static char noise_vector__doc__[] = "((x,y,z) tuple, [noisetype])\n\n\
+PyDoc_STRVAR(noise_vector__doc__,
+"((x,y,z) tuple, [noisetype])\n\n\
Returns noise vector (3-float list) of the optional specified type.\
-Optional argument noisetype determines the type of noise, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisetype determines the type of noise, STDPERLIN by default, see NoiseTypes."
+);
-static char turbulence__doc__[] =
- "((x,y,z) tuple, octaves, hard, [noisebasis], [ampscale], [freqscale])\n\n\
+PyDoc_STRVAR(turbulence__doc__,
+"((x,y,z) tuple, octaves, hard, [noisebasis], [ampscale], [freqscale])\n\n\
Returns general turbulence value using the optional specified noisebasis function.\n\
octaves (integer) is the number of noise values added.\n\
hard (bool), when false (0) returns 'soft' noise, when true (1) returns 'hard' noise (returned value always positive).\n\
Optional arguments:\n\
noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.\n\
ampscale sets the amplitude scale value of the noise frequencies added, 0.5 by default.\n\
-freqscale sets the frequency scale factor, 2.0 by default.";
+freqscale sets the frequency scale factor, 2.0 by default."
+);
-static char turbulence_vector__doc__[] =
- "((x,y,z) tuple, octaves, hard, [noisebasis], [ampscale], [freqscale])\n\n\
+PyDoc_STRVAR(turbulence_vector__doc__,
+"((x,y,z) tuple, octaves, hard, [noisebasis], [ampscale], [freqscale])\n\n\
Returns general turbulence vector (3-float list) using the optional specified noisebasis function.\n\
octaves (integer) is the number of noise values added.\n\
hard (bool), when false (0) returns 'soft' noise, when true (1) returns 'hard' noise (returned vector always positive).\n\
Optional arguments:\n\
noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.\n\
ampscale sets the amplitude scale value of the noise frequencies added, 0.5 by default.\n\
-freqscale sets the frequency scale factor, 2.0 by default.";
+freqscale sets the frequency scale factor, 2.0 by default."
+);
-static char fractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, [noisebasis])\n\n\
+PyDoc_STRVAR(fractal__doc__,
+"((x,y,z) tuple, H, lacunarity, octaves, [noisebasis])\n\n\
Returns Fractal Brownian Motion noise value(fBm).\n\
H is the fractal increment parameter.\n\
lacunarity is the gap between successive frequencies.\n\
octaves is the number of frequencies in the fBm.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes."
+);
-static char multi_fractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, [noisebasis])\n\n\
+PyDoc_STRVAR(multi_fractal__doc__,
+"((x,y,z) tuple, H, lacunarity, octaves, [noisebasis])\n\n\
Returns Multifractal noise value.\n\
H determines the highest fractal dimension.\n\
lacunarity is gap between successive frequencies.\n\
octaves is the number of frequencies in the fBm.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes."
+);
-static char vl_vector__doc__[] =
- "((x,y,z) tuple, distortion, [noisetype1], [noisetype2])\n\n\
+PyDoc_STRVAR(vl_vector__doc__,
+"((x,y,z) tuple, distortion, [noisetype1], [noisetype2])\n\n\
Returns Variable Lacunarity Noise value, a distorted variety of noise.\n\
distortion sets the amount of distortion.\n\
Optional arguments noisetype1 and noisetype2 set the noisetype to distort and the noisetype used for the distortion respectively.\n\
-See NoiseTypes, both are STDPERLIN by default.";
+See NoiseTypes, both are STDPERLIN by default."
+);
-static char hetero_terrain__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, offset, [noisebasis])\n\n\
+PyDoc_STRVAR(hetero_terrain__doc__,
+"((x,y,z) tuple, H, lacunarity, octaves, offset, [noisebasis])\n\n\
returns Heterogeneous Terrain value\n\
H determines the fractal dimension of the roughest areas.\n\
lacunarity is the gap between successive frequencies.\n\
octaves is the number of frequencies in the fBm.\n\
offset raises the terrain from 'sea level'.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes."
+);
-static char hybrid_multi_fractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, offset, gain, [noisebasis])\n\n\
+PyDoc_STRVAR(hybrid_multi_fractal__doc__,
+"((x,y,z) tuple, H, lacunarity, octaves, offset, gain, [noisebasis])\n\n\
returns Hybrid Multifractal value.\n\
H determines the fractal dimension of the roughest areas.\n\
lacunarity is the gap between successive frequencies.\n\
octaves is the number of frequencies in the fBm.\n\
offset raises the terrain from 'sea level'.\n\
gain scales the values.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes."
+);
-static char ridged_multi_fractal__doc__[] =
- "((x,y,z) tuple, H, lacunarity, octaves, offset, gain [noisebasis])\n\n\
+PyDoc_STRVAR(ridged_multi_fractal__doc__,
+"((x,y,z) tuple, H, lacunarity, octaves, offset, gain [noisebasis])\n\n\
returns Ridged Multifractal value.\n\
H determines the fractal dimension of the roughest areas.\n\
lacunarity is the gap between successive frequencies.\n\
octaves is the number of frequencies in the fBm.\n\
offset raises the terrain from 'sea level'.\n\
gain scales the values.\n\
-Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes.";
+Optional argument noisebasis determines the type of noise used for the turbulence, STDPERLIN by default, see NoiseTypes."
+);
-static char voronoi__doc__[] =
- "((x,y,z) tuple, distance_metric, [exponent])\n\n\
+PyDoc_STRVAR(voronoi__doc__,
+"((x,y,z) tuple, distance_metric, [exponent])\n\n\
returns a list, containing a list of distances in order of closest feature,\n\
and a list containing the positions of the four closest features\n\
Optional arguments:\n\
distance_metric: see DistanceMetrics, default is DISTANCE\n\
-exponent is only used with MINKOVSKY, default is 2.5.";
+exponent is only used with MINKOVSKY, default is 2.5."
+);
-static char cell__doc__[] = "((x,y,z) tuple)\n\n\
-returns cellnoise float value.";
+PyDoc_STRVAR(cell__doc__,
+"((x,y,z) tuple)\n\n\
+returns cellnoise float value."
+);
-static char cell_vector__doc__[] = "((x,y,z) tuple)\n\n\
-returns cellnoise vector/point/color (3-float list).";
+PyDoc_STRVAR(cell_vector__doc__,
+"((x,y,z) tuple)\n\n\
+returns cellnoise vector/point/color (3-float list)."
+);
-static char Noise__doc__[] = "Blender Noise and Turbulence Module\n\n\
+PyDoc_STRVAR(Noise__doc__,
+"Blender Noise and Turbulence Module\n\n\
This module can be used to generate noise of various types.\n\
This can be used for terrain generation, to create textures,\n\
make animations more 'animated', object deformation, etc.\n\
@@ -610,7 +633,8 @@ look like anything from an earthquake to a very nervous or maybe even drunk came
\trv = Noise.turbulence_vector(ps, 3, 0, Noise.NoiseTypes.NEWPERLIN)\n\
\tob.dloc = (sp*rv[0], sp*rv[1], sp*rv[2])\n\
\tob.drot = (sr*rv[0], sr*rv[1], sr*rv[2])\n\
-\n";
+\n"
+);
/* Just in case, declarations for a header file */
/*
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 525d3fcba78..450151ee870 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -64,14 +64,14 @@
PyObject *bpy_package_py= NULL;
-static char bpy_script_paths_doc[] =
+PyDoc_STRVAR(bpy_script_paths_doc,
".. function:: script_paths()\n"
"\n"
" Return 2 paths to blender scripts directories.\n"
"\n"
" :return: (system, user) strings will be empty when not found.\n"
" :rtype: tuple of strings\n"
-;
+);
static PyObject *bpy_script_paths(PyObject *UNUSED(self))
{
PyObject *ret= PyTuple_New(2);
@@ -85,7 +85,7 @@ static PyObject *bpy_script_paths(PyObject *UNUSED(self))
return ret;
}
-static char bpy_blend_paths_doc[] =
+PyDoc_STRVAR(bpy_blend_paths_doc,
".. function:: blend_paths(absolute=False)\n"
"\n"
" Returns a list of paths to external files referenced by the loaded .blend file.\n"
@@ -94,7 +94,7 @@ static char bpy_blend_paths_doc[] =
" :type absolute: boolean\n"
" :return: path list.\n"
" :rtype: list of strings\n"
-;
+);
static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
struct BPathIterator *bpi;
@@ -137,7 +137,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
}
-// static char bpy_user_resource_doc[]= // now in bpy/utils.py
+// PyDoc_STRVAR(bpy_user_resource_doc[]= // now in bpy/utils.py
static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
char *type;
@@ -169,7 +169,7 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
return PyUnicode_DecodeFSDefault(path ? path : "");
}
-static char bpy_resource_path_doc[] =
+PyDoc_STRVAR(bpy_resource_path_doc,
".. function:: resource_path(type, major=2, minor=57)\n"
"\n"
" Return the base path for storing system files.\n"
@@ -182,7 +182,7 @@ static char bpy_resource_path_doc[] =
" :type minor: string\n"
" :return: the resource path (not necessarily existing).\n"
" :rtype: string\n"
-;
+);
static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{
char *type;
@@ -239,7 +239,7 @@ void BPy_init_modules( void )
PyObject *mod;
/* Needs to be first since this dir is needed for future modules */
- char *modpath= BLI_get_folder(BLENDER_SCRIPTS, "modules");
+ char *modpath= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "modules");
if(modpath) {
// printf("bpy: found module path '%s'.\n", modpath);
PyObject *sys_path= PySys_GetObject("path"); /* borrow */
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index acd23887af0..e6f4c5713a1 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -197,7 +197,7 @@ void BPY_python_start(int argc, const char **argv)
PyImport_ExtendInittab(bpy_internal_modules);
/* allow to use our own included python */
- PyC_SetHomePath(BLI_get_folder(BLENDER_PYTHON, NULL));
+ PyC_SetHomePath(BLI_get_folder(BLENDER_SYSTEM_PYTHON, NULL));
/* Python 3.2 now looks for '2.57/python/include/python3.2d/pyconfig.h' to parse
* from the 'sysconfig' module which is used by 'site', so for now disable site.
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index b66b2109329..10e97573447 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -26,6 +26,9 @@
* \ingroup pythonintern
*/
+/* nifty feature. swap out strings for RNA data */
+#define USE_RNA_DATABLOCKS
+
#include <Python.h>
#include <stddef.h>
@@ -47,6 +50,11 @@
#include "bpy_util.h"
+#ifdef USE_RNA_DATABLOCKS
+# include "bpy_rna.h"
+# include "RNA_access.h"
+#endif
+
typedef struct {
PyObject_HEAD /* required python macro */
/* collection iterator spesific parts */
@@ -155,7 +163,7 @@ static PyTypeObject bpy_lib_Type= {
NULL
};
-static char bpy_lib_load_doc[] =
+PyDoc_STRVAR(bpy_lib_load_doc,
".. method:: load(filepath, link=False, relative=False)\n"
"\n"
" Returns a context manager which exposes 2 library objects on entering.\n"
@@ -167,7 +175,7 @@ static char bpy_lib_load_doc[] =
" :type link: bool\n"
" :arg relative: When True the path is stored relative to the open blend file.\n"
" :type relative: bool\n"
-;
+);
static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)
{
static const char *kwlist[]= {"filepath", "link", "relative", NULL};
@@ -271,6 +279,36 @@ static PyObject *bpy_lib_enter(BPy_Library *self, PyObject *UNUSED(args))
return ret;
}
+static void bpy_lib_exit_warn_idname(BPy_Library *self, const char *name_plural, const char *idname)
+{
+ PyObject *exc, *val, *tb;
+ PyErr_Fetch(&exc, &val, &tb);
+ if (PyErr_WarnFormat(PyExc_UserWarning, 1,
+ "load: '%s' does not contain %s[\"%s\"]",
+ self->abspath, name_plural, idname)) {
+ /* Spurious errors can appear at shutdown */
+ if (PyErr_ExceptionMatches(PyExc_Warning)) {
+ PyErr_WriteUnraisable((PyObject *)self);
+ }
+ }
+ PyErr_Restore(exc, val, tb);
+}
+
+static void bpy_lib_exit_warn_type(BPy_Library *self, PyObject *item)
+{
+ PyObject *exc, *val, *tb;
+ PyErr_Fetch(&exc, &val, &tb);
+ if (PyErr_WarnFormat(PyExc_UserWarning, 1,
+ "load: '%s' expected a string type, not a %.200s",
+ self->abspath, Py_TYPE(item)->tp_name)) {
+ /* Spurious errors can appear at shutdown */
+ if (PyErr_ExceptionMatches(PyExc_Warning)) {
+ PyErr_WriteUnraisable((PyObject *)self);
+ }
+ }
+ PyErr_Restore(exc, val, tb);
+}
+
static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
{
Main *mainl= NULL;
@@ -302,18 +340,41 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
// printf(" %s\n", item_str);
if(item_str) {
- if(!BLO_library_append_named_part(NULL, mainl, &(self->blo_handle), item_str, code, self->flag)) {
- PyErr_Format(PyExc_KeyError,
- "load: %s does not contain %s[\"%s\"]",
- self->abspath, name_plural, item_str);
- err= -1;
- break;
+ ID *id= BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, code);
+ if(id) {
+#ifdef USE_RNA_DATABLOCKS
+ PointerRNA id_ptr;
+ RNA_id_pointer_create(id, &id_ptr);
+ Py_DECREF(item);
+ item= pyrna_struct_CreatePyObject(&id_ptr);
+#endif
}
+ else {
+ bpy_lib_exit_warn_idname(self, name_plural, item_str);
+ /* just warn for now */
+ /* err = -1; */
+#ifdef USE_RNA_DATABLOCKS
+ item= Py_None;
+ Py_INCREF(item);
+#endif
+ }
+
+ /* ID or None */
}
else {
/* XXX, could complain about this */
+ bpy_lib_exit_warn_type(self, item);
PyErr_Clear();
+
+#ifdef USE_RNA_DATABLOCKS
+ item= Py_None;
+ Py_INCREF(item);
+#endif
}
+
+#ifdef USE_RNA_DATABLOCKS
+ PyList_SET_ITEM(ls, i, item);
+#endif
}
}
}
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 6ea52abc5f4..0ee9d7e5bd5 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -47,6 +47,8 @@
#include "../generic/py_capi_utils.h"
+extern BPy_StructRNA *bpy_context_module;
+
static EnumPropertyItem property_flag_items[]= {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
@@ -194,7 +196,7 @@ static int bpy_struct_id_used(StructRNA *srna, char *identifier)
/* Function that sets RNA, NOTE - self is NULL when called from python, but being abused from C so we can pass the srna allong
* This isnt incorrect since its a python object - but be careful */
-static char BPy_BoolProperty_doc[] =
+PyDoc_STRVAR(BPy_BoolProperty_doc,
".. function:: BoolProperty(name=\"\", description=\"\", default=False, options={'ANIMATABLE'}, subtype='NONE')\n"
"\n"
" Returns a new boolean property definition.\n"
@@ -205,7 +207,7 @@ BPY_PROPDEF_DESC_DOC
" :type options: set\n"
" :arg subtype: Enumerator in ['UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n"
" :type subtype: string\n"
-;
+);
static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -248,7 +250,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
Py_RETURN_NONE;
}
-static char BPy_BoolVectorProperty_doc[] =
+PyDoc_STRVAR(BPy_BoolVectorProperty_doc,
".. function:: BoolVectorProperty(name=\"\", description=\"\", default=(False, False, False), options={'ANIMATABLE'}, subtype='NONE', size=3)\n"
"\n"
" Returns a new vector boolean property definition.\n"
@@ -263,7 +265,7 @@ BPY_PROPDEF_DESC_DOC
" :type subtype: string\n"
" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
" :type size: int\n"
-;
+);
static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -318,7 +320,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
Py_RETURN_NONE;
}
-static char BPy_IntProperty_doc[] =
+PyDoc_STRVAR(BPy_IntProperty_doc,
".. function:: IntProperty(name=\"\", description=\"\", default=0, min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, step=1, options={'ANIMATABLE'}, subtype='NONE')\n"
"\n"
" Returns a new int property definition.\n"
@@ -329,7 +331,7 @@ BPY_PROPDEF_DESC_DOC
" :type options: set\n"
" :arg subtype: Enumerator in ['UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n"
" :type subtype: string\n"
-;
+);
static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -374,7 +376,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
Py_RETURN_NONE;
}
-static char BPy_IntVectorProperty_doc[] =
+PyDoc_STRVAR(BPy_IntVectorProperty_doc,
".. function:: IntVectorProperty(name=\"\", description=\"\", default=(0, 0, 0), min=-sys.maxint, max=sys.maxint, soft_min=-sys.maxint, soft_max=sys.maxint, options={'ANIMATABLE'}, subtype='NONE', size=3)\n"
"\n"
" Returns a new vector int property definition.\n"
@@ -389,7 +391,7 @@ BPY_PROPDEF_DESC_DOC
" :type subtype: string\n"
" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
" :type size: int\n"
-;
+);
static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -447,7 +449,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
}
-static char BPy_FloatProperty_doc[] =
+PyDoc_STRVAR(BPy_FloatProperty_doc,
".. function:: FloatProperty(name=\"\", description=\"\", default=0.0, min=sys.float_info.min, max=sys.float_info.max, soft_min=sys.float_info.min, soft_max=sys.float_info.max, step=3, precision=2, options={'ANIMATABLE'}, subtype='NONE', unit='NONE')\n"
"\n"
" Returns a new float property definition.\n"
@@ -460,7 +462,7 @@ BPY_PROPDEF_DESC_DOC
" :type subtype: string\n"
" :arg unit: Enumerator in ['NONE', 'LENGTH', 'AREA', 'VOLUME', 'ROTATION', 'TIME', 'VELOCITY', 'ACCELERATION'].\n"
" :type unit: string\n"
-;
+);
static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -514,7 +516,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
Py_RETURN_NONE;
}
-static char BPy_FloatVectorProperty_doc[] =
+PyDoc_STRVAR(BPy_FloatVectorProperty_doc,
".. function:: FloatVectorProperty(name=\"\", description=\"\", default=(0.0, 0.0, 0.0), min=sys.float_info.min, max=sys.float_info.max, soft_min=sys.float_info.min, soft_max=sys.float_info.max, step=3, precision=2, options={'ANIMATABLE'}, subtype='NONE', size=3)\n"
"\n"
" Returns a new vector float property definition.\n"
@@ -529,7 +531,7 @@ BPY_PROPDEF_DESC_DOC
" :type subtype: string\n"
" :arg size: Vector dimensions in [1, and " STRINGIFY(PYRNA_STACK_ARRAY) "].\n"
" :type size: int\n"
-;
+);
static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -586,7 +588,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
Py_RETURN_NONE;
}
-static char BPy_StringProperty_doc[] =
+PyDoc_STRVAR(BPy_StringProperty_doc,
".. function:: StringProperty(name=\"\", description=\"\", default=\"\", maxlen=0, options={'ANIMATABLE'}, subtype='NONE')\n"
"\n"
" Returns a new string property definition.\n"
@@ -597,7 +599,7 @@ BPY_PROPDEF_DESC_DOC
" :type options: set\n"
" :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILENAME', 'NONE'].\n"
" :type subtype: string\n"
-;
+);
static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -741,20 +743,116 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
return items;
}
-static char BPy_EnumProperty_doc[] =
+static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int *free)
+{
+ PyGILState_STATE gilstate;
+
+ PyObject *py_func= RNA_property_enum_py_data_get(prop);
+ PyObject *self= NULL;
+ PyObject *args;
+ PyObject *items; /* returned from the function call */
+
+ EnumPropertyItem *eitems= NULL;
+ int err= 0;
+
+ bpy_context_set(C, &gilstate);
+
+ args= PyTuple_New(2);
+
+ /* first get self */
+ /* operators can store their own instance for later use */
+ if(ptr->data) {
+ void **instance = RNA_struct_instance(ptr);
+
+ if(instance) {
+ if(*instance) {
+ self= *instance;
+ Py_INCREF(self);
+ }
+ }
+ }
+ if(self == NULL) {
+ self= pyrna_struct_CreatePyObject(ptr);
+ }
+
+ PyTuple_SET_ITEM(args, 0, self);
+
+ /* now get the context */
+ PyTuple_SET_ITEM(args, 1, (PyObject *)bpy_context_module);
+ Py_INCREF(bpy_context_module);
+
+ items= PyObject_CallObject(py_func, args);
+
+ Py_DECREF(args);
+
+ if(items==NULL) {
+ err= -1;
+ }
+ else {
+ PyObject *items_fast;
+ int defvalue_dummy=0;
+
+ if(!(items_fast= PySequence_Fast(items, "EnumProperty(...): return value from the callback was not a sequence"))) {
+ err= -1;
+ }
+ else {
+ eitems= enum_items_from_py(items_fast, NULL, &defvalue_dummy, (RNA_property_flag(prop) & PROP_ENUM_FLAG)!=0);
+
+ Py_DECREF(items_fast);
+
+ if(!eitems) {
+ err= -1;
+ }
+ }
+
+ Py_DECREF(items);
+ }
+
+ if(err != -1) { /* worked */
+ *free= 1;
+ }
+ else {
+ /* since we return to C code we can't leave the error */
+ PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(py_func);
+ PyErr_Print();
+ PyErr_Clear();
+
+ /* use py style error */
+ fprintf(stderr, "File \"%s\", line %d, in %s\n",
+ _PyUnicode_AsString(f_code->co_filename),
+ f_code->co_firstlineno,
+ _PyUnicode_AsString(((PyFunctionObject *)py_func)->func_name)
+ );
+
+ eitems= DummyRNA_NULL_items;
+ }
+
+
+ bpy_context_clear(C, &gilstate);
+ return eitems;
+}
+
+PyDoc_STRVAR(BPy_EnumProperty_doc,
".. function:: EnumProperty(items, name=\"\", description=\"\", default=\"\", options={'ANIMATABLE'})\n"
"\n"
" Returns a new enumerator property definition.\n"
"\n"
BPY_PROPDEF_NAME_DOC
BPY_PROPDEF_DESC_DOC
-" :arg default: The default value for this enum, A string when *ENUM_FLAG* is disabled otherwise a set which may only contain string identifiers used in *items*.\n"
+" :arg default: The default value for this enum, A string when *ENUM_FLAG*\n"
+" is disabled otherwise a set which may only contain string identifiers\n"
+" used in *items*.\n"
" :type default: string or set\n"
" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE', 'ENUM_FLAG'].\n"
" :type options: set\n"
-" :arg items: sequence of enum items formatted: [(identifier, name, description), ...] where the identifier is used for python access and other values are used for the interface.\n"
-" :type items: sequence of string triplets\n"
-;
+" :arg items: sequence of enum items formatted:\n"
+" [(identifier, name, description), ...] where the identifier is used\n"
+" for python access and other values are used for the interface.\n"
+" For dynamic values a callback can be passed which returns a list in\n"
+" the same format as the static list.\n"
+" This function must take 2 arguments (self, context)\n"
+" :type items: sequence of string triplets or a function\n"
+);
static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -772,6 +870,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
PropertyRNA *prop;
PyObject *pyopts= NULL;
int opts=0;
+ short is_itemf= FALSE;
if (!PyArg_ParseTupleAndKeywords(args, kw,
"s#O|ssOO!:EnumProperty",
@@ -784,26 +883,58 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
BPY_PROPDEF_CHECK(EnumProperty, property_flag_enum_items)
- if(!(items_fast= PySequence_Fast(items, "EnumProperty(...): expected a sequence of tuples for the enum items"))) {
- return NULL;
+ /* items can be a list or a callable */
+ if(PyFunction_Check(items)) { /* dont use PyCallable_Check because we need the function code for errors */
+ PyCodeObject *f_code= (PyCodeObject *)PyFunction_GET_CODE(items);
+ if(f_code->co_argcount != 2) {
+ PyErr_Format(PyExc_ValueError,
+ "EnumProperty(...): expected 'items' function to take 2 arguments, not %d",
+ f_code->co_argcount);
+ return NULL;
+ }
+
+ if(def) {
+ /* note, using type error here is odd but python does this for invalid arguments */
+ PyErr_SetString(PyExc_TypeError,
+ "EnumProperty(...): 'default' can't be set when 'items' is a function");
+ return NULL;
+ }
+
+ is_itemf= TRUE;
+ eitems= DummyRNA_NULL_items;
}
+ else {
+ if(!(items_fast= PySequence_Fast(items, "EnumProperty(...): expected a sequence of tuples for the enum items or a function"))) {
+ return NULL;
+ }
- eitems= enum_items_from_py(items_fast, def, &defvalue, (opts & PROP_ENUM_FLAG)!=0);
+ eitems= enum_items_from_py(items_fast, def, &defvalue, (opts & PROP_ENUM_FLAG)!=0);
- Py_DECREF(items_fast);
+ Py_DECREF(items_fast);
- if(!eitems)
- return NULL;
+ if(!eitems) {
+ return NULL;
+ }
+ }
if(opts & PROP_ENUM_FLAG) prop= RNA_def_enum_flag(srna, id, eitems, defvalue, name, description);
else prop= RNA_def_enum(srna, id, eitems, defvalue, name, description);
+ if(is_itemf) {
+ RNA_def_enum_funcs(prop, bpy_props_enum_itemf);
+ RNA_def_enum_py_data(prop, (void *)items);
+ /* Py_INCREF(items); */ /* watch out!, if user is tricky they can probably crash blender if they manage to free the callback, take care! */
+ }
+
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
if((opts & PROP_ANIMATABLE)==0) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
}
RNA_def_property_duplicate_pointers(srna, prop);
- MEM_freeN(eitems);
+
+ if(is_itemf == FALSE) {
+ MEM_freeN(eitems);
+ }
}
Py_RETURN_NONE;
}
@@ -840,7 +971,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
return srna;
}
-static char BPy_PointerProperty_doc[] =
+PyDoc_STRVAR(BPy_PointerProperty_doc,
".. function:: PointerProperty(type=\"\", description=\"\", options={'ANIMATABLE'})\n"
"\n"
" Returns a new pointer property definition.\n"
@@ -851,7 +982,7 @@ BPY_PROPDEF_NAME_DOC
BPY_PROPDEF_DESC_DOC
" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n"
" :type options: set\n"
-;
+);
static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -893,7 +1024,7 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k
Py_RETURN_NONE;
}
-static char BPy_CollectionProperty_doc[] =
+PyDoc_STRVAR(BPy_CollectionProperty_doc,
".. function:: CollectionProperty(items, type=\"\", description=\"\", default=\"\", options={'ANIMATABLE'})\n"
"\n"
" Returns a new collection property definition.\n"
@@ -904,7 +1035,7 @@ BPY_PROPDEF_NAME_DOC
BPY_PROPDEF_DESC_DOC
" :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE'].\n"
" :type options: set\n"
-;
+);
static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
@@ -946,14 +1077,14 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject
Py_RETURN_NONE;
}
-static char BPy_RemoveProperty_doc[] =
+PyDoc_STRVAR(BPy_RemoveProperty_doc,
".. function:: RemoveProperty(attr)\n"
"\n"
" Removes a dynamically defined property.\n"
"\n"
" :arg attr: Property name.\n"
" :type attr: string\n"
-;
+);
static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw)
{
StructRNA *srna;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 4f62c545a71..72d391fed32 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -2527,16 +2527,18 @@ static PyMappingMethods pyrna_struct_as_mapping= {
(objobjargproc) pyrna_struct_ass_subscript, /* mp_ass_subscript */
};
-static char pyrna_struct_keys_doc[] =
+PyDoc_STRVAR(pyrna_struct_keys_doc,
".. method:: keys()\n"
"\n"
-" Returns the keys of this objects custom properties (matches pythons dictionary function of the same name).\n"
+" Returns the keys of this objects custom properties (matches pythons\n"
+" dictionary function of the same name).\n"
"\n"
" :return: custom property keys.\n"
" :rtype: list of strings\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n";
-
+" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes\n"
+" support custom properties.\n"
+);
static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self)
{
IDProperty *group;
@@ -2554,16 +2556,18 @@ static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self)
return BPy_Wrap_GetKeys(group);
}
-static char pyrna_struct_items_doc[] =
+PyDoc_STRVAR(pyrna_struct_items_doc,
".. method:: items()\n"
"\n"
-" Returns the items of this objects custom properties (matches pythons dictionary function of the same name).\n"
+" Returns the items of this objects custom properties (matches pythons\n"
+" dictionary function of the same name).\n"
"\n"
" :return: custom property key, value pairs.\n"
" :rtype: list of key, value tuples\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n";
-
+" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n"
+" classes support custom properties.\n"
+);
static PyObject *pyrna_struct_items(BPy_PropertyRNA *self)
{
IDProperty *group;
@@ -2581,16 +2585,18 @@ static PyObject *pyrna_struct_items(BPy_PropertyRNA *self)
return BPy_Wrap_GetItems(self->ptr.id.data, group);
}
-static char pyrna_struct_values_doc[] =
+PyDoc_STRVAR(pyrna_struct_values_doc,
".. method:: values()\n"
"\n"
-" Returns the values of this objects custom properties (matches pythons dictionary function of the same name).\n"
+" Returns the values of this objects custom properties (matches pythons\n"
+" dictionary function of the same name).\n"
"\n"
" :return: custom property values.\n"
" :rtype: list\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n";
-
+" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n"
+" classes support custom properties.\n"
+);
static PyObject *pyrna_struct_values(BPy_PropertyRNA *self)
{
IDProperty *group;
@@ -2609,14 +2615,14 @@ static PyObject *pyrna_struct_values(BPy_PropertyRNA *self)
}
-static char pyrna_struct_is_property_set_doc[] =
+PyDoc_STRVAR(pyrna_struct_is_property_set_doc,
".. method:: is_property_set(property)\n"
"\n"
" Check if a property is set, use for testing operator properties.\n"
"\n"
" :return: True when the property has been set.\n"
" :rtype: boolean\n"
-;
+);
static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *args)
{
PropertyRNA *prop;
@@ -2653,14 +2659,14 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg
return PyBool_FromLong(ret);
}
-static char pyrna_struct_is_property_hidden_doc[] =
+PyDoc_STRVAR(pyrna_struct_is_property_hidden_doc,
".. method:: is_property_hidden(property)\n"
"\n"
" Check if a property is hidden.\n"
"\n"
" :return: True when the property is hidden.\n"
" :rtype: boolean\n"
-;
+);
static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *args)
{
PropertyRNA *prop;
@@ -2681,16 +2687,17 @@ static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *
return PyBool_FromLong(RNA_property_flag(prop) & PROP_HIDDEN);
}
-static char pyrna_struct_path_resolve_doc[] =
+PyDoc_STRVAR(pyrna_struct_path_resolve_doc,
".. method:: path_resolve(path, coerce=True)\n"
"\n"
" Returns the property from the path, raise an exception when not found.\n"
"\n"
" :arg path: path which this property resolves.\n"
" :type path: string\n"
-" :arg coerce: optional argument, when True, the property will be converted into its python representation.\n"
+" :arg coerce: optional argument, when True, the property will be converted\n"
+" into its python representation.\n"
" :type coerce: boolean\n"
-;
+);
static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
{
const char *path;
@@ -2738,16 +2745,18 @@ static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
}
}
-static char pyrna_struct_path_from_id_doc[] =
+PyDoc_STRVAR(pyrna_struct_path_from_id_doc,
".. method:: path_from_id(property=\"\")\n"
"\n"
" Returns the data path from the ID to this object (string).\n"
"\n"
-" :arg property: Optional property name which can be used if the path is to a property of this object.\n"
+" :arg property: Optional property name which can be used if the path is\n"
+" to a property of this object.\n"
" :type property: string\n"
-" :return: The path from :class:`bpy_struct.id_data` to this struct and property (when given).\n"
+" :return: The path from :class:`bpy_struct.id_data`\n"
+" to this struct and property (when given).\n"
" :rtype: str\n"
-;
+);
static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
{
const char *name= NULL;
@@ -2795,14 +2804,14 @@ static PyObject *pyrna_struct_path_from_id(BPy_StructRNA *self, PyObject *args)
return ret;
}
-static char pyrna_prop_path_from_id_doc[] =
+PyDoc_STRVAR(pyrna_prop_path_from_id_doc,
".. method:: path_from_id()\n"
"\n"
" Returns the data path from the ID to this property (string).\n"
"\n"
" :return: The path from :class:`bpy_struct.id_data` to this property.\n"
" :rtype: str\n"
-;
+);
static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self)
{
const char *path;
@@ -2824,14 +2833,15 @@ static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self)
return ret;
}
-static char pyrna_struct_type_recast_doc[] =
+PyDoc_STRVAR(pyrna_struct_type_recast_doc,
".. method:: type_recast()\n"
"\n"
-" Return a new instance, this is needed because types such as textures can be changed at runtime.\n"
+" Return a new instance, this is needed because types\n"
+" such as textures can be changed at runtime.\n"
"\n"
" :return: a new instance of this object with the type initialized again.\n"
" :rtype: subclass of :class:`bpy_struct`\n"
-;
+);
static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self)
{
PointerRNA r_ptr;
@@ -3091,7 +3101,7 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr
* >>> bpy.types.Scene.foo= BoolProperty()
* >>> bpy.types.Scene.foo
* <bpy_struct, BooleanProperty("foo")>
- * ...rather then returning the deferred class register tuple as checked by pyrna_is_deferred_prop()
+ * ...rather than returning the deferred class register tuple as checked by pyrna_is_deferred_prop()
*
* Disable for now, this is faking internal behavior in a way thats too tricky to maintain well. */
#if 0
@@ -3434,14 +3444,15 @@ static PyGetSetDef pyrna_struct_getseters[]= {
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
-static char pyrna_prop_collection_keys_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_keys_doc,
".. method:: keys()\n"
"\n"
-" Return the identifiers of collection members (matching pythons dict.keys() functionality).\n"
+" Return the identifiers of collection members\n"
+" (matching pythons dict.keys() functionality).\n"
"\n"
" :return: the identifiers for each member of this collection.\n"
" :rtype: list of stings\n"
-;
+);
static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
{
PyObject *ret= PyList_New(0);
@@ -3467,14 +3478,15 @@ static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
return ret;
}
-static char pyrna_prop_collection_items_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_items_doc,
".. method:: items()\n"
"\n"
-" Return the identifiers of collection members (matching pythons dict.items() functionality).\n"
+" Return the identifiers of collection members\n"
+" (matching pythons dict.items() functionality).\n"
"\n"
" :return: (key, value) pairs for each member of this collection.\n"
" :rtype: list of tuples\n"
-;
+);
static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
{
PyObject *ret= PyList_New(0);
@@ -3508,32 +3520,36 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
return ret;
}
-static char pyrna_prop_collection_values_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_values_doc,
".. method:: values()\n"
"\n"
-" Return the values of collection (matching pythons dict.values() functionality).\n"
+" Return the values of collection\n"
+" (matching pythons dict.values() functionality).\n"
"\n"
" :return: the members of this collection.\n"
" :rtype: list\n"
-;
+);
static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self)
{
/* re-use slice*/
return pyrna_prop_collection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
}
-static char pyrna_struct_get_doc[] =
+PyDoc_STRVAR(pyrna_struct_get_doc,
".. method:: get(key, default=None)\n"
"\n"
-" Returns the value of the custom property assigned to key or default when not found (matches pythons dictionary function of the same name).\n"
+" Returns the value of the custom property assigned to key or default\n"
+" when not found (matches pythons dictionary function of the same name).\n"
"\n"
" :arg key: The key assosiated with the custom property.\n"
" :type key: string\n"
-" :arg default: Optional argument for the value to return if *key* is not found.\n"
+" :arg default: Optional argument for the value to return if\n"
+" *key* is not found.\n"
" :type default: Undefined\n"
"\n"
-" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes support custom properties.\n"
-;
+" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n"
+" classes support custom properties.\n"
+);
static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
{
IDProperty *group, *idprop;
@@ -3563,7 +3579,7 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
return Py_INCREF(def), def;
}
-static char pyrna_struct_as_pointer_doc[] =
+PyDoc_STRVAR(pyrna_struct_as_pointer_doc,
".. method:: as_pointer()\n"
"\n"
" Returns the memory address which holds a pointer to blenders internal data\n"
@@ -3571,23 +3587,26 @@ static char pyrna_struct_as_pointer_doc[] =
" :return: int (memory address).\n"
" :rtype: int\n"
"\n"
-" .. note:: This is intended only for advanced script writers who need to pass blender data to their own C/Python modules.\n"
-;
+" .. note:: This is intended only for advanced script writers who need to\n"
+" pass blender data to their own C/Python modules.\n"
+);
static PyObject *pyrna_struct_as_pointer(BPy_StructRNA *self)
{
return PyLong_FromVoidPtr(self->ptr.data);
}
-static char pyrna_prop_collection_get_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_get_doc,
".. method:: get(key, default=None)\n"
"\n"
-" Returns the value of the item assigned to key or default when not found (matches pythons dictionary function of the same name).\n"
+" Returns the value of the item assigned to key or default when not found\n"
+" (matches pythons dictionary function of the same name).\n"
"\n"
" :arg key: The identifier for the collection member.\n"
" :type key: string\n"
-" :arg default: Optional argument for the value to return if *key* is not found.\n"
+" :arg default: Optional argument for the value to return if\n"
+" *key* is not found.\n"
" :type default: Undefined\n"
-;
+);
static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args)
{
PointerRNA newptr;
@@ -3851,7 +3870,7 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
Py_RETURN_NONE;
}
-static char pyrna_prop_collection_foreach_get_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_foreach_get_doc,
".. method:: foreach_get(attr, seq)\n"
"\n"
" This is a function to give fast access to attributes within a collection.\n"
@@ -3863,7 +3882,7 @@ static char pyrna_prop_collection_foreach_get_doc[] =
" # Python equivalent\n"
" for i in range(len(seq)): someseq[i]= getattr(collection, attr)\n"
"\n"
-;
+);
static PyObject *pyrna_prop_collection_foreach_get(BPy_PropertyRNA *self, PyObject *args)
{
PYRNA_PROP_CHECK_OBJ(self)
@@ -3871,7 +3890,7 @@ static PyObject *pyrna_prop_collection_foreach_get(BPy_PropertyRNA *self, PyObje
return foreach_getset(self, args, 0);
}
-static char pyrna_prop_collection_foreach_set_doc[] =
+PyDoc_STRVAR(pyrna_prop_collection_foreach_set_doc,
".. method:: foreach_set(attr, seq)\n"
"\n"
" This is a function to give fast access to attributes within a collection.\n"
@@ -3883,7 +3902,7 @@ static char pyrna_prop_collection_foreach_set_doc[] =
" # Python equivalent\n"
" for i in range(len(seq)): setattr(collection[i], attr, seq[i])\n"
"\n"
-;
+);
static PyObject *pyrna_prop_collection_foreach_set(BPy_PropertyRNA *self, PyObject *args)
{
PYRNA_PROP_CHECK_OBJ(self)
@@ -5498,7 +5517,7 @@ PyObject *BPY_rna_module(void)
BPy_StructRNA *pyrna;
PointerRNA ptr;
- /* for now, return the base RNA type rather then a real module */
+ /* for now, return the base RNA type rather than a real module */
RNA_main_pointer_create(G.main, &ptr);
pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
@@ -5518,7 +5537,7 @@ PyObject *BPY_rna_doc(void)
{
PointerRNA ptr;
- /* for now, return the base RNA type rather then a real module */
+ /* for now, return the base RNA type rather than a real module */
RNA_blender_rna_pointer_create(&ptr);
return pyrna_struct_CreatePyObject(&ptr);
@@ -5863,7 +5882,6 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
PyObject *py_class= (PyObject*)py_data;
PyObject *base_class= RNA_struct_py_type_get(srna);
PyObject *item;
- PyObject *py_arg_count;
int i, flag, arg_count, func_arg_count;
const char *py_class_name= ((PyTypeObject *)py_class)->tp_name; // __name__
@@ -5926,9 +5944,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
func_arg_count= rna_function_arg_count(func);
if (func_arg_count >= 0) { /* -1 if we dont care*/
- py_arg_count= PyObject_GetAttrString(PyFunction_GET_CODE(item), "co_argcount");
- arg_count= PyLong_AsLong(py_arg_count);
- Py_DECREF(py_arg_count);
+ arg_count= ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
/* note, the number of args we check for and the number of args we give to
* @classmethods are different (quirk of python), this is why rna_function_arg_count() doesn't return the value -1*/
@@ -6359,16 +6375,20 @@ void pyrna_free_types(void)
* the decref. This is not so bad because the leak only happens when re-registering (hold F8)
* - Should still be fixed - Campbell
* */
-static char pyrna_register_class_doc[] =
+PyDoc_STRVAR(pyrna_register_class_doc,
".. method:: register_class(cls)\n"
"\n"
-" Register a subclass of a blender type in (:class:`Panel`, :class:`Menu`, :class:`Header`, :class:`Operator`, :class:`KeyingSetInfo`, :class:`RenderEngine`).\n"
+" Register a subclass of a blender type in (:class:`Panel`,\n"
+" :class:`Menu`, :class:`Header`, :class:`Operator`,\n"
+" :class:`KeyingSetInfo`, :class:`RenderEngine`).\n"
"\n"
-" If the class has a *register* class method it will be called before registration.\n"
+" If the class has a *register* class method it will be called\n"
+" before registration.\n"
"\n"
-" .. note:: :exc:`ValueError` exception is raised if the class is not a subclass of a registerable blender class.\n"
+" .. note:: :exc:`ValueError` exception is raised if the class is not a\n"
+" subclass of a registerable blender class.\n"
"\n"
-;
+);
PyMethodDef meth_bpy_register_class= {"register_class", pyrna_register_class, METH_O, pyrna_register_class_doc};
static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class)
{
@@ -6487,13 +6507,14 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN
return 0;
}
-static char pyrna_unregister_class_doc[] =
+PyDoc_STRVAR(pyrna_unregister_class_doc,
".. method:: unregister_class(cls)\n"
"\n"
" Unload the python class from blender.\n"
"\n"
-" If the class has an *unregister* class method it will be called before unregistering.\n"
-;
+" If the class has an *unregister* class method it will be called\n"
+" before unregistering.\n"
+);
PyMethodDef meth_bpy_unregister_class= {"unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc};
static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_class)
{
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 28459677b32..ea8af61c9bf 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -44,7 +44,7 @@
/* support for inter references, currently only needed for corner case */
#define USE_PYRNA_STRUCT_REFERENCE
-/* use real collection iterators rather then faking with a list */
+/* use real collection iterators rather than faking with a list */
#define USE_PYRNA_ITER
#else /* WITH_PYTHON_SAFETY */
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index e575776ec79..77141d9b445 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -633,14 +633,14 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float *
dxco[0]= fx;
dxco[1]= 0.0f;
if(shi->facenor[2]!=0.0f)
- dxco[2]= (shi->facenor[0]*fx)/shi->facenor[2];
+ dxco[2]= -(shi->facenor[0]*fx)/shi->facenor[2];
else
dxco[2]= 0.0f;
dyco[0]= 0.0f;
dyco[1]= fy;
if(shi->facenor[2]!=0.0f)
- dyco[2]= (shi->facenor[1]*fy)/shi->facenor[2];
+ dyco[2]= -(shi->facenor[1]*fy)/shi->facenor[2];
else
dyco[2]= 0.0f;
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index ea77fca4712..1f005ba6021 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -544,7 +544,7 @@ void WM_read_history(void)
struct RecentFile *recent;
char *line;
int num;
- char *cfgdir = BLI_get_folder(BLENDER_CONFIG, NULL);
+ char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
if (!cfgdir) return;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index fc2c0338bdf..34702558bc8 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -56,6 +56,7 @@
#include "BLI_blenlib.h"
#include "BLI_dynstr.h" /*for WM_operator_pystring */
#include "BLI_math.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLO_readfile.h"
@@ -441,10 +442,12 @@ void WM_operator_py_idname(char *to, const char *from)
{
char *sep= strstr(from, "_OT_");
if(sep) {
- int i, ofs= (sep-from);
-
- for(i=0; i<ofs; i++)
- to[i]= tolower(from[i]);
+ int ofs= (sep-from);
+
+ /* note, we use ascii tolower instead of system tolower, because the
+ latter depends on the locale, and can lead to idname mistmatch */
+ memcpy(to, from, sizeof(char)*ofs);
+ BLI_ascii_strtolower(to, ofs);
to[ofs] = '.';
BLI_strncpy(to+(ofs+1), sep+4, OP_MAX_TYPENAME);
@@ -462,10 +465,10 @@ void WM_operator_bl_idname(char *to, const char *from)
char *sep= strchr(from, '.');
if(sep) {
- int i, ofs= (sep-from);
+ int ofs= (sep-from);
- for(i=0; i<ofs; i++)
- to[i]= toupper(from[i]);
+ memcpy(to, from, sizeof(char)*ofs);
+ BLI_ascii_strtoupper(to, ofs);
BLI_strncpy(to+ofs, "_OT_", OP_MAX_TYPENAME);
BLI_strncpy(to+(ofs+4), sep+1, OP_MAX_TYPENAME);
@@ -683,7 +686,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *arg_ot, cons
RNA_property_enum_items((bContext *)C, &ptr, prop, &item_array, NULL, &do_free);
for(item= item_array; item->identifier; item++) {
- /* note: need to give the intex rather then the dientifier because the enum can be freed */
+ /* note: need to give the intex rather than the dientifier because the enum can be freed */
if(BLI_strcasestr(item->name, str))
if(0==uiSearchItemAdd(items, item->name, SET_INT_IN_POINTER(item->value), 0))
break;
@@ -1457,7 +1460,7 @@ static void open_set_load_ui(wmOperator *op)
static void open_set_use_scripts(wmOperator *op)
{
if(!RNA_property_is_set(op->ptr, "use_scripts")) {
- /* use G_SCRIPT_AUTOEXEC rather then the userpref because this means if
+ /* use G_SCRIPT_AUTOEXEC rather than the userpref because this means if
* the flag has been disabled from the command line, then opening
* from the menu wont enable this setting. */
RNA_boolean_set(op->ptr, "use_scripts", (G.f & G_SCRIPT_AUTOEXEC));
@@ -1639,12 +1642,12 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
/* here appending/linking starts */
mainl = BLO_library_append_begin(C, &bh, libname);
if(totfiles == 0) {
- BLO_library_append_named_part(C, mainl, &bh, name, idcode, flag);
+ BLO_library_append_named_part_ex(C, mainl, &bh, name, idcode, flag);
}
else {
RNA_BEGIN(op->ptr, itemptr, "files") {
RNA_string_get(&itemptr, "name", name);
- BLO_library_append_named_part(C, mainl, &bh, name, idcode, flag);
+ BLO_library_append_named_part_ex(C, mainl, &bh, name, idcode, flag);
}
RNA_END;
}
@@ -2835,6 +2838,8 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
alpha = 0.75;
break;
default:
+ tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE; /* note, this is a dummy value */
+ alpha = 0.75;
break;
}
@@ -3094,6 +3099,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
if(snap) new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10*10);
break;
default:
+ new_value = dist; /* dummy value, should this ever happen? - campbell */
break;
}
@@ -3645,38 +3651,38 @@ static EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(pt
}
/* can add more as needed */
-EnumPropertyItem *RNA_action_itemf(bContext *C, PointerRNA *ptr, int *do_free)
+EnumPropertyItem *RNA_action_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
{
return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->action.first : NULL, FALSE);
}
-EnumPropertyItem *RNA_action_local_itemf(bContext *C, PointerRNA *ptr, int *do_free)
+EnumPropertyItem *RNA_action_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
{
return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->action.first : NULL, TRUE);
}
-EnumPropertyItem *RNA_group_itemf(bContext *C, PointerRNA *ptr, int *do_free)
+EnumPropertyItem *RNA_group_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
{
return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->group.first : NULL, FALSE);
}
-EnumPropertyItem *RNA_group_local_itemf(bContext *C, PointerRNA *ptr, int *do_free)
+EnumPropertyItem *RNA_group_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
{
return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->group.first : NULL, TRUE);
}
-EnumPropertyItem *RNA_image_itemf(bContext *C, PointerRNA *ptr, int *do_free)
+EnumPropertyItem *RNA_image_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
{
return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->image.first : NULL, FALSE);
}
-EnumPropertyItem *RNA_image_local_itemf(bContext *C, PointerRNA *ptr, int *do_free)
+EnumPropertyItem *RNA_image_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
{
return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->image.first : NULL, TRUE);
}
-EnumPropertyItem *RNA_scene_itemf(bContext *C, PointerRNA *ptr, int *do_free)
+EnumPropertyItem *RNA_scene_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
{
return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, FALSE);
}
-EnumPropertyItem *RNA_scene_local_itemf(bContext *C, PointerRNA *ptr, int *do_free)
+EnumPropertyItem *RNA_scene_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
{
return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, TRUE);
}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index d592b432070..aea48d88b47 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -193,8 +193,8 @@ if(WITH_PYTHON_MODULE)
PROPERTIES
PREFIX ""
OUTPUT_NAME bpy
- LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/
- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/ # only needed on windows
+ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin # only needed on windows
)
if(WIN32)
@@ -233,7 +233,11 @@ if(UNIX AND NOT APPLE)
if(WITH_INSTALL_PORTABLE)
set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
else()
- set(TARGETDIR_VER ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
+ if(WITH_PYTHON_MODULE)
+ set(TARGETDIR_VER ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/${BLENDER_VERSION})
+ else()
+ set(TARGETDIR_VER ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
+ endif()
endif()
# important to make a clean install each time
@@ -266,17 +270,26 @@ if(UNIX AND NOT APPLE)
)
install(
- DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
+ DIRECTORY ${CMAKE_SOURCE_DIR}/release/text
DESTINATION ${TARGETDIR}
PATTERN ".svn" EXCLUDE
)
else()
# main blender binary
- install(
- PROGRAMS ${TARGETDIR}/blender
- DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
- )
+ if(WITH_PYTHON_MODULE)
+ install(
+ TARGETS blender
+ LIBRARY
+ DESTINATION ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages
+ )
+ else()
+ install(
+ PROGRAMS ${TARGETDIR}/blender
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+ )
+ endif()
+
if(WITH_GAMEENGINE AND WITH_PLAYER)
install(
@@ -298,7 +311,7 @@ if(UNIX AND NOT APPLE)
${CMAKE_SOURCE_DIR}/release/freedesktop/icons/32x32
${CMAKE_SOURCE_DIR}/release/freedesktop/icons/48x48
${CMAKE_SOURCE_DIR}/release/freedesktop/icons/256x256
- DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor
PATTERN ".svn" EXCLUDE
PATTERN "*.svg" EXCLUDE
)
@@ -315,7 +328,7 @@ if(UNIX AND NOT APPLE)
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
)
install(
- DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
+ DIRECTORY ${CMAKE_SOURCE_DIR}/release/text
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender
PATTERN ".svn" EXCLUDE
)
@@ -334,7 +347,7 @@ if(UNIX AND NOT APPLE)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
- DESTINATION ${TARGETDIR_VER}/datafiles/
+ DESTINATION ${TARGETDIR_VER}/datafiles
PATTERN ".svn" EXCLUDE
)
endif()
@@ -343,7 +356,7 @@ if(UNIX AND NOT APPLE)
#
# install(
# DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
- # DESTINATION ${TARGETDIR_VER}/
+ # DESTINATION ${TARGETDIR_VER}
# PATTERN ".svn" EXCLUDE
# )
@@ -351,7 +364,7 @@ if(UNIX AND NOT APPLE)
# install(CODE "message(\"copying blender scripts...\")")
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
- DESTINATION ${TARGETDIR_VER}/
+ DESTINATION ${TARGETDIR_VER}
PATTERN ".svn" EXCLUDE
PATTERN "__pycache__" EXCLUDE
)
@@ -362,9 +375,9 @@ if(UNIX AND NOT APPLE)
# install(CODE "message(\"copying a subset of the systems python...\")")
install(
DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}
- DESTINATION ${TARGETDIR_VER}/python/lib/
+ DESTINATION ${TARGETDIR_VER}/python/lib
PATTERN ".svn" EXCLUDE
- PATTERN "__pycache__" EXCLUDE # ./distutils
+ PATTERN "__pycache__" EXCLUDE # * any cache *
PATTERN "distutils" EXCLUDE # ./distutils
PATTERN "lib2to3" EXCLUDE # ./lib2to3
PATTERN "config" EXCLUDE # ./config
@@ -372,8 +385,10 @@ if(UNIX AND NOT APPLE)
PATTERN "site-packages/*" EXCLUDE # ./site-packages/*
PATTERN "tkinter" EXCLUDE # ./tkinter
PATTERN "lib-dynload/_tkinter.*" EXCLUDE # ./lib-dynload/_tkinter.co
+ PATTERN "idlelib" EXCLUDE # ./idlelib
PATTERN "test" EXCLUDE # ./test
PATTERN "turtledemo" EXCLUDE # ./turtledemo
+ PATTERN "turtle.py" EXCLUDE # ./turtle.py
)
# # doesnt work, todo
@@ -390,8 +405,8 @@ elseif(WIN32)
)
install( # same as linux!, deduplicate
- DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
- DESTINATION ${TARGETDIR}/
+ DIRECTORY ${CMAKE_SOURCE_DIR}/release/text
+ DESTINATION ${TARGETDIR}
PATTERN ".svn" EXCLUDE
)
@@ -407,25 +422,25 @@ elseif(WIN32)
)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
- DESTINATION ${TARGETDIR_VER}/datafiles/
+ DESTINATION ${TARGETDIR_VER}/datafiles
PATTERN ".svn" EXCLUDE
)
if(NOT CMAKE_CL_64)
install(
FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
install(
FILES ${LIBDIR}/iconv/lib/iconv.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
endif()
endif()
install( # same as linux!, deduplicate
- DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale/
+ DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
DESTINATION ${TARGETDIR_VER}/datafiles/locale
PATTERN ".svn" EXCLUDE
)
@@ -434,7 +449,7 @@ elseif(WIN32)
#
# install(
# DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
- # DESTINATION ${TARGETDIR_VER}/
+ # DESTINATION ${TARGETDIR_VER}
# PATTERN ".svn" EXCLUDE
# )
@@ -442,37 +457,40 @@ elseif(WIN32)
# install(CODE "message(\"copying blender scripts...\")")
install( # same as linux!, deduplicate
DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
- DESTINATION ${TARGETDIR_VER}/
+ DESTINATION ${TARGETDIR_VER}
PATTERN ".svn" EXCLUDE
PATTERN "__pycache__" EXCLUDE
)
# TODO, multiple targets?
- install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS Release)
- install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS RelWithDebInfo)
- install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS MinSizeRel)
+ install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR} CONFIGURATIONS Release)
+ install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR} CONFIGURATIONS RelWithDebInfo)
+ install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR} CONFIGURATIONS MinSizeRel)
install(
FILES ${LIBDIR}/python/lib/python32_d.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
CONFIGURATIONS Debug
)
if(WITH_PYTHON_INSTALL)
- #~ # note, as far as python is concerned 'RelWithDebInfo' is not debug since its without debug flags.
+ # note, as far as python is concerned 'RelWithDebInfo' is not debug since its without debug flags.
# create the directory in multiple steps, so it actually gets created when it doesn't exist yet
- install(CODE "
- message(\"creating ${TARGETDIR_VER}/python/lib\")
- file(MAKE_DIRECTORY ${TARGETDIR_VER}/python/)
- file(MAKE_DIRECTORY ${TARGETDIR_VER}/python/lib/)
- message(\"done creating dir\")
- ")
+ install(
+ CODE
+ "
+ message(\"creating ${TARGETDIR_VER}/python/lib\")
+ file(MAKE_DIRECTORY \"${TARGETDIR_VER}/python\")
+ file(MAKE_DIRECTORY \"${TARGETDIR_VER}/python/lib\")
+ message(\"done creating dir\")
+ "
+ )
install(
CODE
"
- execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
+ execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib\"
\"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
"
CONFIGURATIONS Release
@@ -480,7 +498,7 @@ elseif(WIN32)
install(
CODE
"
- execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
+ execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib\"
\"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
"
CONFIGURATIONS RelWithDebInfo
@@ -488,7 +506,7 @@ elseif(WIN32)
install(
CODE
"
- execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
+ execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib\"
\"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
"
CONFIGURATIONS MinSizeRel
@@ -496,7 +514,7 @@ elseif(WIN32)
install(
CODE
"
- execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
+ execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib\"
\"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32_d.tar.gz\")
"
CONFIGURATIONS Debug
@@ -511,26 +529,26 @@ elseif(WIN32)
# gettext and png are statically linked on win64
install(
FILES ${LIBDIR}/zlib/lib/zlib.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
else()
install(
FILES
${LIBDIR}/png/lib/libpng.dll
${LIBDIR}/zlib/lib/zlib.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
endif()
if(MSVC)
install(
FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
else()
install(
FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
endif()
@@ -542,7 +560,7 @@ elseif(WIN32)
${LIBDIR}/ffmpeg/lib/avdevice-52.dll
${LIBDIR}/ffmpeg/lib/avutil-50.dll
${LIBDIR}/ffmpeg/lib/swscale-0.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
endif()
@@ -551,7 +569,7 @@ elseif(WIN32)
install(
FILES
${LIBDIR}/sndfile/lib/libsndfile-1.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
endif()
@@ -560,7 +578,7 @@ elseif(WIN32)
FILES
${LIBDIR}/openal/lib/OpenAL32.dll
${LIBDIR}/openal/lib/wrap_oal.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
endif()
@@ -569,7 +587,7 @@ elseif(WIN32)
install(
FILES
${LIBDIR}/sdl/lib/SDL.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
endif()
endif()
@@ -578,13 +596,13 @@ elseif(WIN32)
install(
FILES
${LIBDIR}/thumbhandler/lib/BlendThumb.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
else()
install(
FILES
${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
- DESTINATION ${TARGETDIR}/
+ DESTINATION ${TARGETDIR}
)
endif()
@@ -638,7 +656,7 @@ elseif(APPLE)
install(
FILES ${SOURCEDIR}/Contents/PkgInfo
- DESTINATION ${TARGETDIR}/blender.app/Contents/
+ DESTINATION ${TARGETDIR}/blender.app/Contents
)
install_dir(
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 0c29c807554..6e9ecf234fc 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -314,7 +314,6 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
printf ("\nEnvironment Variables:\n");
printf (" $BLENDER_USER_CONFIG Directory for user configuration files.\n");
- printf (" $BLENDER_SYSTEM_CONFIG Directory for system wide configuration files.\n");
printf (" $BLENDER_USER_SCRIPTS Directory for user scripts.\n");
printf (" $BLENDER_SYSTEM_SCRIPTS Directory for system wide scripts.\n");
printf (" $BLENDER_USER_DATAFILES Directory for user data files (icons, translations, ..).\n");
@@ -1048,7 +1047,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
static char debug_doc[] = "\n\tTurn debugging on\n"
"\n\t* Prints every operator call and their arguments"
"\n\t* Disables mouse grab (to interact with a debugger in some cases)"
- "\n\t* Keeps python sys.stdin rather then setting it to None";
+ "\n\t* Keeps python sys.stdin rather than setting it to None";
//BLI_argsAdd(ba, pass, short_arg, long_arg, doc, cb, C);
@@ -1087,7 +1086,6 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
BLI_argsAdd(ba, 1, NULL, "--factory-startup", "\n\tSkip reading the "STRINGIFY(BLENDER_STARTUP_FILE)" in the users home directory", set_factory_startup, NULL);
/* TODO, add user env vars? */
- BLI_argsAdd(ba, 1, NULL, "--env-system-config", "\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_CONFIG)" environment variable", set_env, NULL);
BLI_argsAdd(ba, 1, NULL, "--env-system-datafiles", "\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_DATAFILES)" environment variable", set_env, NULL);
BLI_argsAdd(ba, 1, NULL, "--env-system-scripts", "\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_SCRIPTS)" environment variable", set_env, NULL);
BLI_argsAdd(ba, 1, NULL, "--env-system-plugins", "\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_PLUGINS)" environment variable", set_env, NULL);
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 59c5888ff35..cac801c80ef 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -250,13 +250,15 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
// some blender stuff
float camzoom;
+ int draw_letterbox = 0;
if(rv3d->persp==RV3D_CAMOB) {
if(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */
camzoom = 1.0f;
+ draw_letterbox = 1;
}
else {
- camzoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
+ camzoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom)*4.0f;
}
}
else {
@@ -427,19 +429,22 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
{
// first check if we want to exit
exitrequested = ketsjiengine->GetExitCode();
-
- // Clear screen to border color
- // We do this here since we set the canvas to be within the frames. This means the engine
- // itself is unaware of the extra space, so we clear the whole region for it.
- glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f);
- glViewport(ar->winrct.xmin, ar->winrct.ymin, ar->winrct.xmax, ar->winrct.ymax);
- glClear(GL_COLOR_BUFFER_BIT);
// kick the engine
bool render = ketsjiengine->NextFrame();
if (render)
{
+ if(draw_letterbox) {
+ // Clear screen to border color
+ // We do this here since we set the canvas to be within the frames. This means the engine
+ // itself is unaware of the extra space, so we clear the whole region for it.
+ glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f);
+ glViewport(ar->winrct.xmin, ar->winrct.ymin,
+ ar->winrct.xmax - ar->winrct.xmin, ar->winrct.ymax - ar->winrct.ymin);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+
// render the frame
ketsjiengine->Render();
}
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 684ed0b06f9..58089cc4b2d 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -994,7 +994,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
int i=0;
LinkNode *n= names;
while(n) {
- BLO_library_append_named_part(C, main_tmp, &bpy_openlib, (char *)n->link, idcode, 0);
+ BLO_library_append_named_part(main_tmp, &bpy_openlib, (char *)n->link, idcode);
n= (LinkNode *)n->next;
i++;
}
@@ -1012,7 +1012,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
int i=0;
LinkNode *n= names;
while(n) {
- BLO_library_append_named_part(C, main_tmp, &bpy_openlib, (char *)n->link, ID_AC, 0);
+ BLO_library_append_named_part(main_tmp, &bpy_openlib, (char *)n->link, ID_AC);
n= (LinkNode *)n->next;
i++;
}
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index c340d13b3d4..10906cdae02 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -179,7 +179,7 @@ PyObject * PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObjec
return NULL;
}
- /* use base_type rather then Py_TYPE(base) because we could already be subtyped */
+ /* use base_type rather than Py_TYPE(base) because we could already be subtyped */
if(!PyType_IsSubtype(type, base_type)) {
PyErr_Format(PyExc_TypeError, "can't subclass blender game type <%s> from <%s> because it is not a subclass", base_type->tp_name, type->tp_name);
return NULL;
@@ -1198,14 +1198,13 @@ void PyDebugLine()
f_lineno= PyObject_GetAttrString(frame, "f_lineno");
f_code= PyObject_GetAttrString(frame, "f_code");
if (f_lineno && f_code) {
- co_filename= PyObject_GetAttrString(f_code, "co_filename");
+ co_filename= ((PyCodeObject *)f_code)->co_filename; /* borrow */
if (co_filename) {
printf("\t%s:%d\n", _PyUnicode_AsString(co_filename), (int)PyLong_AsSsize_t(f_lineno));
Py_DECREF(f_lineno);
Py_DECREF(f_code);
- Py_DECREF(co_filename);
Py_DECREF(frame);
return;
}
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index d0c1155de96..19ddce13757 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -357,14 +357,7 @@ bool SCA_PythonController::Import()
m_function_argc = 0; /* rare cases this could be a function that isnt defined in python, assume zero args */
if (PyFunction_Check(m_function)) {
- PyObject *py_arg_count = PyObject_GetAttrString(PyFunction_GET_CODE(m_function), "co_argcount");
- if(py_arg_count) {
- m_function_argc = PyLong_AsLong(py_arg_count);
- Py_DECREF(py_arg_count);
- }
- else {
- PyErr_Clear(); /* unlikely to fail but just incase */
- }
+ m_function_argc= ((PyCodeObject *)PyFunction_GET_CODE(m_function))->co_argcount;
}
if(m_function_argc > 1) {
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 75181b6c330..7a98c7e09b0 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -62,7 +62,8 @@ extern "C"
#include "BKE_global.h"
#include "BKE_icons.h"
#include "BKE_node.h"
-#include "BKE_report.h"
+#include "BKE_report.h"
+#include "BKE_library.h"
#include "BLI_blenlib.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
@@ -404,6 +405,9 @@ int main(int argc, char** argv)
initglobals();
+ // We load our own G.main, so free the one that initglobals() gives us
+ free_main(G.main);
+
IMB_init();
// Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c)
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index bf288e1f1ad..12024657149 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -405,8 +405,13 @@ static PyObject* gPyCreateConstraint(PyObject* self,
PyObject* args,
PyObject* kwds)
{
- /* FIXME - physicsid is an int being cast to a pointer, should at least use PyCapsule */
- int physicsid=0,physicsid2 = 0,constrainttype=0,extrainfo=0;
+ /* FIXME - physicsid is a long being cast to a pointer, should at least use PyCapsule */
+#if defined(_WIN64)
+ __int64 physicsid=0,physicsid2 = 0;
+#else
+ long physicsid=0,physicsid2 = 0;
+#endif
+ int constrainttype=0, extrainfo=0;
int len = PyTuple_Size(args);
int success = 1;
int flag = 0;
@@ -414,27 +419,51 @@ static PyObject* gPyCreateConstraint(PyObject* self,
float pivotX=1,pivotY=1,pivotZ=1,axisX=0,axisY=0,axisZ=1;
if (len == 3)
{
- success = PyArg_ParseTuple(args,"iii",&physicsid,&physicsid2,&constrainttype);
+#if defined(_WIN64)
+ success = PyArg_ParseTuple(args,"LLi",&physicsid,&physicsid2,&constrainttype);
+#else
+ success = PyArg_ParseTuple(args,"lli",&physicsid,&physicsid2,&constrainttype);
+#endif
}
else
if (len ==6)
{
- success = PyArg_ParseTuple(args,"iiifff",&physicsid,&physicsid2,&constrainttype,
+#if defined(_WIN64)
+ success = PyArg_ParseTuple(args,"LLifff",&physicsid,&physicsid2,&constrainttype,
&pivotX,&pivotY,&pivotZ);
+#else
+ success = PyArg_ParseTuple(args,"llifff",&physicsid,&physicsid2,&constrainttype,
+ &pivotX,&pivotY,&pivotZ);
+#endif
}
else if (len == 9)
{
- success = PyArg_ParseTuple(args,"iiiffffff",&physicsid,&physicsid2,&constrainttype,
+#if defined(_WIN64)
+ success = PyArg_ParseTuple(args,"LLiffffff",&physicsid,&physicsid2,&constrainttype,
&pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ);
+#else
+ success = PyArg_ParseTuple(args,"lliffffff",&physicsid,&physicsid2,&constrainttype,
+ &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ);
+#endif
+
}
else if (len == 10)
{
- success = PyArg_ParseTuple(args,"iiiffffffi",&physicsid,&physicsid2,&constrainttype,
+#if defined(_WIN64)
+ success = PyArg_ParseTuple(args,"LLiffffffi",&physicsid,&physicsid2,&constrainttype,
&pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ,&flag);
+#else
+ success = PyArg_ParseTuple(args,"lliffffffi",&physicsid,&physicsid2,&constrainttype,
+ &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ,&flag);
+#endif
}
else if (len==4)
{
- success = PyArg_ParseTuple(args,"iiii",&physicsid,&physicsid2,&constrainttype,&extrainfo);
+#if defined(_WIN64)
+ success = PyArg_ParseTuple(args,"LLii",&physicsid,&physicsid2,&constrainttype,&extrainfo);
+#else
+ success = PyArg_ParseTuple(args,"llii",&physicsid,&physicsid2,&constrainttype,&extrainfo);
+#endif
pivotX=extrainfo;
}
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index a3738995db3..c8a6ae5a6d0 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1781,7 +1781,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
PyImport_ExtendInittab(bge_internal_modules);
/* find local python installation */
- PyC_SetHomePath(BLI_get_folder(BLENDER_PYTHON, NULL));
+ PyC_SetHomePath(BLI_get_folder(BLENDER_SYSTEM_PYTHON, NULL));
Py_Initialize();
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 416cef71067..3f0c4cb95a1 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -939,7 +939,7 @@ int CcdPhysicsEnvironment::createUniversalD6Constraint(
} else
{
// TODO: Implement single body case...
- //No, we can use a fixed rigidbody in above code, rather then unnecessary duplation of code
+ //No, we can use a fixed rigidbody in above code, rather than unnecessary duplation of code
}
@@ -2271,7 +2271,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radi
cinfo.m_collisionShape = new btSphereShape(radius); // memory leak! The shape is not deleted by Bullet and we cannot add it to the KX_Scene.m_shapes list
cinfo.m_MotionState = 0;
cinfo.m_physicsEnv = this;
- // declare this object as Dyamic rather then static!!
+ // declare this object as Dyamic rather than static!!
// The reason as it is designed to detect all type of object, including static object
// It would cause static-static message to be printed on the console otherwise
cinfo.m_collisionFlags |= btCollisionObject::CF_NO_CONTACT_RESPONSE | btCollisionObject::CF_STATIC_OBJECT;
diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt
index fb10b619f17..b544139d4a7 100644
--- a/source/gameengine/VideoTexture/CMakeLists.txt
+++ b/source/gameengine/VideoTexture/CMakeLists.txt
@@ -45,6 +45,7 @@ set(INC
../../../intern/string
../../../intern/moto/include
../../../intern/guardedalloc
+ ../../../intern/ffmpeg
${GLEW_INCLUDE_PATH}
)
diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript
index 5091082e87a..b39a59e4504 100644
--- a/source/gameengine/VideoTexture/SConscript
+++ b/source/gameengine/VideoTexture/SConscript
@@ -13,6 +13,7 @@ incs += ' #source/blender/editors/include #source/blender/blenlib #source/blende
incs += ' #source/blender/makesdna #source/blender/imbuf #source/blender/python #source/blender/python/generic'
incs += ' #source/blender/gpu #intern/string #intern/moto/include'
incs += ' #intern/guardedalloc #intern/container #extern/glew/include'
+incs += ' #intern/ffmpeg'
defs = []
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw'):
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index 63dbc5bb7ba..f8274756c8b 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -182,7 +182,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
{
if(formatCtx->streams[i] &&
get_codec_from_stream(formatCtx->streams[i]) &&
- (get_codec_from_stream(formatCtx->streams[i])->codec_type==CODEC_TYPE_VIDEO))
+ (get_codec_from_stream(formatCtx->streams[i])->codec_type==AVMEDIA_TYPE_VIDEO))
{
videoStream=i;
break;
@@ -368,9 +368,9 @@ void *VideoFFmpeg::cacheThread(void *data)
BLI_remlink(&video->m_packetCacheBase, cachePacket);
// use m_frame because when caching, it is not used in main thread
// we can't use currentFrame directly because we need to convert to RGB first
- avcodec_decode_video(video->m_codecCtx,
+ avcodec_decode_video2(video->m_codecCtx,
video->m_frame, &frameFinished,
- cachePacket->packet.data, cachePacket->packet.size);
+ &cachePacket->packet);
if(frameFinished)
{
AVFrame * input = video->m_frame;
@@ -641,7 +641,7 @@ void VideoFFmpeg::openCam (char * file, short camIdx)
if (m_captRate <= 0.f)
m_captRate = defFrameRate;
sprintf(rateStr, "%f", m_captRate);
- av_parse_video_frame_rate(&frameRate, rateStr);
+ av_parse_video_rate(&frameRate, rateStr);
// populate format parameters
// need to specify the time base = inverse of rate
formatParams.time_base.num = frameRate.den;
@@ -924,10 +924,10 @@ AVFrame *VideoFFmpeg::grabFrame(long position)
{
if (packet.stream_index == m_videoStream)
{
- avcodec_decode_video(
+ avcodec_decode_video2(
m_codecCtx,
m_frame, &frameFinished,
- packet.data, packet.size);
+ &packet);
if (frameFinished)
{
m_curPosition = (long)((packet.dts-startTs) * (m_baseFrameRate*timeBase) + 0.5);
@@ -999,9 +999,9 @@ AVFrame *VideoFFmpeg::grabFrame(long position)
{
if(packet.stream_index == m_videoStream)
{
- avcodec_decode_video(m_codecCtx,
+ avcodec_decode_video2(m_codecCtx,
m_frame, &frameFinished,
- packet.data, packet.size);
+ &packet);
// remember dts to compute exact frame number
dts = packet.dts;
if (frameFinished && !posFound)
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h
index 9b09c485329..139b90dc463 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.h
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.h
@@ -31,17 +31,15 @@ http://www.gnu.org/copyleft/lesser.txt.
extern "C" {
#undef __cplusplus
#include <pthread.h>
-#include <libavformat/avformat.h>
-#include <libavcodec/avcodec.h>
-#include <libavutil/rational.h>
-#include <libswscale/swscale.h>
+
+#include "ffmpeg_compat.h"
+
#include "DNA_listBase.h"
#include "BLI_threads.h"
#include "BLI_blenlib.h"
#define __cplusplus
}
-
#if LIBAVFORMAT_VERSION_INT < (49 << 16)
#define FFMPEG_OLD_FRAME_RATE 1
#else