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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-31 13:51:46 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-31 13:51:46 +0400
commit6a128eee7b8a49e5d7344f8982c82fc2aa97dad6 (patch)
tree2a385fd94761b66777db1ba0675151e84b697c2e /source/blender
parent89983a2187863b9fbd72f5b1b45aadf2c930aba3 (diff)
parentb434550edcae656a50ac46a45ae66641b8fd0050 (diff)
Cycles: svn merge -r36777:37040 https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/avi/CMakeLists.txt5
-rw-r--r--source/blender/blenfont/CMakeLists.txt7
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_screen.h3
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h2
-rw-r--r--source/blender/blenkernel/BKE_text.h10
-rw-r--r--source/blender/blenkernel/CMakeLists.txt18
-rw-r--r--source/blender/blenkernel/SConscript1
-rw-r--r--source/blender/blenkernel/intern/anim.c6
-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/depsgraph.c4
-rw-r--r--source/blender/blenkernel/intern/displist.c11
-rw-r--r--source/blender/blenkernel/intern/fcurve.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.c24
-rw-r--r--source/blender/blenkernel/intern/particle.c4
-rw-r--r--source/blender/blenkernel/intern/particle_system.c4
-rw-r--r--source/blender/blenkernel/intern/scene.c1
-rw-r--r--source/blender/blenkernel/intern/screen.c18
-rw-r--r--source/blender/blenkernel/intern/sequencer.c6
-rw-r--r--source/blender/blenkernel/intern/softbody.c36
-rw-r--r--source/blender/blenkernel/intern/text.c51
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c122
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h2
-rw-r--r--source/blender/blenlib/BLI_path_util.h7
-rw-r--r--source/blender/blenlib/BLI_string.h10
-rw-r--r--source/blender/blenlib/CMakeLists.txt7
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c4
-rw-r--r--source/blender/blenlib/intern/bpath.c307
-rw-r--r--source/blender/blenlib/intern/edgehash.c2
-rw-r--r--source/blender/blenlib/intern/math_base.c2
-rw-r--r--source/blender/blenlib/intern/math_color.c4
-rw-r--r--source/blender/blenlib/intern/math_matrix.c6
-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/CMakeLists.txt5
-rw-r--r--source/blender/blenloader/intern/readfile.c165
-rw-r--r--source/blender/blenloader/intern/writefile.c4
-rw-r--r--source/blender/blenpluginapi/CMakeLists.txt8
-rw-r--r--source/blender/collada/CMakeLists.txt10
-rw-r--r--source/blender/editors/animation/CMakeLists.txt5
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c8
-rw-r--r--source/blender/editors/animation/anim_ops.c9
-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/CMakeLists.txt5
-rw-r--r--source/blender/editors/armature/editarmature.c55
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c14
-rw-r--r--source/blender/editors/armature/poselib.c2
-rw-r--r--source/blender/editors/armature/poseobject.c2
-rw-r--r--source/blender/editors/curve/CMakeLists.txt6
-rw-r--r--source/blender/editors/curve/editcurve.c22
-rw-r--r--source/blender/editors/datafiles/CMakeLists.txt10
-rw-r--r--source/blender/editors/gpencil/CMakeLists.txt5
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c23
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c41
-rw-r--r--source/blender/editors/include/ED_keyframing.h2
-rw-r--r--source/blender/editors/include/ED_view3d.h164
-rw-r--r--source/blender/editors/interface/CMakeLists.txt5
-rw-r--r--source/blender/editors/interface/interface.c17
-rw-r--r--source/blender/editors/interface/interface_handlers.c9
-rw-r--r--source/blender/editors/interface/interface_layout.c3
-rw-r--r--source/blender/editors/interface/view2d.c12
-rw-r--r--source/blender/editors/interface/view2d_ops.c13
-rw-r--r--source/blender/editors/mesh/CMakeLists.txt5
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c4
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c16
-rw-r--r--source/blender/editors/metaball/CMakeLists.txt6
-rw-r--r--source/blender/editors/object/CMakeLists.txt6
-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.c14
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/physics/CMakeLists.txt7
-rw-r--r--source/blender/editors/physics/particle_edit.c27
-rw-r--r--source/blender/editors/render/CMakeLists.txt8
-rw-r--r--source/blender/editors/render/render_opengl.c2
-rw-r--r--source/blender/editors/screen/CMakeLists.txt5
-rw-r--r--source/blender/editors/screen/area.c8
-rw-r--r--source/blender/editors/screen/screen_edit.c4
-rw-r--r--source/blender/editors/screen/screen_ops.c9
-rw-r--r--source/blender/editors/sculpt_paint/CMakeLists.txt5
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c51
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h6
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c10
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c391
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c17
-rw-r--r--source/blender/editors/sound/CMakeLists.txt6
-rw-r--r--source/blender/editors/space_action/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_action/action_select.c21
-rw-r--r--source/blender/editors/space_api/CMakeLists.txt6
-rw-r--r--source/blender/editors/space_buttons/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c13
-rw-r--r--source/blender/editors/space_console/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_file/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_file/file_ops.c4
-rw-r--r--source/blender/editors/space_file/space_file.c2
-rw-r--r--source/blender/editors/space_graph/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_graph/graph_draw.c2
-rw-r--r--source/blender/editors/space_graph/graph_ops.c11
-rw-r--r--source/blender/editors/space_graph/graph_select.c43
-rw-r--r--source/blender/editors/space_graph/space_graph.c15
-rw-r--r--source/blender/editors/space_image/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_image/image_ops.c5
-rw-r--r--source/blender/editors/space_image/space_image.c28
-rw-r--r--source/blender/editors/space_info/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_logic/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_logic/space_logic.c13
-rw-r--r--source/blender/editors/space_nla/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_nla/nla_channels.c8
-rw-r--r--source/blender/editors/space_nla/nla_select.c21
-rw-r--r--source/blender/editors/space_nla/space_nla.c17
-rw-r--r--source/blender/editors/space_node/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_node/drawnode.c2
-rw-r--r--source/blender/editors/space_node/node_edit.c17
-rw-r--r--source/blender/editors/space_node/node_select.c22
-rw-r--r--source/blender/editors/space_node/node_state.c10
-rw-r--r--source/blender/editors/space_node/space_node.c13
-rw-r--r--source/blender/editors/space_outliner/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_outliner/outliner.c16
-rw-r--r--source/blender/editors/space_script/CMakeLists.txt8
-rw-r--r--source/blender/editors/space_sequencer/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c8
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c8
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c19
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c13
-rw-r--r--source/blender/editors/space_sound/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_text/CMakeLists.txt8
-rw-r--r--source/blender/editors/space_text/text_header.c14
-rw-r--r--source/blender/editors/space_text/text_ops.c8
-rw-r--r--source/blender/editors/space_time/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_time/space_time.c12
-rw-r--r--source/blender/editors/space_userpref/CMakeLists.txt6
-rw-r--r--source/blender/editors/space_view3d/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_view3d/drawobject.c22
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c21
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c51
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c295
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c17
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h6
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c17
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c109
-rw-r--r--source/blender/editors/transform/CMakeLists.txt5
-rw-r--r--source/blender/editors/transform/transform.c21
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_conversions.c6
-rw-r--r--source/blender/editors/transform/transform_generics.c4
-rw-r--r--source/blender/editors/transform/transform_input.c5
-rw-r--r--source/blender/editors/transform/transform_manipulator.c4
-rw-r--r--source/blender/editors/transform/transform_snap.c12
-rw-r--r--source/blender/editors/util/CMakeLists.txt6
-rw-r--r--source/blender/editors/util/undo.c2
-rw-r--r--source/blender/editors/uvedit/CMakeLists.txt5
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c31
-rw-r--r--source/blender/gpu/CMakeLists.txt5
-rw-r--r--source/blender/gpu/intern/gpu_material.c4
-rw-r--r--source/blender/ikplugin/CMakeLists.txt14
-rw-r--r--source/blender/imbuf/CMakeLists.txt23
-rw-r--r--source/blender/imbuf/SConscript2
-rw-r--r--source/blender/imbuf/intern/IMB_anim.h2
-rw-r--r--source/blender/imbuf/intern/anim_movie.c56
-rw-r--r--source/blender/imbuf/intern/cineon/CMakeLists.txt22
-rw-r--r--source/blender/imbuf/intern/dds/CMakeLists.txt8
-rw-r--r--source/blender/imbuf/intern/imageprocess.c2
-rw-r--r--source/blender/imbuf/intern/md5.h2
-rw-r--r--source/blender/imbuf/intern/openexr/CMakeLists.txt8
-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/DNA_userdef_types.h2
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h2
-rw-r--r--source/blender/makesdna/intern/CMakeLists.txt7
-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/CMakeLists.txt14
-rw-r--r--source/blender/makesrna/intern/makesrna.c2
-rw-r--r--source/blender/makesrna/intern/rna_ID.c6
-rw-r--r--source/blender/makesrna/intern/rna_access.c48
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c2
-rw-r--r--source/blender/makesrna/intern/rna_armature.c6
-rw-r--r--source/blender/makesrna/intern/rna_brush.c29
-rw-r--r--source/blender/makesrna/intern/rna_cloth.c6
-rw-r--r--source/blender/makesrna/intern/rna_color.c4
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c6
-rw-r--r--source/blender/makesrna/intern/rna_curve.c4
-rw-r--r--source/blender/makesrna/intern/rna_define.c10
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c4
-rw-r--r--source/blender/makesrna/intern/rna_image.c14
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c6
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c2
-rw-r--r--source/blender/makesrna/intern/rna_main.c5
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c42
-rw-r--r--source/blender/makesrna/intern/rna_material.c6
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c22
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c2
-rw-r--r--source/blender/makesrna/intern/rna_nla.c4
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c10
-rw-r--r--source/blender/makesrna/intern/rna_object.c24
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c22
-rw-r--r--source/blender/makesrna/intern/rna_particle.c12
-rw-r--r--source/blender/makesrna/intern/rna_pose.c6
-rw-r--r--source/blender/makesrna/intern/rna_render.c2
-rw-r--r--source/blender/makesrna/intern/rna_rna.c6
-rw-r--r--source/blender/makesrna/intern/rna_scene.c33
-rw-r--r--source/blender/makesrna/intern/rna_screen.c59
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c8
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c2
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c29
-rw-r--r--source/blender/makesrna/intern/rna_sequencer_api.c6
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c42
-rw-r--r--source/blender/makesrna/intern/rna_texture.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui.c6
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c16
-rw-r--r--source/blender/makesrna/intern/rna_wm.c17
-rw-r--r--source/blender/makesrna/intern/rna_world.c8
-rw-r--r--source/blender/modifiers/CMakeLists.txt9
-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/modifiers/intern/MOD_uvproject.c10
-rw-r--r--source/blender/nodes/CMakeLists.txt9
-rw-r--r--source/blender/python/generic/CMakeLists.txt5
-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.c126
-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/CMakeLists.txt5
-rw-r--r--source/blender/python/intern/bpy.c20
-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/quicktime/CMakeLists.txt41
-rw-r--r--source/blender/render/CMakeLists.txt9
-rw-r--r--source/blender/render/intern/source/shadeinput.c4
-rw-r--r--source/blender/windowmanager/CMakeLists.txt20
-rw-r--r--source/blender/windowmanager/SConscript5
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/intern/wm_apple.c8
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c18
-rw-r--r--source/blender/windowmanager/intern/wm_files.c2
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c11
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c16
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c57
-rw-r--r--source/blender/windowmanager/intern/wm_window.c2
272 files changed, 3015 insertions, 2401 deletions
diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt
index 77a43e5560e..b62e0cc5afd 100644
--- a/source/blender/avi/CMakeLists.txt
+++ b/source/blender/avi/CMakeLists.txt
@@ -27,6 +27,9 @@
set(INC
.
../../../intern/guardedalloc
+)
+
+set(INC_SYS
${JPEG_INCLUDE_DIR}
)
@@ -47,4 +50,4 @@ set(SRC
intern/rgb32.h
)
-blender_add_lib(bf_avi "${SRC}" "${INC}")
+blender_add_lib(bf_avi "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
index 48ee4aed033..b915764c1bb 100644
--- a/source/blender/blenfont/CMakeLists.txt
+++ b/source/blender/blenfont/CMakeLists.txt
@@ -29,6 +29,9 @@ set(INC
../editors/include
../blenkernel
../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
${FREETYPE_INCLUDE_DIRS}
)
@@ -47,7 +50,7 @@ set(SRC
)
if(WITH_INTERNATIONAL)
- list(APPEND INC ${GETTEXT_INC})
+ list(APPEND INC_SYS ${GETTEXT_INC})
add_definitions(-DINTERNATIONAL)
endif()
@@ -55,5 +58,5 @@ if(WIN32 AND NOT UNIX)
add_definitions(-DUSE_GETTEXT_DLL)
endif()
-blender_add_lib(bf_blenfont "${SRC}" "${INC}")
+blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}")
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_screen.h b/source/blender/blenkernel/BKE_screen.h
index 56b0cd63e01..bc443b4a3a6 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -246,6 +246,9 @@ void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene);
void BKE_screen_view3d_scene_sync(struct bScreen *sc);
void BKE_screen_view3d_main_sync(ListBase *screen_lb, struct Scene *scene);
+/* zoom factor conversion */
+float BKE_screen_view3d_zoom_to_fac(float camzoom);
+float BKE_screen_view3d_zoom_from_fac(float zoomfac);
/* screen */
void free_screen(struct bScreen *sc);
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/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index 20e5bc27146..bf80b033fbd 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -91,12 +91,12 @@ void txt_backspace_word (struct Text *text);
int txt_add_char (struct Text *text, char add);
int txt_add_raw_char (struct Text *text, char add);
int txt_replace_char (struct Text *text, char add);
-void txt_export_to_object (struct Text *text);
+void txt_export_to_object(struct Text *text);
void txt_export_to_objects(struct Text *text);
-void unindent (struct Text *text);
-void comment (struct Text *text);
-void indent (struct Text *text);
-void uncomment (struct Text *text);
+void txt_unindent (struct Text *text);
+void txt_comment (struct Text *text);
+void txt_indent (struct Text *text);
+void txt_uncomment (struct Text *text);
int setcurr_tab_spaces (struct Text *text, int space);
void txt_add_marker (struct Text *text, struct TextLine *line, int start, int end, const unsigned char color[4], int group, int flags);
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 2831636361f..5078657588d 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
@@ -54,6 +55,9 @@ set(INC
../../../intern/smoke/extern
../../../intern/mikktspace
../../../source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
${ZLIB_INCLUDE_DIRS}
)
@@ -268,17 +272,19 @@ if(WITH_IMAGE_HDR)
endif()
if(WITH_CODEC_QUICKTIME)
- list(APPEND INC ../quicktime ${QUICKTIME_INC})
+ list(APPEND INC ../quicktime)
+ list(APPEND INC_SYS ${QUICKTIME_INC})
add_definitions(-DWITH_QUICKTIME)
endif()
if(WITH_CODEC_FFMPEG)
- list(APPEND INC ${FFMPEG_INC})
+ list(APPEND INC_SYS ${FFMPEG_INC})
add_definitions(-DWITH_FFMPEG)
endif()
if(WITH_PYTHON)
- list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS})
+ list(APPEND INC ../python)
+ list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS})
add_definitions(-DWITH_PYTHON)
if(WITH_PYTHON_SECURITY)
@@ -299,12 +305,12 @@ if(WITH_JACK)
endif()
if(WITH_LZO)
- list(APPEND INC ../../../extern/lzo/minilzo)
+ list(APPEND INC_SYS ../../../extern/lzo/minilzo)
add_definitions(-DWITH_LZO)
endif()
if(WITH_LZMA)
- list(APPEND INC ../../../extern/lzma)
+ list(APPEND INC_SYS ../../../extern/lzma)
add_definitions(-DWITH_LZMA)
endif()
@@ -312,4 +318,4 @@ if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
endif()
-blender_add_lib(bf_blenkernel "${SRC}" "${INC}")
+blender_add_lib(bf_blenkernel "${SRC}" "${INC}" "${INC_SYS}")
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.c b/source/blender/blenkernel/intern/anim.c
index e12ec559f4b..1763866c000 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1206,7 +1206,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
float tmat[4][4], mat[4][4], pamat[4][4], vec[3], size=0.0;
float (*obmat)[4], (*oldobmat)[4];
int a, b, counter, hair = 0;
- int totpart, totchild, totgroup=0, pa_num;
+ int totpart, totchild, totgroup=0 /*, pa_num */;
int no_draw_flag = PARS_UNEXIST;
@@ -1323,7 +1323,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
if(pa->flag & no_draw_flag)
continue;
- pa_num = pa->num;
+ /* pa_num = pa->num; */ /* UNUSED */
pa_time = pa->time;
size = pa->size;
}
@@ -1331,7 +1331,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
/* handle child particle */
cpa = &psys->child[a - totpart];
- pa_num = a;
+ /* pa_num = a; */ /* UNUSED */
pa_time = psys->particles[cpa->parent].time;
size = psys_get_child_size(psys, cpa, ctime, NULL);
}
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index f17d362f237..d9d9aa204b4 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1045,6 +1045,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)
{
@@ -1076,9 +1079,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)
@@ -1869,9 +1872,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/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 845f1bc13e8..b12ab30a5bc 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -1189,7 +1189,7 @@ DagNodeQueue * graph_dfs(void)
int skip = 0;
int minheight;
int maxpos=0;
- int is_cycle = 0;
+ /* int is_cycle = 0; */ /* UNUSED */
/*
*fprintf(stderr,"starting DFS \n ------------\n");
*/
@@ -1245,7 +1245,7 @@ DagNodeQueue * graph_dfs(void)
} else {
if (itA->node->color == DAG_GRAY) { // back edge
fprintf(stderr,"dfs back edge :%15s %15s \n",((ID *) node->ob)->name, ((ID *) itA->node->ob)->name);
- is_cycle = 1;
+ /* is_cycle = 1; */ /* UNUSED */
} else if (itA->node->color == DAG_BLACK) {
;
/* already processed node but we may want later to change distance either to shorter to longer.
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 54e4bf08ee7..9aa794aa97e 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -332,19 +332,12 @@ void fastshade_free_render(void)
}
}
-static int fastshade_customdata_layer_num(int n, int active)
-{
- /* make the active layer the first */
- if (n == active) return 0;
- else if (n < active) return n+1;
- else return n;
-}
static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma)
{
CustomDataLayer *layer;
MTFace *mtface;
- int index, n, needuv= ma->texco & TEXCO_UV;
+ int index, needuv= ma->texco & TEXCO_UV;
char *vertcol;
shi.totuv= 0;
@@ -354,7 +347,6 @@ static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma)
layer= &fdata->layers[index];
if(needuv && layer->type == CD_MTFACE && shi.totuv < MAX_MTFACE) {
- n= fastshade_customdata_layer_num(shi.totuv, layer->active_rnd);
mtface= &((MTFace*)layer->data)[a];
shi.uv[shi.totuv].uv[0]= 2.0f*mtface->uv[j][0]-1.0f;
@@ -365,7 +357,6 @@ static void fastshade_customdata(CustomData *fdata, int a, int j, Material *ma)
shi.totuv++;
}
else if(layer->type == CD_MCOL && shi.totcol < MAX_MCOL) {
- n= fastshade_customdata_layer_num(shi.totcol, layer->active_rnd);
vertcol= (char*)&((MCol*)layer->data)[a*4 + j];
shi.col[shi.totcol].col[0]= ((float)vertcol[3])/255.0f;
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index b1272ee2d53..d6a9d950015 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2039,7 +2039,7 @@ float evaluate_fcurve (FCurve *fcu, float evaltime)
* here so that the curve can be sampled correctly
*/
if (fcu->flag & FCURVE_INT_VALUES)
- cvalue= (float)((int)cvalue);
+ cvalue= floorf(cvalue + 0.5f);
/* return evaluated value */
return cvalue;
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 b8f2e0f9b9f..ca451cff0f3 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1661,12 +1661,6 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
/* there is also a timing calculation in drawobject() */
-static int no_speed_curve= 0;
-
-void disable_speed_curve(int val)
-{
- no_speed_curve= val;
-}
// XXX THIS CRUFT NEEDS SERIOUS RECODING ASAP!
/* ob can be NULL */
@@ -1783,7 +1777,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);
}
@@ -3056,9 +3050,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 */
@@ -3094,7 +3093,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/particle.c b/source/blender/blenkernel/intern/particle.c
index 5ec4c36177f..d0fee1d5bd5 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3057,7 +3057,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
ParticleKey result;
float birthtime = 0.0f, dietime = 0.0f;
- float t, time = 0.0f, keytime = 0.0f, frs_sec;
+ float t, time = 0.0f, keytime = 0.0f /*, frs_sec */;
float hairmat[4][4], rotmat[3][3], prev_tangent[3] = {0.0f, 0.0f, 0.0f};
int k, i;
int steps = (int)pow(2.0, (double)pset->draw_step);
@@ -3078,7 +3078,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
recalc_set = 1;
}
- frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f;
+ /* frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f; */ /* UNUSED */
if(pset->brushtype == PE_BRUSH_WEIGHT) {
;/* use weight painting colors now... */
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 6b1540d7d53..fca8d470dc1 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -890,7 +890,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
if(ctx->tree){
KDTreeNearest ptn[10];
int w,maxw;//, do_seams;
- float maxd,mind,/*dd,*/totw= 0.0f;
+ float maxd /*, mind,dd */, totw= 0.0f;
int parent[10];
float pweight[10];
@@ -899,7 +899,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
maxw = BLI_kdtree_find_n_nearest(ctx->tree,4,orco1,NULL,ptn);
maxd=ptn[maxw-1].dist;
- mind=ptn[0].dist;
+ /* mind=ptn[0].dist; */ /* UNUSED */
/* the weights here could be done better */
for(w=0; w<maxw; w++){
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 81cffe7a182..01ced7307a3 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -468,6 +468,7 @@ Scene *add_scene(const char *name)
sce->r.ffcodecdata.audio_mixrate = 44100;
sce->r.ffcodecdata.audio_volume = 1.0f;
+ sce->r.ffcodecdata.audio_bitrate = 192;
BLI_strncpy(sce->r.engine, "BLENDER_RENDER", sizeof(sce->r.engine));
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 63e35408381..50b3e32278a 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -31,6 +31,7 @@
* \ingroup bke
*/
+#include "BLI_winstuff.h"
#include <string.h>
#include <stdio.h>
@@ -416,3 +417,20 @@ void BKE_screen_view3d_main_sync(ListBase *screen_lb, Scene *scene)
}
}
+/* magic zoom calculation, no idea what
+ * it signifies, if you find out, tell me! -zr
+ */
+
+/* simple, its magic dude!
+ * well, to be honest, this gives a natural feeling zooming
+ * with multiple keypad presses (ton)
+ */
+float BKE_screen_view3d_zoom_to_fac(float camzoom)
+{
+ return powf(((float)M_SQRT2 + camzoom/50.0f), 2.0f) / 4.0f;
+}
+
+float BKE_screen_view3d_zoom_from_fac(float zoomfac)
+{
+ return ((sqrtf(4.0f * zoomfac) - (float)M_SQRT2) * 50.0f);
+}
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/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 30d2816769c..ff238678eeb 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -640,7 +640,7 @@ static void add_mesh_quad_diag_springs(Object *ob)
{
Mesh *me= ob->data;
MFace *mface= me->mface;
- BodyPoint *bp;
+ /*BodyPoint *bp;*/ /*UNUSED*/
BodySpring *bs, *bs_new;
int a ;
@@ -661,7 +661,7 @@ static void add_mesh_quad_diag_springs(Object *ob)
/* fill the tail */
a = 0;
bs = bs_new+ob->soft->totspring;
- bp= ob->soft->bpoint;
+ /*bp= ob->soft->bpoint; */ /*UNUSED*/
if(mface ) {
for(a=me->totface; a>0; a--, mface++) {
if(mface->v4) {
@@ -1042,7 +1042,10 @@ static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int
GHash *hash;
GHashIterator *ihash;
float aabbmin[3],aabbmax[3];
- int a, deflected=0;
+ int deflected=0;
+#if 0
+ int a;
+#endif
if ((sb == NULL) || (sb->scratch ==NULL)) return 0;
VECCOPY(aabbmin,sb->scratch->aabbmin);
@@ -1056,17 +1059,20 @@ static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int
ob = BLI_ghashIterator_getKey (ihash);
/* only with deflecting set */
if(ob->pd && ob->pd->deflect) {
+#if 0 /* UNUSED */
MFace *mface= NULL;
MVert *mvert= NULL;
MVert *mprevvert= NULL;
ccdf_minmax *mima= NULL;
+#endif
if(ccdm){
+#if 0 /* UNUSED */
mface= ccdm->mface;
mvert= ccdm->mvert;
mprevvert= ccdm->mprevvert;
mima= ccdm->mima;
a = ccdm->totface;
-
+#endif
if ((aabbmax[0] < ccdm->bbmin[0]) ||
(aabbmax[1] < ccdm->bbmin[1]) ||
(aabbmax[2] < ccdm->bbmin[2]) ||
@@ -2095,19 +2101,25 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
float dir[3],dvel[3];
float distance,forcefactor,kd,absvel,projvel,kw;
+#if 0 /* UNUSED */
int ia,ic;
+#endif
/* prepare depending on which side of the spring we are on */
if (bpi == bs->v1){
bp1 = &sb->bpoint[bs->v1];
bp2 = &sb->bpoint[bs->v2];
+#if 0 /* UNUSED */
ia =3*bs->v1;
ic =3*bs->v2;
+#endif
}
else if (bpi == bs->v2){
bp1 = &sb->bpoint[bs->v2];
bp2 = &sb->bpoint[bs->v1];
+#if 0 /* UNUSED */
ia =3*bs->v2;
ic =3*bs->v1;
+#endif
}
else{
/* TODO make this debug option */
@@ -2454,23 +2466,23 @@ static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, fl
* this will ruin adaptive stepsize AKA heun! (BM)
*/
SoftBody *sb= ob->soft; /* is supposed to be there */
- BodyPoint *bproot;
+ /*BodyPoint *bproot;*/ /* UNUSED */
ListBase *do_effector = NULL;
- float gravity;
+ /* float gravity; */ /* UNUSED */
/* float iks; */
float fieldfactor = -1.0f, windfactor = 0.25;
- int do_deflector,do_selfcollision,do_springcollision,do_aero;
+ int do_deflector /*,do_selfcollision*/ ,do_springcollision,do_aero;
- gravity = sb->grav * sb_grav_force_scale(ob);
+ /* gravity = sb->grav * sb_grav_force_scale(ob); */ /* UNUSED */
/* check conditions for various options */
do_deflector= query_external_colliders(scene, ob);
- do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF));
+ /* do_selfcollision=((ob->softflag & OB_SB_EDGES) && (sb->bspring)&& (ob->softflag & OB_SB_SELF)); */ /* UNUSED */
do_springcollision=do_deflector && (ob->softflag & OB_SB_EDGES) &&(ob->softflag & OB_SB_EDGECOLL);
do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES));
/* iks = 1.0f/(1.0f-sb->inspring)-1.0f; */ /* inner spring constants function */ /* UNUSED */
- bproot= sb->bpoint; /* need this for proper spring addressing */
+ /* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */
if (do_springcollision || do_aero)
sb_sfesf_threads_run(scene, ob, timenow,sb->totspring,NULL);
@@ -2516,7 +2528,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
*/
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp;
- BodyPoint *bproot;
+ /* BodyPoint *bproot; */ /* UNUSED */
BodySpring *bs;
ListBase *do_effector = NULL;
float iks, ks, kd, gravity[3] = {0.0f,0.0f,0.0f};
@@ -2547,7 +2559,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
do_aero=((sb->aeroedge)&& (ob->softflag & OB_SB_EDGES));
iks = 1.0f/(1.0f-sb->inspring)-1.0f ;/* inner spring constants function */
- bproot= sb->bpoint; /* need this for proper spring addressing */
+ /* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */
if (do_springcollision || do_aero) scan_for_ext_spring_forces(scene, ob, timenow);
/* after spring scan because it uses Effoctors too */
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 512914e2c52..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);
@@ -1894,13 +1891,13 @@ void txt_do_undo(Text *text)
if (op==UNDO_INDENT) {
- unindent(text);
+ txt_unindent(text);
} else if (op== UNDO_UNINDENT) {
- indent(text);
+ txt_indent(text);
} else if (op == UNDO_COMMENT) {
- uncomment(text);
+ txt_uncomment(text);
} else if (op == UNDO_UNCOMMENT) {
- comment(text);
+ txt_comment(text);
}
text->undo_pos--;
@@ -2110,13 +2107,13 @@ void txt_do_redo(Text *text)
}
if (op==UNDO_INDENT) {
- indent(text);
+ txt_indent(text);
} else if (op== UNDO_UNINDENT) {
- unindent(text);
+ txt_unindent(text);
} else if (op == UNDO_COMMENT) {
- comment(text);
+ txt_comment(text);
} else if (op == UNDO_UNCOMMENT) {
- uncomment(text);
+ txt_uncomment(text);
}
break;
default:
@@ -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;
@@ -2501,7 +2498,7 @@ int txt_replace_char (Text *text, char add)
return 1;
}
-void indent(Text *text)
+void txt_indent(Text *text)
{
int len, num;
char *tmp;
@@ -2512,7 +2509,7 @@ void 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;
@@ -2564,7 +2561,7 @@ void indent(Text *text)
}
}
-void unindent(Text *text)
+void txt_unindent(Text *text)
{
int num = 0;
const char *remove = "\t";
@@ -2573,7 +2570,7 @@ void 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;
@@ -2622,7 +2619,7 @@ void unindent(Text *text)
}
}
-void comment(Text *text)
+void txt_comment(Text *text)
{
int len, num;
char *tmp;
@@ -2674,7 +2671,7 @@ void comment(Text *text)
}
}
-void uncomment(Text *text)
+void txt_uncomment(Text *text)
{
int num = 0;
char remove = '#';
@@ -2751,19 +2748,19 @@ int setcurr_tab_spaces (Text *text, int space)
* 2) within an identifier
* 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414]
*/
- int a, indent = 0;
+ int a, is_indent = 0;
for(a=0; (a < text->curc) && (text->curl->line[a] != '\0'); a++)
{
char ch= text->curl->line[a];
if (ch=='#') {
break;
} else if (ch==':') {
- indent = 1;
- } else if (ch==']' || ch=='}' || ch=='"' || ch=='\'') {
- indent = 0;
+ is_indent = 1;
+ } else if (ch!=' ' && ch!='\t') {
+ is_indent = 0;
}
}
- if (indent) {
+ if (is_indent) {
i += space;
}
}
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_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 939c4348461..d8719f399ae 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -84,7 +84,7 @@ void mul_v3_m4v3(float r[3], float M[4][4], float v[3]);
void mul_mat3_m4_v3(float M[4][4], float r[3]);
void mul_m4_v4(float M[4][4], float r[4]);
void mul_v4_m4v4(float r[4], float M[4][4], float v[4]);
-void mul_project_m4_v4(float M[4][4], float r[3]);
+void mul_project_m4_v3(float M[4][4], float vec[3]);
void mul_m3_v3(float M[3][3], float r[3]);
void mul_v3_m3v3(float r[3], float M[3][3], float a[3]);
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index dd4ae781832..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
@@ -86,7 +81,7 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check);
#ifdef WIN32
#define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s"
#define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s"
-#elif __APPLE__
+#elif defined(__APPLE__)
#define BLENDER_USER_FORMAT "%s/Blender/%s"
#define BLENDER_SYSTEM_FORMAT "%s/Blender/%s"
#else
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/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index b7827d62851..0c25da325ad 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -32,6 +32,9 @@ set(INC
../gpu
../../../intern/ghost
../../../intern/guardedalloc
+)
+
+set(INC_SYS
${ZLIB_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
)
@@ -134,12 +137,12 @@ set(SRC
)
if(WITH_BINRELOC)
+ list(APPEND INC_SYS "${BINRELOC_INC}")
add_definitions(-DWITH_BINRELOC)
- list(APPEND INC "${BINRELOC_INC}")
endif()
if(WITH_OPENMP)
add_definitions(-DPARALLEL=1)
endif()
-blender_add_lib(bf_blenlib "${SRC}" "${INC}")
+blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}")
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/bpath.c b/source/blender/blenlib/intern/bpath.c
index 63a8df3f73a..654ade8955f 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -68,21 +68,16 @@
#include "BKE_utildefines.h"
#include "BKE_report.h"
-//XXX #include "BIF_screen.h" /* only for wait cursor */
-//
-/* for sequence */
-//XXX #include "BSE_sequence.h"
-//XXX define below from BSE_sequence.h - otherwise potentially odd behaviour
-
-
-typedef struct BPathIteratorSeqData {
+typedef struct BPathIteratorSeqData
+{
int totseq;
int seq;
- struct Sequence **seqar; /* Sequence */
- struct Scene *scene; /* Current scene */
+ struct Sequence **seqar; /* Sequence */
+ struct Scene *scene; /* Current scene */
} BPathIteratorSeqData;
-typedef struct BPathIterator {
+typedef struct BPathIterator
+{
char* _path; /* never access directly, use BLI_bpathIterator_getPath */
const char* _lib;
const char* _name;
@@ -94,7 +89,7 @@ typedef struct BPathIterator {
void (*setpath_callback)(struct BPathIterator *, const char *);
void (*getpath_callback)(struct BPathIterator *, char *);
- const char* base_path; /* base path, the directry the blend file is in - normally bmain->name */
+ const char* base_path; /* base path, the directory the blend file is in - normally bmain->name */
Main *bmain;
@@ -116,7 +111,7 @@ enum BPathTypes {
BPATH_SEQ,
BPATH_CDATA,
- BPATH_DONE
+ BPATH_DONE
};
void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const char *basedir, const int flag)
@@ -128,10 +123,10 @@ void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const ch
bpi->type= BPATH_IMAGE;
bpi->data= NULL;
-
+
bpi->getpath_callback= NULL;
bpi->setpath_callback= NULL;
-
+
/* Sequencer specific */
bpi->seqdata.totseq= 0;
bpi->seqdata.seq= 0;
@@ -147,62 +142,75 @@ void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const ch
}
#if 0
-static void BLI_bpathIterator_alloc(struct BPathIterator **bpi) {
+static void BLI_bpathIterator_alloc(struct BPathIterator **bpi)
+{
*bpi= MEM_mallocN(sizeof(BPathIterator), "BLI_bpathIterator_alloc");
}
#endif
-void BLI_bpathIterator_free(struct BPathIterator *bpi) {
+void BLI_bpathIterator_free(struct BPathIterator *bpi)
+{
if (bpi->seqdata.seqar)
MEM_freeN((void *)bpi->seqdata.seqar);
bpi->seqdata.seqar= NULL;
bpi->seqdata.scene= NULL;
-
+
MEM_freeN(bpi);
}
-void BLI_bpathIterator_getPath(struct BPathIterator *bpi, char *path) {
+void BLI_bpathIterator_getPath(struct BPathIterator *bpi, char *path)
+{
if (bpi->getpath_callback) {
bpi->getpath_callback(bpi, path);
- } else {
+ }
+ else {
strcpy(path, bpi->_path); /* warning, we assume 'path' are long enough */
}
}
-void BLI_bpathIterator_setPath(struct BPathIterator *bpi, const char *path) {
+void BLI_bpathIterator_setPath(struct BPathIterator *bpi, const char *path)
+{
if (bpi->setpath_callback) {
bpi->setpath_callback(bpi, path);
- } else {
+ }
+ else {
strcpy(bpi->_path, path); /* warning, we assume 'path' are long enough */
}
}
-void BLI_bpathIterator_getPathExpanded(struct BPathIterator *bpi, char *path_expanded) {
+void BLI_bpathIterator_getPathExpanded(struct BPathIterator *bpi, char *path_expanded)
+{
const char *libpath;
-
+
BLI_bpathIterator_getPath(bpi, path_expanded);
libpath= BLI_bpathIterator_getLib(bpi);
-
+
if (libpath) { /* check the files location relative to its library path */
BLI_path_abs(path_expanded, libpath);
- } else { /* local data, use the blend files path */
+ }
+ else { /* local data, use the blend files path */
BLI_path_abs(path_expanded, bpi->base_path);
}
BLI_cleanup_file(NULL, path_expanded);
}
-const char* BLI_bpathIterator_getLib(struct BPathIterator *bpi) {
+const char* BLI_bpathIterator_getLib(struct BPathIterator *bpi)
+{
return bpi->_lib;
}
-const char* BLI_bpathIterator_getName(struct BPathIterator *bpi) {
+const char* BLI_bpathIterator_getName(struct BPathIterator *bpi)
+{
return bpi->_name;
}
-int BLI_bpathIterator_getType(struct BPathIterator *bpi) {
+int BLI_bpathIterator_getType(struct BPathIterator *bpi)
+{
return bpi->type;
}
-unsigned int BLI_bpathIterator_getPathMaxLen(struct BPathIterator *bpi) {
+unsigned int BLI_bpathIterator_getPathMaxLen(struct BPathIterator *bpi)
+{
return bpi->len;
}
-const char* BLI_bpathIterator_getBasePath(struct BPathIterator *bpi) {
+const char* BLI_bpathIterator_getBasePath(struct BPathIterator *bpi)
+{
return bpi->base_path;
}
@@ -211,10 +219,10 @@ static struct Image *ima_stepdata__internal(struct Image *ima, const int step_ne
{
if (ima==NULL)
return NULL;
-
+
if (step_next)
ima= ima->id.next;
-
+
while (ima) {
if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
if(ima->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
@@ -223,7 +231,7 @@ static struct Image *ima_stepdata__internal(struct Image *ima, const int step_ne
}
/* image is not a image with a path, skip it */
ima= ima->id.next;
- }
+ }
return ima;
}
@@ -240,7 +248,7 @@ static struct Tex *tex_stepdata__internal(struct Tex *tex, const int step_next,
break;
/* image is not a image with a path, skip it */
tex= tex->id.next;
- }
+ }
return tex;
}
@@ -257,7 +265,7 @@ static struct Text *text_stepdata__internal(struct Text *text, const int step_ne
break;
/* image is not a image with a path, skip it */
text= text->id.next;
- }
+ }
return text;
}
@@ -265,20 +273,20 @@ static struct VFont *vf_stepdata__internal(struct VFont *vf, const int step_next
{
if (vf==NULL)
return NULL;
-
+
if (step_next)
vf= vf->id.next;
-
+
while (vf) {
if (strcmp(vf->name, FO_BUILTIN_NAME)!=0) {
if(vf->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
break;
}
}
-
+
/* font with no path, skip it */
vf= vf->id.next;
- }
+ }
return vf;
}
@@ -286,10 +294,10 @@ static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next,
{
if (snd==NULL)
return NULL;
-
+
if (step_next)
snd= snd->id.next;
-
+
while (snd) {
if(snd->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
break;
@@ -297,7 +305,7 @@ static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next,
/* font with no path, skip it */
snd= snd->id.next;
- }
+ }
return snd;
}
@@ -305,16 +313,16 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
{
Editing *ed;
Sequence *seq;
-
+
/* Initializing */
if (bpi->seqdata.scene==NULL) {
bpi->seqdata.scene= bpi->bmain->scene.first;
}
-
+
if (step_next) {
bpi->seqdata.seq++;
}
-
+
while (bpi->seqdata.scene) {
ed= seq_give_editing(bpi->seqdata.scene, 0);
if (ed) {
@@ -323,10 +331,11 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
seq_array(ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0);
bpi->seqdata.seq= 0;
}
-
+
if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
seq= NULL;
- } else {
+ }
+ else {
seq= bpi->seqdata.seqar[bpi->seqdata.seq];
while (!SEQ_HAS_PATH(seq) && seq->plugin==NULL) {
bpi->seqdata.seq++;
@@ -339,7 +348,8 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
}
if (seq) {
return seq;
- } else {
+ }
+ else {
/* keep looking through the next scene, reallocate seq array */
if (bpi->seqdata.seqar) {
MEM_freeN((void *)bpi->seqdata.seqar);
@@ -347,19 +357,21 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
}
bpi->seqdata.scene= bpi->seqdata.scene->id.next;
}
- } else {
+ }
+ else {
/* no seq data in this scene, next */
bpi->seqdata.scene= bpi->seqdata.scene->id.next;
}
}
-
+
return NULL;
}
-static void seq_getpath(struct BPathIterator *bpi, char *path) {
+static void seq_getpath(struct BPathIterator *bpi, char *path)
+{
Sequence *seq= (Sequence *)bpi->data;
-
+
path[0]= '\0'; /* incase we cant get the path */
if (seq==NULL) return;
if (SEQ_HAS_PATH(seq)) {
@@ -369,7 +381,7 @@ static void seq_getpath(struct BPathIterator *bpi, char *path) {
if (seq->strip->stripdata) { /* should always be true! */
/* Using the first image is weak for image sequences */
strcat(path, seq->strip->stripdata->name);
- }
+ }
}
else {
/* simple case */
@@ -381,10 +393,11 @@ static void seq_getpath(struct BPathIterator *bpi, char *path) {
}
}
-static void seq_setpath(struct BPathIterator *bpi, const char *path) {
+static void seq_setpath(struct BPathIterator *bpi, const char *path)
+{
Sequence *seq= (Sequence *)bpi->data;
- if (seq==NULL) return;
-
+ if (seq==NULL) return;
+
if (SEQ_HAS_PATH(seq)) {
if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) {
BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name);
@@ -399,7 +412,8 @@ static void seq_setpath(struct BPathIterator *bpi, const char *path) {
}
}
-static void text_getpath(struct BPathIterator *bpi, char *path) {
+static void text_getpath(struct BPathIterator *bpi, char *path)
+{
Text *text= (Text *)bpi->data;
path[0]= '\0'; /* incase we cant get the path */
if(text->name) {
@@ -407,9 +421,10 @@ static void text_getpath(struct BPathIterator *bpi, char *path) {
}
}
-static void text_setpath(struct BPathIterator *bpi, const char *path) {
+static void text_setpath(struct BPathIterator *bpi, const char *path)
+{
Text *text= (Text *)bpi->data;
- if (text==NULL) return;
+ if (text==NULL) return;
if(text->name) {
MEM_freeN(text->name);
@@ -418,27 +433,29 @@ static void text_setpath(struct BPathIterator *bpi, const char *path) {
text->name= BLI_strdup(path);
}
-static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next) {
+static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next)
+{
if (me==NULL)
return NULL;
-
+
if (step_next)
me= me->id.next;
-
+
while (me) {
if (me->fdata.external) {
break;
}
-
+
me= me->id.next;
- }
+ }
return me;
}
-static void bpi_type_step__internal(struct BPathIterator *bpi) {
+static void bpi_type_step__internal(struct BPathIterator *bpi)
+{
bpi->type++; /* advance to the next type */
bpi->data= NULL;
-
+
switch (bpi->type) {
case BPATH_SEQ:
bpi->getpath_callback= seq_getpath;
@@ -455,27 +472,29 @@ static void bpi_type_step__internal(struct BPathIterator *bpi) {
}
}
-void BLI_bpathIterator_step(struct BPathIterator *bpi) {
+void BLI_bpathIterator_step(struct BPathIterator *bpi)
+{
while (bpi->type != BPATH_DONE) {
-
+
if ((bpi->type) == BPATH_IMAGE) {
/*if (bpi->data) bpi->data= ((ID *)bpi->data)->next;*/
if (bpi->data) bpi->data= ima_stepdata__internal((Image *)bpi->data, 1, bpi->flag); /* must skip images that have no path */
else bpi->data= ima_stepdata__internal(bpi->bmain->image.first, 0, bpi->flag);
-
+
if (bpi->data) {
/* get the path info from this datatype */
Image *ima= (Image *)bpi->data;
-
+
bpi->_lib= ima->id.lib ? ima->id.lib->filepath : NULL;
bpi->_path= ima->name;
bpi->_name= ima->id.name+2;
bpi->len= sizeof(ima->name);
-
+
/* we are done, advancing to the next item, this type worked fine */
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
}
@@ -502,7 +521,8 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
/* we are done, advancing to the next item, this type worked fine */
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
}
@@ -524,11 +544,11 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
/* we are done, advancing to the next item, this type worked fine */
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
}
-
else if ((bpi->type) == BPATH_SOUND) {
if (bpi->data) bpi->data= snd_stepdata__internal((bSound *)bpi->data, 1, bpi->flag); /* must skip images that have no path */
else bpi->data= snd_stepdata__internal(bpi->bmain->sound.first, 0, bpi->flag);
@@ -544,16 +564,16 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
/* we are done, advancing to the next item, this type worked fine */
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
-
-
- } else if ((bpi->type) == BPATH_FONT) {
-
+ }
+ else if ((bpi->type) == BPATH_FONT) {
+
if (bpi->data) bpi->data= vf_stepdata__internal((VFont *)bpi->data, 1, bpi->flag);
else bpi->data= vf_stepdata__internal(bpi->bmain->vfont.first, 0, bpi->flag);
-
+
if (bpi->data) {
/* get the path info from this datatype */
VFont *vf= (VFont *)bpi->data;
@@ -565,29 +585,33 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
/* we are done, advancing to the next item, this type worked fine */
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
- } else if ((bpi->type) == BPATH_LIB) {
+ }
+ else if ((bpi->type) == BPATH_LIB) {
if (bpi->data) bpi->data= ((ID *)bpi->data)->next;
else bpi->data= bpi->bmain->library.first;
-
+
if (bpi->data) {
/* get the path info from this datatype */
Library *lib= (Library *)bpi->data;
-
+
bpi->_lib= NULL;
bpi->_path= lib->name;
bpi->_name= NULL;
bpi->len= sizeof(lib->name);
-
+
/* we are done, advancing to the next item, this type worked fine */
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
- } else if ((bpi->type) == BPATH_SEQ) {
+ }
+ else if ((bpi->type) == BPATH_SEQ) {
if (bpi->data) bpi->data= seq_stepdata__internal( bpi, 1 );
else bpi->data= seq_stepdata__internal( bpi, 0 );
if (bpi->data) {
@@ -596,10 +620,12 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
bpi->_name= seq->name+2;
bpi->len= seq->plugin ? sizeof(seq->plugin->name) : sizeof(seq->strip->dir) + sizeof(seq->strip->stripdata->name);
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
- } else if ((bpi->type) == BPATH_CDATA) {
+ }
+ else if ((bpi->type) == BPATH_CDATA) {
if (bpi->data) bpi->data= cdata_stepdata__internal( bpi->data, 1 );
else bpi->data= cdata_stepdata__internal( bpi->bmain->mesh.first, 0 );
@@ -610,7 +636,8 @@ void BLI_bpathIterator_step(struct BPathIterator *bpi) {
bpi->_name= me->id.name+2;
bpi->len= sizeof(me->fdata.external->filename);
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
}
@@ -627,7 +654,7 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
const char *prefix;
const char *name;
char path_expanded[FILE_MAXDIR*2];
-
+
if(reports==NULL)
return;
@@ -660,7 +687,7 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
prefix= "Unknown";
break;
}
-
+
name= BLI_bpathIterator_getName(bpi);
BLI_bpathIterator_getPathExpanded(bpi, path_expanded);
@@ -674,14 +701,14 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
/* high level function */
void checkMissingFiles(Main *bmain, ReportList *reports) {
struct BPathIterator *bpi;
-
+
/* be sure there is low chance of the path being too short */
- char filepath_expanded[FILE_MAXDIR*2];
-
+ char filepath_expanded[FILE_MAXDIR*2];
+
BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0);
while (!BLI_bpathIterator_isDone(bpi)) {
BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
-
+
if (!BLI_exists(filepath_expanded))
bpath_as_report(bpi, "file not found", reports);
@@ -696,7 +723,7 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) {
struct BPathIterator *bpi;
char filepath[FILE_MAX];
const char *libpath;
-
+
/* be sure there is low chance of the path being too short */
char filepath_relative[(FILE_MAXDIR * 2) + FILE_MAXFILE];
@@ -709,25 +736,28 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) {
while (!BLI_bpathIterator_isDone(bpi)) {
BLI_bpathIterator_getPath(bpi, filepath);
libpath= BLI_bpathIterator_getLib(bpi);
-
+
if(strncmp(filepath, "//", 2)) {
if (libpath) { /* cant make relative if we are library - TODO, LOG THIS */
linked++;
- } else { /* local data, use the blend files path */
+ }
+ else { /* local data, use the blend files path */
BLI_strncpy(filepath_relative, filepath, sizeof(filepath_relative));
/* Important BLI_cleanup_dir runs before the path is made relative
- * because it wont work for paths that start with "//../" */
+ * because it wont work for paths that start with "//../" */
BLI_cleanup_file(bpi->base_path, filepath_relative); /* fix any /foo/../foo/ */
BLI_path_rel(filepath_relative, bpi->base_path);
/* be safe and check the length */
if (BLI_bpathIterator_getPathMaxLen(bpi) <= strlen(filepath_relative)) {
bpath_as_report(bpi, "couldn't make path relative (too long)", reports);
failed++;
- } else {
+ }
+ else {
if(strncmp(filepath_relative, "//", 2)==0) {
BLI_bpathIterator_setPath(bpi, filepath_relative);
changed++;
- } else {
+ }
+ else {
bpath_as_report(bpi, "couldn't make path relative", reports);
failed++;
}
@@ -752,7 +782,7 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
struct BPathIterator *bpi;
char filepath[FILE_MAX];
const char *libpath;
-
+
/* be sure there is low chance of the path being too short */
char filepath_absolute[(FILE_MAXDIR * 2) + FILE_MAXFILE];
@@ -765,22 +795,25 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
while (!BLI_bpathIterator_isDone(bpi)) {
BLI_bpathIterator_getPath(bpi, filepath);
libpath= BLI_bpathIterator_getLib(bpi);
-
+
if(strncmp(filepath, "//", 2)==0) {
if (libpath) { /* cant make absolute if we are library - TODO, LOG THIS */
linked++;
- } else { /* get the expanded path and check it is relative or too long */
+ }
+ else { /* get the expanded path and check it is relative or too long */
BLI_bpathIterator_getPathExpanded(bpi, filepath_absolute);
BLI_cleanup_file(bpi->base_path, filepath_absolute); /* fix any /foo/../foo/ */
/* to be safe, check the length */
if (BLI_bpathIterator_getPathMaxLen(bpi) <= strlen(filepath_absolute)) {
bpath_as_report(bpi, "couldn't make absolute (too long)", reports);
failed++;
- } else {
+ }
+ else {
if(strncmp(filepath_absolute, "//", 2)) {
BLI_bpathIterator_setPath(bpi, filepath_absolute);
changed++;
- } else {
+ }
+ else {
bpath_as_report(bpi, "couldn't make absolute", reports);
failed++;
}
@@ -811,25 +844,25 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
struct stat status;
char path[FILE_MAX];
int size;
-
+
dir= opendir(dirname);
-
+
if (dir==NULL)
return 0;
-
+
if (*filesize == -1)
*filesize= 0; /* dir opened fine */
-
+
while ((de= readdir(dir)) != NULL) {
-
+
if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0)
continue;
-
+
BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
-
+
if (stat(path, &status) != 0)
continue; /* cant stat, dont bother with this file, could print debug info here */
-
+
if (S_ISREG(status.st_mode)) { /* is file */
if (strncmp(filename, de->d_name, FILE_MAX)==0) { /* name matches */
/* open the file to read its size */
@@ -839,7 +872,8 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
BLI_strncpy(filename_new, path, FILE_MAX);
}
}
- } else if (S_ISDIR(status.st_mode)) { /* is subdir */
+ }
+ else if (S_ISDIR(status.st_mode)) { /* is subdir */
if (*recur_depth <= MAX_RECUR) {
(*recur_depth)++;
findFileRecursive(filename_new, path, filename, filesize, recur_depth);
@@ -854,54 +888,55 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
/* high level function - call from fileselector */
void findMissingFiles(Main *bmain, const char *str) {
struct BPathIterator *bpi;
-
+
/* be sure there is low chance of the path being too short */
- char filepath_expanded[FILE_MAXDIR*2];
+ char filepath_expanded[FILE_MAXDIR*2];
char filepath[FILE_MAX];
const char *libpath;
int filesize, recur_depth;
-
+
char dirname[FILE_MAX], filename_new[FILE_MAX];
-
+
//XXX waitcursor( 1 );
-
+
BLI_split_dirfile(str, dirname, NULL);
-
+
BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0);
-
+
while (!BLI_bpathIterator_isDone(bpi)) {
BLI_bpathIterator_getPath(bpi, filepath);
libpath= BLI_bpathIterator_getLib(bpi);
-
+
/* Check if esc was pressed because searching files can be slow */
/*XXX if (blender_test_break()) {
break;
}*/
-
+
if (libpath==NULL) {
-
+
BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
-
+
if (!BLI_exists(filepath_expanded)) {
/* can the dir be opened? */
filesize= -1;
recur_depth= 0;
-
+
findFileRecursive(filename_new, dirname, BLI_path_basename(filepath), &filesize, &recur_depth);
if (filesize == -1) { /* could not open dir */
printf("Could not open dir \"%s\"\n", dirname);
return;
}
-
+
if (filesize > 0) {
-
- if (BLI_bpathIterator_getPathMaxLen(bpi) < strlen(filename_new)) {
+
+ if (BLI_bpathIterator_getPathMaxLen(bpi) < strlen(filename_new)) {
printf("cannot set path \"%s\" too long!", filename_new);
- } else {
+ }
+ else {
/* copy the found path into the old one */
if (G.relbase_valid)
BLI_path_rel(filename_new, bpi->base_path);
-
+
BLI_bpathIterator_setPath(bpi, filename_new);
}
}
@@ -910,6 +945,6 @@ void findMissingFiles(Main *bmain, const char *str) {
BLI_bpathIterator_step(bpi);
}
BLI_bpathIterator_free(bpi);
-
+
//XXX waitcursor( 0 );
}
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index bcd6855f272..5108d1bbbe1 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -96,7 +96,7 @@ void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) {
eh->buckets[hash]= e;
if (++eh->nentries>eh->nbuckets*3) {
- Entry *e, **old= eh->buckets;
+ Entry **old= eh->buckets;
int i, nold= eh->nbuckets;
eh->nbuckets= hashsizes[++eh->cursize];
diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c
index 0e122a23faa..8ad93495f6d 100644
--- a/source/blender/blenlib/intern/math_base.c
+++ b/source/blender/blenlib/intern/math_base.c
@@ -34,7 +34,7 @@
#include "BLI_math.h"
/* WARNING: MSVC compiling hack for double_round() */
-#if (WIN32 || WIN64) && !(FREE_WINDOWS)
+#if (defined(WIN32) || defined(WIN64)) && !(defined(FREE_WINDOWS))
/* from python 3.1 pymath.c */
double copysign(double x, double y)
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/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 9fde87d734f..5edf6e28d4c 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -340,11 +340,9 @@ void mul_mat3_m4_v3(float mat[][4], float *vec)
vec[2]= x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2];
}
-void mul_project_m4_v4(float mat[][4], float *vec)
+void mul_project_m4_v3(float mat[][4], float vec[3])
{
- float w;
-
- w = vec[0]*mat[0][3] + vec[1]*mat[1][3] + vec[2]*mat[2][3] + mat[3][3];
+ const float w= vec[0]*mat[0][3] + vec[1]*mat[1][3] + vec[2]*mat[2][3] + mat[3][3];
mul_m4_v3(mat, vec);
vec[0] /= w;
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/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index 888cf3148e3..312a6546e22 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -32,6 +32,9 @@ set(INC
../makesrna
../render/extern/include
../../../intern/guardedalloc
+)
+
+set(INC_SYS
${ZLIB_INCLUDE_DIRS}
)
@@ -55,4 +58,4 @@ if(WITH_BUILDINFO)
add_definitions(-DNAN_BUILDINFO)
endif()
-blender_add_lib(bf_blenloader "${SRC}" "${INC}")
+blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c2a9f9aaea4..0c859aa27aa 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1084,7 +1084,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;
@@ -2119,7 +2119,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
@@ -2129,7 +2129,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 */
@@ -4167,7 +4167,6 @@ static void direct_link_object(FileData *fd, Object *ob)
bSensor *sens;
bController *cont;
bActuator *act;
- int a;
/* weak weak... this was only meant as draw flag, now is used in give_base_to_objects too */
ob->flag &= ~OB_FROMGROUP;
@@ -4267,6 +4266,7 @@ static void direct_link_object(FileData *fd, Object *ob)
sb->keys= newdataadr(fd, sb->keys);
test_pointer_array(fd, (void **)&sb->keys);
if(sb->keys) {
+ int a;
for(a=0; a<sb->totkey; a++) {
sb->keys[a]= newdataadr(fd, sb->keys[a]);
}
@@ -8426,7 +8426,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ArmatureModifierData *amd = (ArmatureModifierData*) md;
if(amd->object && amd->deformflag==0) {
Object *oba= newlibadr(fd, lib, amd->object);
- bArmature *arm= newlibadr(fd, lib, oba->data);
+ arm= newlibadr(fd, lib, oba->data);
amd->deformflag= arm->deformflag;
}
}
@@ -8573,7 +8573,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
int a;
for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a] && ma->mtex[a]->tex) {
- Tex *tex= newlibadr(fd, lib, ma->mtex[a]->tex);
+ tex= newlibadr(fd, lib, ma->mtex[a]->tex);
if(tex && tex->type==TEX_STUCCI)
ma->mtex[a]->mapto &= ~(MAP_COL|MAP_SPEC|MAP_REF);
}
@@ -8765,7 +8765,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* now, subversion control! */
if(main->subversionfile < 3) {
- bScreen *sc;
Image *ima;
Tex *tex;
@@ -9741,7 +9740,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) {
@@ -10181,7 +10180,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ToolSettings *ts;
//PTCacheID *pid;
//ListBase pidlist;
- int a;
for(ob = main->object.first; ob; ob = ob->id.next) {
//BKE_ptcache_ids_from_object(&pidlist, ob);
@@ -10220,6 +10218,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
for(ma = main->mat.first; ma; ma = ma->id.next) {
+ int a;
if(ma->mode & MA_WIRE) {
ma->material_type= MA_TYPE_WIRE;
ma->mode &= ~MA_WIRE;
@@ -11546,7 +11545,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);
@@ -12249,6 +12248,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)
@@ -12770,10 +12772,11 @@ static int object_in_any_scene(Main *mainvar, Object *ob)
}
/* when *lib set, it also does objects that were in the appended group */
-static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, int is_group_append)
+static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const short idcode, const short is_link)
{
Object *ob;
Base *base;
+ const short is_group_append= (is_link==FALSE && idcode==ID_GR);
/* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
for(ob= mainvar->object.first; ob; ob= ob->id.next) {
@@ -12792,16 +12795,20 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, int is
if(ob->id.us==0) {
do_it= 1;
}
- else if (lib==NULL) { /* appending */
- if(object_in_any_scene(mainvar, ob)==0) {
- /* when appending, make sure any indirectly loaded objects
- * get a base else they cant be accessed at all [#27437] */
- do_it= 1;
+ else if(idcode==ID_GR) {
+ if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) {
+ if((ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) {
+ do_it= 1;
+ }
}
}
- else if(ob->id.us==1 && lib) {
- if(ob->id.lib==lib && (ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) {
- do_it= 1;
+ else {
+ /* when appending, make sure any indirectly loaded objects
+ * get a base else they cant be accessed at all [#27437] */
+ if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) {
+ if(object_in_any_scene(mainvar, ob)==0) {
+ do_it= 1;
+ }
}
}
@@ -12853,29 +12860,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");
@@ -12886,47 +12886,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;
+}
+
+ID *BLO_library_append_named_part(Main *mainl, BlendHandle** bh, const char *idname, const int idcode)
+{
+ FileData *fd= (FileData*)(*bh);
+ return append_named_part(mainl, fd, idname, idcode);
}
-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_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(C, mainl, fd, idname, idcode, flag);
+ 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)
@@ -12935,8 +12955,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);
@@ -13057,21 +13077,16 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
/* give a base to loose objects. If group append, do it for objects too */
if(scene) {
+ const short is_link= (flag & FILE_LINK) != 0;
if(idcode==ID_SCE) {
/* dont instance anything when linking in scenes, assume the scene its self instances the data */
}
- else if(idcode==ID_GR) {
- if (flag & FILE_LINK) {
- give_base_to_objects(mainvar, scene, NULL, 0);
- } else {
- give_base_to_objects(mainvar, scene, curlib, 1);
- }
+ else {
+ give_base_to_objects(mainvar, scene, curlib, idcode, is_link);
if (flag & FILE_GROUP_INSTANCE) {
give_base_to_groups(mainvar, scene);
}
- } else {
- give_base_to_objects(mainvar, scene, NULL, 0);
}
}
else {
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index b7c0a292ef3..09dc659f068 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2142,8 +2142,8 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
writestruct(wd, DATA, "SpaceText", 1, sl);
}
else if(sl->spacetype==SPACE_SCRIPT) {
- SpaceScript *sc = (SpaceScript*)sl;
- sc->but_refs = NULL;
+ SpaceScript *scr = (SpaceScript*)sl;
+ scr->but_refs = NULL;
writestruct(wd, DATA, "SpaceScript", 1, sl);
}
else if(sl->spacetype==SPACE_ACTION) {
diff --git a/source/blender/blenpluginapi/CMakeLists.txt b/source/blender/blenpluginapi/CMakeLists.txt
index 1e3a3398861..c3aad25ccbe 100644
--- a/source/blender/blenpluginapi/CMakeLists.txt
+++ b/source/blender/blenpluginapi/CMakeLists.txt
@@ -34,6 +34,10 @@ set(INC
../../../intern/guardedalloc
)
+set(INC_SYS
+
+)
+
set(SRC
intern/pluginapi.c
@@ -46,8 +50,8 @@ set(SRC
)
if(WITH_CODEC_QUICKTIME)
- list(APPEND INC ${QUICKTIME_INC})
+ list(APPEND INC_SYS ${QUICKTIME_INC})
add_definitions(-DWITH_QUICKTIME)
endif()
-blender_add_lib(bf_blenpluginapi "${SRC}" "${INC}")
+blender_add_lib(bf_blenpluginapi "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt
index fa7bfee8ee5..a7e7c973f36 100644
--- a/source/blender/collada/CMakeLists.txt
+++ b/source/blender/collada/CMakeLists.txt
@@ -38,8 +38,12 @@ set(INC
../../../intern/guardedalloc
)
+set(INC_SYS
+
+)
+
if(APPLE)
- list(APPEND INC
+ list(APPEND INC_SYS
${OPENCOLLADA_INC}/COLLADAStreamWriter
${OPENCOLLADA_INC}/COLLADABaseUtils
${OPENCOLLADA_INC}/COLLADAFramework
@@ -47,7 +51,7 @@ if(APPLE)
${OPENCOLLADA_INC}/GeneratedSaxParser
)
else()
- list(APPEND INC
+ list(APPEND INC_SYS
${OPENCOLLADA_INC}/COLLADAStreamWriter/include
${OPENCOLLADA_INC}/COLLADABaseUtils/include
${OPENCOLLADA_INC}/COLLADAFramework/include
@@ -111,4 +115,4 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
-blender_add_lib(bf_collada "${SRC}" "${INC}")
+blender_add_lib(bf_collada "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index 8fc1ec429cc..a3c1d035d9b 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -28,6 +28,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -51,4 +54,4 @@ set(SRC
anim_intern.h
)
-blender_add_lib(bf_editor_animation "${SRC}" "${INC}")
+blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 4edcca46935..f755df79986 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -2148,7 +2148,7 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
bAnimContext ac;
ARegion *ar;
View2D *v2d;
- int mval[2], channel_index;
+ int channel_index;
int notifierFlags = 0;
short selectmode;
float x, y;
@@ -2162,10 +2162,6 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
ar= ac.ar;
v2d= &ar->v2d;
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -2179,7 +2175,7 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
* so that the tops of channels get caught ok. Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use
* ACHANNEL_HEIGHT_HALF.
*/
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
+ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP, 0, (float)ACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
/* handle mouse-click in the relevant channel then */
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index ff9521f1ebd..93d99c59a0e 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -107,14 +107,9 @@ static int frame_from_event(bContext *C, wmEvent *event)
{
ARegion *region= CTX_wm_region(C);
float viewx;
- int x, y;
-
- /* convert screen coordinates to region coordinates */
- x= event->x - region->winrct.xmin;
- y= event->y - region->winrct.ymin;
-
+
/* convert from region coordinates to View2D 'tot' space */
- UI_view2d_region_to_view(&region->v2d, x, y, &viewx, NULL);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &viewx, NULL);
/* round result to nearest int (frames are ints!) */
return (int)floor(viewx+0.5f);
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/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt
index 3234254f745..2db6e278460 100644
--- a/source/blender/editors/armature/CMakeLists.txt
+++ b/source/blender/editors/armature/CMakeLists.txt
@@ -29,6 +29,9 @@ set(INC
../../windowmanager
../../../../intern/guardedalloc
../../../../intern/opennl/extern
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -52,4 +55,4 @@ set(SRC
reeb.h
)
-blender_add_lib(bf_editor_armature "${SRC}" "${INC}")
+blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 06b2c06d4d2..abf08393544 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -1522,22 +1522,17 @@ static void selectconnected_posebonechildren (Object *ob, Bone *bone, int extend
/* within active object context */
/* previously known as "selectconnected_posearmature" */
static int pose_select_connected_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- ARegion *ar= CTX_wm_region(C);
+{
Object *ob= CTX_data_edit_object(C);
Bone *bone, *curBone, *next= NULL;
int extend= RNA_boolean_get(op->ptr, "extend");
- int x, y;
-
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
view3d_operator_needs_opengl(C);
if (extend)
- bone= get_nearest_bone(C, 0, x, y);
+ bone= get_nearest_bone(C, 0, event->mval[0], event->mval[1]);
else
- bone= get_nearest_bone(C, 1, x, y);
+ bone= get_nearest_bone(C, 1, event->mval[0], event->mval[1]);
if (!bone)
return OPERATOR_CANCELLED;
@@ -1606,21 +1601,17 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, wmEvent *e
bArmature *arm;
EditBone *bone, *curBone, *next;
int extend= RNA_boolean_get(op->ptr, "extend");
- int x, y;
ARegion *ar;
Object *obedit= CTX_data_edit_object(C);
arm= obedit->data;
ar= CTX_wm_region(C);
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
-
view3d_operator_needs_opengl(C);
if (extend)
- bone= get_nearest_bone(C, 0, x, y);
+ bone= get_nearest_bone(C, 0, event->mval[0], event->mval[1]);
else
- bone= get_nearest_bone(C, 1, x, y);
+ bone= get_nearest_bone(C, 1, event->mval[0], event->mval[1]);
if (!bone)
return OPERATOR_CANCELLED;
@@ -2365,6 +2356,7 @@ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name)
void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
{
Object *obedit= scene->obedit; // XXX get from context
+ bArmature *arm= obedit->data;
float obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3];
EditBone *bone;
@@ -2383,7 +2375,9 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
ED_armature_deselect_all(obedit, 0);
/* Create a bone */
- bone= ED_armature_edit_bone_add(obedit->data, "Bone");
+ bone= ED_armature_edit_bone_add(arm, "Bone");
+
+ arm->act_edbone= bone;
copy_v3_v3(bone->head, curs);
@@ -2497,24 +2491,19 @@ 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];
- int mx, my;
+ 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);
copy_v3_v3(oldcurs, fp);
-
- mx= event->x - ar->winrct.xmin;
- my= event->y - ar->winrct.ymin;
- window_to_3d(ar, tvec, fp, mx, my);
+ VECCOPY2D(mval_f, event->mval);
+ ED_view3d_win_to_3d(ar, fp, mval_f, tvec);
copy_v3_v3(fp, tvec);
/* extrude to the where new cursor is and store the operation result */
@@ -5530,6 +5519,26 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
BKE_animdata_fix_paths_rename(&ob->id, ob->adt, "pose.bones", oldname, newname, 0, 0, 1);
}
}
+
+ {
+ /* correct view locking */
+ bScreen *screen;
+ for(screen= G.main->screen.first; screen; screen= screen->id.next) {
+ ScrArea *sa;
+ /* add regions */
+ for(sa= screen->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl= sa->spacedata.first;
+ if(sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d= (View3D *)sl;
+ if(v3d->ob_centre && v3d->ob_centre->data == arm) {
+ if (!strcmp(v3d->ob_centre_bone, oldname)) {
+ BLI_strncpy(v3d->ob_centre_bone, newname, MAXBONENAME);
+ }
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 1fa6a88c9f3..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;
@@ -1005,7 +1005,7 @@ static void sk_interpolateDepth(bContext *C, SK_Stroke *stk, int start, int end,
float pval[2];
project_float(ar, stk->points[i].p, pval);
- viewray(ar, v3d, pval, ray_start, ray_normal);
+ ED_view3d_win_to_ray(ar, v3d, pval, ray_start, ray_normal);
mul_v3_fl(ray_normal, distance * progress / length);
add_v3_v3(stk->points[i].p, ray_normal);
@@ -1022,6 +1022,7 @@ static void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_Dr
short cval[2];
float fp[3] = {0, 0, 0};
float dvec[3];
+ float mval_f[2];
if (last != NULL)
{
@@ -1032,7 +1033,8 @@ static void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_Dr
/* method taken from editview.c - mouse_cursor() */
project_short_noclip(ar, fp, cval);
- window_to_3d_delta(ar, dvec, cval[0] - dd->mval[0], cval[1] - dd->mval[1]);
+ VECSUB2D(mval_f, cval, dd->mval);
+ ED_view3d_win_to_delta(ar, mval_f, dvec);
sub_v3_v3v3(vec, fp, dvec);
}
@@ -1721,7 +1723,7 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S
mval[0] = vi[0];
mval[1] = vi[1];
- viewline(ar, v3d, mval, ray_start, ray_end);
+ ED_view3d_win_to_segment_clip(ar, v3d, mval, ray_start, ray_end);
isect_line_line_v3( stk->points[s_i].p,
stk->points[s_i + 1].p,
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/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 719362d82c5..8176aa5893b 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -1169,7 +1169,7 @@ void POSE_OT_paste (wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "flipped", 0, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose");
- RNA_def_boolean(ot->srna, "selected_mask", 0, "On Selected Only", "Only paste the stored post on to selected bones in the current pose");
+ RNA_def_boolean(ot->srna, "selected_mask", 0, "On Selected Only", "Only paste the stored pose on to selected bones in the current pose");
}
/* ********************************************** */
diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt
index a73fb9502a6..dfc7e336e84 100644
--- a/source/blender/editors/curve/CMakeLists.txt
+++ b/source/blender/editors/curve/CMakeLists.txt
@@ -30,6 +30,10 @@ set(INC
../../../../intern/guardedalloc
)
+set(INC_SYS
+
+)
+
set(SRC
curve_ops.c
editcurve.c
@@ -39,4 +43,4 @@ set(SRC
curve_intern.h
)
-blender_add_lib(bf_editor_curve "${SRC}" "${INC}")
+blender_add_lib(bf_editor_curve "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 1bfd910523e..99aebfffaee 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -780,7 +780,7 @@ static void calc_shapeKeys(Object *obedit)
/* are there keys? */
if(cu->key) {
- int a, i, j;
+ int a, i;
EditNurb *editnurb= cu->editnurb;
KeyBlock *currkey;
KeyBlock *actkey= BLI_findlink(&cu->key->block, editnurb->shapenr-1);
@@ -804,7 +804,6 @@ static void calc_shapeKeys(Object *obedit)
}
if(act_is_basis) { /* active key is a base */
- int j;
int totvec= 0;
/* Calculate needed memory to store offset */
@@ -831,6 +830,7 @@ static void calc_shapeKeys(Object *obedit)
oldbezt= getKeyIndexOrig_bezt(editnurb, bezt);
if (oldbezt) {
+ int j;
for (j= 0; j < 3; ++j) {
VECSUB(ofs[i], bezt->vec[j], oldbezt->vec[j]);
i++;
@@ -878,6 +878,7 @@ static void calc_shapeKeys(Object *obedit)
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
+ int j;
oldbezt= getKeyIndexOrig_bezt(editnurb, bezt);
for (j= 0; j < 3; ++j, ++i) {
@@ -932,6 +933,7 @@ static void calc_shapeKeys(Object *obedit)
while(a--) {
index= getKeyIndexOrig_keyIndex(editnurb, bezt);
if (index >= 0) {
+ int j;
curofp= ofp + index;
for (j= 0; j < 3; ++j, ++i) {
@@ -953,6 +955,7 @@ static void calc_shapeKeys(Object *obedit)
fp+= 3; /* alphas */
} else {
+ int j;
for (j= 0; j < 3; ++j, ++i) {
VECCOPY(fp, bezt->vec[j]);
fp+= 3;
@@ -3309,7 +3312,7 @@ static void findnearestNurbvert__doClosest(void *userData, Nurb *nu, BPoint *bp,
}
}
-static short findnearestNurbvert(ViewContext *vc, short sel, int mval[2], Nurb **nurb, BezTriple **bezt, BPoint **bp)
+static short findnearestNurbvert(ViewContext *vc, short sel, const int mval[2], Nurb **nurb, BezTriple **bezt, BPoint **bp)
{
/* sel==1: selected gets a disadvantage */
/* in nurb and bezt or bp the nearest is written */
@@ -4666,7 +4669,6 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
Curve *cu;
ViewContext vc;
float location[3];
- int mval[2];
Nurb *nu;
BezTriple *bezt;
@@ -4688,10 +4690,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
copy_v3_v3(location, give_cursor(vc.scene, vc.v3d));
}
- mval[0]= event->x - vc.ar->winrct.xmin;
- mval[1]= event->y - vc.ar->winrct.ymin;
-
- view3d_get_view_aligned_coordinate(&vc, location, mval, TRUE);
+ view3d_get_view_aligned_coordinate(&vc, location, event->mval, TRUE);
RNA_float_set_array(op->ptr, "location", location);
}
@@ -4987,21 +4986,18 @@ void CURVE_OT_select_linked(wmOperatorType *ot)
static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Object *obedit= CTX_data_edit_object(C);
- ARegion *ar= CTX_wm_region(C);
ViewContext vc;
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
- int a, location[2], deselect;
+ int a, deselect;
deselect= RNA_boolean_get(op->ptr, "deselect");
- location[0]= event->x - ar->winrct.xmin;
- location[1]= event->y - ar->winrct.ymin;
view3d_operator_needs_opengl(C);
view3d_set_viewcontext(C, &vc);
- findnearestNurbvert(&vc, 1, location, &nu, &bezt, &bp);
+ findnearestNurbvert(&vc, 1, event->mval, &nu, &bezt, &bp);
if(bezt) {
a= nu->pntsu;
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index a359b0ef6f5..8761297b979 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -19,7 +19,13 @@
#
# ***** END GPL LICENSE BLOCK *****
-set(INC "")
+set(INC
+
+)
+
+set(INC_SYS
+
+)
set(SRC
Bfont.c
@@ -60,4 +66,4 @@ set(SRC
vertexdraw.png.c
)
-blender_add_lib(bf_editor_datafiles "${SRC}" "${INC}")
+blender_add_lib(bf_editor_datafiles "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt
index 71199ee9580..352960d285a 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -29,6 +29,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -43,4 +46,4 @@ set(SRC
gpencil_intern.h
)
-blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}")
+blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index b93e4b07302..a275a5f908a 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -790,7 +790,7 @@ void draw_gpencil_view3d_ext (Scene *scene, View3D *v3d, ARegion *ar, short only
* deal with the camera border, otherwise map the coords to the camera border. */
if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) {
rctf rectf;
- view3d_calc_camera_border(scene, ar, rv3d, v3d, &rectf, -1); /* negative shift */
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, -1); /* negative shift */
BLI_copy_rcti_rctf(&rect, &rectf);
}
else {
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index e5f39614c03..2860d467cef 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -377,31 +377,30 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi
}
else {
float *fp= give_cursor(scene, v3d);
- float mx, my;
+ float mvalf[2];
/* get screen coordinate */
if (gps->flag & GP_STROKE_2DSPACE) {
- int mxi, myi;
+ int mvali[2];
View2D *v2d= &ar->v2d;
- UI_view2d_view_to_region(v2d, pt->x, pt->y, &mxi, &myi);
- mx= mxi;
- my= myi;
+ UI_view2d_view_to_region(v2d, pt->x, pt->y, mvali, mvali+1);
+ VECCOPY2D(mvalf, mvali);
}
else {
if(subrect) {
- mx= (((float)pt->x/100.0f) * (subrect->xmax - subrect->xmin)) + subrect->xmin;
- my= (((float)pt->y/100.0f) * (subrect->ymax - subrect->ymin)) + subrect->ymin;
+ mvalf[0]= (((float)pt->x/100.0f) * (subrect->xmax - subrect->xmin)) + subrect->xmin;
+ mvalf[1]= (((float)pt->y/100.0f) * (subrect->ymax - subrect->ymin)) + subrect->ymin;
}
else {
- mx= (float)pt->x / 100.0f * ar->winx;
- my= (float)pt->y / 100.0f * ar->winy;
+ mvalf[0]= (float)pt->x / 100.0f * ar->winx;
+ mvalf[1]= (float)pt->y / 100.0f * ar->winy;
}
}
/* convert screen coordinate to 3d coordinates
* - method taken from editview.c - mouse_cursor()
*/
- window_to_3d(ar, p3d, fp, mx, my);
+ ED_view3d_win_to_3d(ar, fp, mvalf, p3d);
}
}
@@ -445,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);
@@ -454,7 +452,8 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
- view3d_calc_camera_border(scene, ar, NULL, v3d, 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 7db18eaedf4..f4da734473d 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -210,7 +210,7 @@ static void gp_get_3d_reference (tGPsdata *p, float *vec)
/* Stroke Editing ---------------------------- */
/* check if the current mouse position is suitable for adding a new point */
-static short gp_stroke_filtermval (tGPsdata *p, int mval[2], int pmval[2])
+static short gp_stroke_filtermval (tGPsdata *p, const int mval[2], int pmval[2])
{
int dx= abs(mval[0] - pmval[0]);
int dy= abs(mval[1] - pmval[1]);
@@ -239,21 +239,22 @@ static short gp_stroke_filtermval (tGPsdata *p, int mval[2], int pmval[2])
/* convert screen-coordinates to buffer-coordinates */
// XXX this method needs a total overhaul!
-static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], float *depth)
+static void gp_stroke_convertcoords (tGPsdata *p, const int mval[2], float out[3], float *depth)
{
bGPdata *gpd= p->gpd;
/* in 3d-space - pt->x/y/z are 3 side-by-side floats */
if (gpd->sbuffer_sflag & GP_STROKE_3DSPACE) {
- if (gpencil_project_check(p) && (view_autodist_simple(p->ar, mval, out, 0, depth))) {
+ if (gpencil_project_check(p) && (ED_view3d_autodist_simple(p->ar, mval, out, 0, depth))) {
/* projecting onto 3D-Geometry
* - nothing more needs to be done here, since view_autodist_simple() has already done it
*/
}
else {
- const int mx=mval[0], my=mval[1];
+ int mval_prj[2];
float rvec[3], dvec[3];
-
+ float mval_f[2];
+
/* Current method just converts each point in screen-coordinates to
* 3D-coordinates using the 3D-cursor as reference. In general, this
* works OK, but it could of course be improved.
@@ -266,20 +267,17 @@ static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], flo
gp_get_3d_reference(p, rvec);
/* method taken from editview.c - mouse_cursor() */
- project_int_noclip(p->ar, rvec, mval);
- window_to_3d_delta(p->ar, dvec, mval[0]-mx, mval[1]-my);
+ project_int_noclip(p->ar, rvec, mval_prj);
+
+ VECSUB2D(mval_f, mval_prj, mval);
+ ED_view3d_win_to_delta(p->ar, mval_f, dvec);
sub_v3_v3v3(out, rvec, dvec);
}
}
/* 2d - on 'canvas' (assume that p->v2d is set) */
else if ((gpd->sbuffer_sflag & GP_STROKE_2DSPACE) && (p->v2d)) {
- float x, y;
-
- UI_view2d_region_to_view(p->v2d, mval[0], mval[1], &x, &y);
-
- out[0]= x;
- out[1]= y;
+ UI_view2d_region_to_view(p->v2d, mval[0], mval[1], &out[0], &out[1]);
}
#if 0
@@ -315,7 +313,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, int mval[2], float out[3], flo
}
/* add current stroke-point to buffer (returns whether point was successfully added) */
-static short gp_stroke_addpoint (tGPsdata *p, int mval[2], float pressure)
+static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure)
{
bGPdata *gpd= p->gpd;
tGPspoint *pt;
@@ -583,8 +581,8 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
for (i=0, ptc=gpd->sbuffer; i < gpd->sbuffer_size; i++, ptc++, pt++) {
mval[0]= ptc->x; mval[1]= ptc->y;
- if ((view_autodist_depth(p->ar, mval, depth_margin, depth_arr+i) == 0) &&
- (i && (view_autodist_depth_segment(p->ar, mval, mval_prev, depth_margin + 1, depth_arr+i) == 0))
+ if ((ED_view3d_autodist_depth(p->ar, mval, depth_margin, depth_arr+i) == 0) &&
+ (i && (ED_view3d_autodist_depth_seg(p->ar, mval, mval_prev, depth_margin + 1, depth_arr+i) == 0))
) {
interp_depth= TRUE;
}
@@ -1133,7 +1131,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
- view3d_calc_camera_border(p->scene, p->ar, NULL, v3d, &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;
}
}
@@ -1228,7 +1226,7 @@ static void gp_paint_strokeend (tGPsdata *p)
/* need to restore the original projection settings before packing up */
view3d_region_operator_needs_opengl(p->win, p->ar);
- view_autodist_init(p->scene, p->ar, v3d, (p->gpd->flag & GP_DATA_DEPTH_STROKE) ? 1:0);
+ ED_view3d_autodist_init(p->scene, p->ar, v3d, (p->gpd->flag & GP_DATA_DEPTH_STROKE) ? 1:0);
}
/* check if doing eraser or not */
@@ -1416,16 +1414,15 @@ static void gpencil_draw_apply (wmOperator *op, tGPsdata *p)
static void gpencil_draw_apply_event (wmOperator *op, wmEvent *event)
{
tGPsdata *p= op->customdata;
- ARegion *ar= p->ar;
PointerRNA itemptr;
float mousef[2];
int tablet=0;
/* convert from window-space to area-space mouse coordintes */
// NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
- p->mval[0]= event->x - ar->winrct.xmin + 1;
- p->mval[1]= event->y - ar->winrct.ymin + 1;
-
+ p->mval[0]= event->mval[0] + 1;
+ p->mval[1]= event->mval[1] + 1;
+
/* handle pressure sensitivity (which is supplied by tablets) */
if (event->custom == EVT_DATA_TABLET) {
wmTabletData *wmtab= event->customdata;
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 a9061ce1b80..0adf6633b05 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -80,20 +80,123 @@ typedef struct ViewDepths {
float *give_cursor(struct Scene *scene, struct View3D *v3d);
int initgrabz(struct RegionView3D *rv3d, float x, float y, float z);
-void window_to_3d(struct ARegion *ar, float out[3], const float depth_pt[3], const float mx, const float my);
-void window_to_3d_delta(struct ARegion *ar, float out[3], const float mx, const float my);
-void window_to_3d_vector(struct ARegion *ar, float out[3], const float mx, const float my);
+
+/**
+ * Calculate a 3d location from 2d window coordinates.
+ * @param ar The region (used for the window width and height).
+ * @param depth_pt The reference location used to calculate the Z depth.
+ * @param mval The area relative location (such as event->mval converted to floats).
+ * @param out The resulting world-space location.
+ */
+void ED_view3d_win_to_3d(struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]);
+
+/**
+ * Calculate a 3d difference vector from 2d window offset.
+ * note that initgrabz() must be called first to determine
+ * the depth used to calculate the delta.
+ * @param ar The region (used for the window width and height).
+ * @param mval The area relative 2d difference (such as event->mval[0] - other_x).
+ * @param out The resulting world-space delta.
+ */
+void ED_view3d_win_to_delta(struct ARegion *ar, const float mval[2], float out[3]);
+
+/**
+ * Calculate a 3d direction vector from 2d window coordinates.
+ * This direction vector starts and the view in the direction of the 2d window coordinates.
+ * In orthographic view all window coordinates yield the same vector.
+ * @param ar The region (used for the window width and height).
+ * @param mval The area relative 2d location (such as event->mval converted to floats).
+ * @param out The resulting normalized world-space direction vector.
+ */
+void ED_view3d_win_to_vector(struct ARegion *ar, const float mval[2], float out[3]);
+
+/**
+ * Calculate a 3d segment from 2d window coordinates.
+ * This ray_start is located at the viewpoint, ray_end is a far point.
+ * ray_start and ray_end are clipped by the view near and far limits
+ * so points along this line are always in view.
+ * In orthographic view all resulting segments will be parallel.
+ * @param ar The region (used for the window width and height).
+ * @param v3d The 3d viewport (used for near and far clipping range).
+ * @param mval The area relative 2d location (such as event->mval, converted into float[2]).
+ * @param ray_start The world-space starting point of the segment.
+ * @param ray_end The world-space end point of the segment.
+ */
+void ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
+
+/**
+ * Calculate a 3d viewpoint and direction vector from 2d window coordinates.
+ * This ray_start is located at the viewpoint, ray_normal is the direction towards mval.
+ * ray_start is clipped by the view near limit so points in front of it are always in view.
+ * In orthographic view the resulting ray_normal will match the view vector.
+ * @param ar The region (used for the window width and height).
+ * @param v3d The 3d viewport (used for near clipping value).
+ * @param out The resulting normalized world-space direction vector.
+ * @param mval The area relative 2d location (such as event->mval, converted into float[2]).
+ * @param ray_start The world-space starting point of the segment.
+ * @param ray_normal The normalized world-space direction of towards mval.
+ */
+void ED_view3d_win_to_ray(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3]);
+
+/**
+ * Calculate a normalized 3d direction vector from the viewpoint towards a global location.
+ * In orthographic view the resulting vector will match the view vector.
+ * @param ar The region (used for the window width and height).
+ * @param coord The world-space location.
+ * @param vec The resulting normalized vector.
+ */
+void ED_view3d_global_to_vector(struct RegionView3D *rv3d, const float coord[3], float vec[3]);
+
+/**
+ * Calculate the view transformation matrix from RegionView3D input.
+ * The resulting matrix is equivilent to RegionView3D.viewinv
+ * @param mat The view 4x4 transformation matrix to calculate.
+ * @param ofs The view offset, normally from RegionView3D.ofs.
+ * @param quat The view rotation, quaternion normally from RegionView3D.viewquat.
+ * @param dist The view distance from ofs, normally from RegionView3D.dist.
+ */
+void ED_view3d_to_m4(float mat[][4], const float ofs[3], const float quat[4], const float dist);
+
+/**
+ * Set the view transformation from a 4x4 matrix.
+ * @param mat The view 4x4 transformation matrix to assign.
+ * @param ofs The view offset, normally from RegionView3D.ofs.
+ * @param quat The view rotation, quaternion normally from RegionView3D.viewquat.
+ * @param dist The view distance from ofs, normally from RegionView3D.dist.
+ */
+void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist);
+
+/**
+ * Set the RegionView3D members from an objects transformation and optionally lens.
+ * @param ob The object to set the view to.
+ * @param ofs The view offset to be set, normally from RegionView3D.ofs.
+ * @param quat The view rotation to be set, quaternion normally from RegionView3D.viewquat.
+ * @param dist The view distance from ofs to be set, normally from RegionView3D.dist.
+ */
+void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens);
+
+/**
+ * Set the object transformation from RegionView3D members.
+ * @param ob The object which has the transformation assigned.
+ * @param ofs The view offset, normally from RegionView3D.ofs.
+ * @param quat The view rotation, quaternion normally from RegionView3D.viewquat.
+ * @param dist The view distance from ofs, normally from RegionView3D.dist.
+ */
+void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist);
+
+#if 0 /* UNUSED */
void view3d_unproject(struct bglMats *mats, float out[3], const short x, const short y, const float z);
+#endif
/* Depth buffer */
-void view3d_update_depths(struct ARegion *ar);
-float read_cached_depth(struct ViewContext *vc, int x, int y);
-void request_depth_update(struct RegionView3D *rv3d);
+void ED_view3d_depth_update(struct ARegion *ar);
+float ED_view3d_depth_read_cached(struct ViewContext *vc, int x, int y);
+void ED_view3d_depth_tag_update(struct RegionView3D *rv3d);
/* Projection */
#define IS_CLIPPED 12000
-void view3d_calculate_clipping(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, struct rcti *rect);
+void ED_view3d_calc_clipping(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, struct rcti *rect);
void project_short(struct ARegion *ar, const float vec[3], short adr[2]);
void project_short_noclip(struct ARegion *ar, const float vec[3], short adr[2]);
@@ -104,17 +207,12 @@ void project_int_noclip(struct ARegion *ar, const float vec[3], int adr[2]);
void project_float(struct ARegion *ar, const float vec[3], float adr[2]);
void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]);
-void viewvector(struct RegionView3D *rv3d, float coord[3], float vec[3]);
-
-void viewline(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_start[3], float ray_end[3]);
-void viewray(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_start[3], float ray_normal[3]);
-
-void get_object_clip_range(struct Object *ob, float *lens, float *clipsta, float *clipend);
-int get_view3d_cliprange(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
-int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
-void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
-void view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]);
-void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r, short do_shift);
+void ED_view3d_ob_clip_range_get(struct Object *ob, float *lens, float *clipsta, float *clipend);
+int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
+int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
+void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
+void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]);
+void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift);
/* drawobject.c iterators */
void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts);
@@ -124,9 +222,9 @@ void nurbs_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData
void lattice_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BPoint *bp, int x, int y), void *userData);
void ED_view3d_local_clipping(struct RegionView3D *rv3d, float mat[][4]);
-int view3d_test_clipping(struct RegionView3D *rv3d, const float vec[3], const int local);
-void view3d_align_axis_to_vector(struct View3D *v3d, struct RegionView3D *rv3d, int axisidx, float vec[3]);
-float view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]);
+int ED_view3d_test_clipping(struct RegionView3D *rv3d, const float vec[3], const int local);
+void ED_view3d_align_axis_to_vector(struct View3D *v3d, struct RegionView3D *rv3d, int axisidx, float vec[3]);
+float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]);
void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]);
@@ -138,13 +236,13 @@ unsigned int view3d_sample_backbuf_rect(struct ViewContext *vc, const int mval[2
unsigned int view3d_sample_backbuf(struct ViewContext *vc, int x, int y);
/* draws and does a 4x4 sample */
-int view_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3]);
+int ED_view3d_autodist(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3]);
-/* only draw so view_autodist_simple can be called many times after */
-int view_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode);
-int view_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth);
-int view_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
-int view_autodist_depth_segment(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
+/* only draw so ED_view3d_autodist_simple can be called many times after */
+int ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode);
+int ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth);
+int ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
+int ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
/* select */
#define MAXPICKBUF 10000
@@ -185,21 +283,11 @@ int ED_view3d_lock(struct RegionView3D *rv3d);
unsigned int ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
unsigned int ED_viewedit_datamask(struct bScreen *screen);
-
-/* assigning view matrix */
-void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist);
-
-void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens);
-void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist);
-
/* 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 */
void ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d);
-int view3d_is_ortho(struct View3D *v3d, struct RegionView3D *rv3d);
-
-
#endif /* ED_VIEW3D_H */
-
diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt
index 264909a325b..84a9ef18620 100644
--- a/source/blender/editors/interface/CMakeLists.txt
+++ b/source/blender/editors/interface/CMakeLists.txt
@@ -32,6 +32,9 @@ set(INC
../../python
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -65,4 +68,4 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
-blender_add_lib(bf_editor_interface "${SRC}" "${INC}")
+blender_add_lib(bf_editor_interface "${SRC}" "${INC}" "${INC_SYS}")
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_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 5f8f3d05346..be46a7c7b85 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4022,12 +4022,9 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
-{
- ARegion *ar= CTX_wm_region(C);
-
- but->linkto[0]= event->x-ar->winrct.xmin;
- but->linkto[1]= event->y-ar->winrct.ymin;
-
+{
+ VECCOPY2D(but->linkto, event->mval);
+
if(data->state == BUTTON_STATE_HIGHLIGHT) {
if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
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/interface/view2d.c b/source/blender/editors/interface/view2d.c
index ad95e6ea9d9..79e52fd9499 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -44,6 +44,7 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
+#include "BKE_screen.h"
#include "BKE_global.h"
@@ -1960,17 +1961,14 @@ View2D *UI_view2d_fromcontext(const bContext *C)
/* same as above, but it returns regionwindow. Utility for pulldowns or buttons */
View2D *UI_view2d_fromcontext_rwin(const bContext *C)
{
- ScrArea *area= CTX_wm_area(C);
+ ScrArea *sa= CTX_wm_area(C);
ARegion *region= CTX_wm_region(C);
- if (area == NULL) return NULL;
+ if (sa == NULL) return NULL;
if (region == NULL) return NULL;
if (region->regiontype!=RGN_TYPE_WINDOW) {
- ARegion *ar= area->regionbase.first;
- for(; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_WINDOW)
- return &(ar->v2d);
- return NULL;
+ ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ return ar ? &(ar->v2d) : NULL;
}
return &(region->v2d);
}
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 4cb67994704..f7bff168a33 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -702,7 +702,7 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* store initial mouse position (in view space) */
UI_view2d_region_to_view(&ar->v2d,
- event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ event->mval[0], event->mval[1],
&vzd->mx_2d, &vzd->my_2d);
}
@@ -759,7 +759,7 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* store initial mouse position (in view space) */
UI_view2d_region_to_view(&ar->v2d,
- event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ event->mval[0], event->mval[1],
&vzd->mx_2d, &vzd->my_2d);
}
@@ -936,7 +936,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* store initial mouse position (in view space) */
UI_view2d_region_to_view(&ar->v2d,
- event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ event->mval[0], event->mval[1],
&vzd->mx_2d, &vzd->my_2d);
}
@@ -1286,7 +1286,6 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
ARegion *ar= CTX_wm_region(C);
View2D *v2d= &ar->v2d;
float mask_size;
- int x, y;
/* set custom-data for operator */
vsm= MEM_callocN(sizeof(v2dScrollerMove), "v2dScrollerMove");
@@ -1300,8 +1299,6 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
/* store mouse-coordinates, and convert mouse/screen coordinates to region coordinates */
vsm->lastx = event->x;
vsm->lasty = event->y;
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
/* 'zone' depends on where mouse is relative to bubble
* - zooming must be allowed on this axis, otherwise, default to pan
@@ -1313,7 +1310,7 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
vsm->fac= (v2d->tot.xmax - v2d->tot.xmin) / mask_size;
/* get 'zone' (i.e. which part of scroller is activated) */
- vsm->zone= mouse_in_scroller_handle(x, v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
+ vsm->zone= mouse_in_scroller_handle(event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
/* default to scroll, as handles not usable */
@@ -1328,7 +1325,7 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
vsm->fac= (v2d->tot.ymax - v2d->tot.ymin) / mask_size;
/* get 'zone' (i.e. which part of scroller is activated) */
- vsm->zone= mouse_in_scroller_handle(y, v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
+ vsm->zone= mouse_in_scroller_handle(event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
/* default to scroll, as handles not usable */
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index a03bf173425..bd8789b9eef 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -30,6 +30,9 @@ set(INC
../../windowmanager
../../render/extern/include
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -49,4 +52,4 @@ set(SRC
mesh_intern.h
)
-blender_add_lib(bf_editor_mesh "${SRC}" "${INC}")
+blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index bd49fab1de1..b5da36756b5 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -504,7 +504,7 @@ static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, in
vec[1]= eed->v1->co[1] + labda*(eed->v2->co[1] - eed->v1->co[1]);
vec[2]= eed->v1->co[2] + labda*(eed->v2->co[2] - eed->v1->co[2]);
- if(view3d_test_clipping(data->vc.rv3d, vec, 1)==0) {
+ if(ED_view3d_test_clipping(data->vc.rv3d, vec, 1)==0) {
data->dist = distance;
data->closest = eed;
}
@@ -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 11e7d64c667..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);
@@ -4871,8 +4871,8 @@ static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *c
{
float vec1[3], vec2[3], mvalf[2];
- view3d_project_float(ar, co1, vec1, mat);
- view3d_project_float(ar, co2, vec2, mat);
+ ED_view3d_project_float(ar, co1, vec1, mat);
+ ED_view3d_project_float(ar, co2, vec2, mat);
mvalf[0]= (float)mval[0];
mvalf[1]= (float)mval[1];
@@ -4916,7 +4916,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* select flush... vertices are important */
EM_selectmode_set(em);
- view3d_get_object_project_mat(rv3d, obedit, projectMat);
+ ED_view3d_ob_project_mat_get(rv3d, obedit, projectMat);
/* find best face, exclude triangles and break on face select or faces with 2 edges select */
mindist= 1000000.0f;
@@ -4933,7 +4933,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
if(totsel>1)
break;
- view3d_project_float(ar, efa->cent, vec, projectMat);
+ ED_view3d_project_float(ar, efa->cent, vec, projectMat);
dist= sqrt( (vec[0]-mval[0])*(vec[0]-mval[0]) + (vec[1]-mval[1])*(vec[1]-mval[1]) );
if(dist<mindist) {
mindist= dist;
@@ -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/metaball/CMakeLists.txt b/source/blender/editors/metaball/CMakeLists.txt
index af3d25699ed..690a8ec2fcb 100644
--- a/source/blender/editors/metaball/CMakeLists.txt
+++ b/source/blender/editors/metaball/CMakeLists.txt
@@ -31,6 +31,10 @@ set(INC
../../../../intern/guardedalloc
)
+set(INC_SYS
+
+)
+
set(SRC
mball_edit.c
mball_ops.c
@@ -38,4 +42,4 @@ set(SRC
mball_intern.h
)
-blender_add_lib(bf_editor_metaball "${SRC}" "${INC}")
+blender_add_lib(bf_editor_metaball "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 47cb4d00938..4d50b78b7a1 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -35,6 +35,10 @@ set(INC
../../../../intern/guardedalloc
)
+set(INC_SYS
+
+)
+
set(SRC
object_add.c
object_bake.c
@@ -58,4 +62,4 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
-blender_add_lib(bf_editor_object "${SRC}" "${INC}")
+blender_add_lib(bf_editor_object "${SRC}" "${INC}" "${INC_SYS}")
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 086d458f3e0..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;
@@ -1543,11 +1543,12 @@ static void single_mat_users(Scene *scene, int flag, int do_textures)
if(do_textures) {
for(b=0; b<MAX_MTEX; b++) {
- if(ma->mtex[b] && ma->mtex[b]->tex) {
- tex= ma->mtex[b]->tex;
+ if(ma->mtex[b] && (tex= ma->mtex[b]->tex)) {
if(tex->id.us>1) {
- ma->mtex[b]->tex= copy_texture(tex);
tex->id.us--;
+ tex= copy_texture(tex);
+ BKE_copy_animdata_id_action(&tex->id);
+ ma->mtex[b]->tex= tex;
}
}
}
@@ -1818,11 +1819,12 @@ static int make_single_user_exec(bContext *C, wmOperator *op)
single_obdata_users(bmain, scene, flag);
if(RNA_boolean_get(op->ptr, "material"))
- single_mat_users(scene, flag, FALSE);
+ single_mat_users(scene, flag, RNA_boolean_get(op->ptr, "texture"));
+#if 0 /* can't do this separate from materials */
if(RNA_boolean_get(op->ptr, "texture"))
single_mat_users(scene, flag, TRUE);
-
+#endif
if(RNA_boolean_get(op->ptr, "animation"))
single_object_action_users(scene, flag);
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/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt
index 8d51d6eec37..1badccffe3b 100644
--- a/source/blender/editors/physics/CMakeLists.txt
+++ b/source/blender/editors/physics/CMakeLists.txt
@@ -29,6 +29,9 @@ set(INC
../../windowmanager
../../../../intern/elbeem/extern
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -48,7 +51,7 @@ if(NOT WITH_MOD_FLUID)
endif()
if(WITH_OPENMP)
- add_definitions(-DPARALLEL=1)
+ add_definitions(-DPARALLEL=1)
endif()
-blender_add_lib(bf_editor_physics "${SRC}" "${INC}")
+blender_add_lib(bf_editor_physics "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index f4f66c17459..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)) {
@@ -385,7 +385,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
/* we may need to force an update here by setting the rv3d as dirty
* for now it seems ok, but take care!:
* rv3d->depths->dirty = 1; */
- view3d_update_depths(data->vc.ar);
+ ED_view3d_depth_update(data->vc.ar);
}
}
}
@@ -1505,13 +1505,7 @@ static int select_linked_exec(bContext *C, wmOperator *op)
static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- int location[2];
-
- location[0]= event->x - ar->winrct.xmin;
- location[1]= event->y - ar->winrct.ymin;
- RNA_int_set_array(op->ptr, "location", location);
-
+ RNA_int_set_array(op->ptr, "location", event->mval);
return select_linked_exec(C, op);
}
@@ -3250,7 +3244,7 @@ static int brush_add(PEData *data, short number)
mco[0]= data->mval[0] + dmx;
mco[1]= data->mval[1] + dmy;
- viewline(data->vc.ar, data->vc.v3d, mco, co1, co2);
+ ED_view3d_win_to_segment_clip(data->vc.ar, data->vc.v3d, mco, co1, co2);
mul_m4_v3(imat,co1);
mul_m4_v3(imat,co2);
@@ -3466,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;
@@ -3489,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)
@@ -3507,6 +3499,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
switch(pset->brushtype) {
case PE_BRUSH_COMB:
{
+ float mval_f[2];
data.mval= mval;
data.rad= (float)brush->size;
@@ -3518,7 +3511,9 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
invert_m4_m4(ob->imat, ob->obmat);
- window_to_3d_delta(ar, vec, dx, dy);
+ mval_f[0]= dx;
+ mval_f[1]= dy;
+ ED_view3d_win_to_delta(ar, mval_f, vec);
data.dvec= vec;
foreach_mouse_hit_key(&data, brush_comb, selected);
@@ -3682,12 +3677,10 @@ static int brush_edit_exec(bContext *C, wmOperator *op)
static void brush_edit_apply_event(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
PointerRNA itemptr;
float mouse[2];
- mouse[0]= event->x - ar->winrct.xmin;
- mouse[1]= event->y - ar->winrct.ymin;
+ VECCOPY2D(mouse, event->mval);
/* fill in stroke */
RNA_collection_add(op->ptr, "stroke", &itemptr);
diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt
index d04c75a2b48..c3bb6f457a2 100644
--- a/source/blender/editors/render/CMakeLists.txt
+++ b/source/blender/editors/render/CMakeLists.txt
@@ -32,6 +32,9 @@ set(INC
../../render/extern/include
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -48,7 +51,8 @@ set(SRC
)
if(WITH_CODEC_QUICKTIME)
- list(APPEND INC ../../quicktime ${QUICKTIME_INC})
+ list(APPEND INC ../../quicktime)
+ list(APPEND INC_SYS ${QUICKTIME_INC})
add_definitions(-DWITH_QUICKTIME)
endif()
@@ -56,4 +60,4 @@ if(WITH_OPENMP)
add_definitions(-DPARALLEL=1)
endif()
-blender_add_lib(bf_editor_render "${SRC}" "${INC}")
+blender_add_lib(bf_editor_render "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 0a279e412f6..98463ce955f 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -149,7 +149,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
rctf viewplane;
float clipsta, clipend;
- int is_ortho= get_view3d_viewplane(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL);
+ int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend, NULL);
if(is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
}
diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index a583d753514..54341257692 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -30,6 +30,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -44,4 +47,4 @@ set(SRC
screen_intern.h
)
-blender_add_lib(bf_editor_screen "${SRC}" "${INC}")
+blender_add_lib(bf_editor_screen "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index b97911eb6b3..faf747f2b91 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -769,12 +769,10 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand
if(sa->spacetype!=SPACE_TIME) {
ARegion *ar;
static rcti rect= {0, 10000, 0, 30}; /* same local check for all areas */
-
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype == RGN_TYPE_WINDOW)
- break;
- if(ar)
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if(ar) {
WM_event_add_keymap_handler_bb(handlers, keymap, &rect, &ar->winrct);
+ }
}
else
WM_event_add_keymap_handler(handlers, keymap);
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/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 02fae52219b..f454dd9ce02 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2616,13 +2616,8 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op))
*/
if((ar == NULL) || (ar->regiontype != RGN_TYPE_HEADER)) {
ScrArea *sa= CTX_wm_area(C);
-
- /* loop over all regions until a matching one is found */
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype == RGN_TYPE_HEADER)
- break;
- }
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+
/* don't do anything if no region */
if(ar == NULL)
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 248b6ea2b94..6ecbc9c5eec 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -31,6 +31,9 @@ set(INC
../../windowmanager
../../render/extern/include
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -48,4 +51,4 @@ set(SRC
sculpt_intern.h
)
-blender_add_lib(bf_editor_sculpt_paint "${SRC}" "${INC}")
+blender_add_lib(bf_editor_sculpt_paint "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index db575907b49..db0d2314ad0 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -766,7 +766,7 @@ static int project_paint_occlude_ptv_clip(
if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
- if(!view3d_test_clipping(ps->rv3d, wco, 1)) {
+ if(!ED_view3d_test_clipping(ps->rv3d, wco, 1)) {
return 1;
}
@@ -2349,7 +2349,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
/* a pitty we need to get the worldspace pixel location here */
if(do_clip) {
interp_v3_v3v3v3(wco, ps->dm_mvert[ (*(&mf->v1 + i1)) ].co, ps->dm_mvert[ (*(&mf->v1 + i2)) ].co, ps->dm_mvert[ (*(&mf->v1 + i3)) ].co, w);
- if(view3d_test_clipping(ps->rv3d, wco, 1)) {
+ if(ED_view3d_test_clipping(ps->rv3d, wco, 1)) {
continue; /* Watch out that no code below this needs to run */
}
}
@@ -2572,7 +2572,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
- if(view3d_test_clipping(ps->rv3d, wco, 1)) {
+ if(ED_view3d_test_clipping(ps->rv3d, wco, 1)) {
continue; /* Watch out that no code below this needs to run */
}
}
@@ -2814,7 +2814,7 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf,
static int project_paint_view_clip(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend)
{
- int orth= get_view3d_cliprange(v3d, rv3d, clipsta, clipend);
+ int orth= ED_view3d_clip_range_get(v3d, rv3d, clipsta, clipend);
if (orth) { /* only needed for ortho */
float fac = 2.0f / ((*clipend) - (*clipsta));
@@ -2953,7 +2953,7 @@ static void project_paint_begin(ProjPaintState *ps)
copy_m4_m4(viewmat, ps->rv3d->viewmat);
copy_m4_m4(viewinv, ps->rv3d->viewinv);
- view3d_get_object_project_mat(ps->rv3d, ps->ob, ps->projectMat);
+ ED_view3d_ob_project_mat_get(ps->rv3d, ps->ob, ps->projectMat);
ps->is_ortho= project_paint_view_clip(ps->v3d, ps->rv3d, &ps->clipsta, &ps->clipend);
}
@@ -3975,7 +3975,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, f
}
-static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *UNUSED(prevmval_i), int *mval_i, double time, float pressure)
+static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, const int UNUSED(prevmval_i[2]), const int mval_i[2], double time, float pressure)
{
/* Use mouse coords as floats for projection painting */
@@ -3994,7 +3994,7 @@ static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, i
}
-static int project_paint_stroke(ProjPaintState *ps, BrushPainter *painter, int *prevmval_i, int *mval_i, double time, float pressure)
+static int project_paint_stroke(ProjPaintState *ps, BrushPainter *painter, const int prevmval_i[2], const int mval_i[2], double time, float pressure)
{
int a, redraw;
@@ -4417,7 +4417,7 @@ static int imapaint_paint_sub_stroke(ImagePaintState *s, BrushPainter *painter,
else return 0;
}
-static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPainter *painter, short texpaint, int *prevmval, int *mval, double time, float pressure)
+static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPainter *painter, short texpaint, const int prevmval[2], const int mval[2], double time, float pressure)
{
Image *newimage = NULL;
float fwuv[2], bkuv[2], newuv[2];
@@ -4858,7 +4858,6 @@ static int paint_exec(bContext *C, wmOperator *op)
static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
PaintOperation *pop= op->customdata;
wmTabletData *wmtab;
PointerRNA itemptr;
@@ -4868,8 +4867,8 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event)
// XXX +1 matches brush location better but
// still not exact, find out why and fix ..
- mouse[0]= event->x - ar->winrct.xmin + 1;
- mouse[1]= event->y - ar->winrct.ymin + 1;
+ mouse[0]= event->mval[0] + 1;
+ mouse[1]= event->mval[1] + 1;
time= PIL_check_seconds_timer();
@@ -5185,16 +5184,8 @@ static int sample_color_exec(bContext *C, wmOperator *op)
static int sample_color_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- int location[2];
-
- if(ar) {
- location[0]= event->x - ar->winrct.xmin;
- location[1]= event->y - ar->winrct.ymin;
- RNA_int_set_array(op->ptr, "location", location);
-
- sample_color_exec(C, op);
- }
+ RNA_int_set_array(op->ptr, "location", event->mval);
+ sample_color_exec(C, op);
WM_event_add_modal_handler(C, op);
@@ -5203,21 +5194,13 @@ static int sample_color_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int sample_color_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- int location[2];
-
switch(event->type) {
case LEFTMOUSE:
case RIGHTMOUSE: // XXX hardcoded
return OPERATOR_FINISHED;
case MOUSEMOVE:
- if(ar) {
- location[0]= event->x - ar->winrct.xmin;
- location[1]= event->y - ar->winrct.ymin;
- RNA_int_set_array(op->ptr, "location", location);
-
- sample_color_exec(C, op);
- }
+ RNA_int_set_array(op->ptr, "location", event->mval);
+ sample_color_exec(C, op);
break;
}
@@ -5284,14 +5267,10 @@ static int set_clone_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
View3D *v3d= CTX_wm_view3d(C);
ARegion *ar= CTX_wm_region(C);
float location[3];
- int mval[2];
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
view3d_operator_needs_opengl(C);
- if(!view_autodist(scene, ar, v3d, mval, location))
+ if(!ED_view3d_autodist(scene, ar, v3d, event->mval, location))
return OPERATOR_CANCELLED;
RNA_float_set_array(op->ptr, "location", location);
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index ba7235a3161..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);
@@ -106,8 +108,8 @@ void PAINT_OT_image_from_view(struct wmOperatorType *ot);
void projectf(struct bglMats *mats, const float v[3], float p[2]);
float paint_calc_object_space_radius(struct ViewContext *vc, float center[3], float pixel_radius);
float paint_get_tex_pixel(struct Brush* br, float u, float v);
-int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsigned int *index);
-void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, int *xy, float *uv);
+int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, const int mval[2], unsigned int *index);
+void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]);
void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y);
void BRUSH_OT_curve_preset(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_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index e7b62505417..58c3446673c 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -333,7 +333,7 @@ static int project_brush_radius(RegionView3D* rv3d, float radius, float location
{
float view[3], nonortho[3], ortho[3], offset[3], p1[2], p2[2];
- viewvector(rv3d, location, view);
+ ED_view3d_global_to_vector(rv3d, location, view);
// create a vector that is not orthogonal to view
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index ad85a4bf29b..09f5c32bea0 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -58,11 +58,15 @@ float paint_calc_object_space_radius(ViewContext *vc, float center[3],
{
Object *ob = vc->obact;
float delta[3], scale, loc[3];
+ float mval_f[2];
mul_v3_m4v3(loc, ob->obmat, center);
initgrabz(vc->rv3d, loc[0], loc[1], loc[2]);
- window_to_3d_delta(vc->ar, delta, pixel_radius, 0);
+
+ mval_f[0]= pixel_radius;
+ mval_f[1]= 0.0f;
+ ED_view3d_win_to_delta(vc->ar, mval_f, delta);
scale= fabsf(mat4_to_scale(ob->obmat));
scale= (scale == 0.0f)? 1.0f: scale;
@@ -144,7 +148,7 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl
}
/* compute uv coordinates of mouse in face */
-void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, int *xy, float *uv)
+void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const int xy[2], float uv[2])
{
DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
const int *index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
@@ -210,7 +214,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, int *xy,
}
///* returns 0 if not found, otherwise 1 */
-int imapaint_pick_face(ViewContext *vc, Mesh *me, int *mval, unsigned int *index)
+int imapaint_pick_face(ViewContext *vc, Mesh *me, const int mval[2], unsigned int *index)
{
if(!me || me->totface==0)
return 0;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index f4fc004f413..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);
@@ -731,7 +749,7 @@ static int sample_backbuf_area(ViewContext *vc, int *indexar, int totface, int x
return tot;
}
-static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], float *vert_nor, float *mval, float pressure)
+static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], float *vert_nor, const float mval[2], float pressure)
{
Brush *brush = paint_brush(&vp->paint);
float fac, fac_2, size, dx, dy;
@@ -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;
@@ -1724,7 +1773,7 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent
return 1;
}
-static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index, float mval[2], float pressure, int UNUSED(flip))
+static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index, const float mval[2], float pressure, int UNUSED(flip))
{
ViewContext *vc = &vpd->vc;
Brush *brush = paint_brush(&vp->paint);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 09e46119dbe..20e74702067 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -281,7 +281,7 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d,
float bb_min[3], bb_max[3], pmat[4][4];
int i, j, k;
- view3d_get_object_project_mat(rv3d, ob, pmat);
+ ED_view3d_ob_project_mat_get(rv3d, ob, pmat);
if(!pbvh)
return 0;
@@ -301,7 +301,7 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d,
vec[0] = i ? bb_min[0] : bb_max[0];
vec[1] = j ? bb_min[1] : bb_max[1];
vec[2] = k ? bb_min[2] : bb_max[2];
- view3d_project_float(ar, vec, proj, pmat);
+ ED_view3d_project_float(ar, vec, proj, pmat);
rect->xmin = MIN2(rect->xmin, proj[0]);
rect->xmax = MAX2(rect->xmax, proj[0]);
rect->ymin = MIN2(rect->ymin, proj[1]);
@@ -357,7 +357,7 @@ void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar,
rect.ymax -= 2;
#endif
- view3d_calculate_clipping(&bb, planes, &mats, &rect);
+ ED_view3d_calc_clipping(&bb, planes, &mats, &rect);
mul_m4_fl(planes, -1.0f);
/* clear redraw flag from nodes */
@@ -912,7 +912,7 @@ static void calc_sculpt_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **n
{
switch (brush->sculpt_plane) {
case SCULPT_DISP_DIR_VIEW:
- viewvector(ss->cache->vc->rv3d, ss->cache->vc->rv3d->twmat[3], an);
+ ED_view3d_global_to_vector(ss->cache->vc->rv3d, ss->cache->vc->rv3d->twmat[3], an);
break;
case SCULPT_DISP_DIR_X:
@@ -1823,7 +1823,7 @@ static void calc_sculpt_plane(Sculpt *sd, Object *ob, PBVHNode **nodes, int totn
{
switch (brush->sculpt_plane) {
case SCULPT_DISP_DIR_VIEW:
- viewvector(ss->cache->vc->rv3d, ss->cache->vc->rv3d->twmat[3], an);
+ ED_view3d_global_to_vector(ss->cache->vc->rv3d, ss->cache->vc->rv3d->twmat[3], an);
break;
case SCULPT_DISP_DIR_X:
@@ -2926,7 +2926,7 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
cache->mats = MEM_callocN(sizeof(bglMats), "sculpt bglMats");
view3d_get_transformation(vc->ar, vc->rv3d, vc->obact, cache->mats);
- viewvector(cache->vc->rv3d, cache->vc->rv3d->twmat[3], cache->true_view_normal);
+ ED_view3d_global_to_vector(cache->vc->rv3d, cache->vc->rv3d->twmat[3], cache->true_view_normal);
/* Initialize layer brush displacements and persistent coords */
if(brush->sculpt_tool == SCULPT_TOOL_LAYER) {
/* not supported yet for multires */
@@ -2994,8 +2994,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
cache->orig_grab_location[1],
cache->orig_grab_location[2]);
- window_to_3d_delta(cache->vc->ar, grab_location,
- cache->mouse[0], cache->mouse[1]);
+ ED_view3d_win_to_delta(cache->vc->ar, cache->mouse, grab_location);
/* compute delta to move verts by */
if(!cache->first_time) {
@@ -3247,7 +3246,7 @@ int sculpt_stroke_get_location(bContext *C, struct PaintStroke *stroke, float ou
sculpt_stroke_modifiers_check(C, ob);
- viewline(vc->ar, vc->v3d, mval, ray_start, ray_end);
+ ED_view3d_win_to_segment_clip(vc->ar, vc->v3d, mval, ray_start, ray_end);
invert_m4_m4(obimat, ob->obmat);
mul_m4_v3(obimat, ray_start);
diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt
index c2f7707309b..6a99971a5af 100644
--- a/source/blender/editors/sound/CMakeLists.txt
+++ b/source/blender/editors/sound/CMakeLists.txt
@@ -31,10 +31,14 @@ set(INC
../../../../intern/audaspace/intern
)
+set(INC_SYS
+
+)
+
set(SRC
sound_ops.c
sound_intern.h
)
-blender_add_lib(bf_editor_sound "${SRC}" "${INC}")
+blender_add_lib(bf_editor_sound "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt
index 7c52f4a9efb..6789556aa2b 100644
--- a/source/blender/editors/space_action/CMakeLists.txt
+++ b/source/blender/editors/space_action/CMakeLists.txt
@@ -28,6 +28,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -41,4 +44,4 @@ set(SRC
action_intern.h
)
-blender_add_lib(bf_editor_space_action "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_action "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 6637e7004d5..be8547afa23 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -847,16 +847,10 @@ static int actkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
Scene *scene= ac.scene;
ARegion *ar= ac.ar;
View2D *v2d= &ar->v2d;
-
- int mval[2];
float x;
-
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
+
/* determine which side of the current frame mouse is on */
- 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);
if (x < CFRA)
RNA_enum_set(op->ptr, "mode", ACTKEYS_LRSEL_LEFT);
else
@@ -974,7 +968,7 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se
/* ------------------- */
-static void mouse_action_keys (bAnimContext *ac, int mval[2], short select_mode, short column)
+static void mouse_action_keys (bAnimContext *ac, const int mval[2], short select_mode, short column)
{
ListBase anim_data = {NULL, NULL};
DLRBT_Tree anim_keys;
@@ -1159,7 +1153,6 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
bAnimContext ac;
ARegion *ar;
short selectmode, column;
- int mval[2];
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -1167,11 +1160,7 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
/* get useful pointers from animation context data */
ar= ac.ar;
-
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
+
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -1182,7 +1171,7 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
column= RNA_boolean_get(op->ptr, "column");
/* select keyframe(s) based upon mouse position*/
- mouse_action_keys(&ac, mval, selectmode, column);
+ mouse_action_keys(&ac, event->mval, selectmode, column);
/* set notifier that keyframe selection (and channels too) have changed */
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|ND_ANIMCHAN|NA_SELECTED, NULL);
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt
index 22319dbb26e..c2dc2582c82 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_api/CMakeLists.txt
@@ -30,9 +30,13 @@ set(INC
../../../../intern/guardedalloc
)
+set(INC_SYS
+
+)
+
set(SRC
space.c
spacetypes.c
)
-blender_add_lib(bf_editor_space_api "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_api "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index e9670949cd5..0a4f251e46f 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -28,6 +28,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -40,4 +43,4 @@ set(SRC
buttons_intern.h
)
-blender_add_lib(bf_editor_space_buttons "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_buttons "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 9190d5aff54..9b914df1b3c 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -51,6 +51,7 @@
#include "WM_types.h"
#include "ED_screen.h"
+#include "ED_util.h"
#include "RNA_access.h"
@@ -131,7 +132,19 @@ static int file_browse_exec(bContext *C, wmOperator *op)
RNA_property_update(C, &fbo->ptr, fbo->prop);
MEM_freeN(str);
+
+ /* special, annoying exception, filesel on redo panel [#26618] */
+ {
+ wmOperator *redo_op= WM_operator_last_redo(C);
+ if(redo_op) {
+ if(fbo->ptr.data == redo_op->ptr->data) {
+ ED_undo_operator_repeat(C, redo_op);
+ }
+ }
+ }
+
MEM_freeN(op->customdata);
+
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt
index 14e7f4a90d0..f89d782c7f2 100644
--- a/source/blender/editors/space_console/CMakeLists.txt
+++ b/source/blender/editors/space_console/CMakeLists.txt
@@ -29,6 +29,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -44,4 +47,4 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
-blender_add_lib(bf_editor_space_console "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_console "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt
index 0a3bce76466..e161e2d4b9b 100644
--- a/source/blender/editors/space_file/CMakeLists.txt
+++ b/source/blender/editors/space_file/CMakeLists.txt
@@ -31,6 +31,9 @@ set(INC
../../windowmanager
../../render/extern/include
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -72,4 +75,4 @@ if(WITH_IMAGE_HDR)
add_definitions(-DWITH_HDR)
endif()
-blender_add_lib(bf_editor_space_file "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_file "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 5d786c1d00b..9662b4b401f 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -318,8 +318,8 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
if(ar->regiontype != RGN_TYPE_WINDOW)
return OPERATOR_CANCELLED;
- rect.xmin = rect.xmax = event->x - ar->winrct.xmin;
- rect.ymin = rect.ymax = event->y - ar->winrct.ymin;
+ rect.xmin = rect.xmax = event->mval[0];
+ rect.ymin = rect.ymax = event->mval[1];
if(!BLI_in_rcti(&ar->v2d.mask, rect.xmin, rect.ymin))
return OPERATOR_CANCELLED;
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/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt
index 59f2b22516d..f5548097db2 100644
--- a/source/blender/editors/space_graph/CMakeLists.txt
+++ b/source/blender/editors/space_graph/CMakeLists.txt
@@ -29,6 +29,9 @@ set(INC
../../windowmanager
../../../../intern/guardedalloc
../../../../intern/audaspace/intern
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -44,4 +47,4 @@ set(SRC
graph_intern.h
)
-blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index d3b9c68a492..382bb71a592 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -320,7 +320,9 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
/* don't draw handle lines if handles are not to be shown */
if ( (sipo->flag & SIPO_NOHANDLES) || /* handles shouldn't be shown anywhere */
(fcu->flag & FCURVE_PROTECTED) || /* keyframes aren't editable */
+#if 0 /* handles can still be selected and handle types set, better draw - campbell */
(fcu->flag & FCURVE_INT_VALUES) || /* editing the handles here will cause weird/incorrect interpolation issues */
+#endif
((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) || /* group that curve belongs to is not editable */
(fcu->totvert <= 1) /* do not show handles if there is only 1 keyframe, otherwise they all clump together in an ugly ball */
)
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 8510446768d..03cc8bb9e80 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -102,18 +102,13 @@ static void graphview_cursor_setprops(bContext *C, wmOperator *op, wmEvent *even
{
ARegion *ar= CTX_wm_region(C);
float viewx, viewy;
- int x, y;
-
+
/* abort if not active region (should not really be possible) */
if (ar == NULL)
return;
-
- /* convert screen coordinates to region coordinates */
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
-
+
/* convert from region coordinates to View2D 'tot' space */
- UI_view2d_region_to_view(&ar->v2d, x, y, &viewx, &viewy);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
/* store the values in the operator properties */
/* frame is rounded to the nearest int, since frames are ints */
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 47b3a71a9ea..76883027df1 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -817,20 +817,14 @@ static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEve
Scene *scene= ac.scene;
ARegion *ar= ac.ar;
View2D *v2d= &ar->v2d;
-
- int mval[2];
float x;
-
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
+
/* determine which side of the current frame mouse is on */
- 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);
if (x < CFRA)
- RNA_int_set(op->ptr, "mode", GRAPHKEYS_LRSEL_LEFT);
+ RNA_enum_set(op->ptr, "mode", GRAPHKEYS_LRSEL_LEFT);
else
- RNA_int_set(op->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
+ RNA_enum_set(op->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
}
/* perform selection */
@@ -905,7 +899,7 @@ static int fcurve_handle_sel_check(SpaceIpo *sipo, BezTriple *bezt)
/* check if the given vertex is within bounds or not */
// TODO: should we return if we hit something?
-static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *fcu, BezTriple *bezt, FPoint *fpt, short hpoint, int mval[2])
+static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *fcu, BezTriple *bezt, FPoint *fpt, short hpoint, const int mval[2])
{
/* Keyframes or Samples? */
if (bezt) {
@@ -957,7 +951,7 @@ static void nearest_fcurve_vert_store (ListBase *matches, View2D *v2d, FCurve *f
}
/* helper for find_nearest_fcurve_vert() - build the list of nearest matches */
-static void get_nearest_fcurve_verts_list (bAnimContext *ac, int mval[2], ListBase *matches)
+static void get_nearest_fcurve_verts_list (bAnimContext *ac, const int mval[2], ListBase *matches)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -1074,7 +1068,7 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert (ListBase *matches)
/* Find the nearest vertices (either a handle or the keyframe) that are nearest to the mouse cursor (in area coordinates)
* NOTE: the match info found must still be freed
*/
-static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, int mval[2])
+static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, const int mval[2])
{
ListBase matches = {NULL, NULL};
tNearestVertInfo *nvi;
@@ -1094,7 +1088,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, int mval[2]
/* ------------------- */
/* option 1) select keyframe directly under mouse */
-static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, short curves_only)
+static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_mode, short curves_only)
{
SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
tNearestVertInfo *nvi;
@@ -1217,7 +1211,7 @@ static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, s
/* (see graphkeys_select_leftright) */
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */
-static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short select_mode)
+static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short select_mode)
{
ListBase anim_data= {NULL, NULL};
bAnimListElem *ale;
@@ -1297,21 +1291,12 @@ static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short selec
static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
bAnimContext ac;
- ARegion *ar;
short selectmode;
- int mval[2];
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
-
- /* get useful pointers from animation context data */
- ar= ac.ar;
-
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
+
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -1321,15 +1306,15 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
/* figure out action to take */
if (RNA_boolean_get(op->ptr, "column")) {
/* select all keyframes in the same frame as the one that was under the mouse */
- graphkeys_mselect_column(&ac, mval, selectmode);
+ graphkeys_mselect_column(&ac, event->mval, selectmode);
}
else if (RNA_boolean_get(op->ptr, "curves")) {
/* select all keyframes in the same F-Curve as the one under the mouse */
- mouse_graph_keys(&ac, mval, selectmode, 1);
+ mouse_graph_keys(&ac, event->mval, selectmode, 1);
}
else {
/* select keyframe under mouse */
- mouse_graph_keys(&ac, mval, selectmode, 0);
+ mouse_graph_keys(&ac, event->mval, selectmode, 0);
}
/* set notifier that keyframe selection (and also channel selection in some cases) has changed */
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 554d2e36ccf..883b476f372 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -71,17 +71,12 @@ ARegion *graph_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype==RGN_TYPE_UI)
- return ar;
- }
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if(ar) return ar;
+
/* add subdiv level; after main */
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype==RGN_TYPE_WINDOW)
- break;
- }
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+
/* is error! */
if (ar==NULL) return NULL;
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt
index 286f1f3178b..7c2d7ffb47b 100644
--- a/source/blender/editors/space_image/CMakeLists.txt
+++ b/source/blender/editors/space_image/CMakeLists.txt
@@ -31,6 +31,9 @@ set(INC
../../windowmanager
../../render/extern/include
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -59,4 +62,4 @@ if(WITH_IMAGE_CINEON)
add_definitions(-DWITH_CINEON)
endif()
-blender_add_lib(bf_editor_space_image "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_image "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index c4d52e3b836..f48daa39c59 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1653,16 +1653,13 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
ImageSampleInfo *info= op->customdata;
float fx, fy;
- int mx, my;
if(ibuf == NULL) {
ED_space_image_release_buffer(sima, lock);
return;
}
- mx= event->x - ar->winrct.xmin;
- my= event->y - ar->winrct.ymin;
- UI_view2d_region_to_view(&ar->v2d, mx, my, &fx, &fy);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
float *fp;
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 409ab4b2fc6..2e9544f5d20 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -328,16 +328,13 @@ static void image_scopes_tag_refresh(ScrArea *sa)
ARegion *image_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_UI)
- return ar;
+
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if(ar) return ar;
/* add subdiv level; after header */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_HEADER)
- break;
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+
/* is error! */
if(ar==NULL) return NULL;
@@ -355,16 +352,13 @@ ARegion *image_has_buttons_region(ScrArea *sa)
ARegion *image_has_scope_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_PREVIEW)
- return ar;
-
+
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+ if(ar) return ar;
+
/* add subdiv level; after buttons */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_UI)
- break;
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+
/* is error! */
if(ar==NULL) return NULL;
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index 16f4b2dedff..c6ed1b7bac7 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -30,6 +30,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -45,4 +48,4 @@ set(SRC
textview.h
)
-blender_add_lib(bf_editor_space_info "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_info "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt
index 6323ef779c2..cd24cb5e5d0 100644
--- a/source/blender/editors/space_logic/CMakeLists.txt
+++ b/source/blender/editors/space_logic/CMakeLists.txt
@@ -29,6 +29,9 @@ set(INC
../../windowmanager
../../editors/interface
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -45,4 +48,4 @@ if(WITH_GAMEENGINE)
add_definitions(-DWITH_GAMEENGINE)
endif()
-blender_add_lib(bf_editor_space_logic "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_logic "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index 7944f0737e1..f420d0ef690 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -63,16 +63,13 @@
ARegion *logic_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_UI)
- return ar;
+
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if(ar) return ar;
/* add subdiv level; after header */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_HEADER)
- break;
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+
/* is error! */
if(ar==NULL) return NULL;
diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt
index 59ccb204d8c..1bf04f4dc37 100644
--- a/source/blender/editors/space_nla/CMakeLists.txt
+++ b/source/blender/editors/space_nla/CMakeLists.txt
@@ -28,6 +28,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -43,4 +46,4 @@ set(SRC
nla_intern.h
)
-blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 265616020d5..38f680fff07 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -303,7 +303,7 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
bAnimContext ac;
ARegion *ar;
View2D *v2d;
- int mval[2], channel_index;
+ int channel_index;
int notifierFlags = 0;
short selectmode;
float x, y;
@@ -316,10 +316,6 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
ar= ac.ar;
v2d= &ar->v2d;
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -331,7 +327,7 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
* so that the tops of channels get caught ok. Since NLACHANNEL_FIRST is really NLACHANNEL_HEIGHT, we simply use
* NLACHANNEL_HEIGHT_HALF.
*/
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
+ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
UI_view2d_listview_view_to_cell(v2d, NLACHANNEL_NAMEWIDTH, NLACHANNEL_STEP, 0, (float)NLACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index);
/* handle mouse-click in the relevant channel then */
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index 188042ad1d1..0f0a4c0ad4c 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -459,16 +459,10 @@ static int nlaedit_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
Scene *scene= ac.scene;
ARegion *ar= ac.ar;
View2D *v2d= &ar->v2d;
-
- int mval[2];
float x;
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
/* determine which side of the current frame mouse is on */
- 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);
if (x < CFRA)
RNA_int_set(op->ptr, "mode", NLAEDIT_LRSEL_LEFT);
else
@@ -503,7 +497,7 @@ void NLA_OT_select_leftright (wmOperatorType *ot)
/* ******************** Mouse-Click Select Operator *********************** */
/* select strip directly under mouse */
-static void mouse_nla_strips (bContext *C, bAnimContext *ac, int mval[2], short select_mode)
+static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2], short select_mode)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale = NULL;
@@ -614,8 +608,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
ARegion *ar;
// View2D *v2d; /*UNUSED*/
short selectmode;
- int mval[2];
-
+
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
@@ -624,11 +617,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
scene= ac.scene;
ar= ac.ar;
// v2d= &ar->v2d;
-
- /* get mouse coordinates (in region coordinates) */
- mval[0]= (event->x - ar->winrct.xmin);
- mval[1]= (event->y - ar->winrct.ymin);
-
+
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend"))
selectmode= SELECT_INVERT;
@@ -636,7 +625,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
selectmode= SELECT_REPLACE;
/* select strips based upon mouse position */
- mouse_nla_strips(C, &ac, mval, selectmode);
+ mouse_nla_strips(C, &ac, event->mval, selectmode);
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_SELECTED, NULL);
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 90f9996e392..f2e0abe1e60 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -69,18 +69,13 @@
ARegion *nla_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype==RGN_TYPE_UI)
- return ar;
- }
-
+
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if(ar) return ar;
+
/* add subdiv level; after main */
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype==RGN_TYPE_WINDOW)
- break;
- }
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+
/* is error! */
if (ar==NULL) return NULL;
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index 0bcd86f53cf..36667e0e00e 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -33,6 +33,9 @@ set(INC
../../render/extern/include
../../../../intern/guardedalloc
../../../../intern/opennl/extern
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -51,4 +54,4 @@ set(SRC
node_intern.h
)
-blender_add_lib(bf_editor_space_node "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 11d822607d7..8668a883fd2 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -995,7 +995,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_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index e1085a5ca71..c88cbac2398 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1206,7 +1206,6 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
Image *ima;
ImBuf *ibuf;
float fx, fy, bufx, bufy;
- int mx, my;
ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
@@ -1221,13 +1220,11 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
IMB_rect_from_float(ibuf);
}
- mx= event->x - ar->winrct.xmin;
- my= event->y - ar->winrct.ymin;
/* map the mouse coords to the backdrop image space */
bufx = ibuf->x * snode->zoom;
bufy = ibuf->y * snode->zoom;
- fx = (bufx > 0.0f ? ((float)mx - 0.5f*ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
- fy = (bufy > 0.0f ? ((float)my - 0.5f*ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
+ fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f*ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
+ fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f*ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
float *fp;
@@ -1357,7 +1354,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event)
switch (event->type) {
case MOUSEMOVE:
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&mx, &my);
if (node) {
@@ -1398,7 +1395,7 @@ static int node_resize_invoke(bContext *C, wmOperator *op, wmEvent *event)
rctf totr;
/* convert mouse coordinates to v2d space */
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&snode->mx, &snode->my);
/* rect we're interested in is just the bottom right corner */
@@ -2134,7 +2131,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
sock= nldrag->sock;
link= nldrag->link;
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&snode->mx, &snode->my);
switch (event->type) {
@@ -2284,7 +2281,7 @@ static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event)
bNodeLinkDrag *nldrag= MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata");
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&snode->mx, &snode->my);
ED_preview_kill_jobs(C);
@@ -2968,7 +2965,7 @@ static int node_add_file_invoke(bContext *C, wmOperator *op, wmEvent *event)
SpaceNode *snode= CTX_wm_space_node(C);
/* convert mouse coordinates to v2d space */
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
&snode->mx, &snode->my);
if (RNA_property_is_set(op->ptr, "filepath") || RNA_property_is_set(op->ptr, "name"))
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 6bda47e5c8f..a1ef75f3976 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -124,14 +124,8 @@ static int node_select_exec(bContext *C, wmOperator *op)
static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- int mval[2];
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
- RNA_int_set(op->ptr, "mouse_x", mval[0]);
- RNA_int_set(op->ptr, "mouse_y", mval[1]);
+ RNA_int_set(op->ptr, "mouse_x", event->mval[0]);
+ RNA_int_set(op->ptr, "mouse_y", event->mval[1]);
return node_select_exec(C,op);
}
@@ -199,17 +193,9 @@ static int node_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event
/* this allows border select on empty space, but drag-translate on nodes */
SpaceNode *snode= CTX_wm_space_node(C);
ARegion *ar= CTX_wm_region(C);
- int mval[2];
float mx, my;
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
- /* get mouse coordinates in view2d space */
- mx= (float)mval[0];
- my= (float)mval[1];
-
- UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &mx, &my);
+
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &mx, &my);
if (node_under_mouse(snode->edittree, mx, my))
return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c
index 9665a152970..601ffbd313d 100644
--- a/source/blender/editors/space_node/node_state.c
+++ b/source/blender/editors/space_node/node_state.c
@@ -201,14 +201,8 @@ static int node_toggle_visibility_exec(bContext *C, wmOperator *op)
static int node_toggle_visibility_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- int mval[2];
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
- RNA_int_set(op->ptr, "mouse_x", mval[0]);
- RNA_int_set(op->ptr, "mouse_y", mval[1]);
+ RNA_int_set(op->ptr, "mouse_x", event->mval[0]);
+ RNA_int_set(op->ptr, "mouse_y", event->mval[1]);
return node_toggle_visibility_exec(C,op);
}
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 3147e5d7a38..81bf20ccea5 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -72,16 +72,13 @@
ARegion *node_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_UI)
- return ar;
+
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if(ar) return ar;
/* add subdiv level; after header */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_HEADER)
- break;
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+
/* is error! */
if(ar==NULL) return NULL;
diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index 871dec4dfc5..c05350c256f 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -30,6 +30,9 @@ set(INC
../../windowmanager
../../../../intern/guardedalloc
../../../../intern/opennl/extern
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -41,4 +44,4 @@ set(SRC
outliner_intern.h
)
-blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 32e6424f709..037b1db56d6 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -2482,7 +2482,7 @@ static int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops,
return 0;
}
-static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, float *mval)
+static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, const float mval[2])
{
if(mval[1]>te->ys && mval[1]<te->ys+OL_H) {
@@ -2580,7 +2580,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
float fmval[2];
int extend= RNA_boolean_get(op->ptr, "extend");
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
if(!ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) && !(soops->flag & SO_HIDE_RESTRICTCOLS) && fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX)
return OPERATOR_CANCELLED;
@@ -2628,7 +2628,7 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
/* *********** */
-static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, float *mval)
+static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, const float mval[2])
{
if(mval[1]>te->ys && mval[1]<te->ys+OL_H) {
@@ -2664,7 +2664,7 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event)
float fmval[2];
int all= RNA_boolean_get(op->ptr, "all");
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_item_openclose(C, soops, te, all, fmval))
@@ -2693,7 +2693,7 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
/* ********************************************** */
-static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, float *mval)
+static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, const float mval[2])
{
if(mval[1]>te->ys && mval[1]<te->ys+OL_H) {
@@ -2736,7 +2736,7 @@ static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
TreeElement *te;
float fmval[2];
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_item_rename(C, ar, soops, te, fmval)) break;
@@ -3728,7 +3728,7 @@ void OUTLINER_OT_data_operation(wmOperatorType *ot)
/* ******************** */
-static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, wmEvent *event, float *mval)
+static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, wmEvent *event, const float mval[2])
{
if(mval[1]>te->ys && mval[1]<te->ys+OL_H) {
@@ -3791,7 +3791,7 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *even
TreeElement *te;
float fmval[2];
- UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break;
diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt
index 974dc66e22c..1aed177eed1 100644
--- a/source/blender/editors/space_script/CMakeLists.txt
+++ b/source/blender/editors/space_script/CMakeLists.txt
@@ -28,6 +28,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -41,8 +44,9 @@ set(SRC
)
if(WITH_PYTHON)
- list(APPEND INC ${PYTHON_INCLUDE_DIRS} ../../python)
+ list(APPEND INC ../../python)
+ list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS})
add_definitions(-DWITH_PYTHON)
endif()
-blender_add_lib(bf_editor_space_script "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_script "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt
index 9dc0b7a4258..d5f36719471 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -30,6 +30,9 @@ set(INC
../../windowmanager
../../../../intern/guardedalloc
../../../../intern/audaspace/intern
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -46,4 +49,4 @@ set(SRC
sequencer_intern.h
)
-blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index ad0d0048388..6d50913dfd4 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -117,17 +117,11 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op,
static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int flag)
{
- ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
- int mval[2];
float mval_v2d[2];
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &mval_v2d[0], &mval_v2d[1]);
+ UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mval_v2d[0], &mval_v2d[1]);
RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f);
RNA_int_set(op->ptr, "frame_start", (int)mval_v2d[0]);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 880f285c3e3..71ed7928bc8 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1573,14 +1573,13 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Scene *scene = CTX_data_scene(C);
- ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
int cut_side= SEQ_SIDE_BOTH;
int cut_frame= CFRA;
if (ED_operator_sequencer_active(C) && v2d)
- cut_side= mouse_frame_side(v2d, event->x - ar->winrct.xmin, cut_frame);
+ cut_side= mouse_frame_side(v2d, event->mval[0], cut_frame);
RNA_int_set(op->ptr, "frame", cut_frame);
RNA_enum_set(op->ptr, "side", cut_side);
@@ -2720,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 2cae2d17a33..8b4bfb2e042 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -298,7 +298,6 @@ void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot)
static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
@@ -306,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;
@@ -318,10 +315,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
marker=find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
- seq= find_nearest_seq(scene, v2d, &hand, mval);
+ seq= find_nearest_seq(scene, v2d, &hand, event->mval);
// XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip
if(seq && linked_time && left_right)
@@ -347,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) {
@@ -652,20 +646,15 @@ void SEQUENCER_OT_select_less(wmOperatorType *ot)
static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Scene *scene= CTX_data_scene(C);
- ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
short extend= RNA_boolean_get(op->ptr, "extend");
- int mval[2];
Sequence *mouse_seq;
int selected, hand;
-
- mval[0]= event->x - ar->winrct.xmin;
- mval[1]= event->y - ar->winrct.ymin;
-
+
/* this works like UV, not mesh */
- mouse_seq= find_nearest_seq(scene, v2d, &hand, mval);
+ mouse_seq= find_nearest_seq(scene, v2d, &hand, event->mval);
if (!mouse_seq)
return OPERATOR_FINISHED; /* user error as with mesh?? */
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 32bd9ce604c..d1df9699fa3 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -66,16 +66,13 @@
ARegion *sequencer_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_UI)
- return ar;
+
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if(ar) return ar;
/* add subdiv level; after header */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_HEADER)
- break;
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+
/* is error! */
if(ar==NULL) return NULL;
diff --git a/source/blender/editors/space_sound/CMakeLists.txt b/source/blender/editors/space_sound/CMakeLists.txt
index 9e70d1dbda3..367d07c0c0b 100644
--- a/source/blender/editors/space_sound/CMakeLists.txt
+++ b/source/blender/editors/space_sound/CMakeLists.txt
@@ -28,6 +28,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -38,4 +41,4 @@ set(SRC
sound_intern.h
)
-blender_add_lib(bf_editor_space_sound "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_sound "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt
index 6241d397417..0c174225a58 100644
--- a/source/blender/editors/space_text/CMakeLists.txt
+++ b/source/blender/editors/space_text/CMakeLists.txt
@@ -29,6 +29,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -43,8 +46,9 @@ set(SRC
)
if(WITH_PYTHON)
- list(APPEND INC ${PYTHON_INCLUDE_DIRS} ../../python)
+ list(APPEND INC ../../python)
+ list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS})
add_definitions(-DWITH_PYTHON)
endif()
-blender_add_lib(bf_editor_text "${SRC}" "${INC}")
+blender_add_lib(bf_editor_text "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index bfc600c774a..165cec238c0 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -55,6 +55,7 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
+#include "BKE_screen.h"
#include "ED_screen.h"
@@ -78,16 +79,13 @@
static ARegion *text_has_properties_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_UI)
- return ar;
+
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if(ar) return ar;
/* add subdiv level; after header */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_HEADER)
- break;
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+
/* is error! */
if(ar==NULL) return NULL;
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 635e922cd65..2bd6bd624df 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -894,7 +894,7 @@ static int indent_exec(bContext *C, wmOperator *UNUSED(op))
if(txt_has_sel(text)) {
txt_order_cursors(text);
- indent(text);
+ txt_indent(text);
}
else
txt_add_char(text, '\t');
@@ -929,7 +929,7 @@ static int unindent_exec(bContext *C, wmOperator *UNUSED(op))
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
txt_order_cursors(text);
- unindent(text);
+ txt_unindent(text);
text_update_edited(text);
@@ -1011,7 +1011,7 @@ static int comment_exec(bContext *C, wmOperator *UNUSED(op))
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
txt_order_cursors(text);
- comment(text);
+ txt_comment(text);
text_update_edited(text);
text_update_cursor_moved(C);
@@ -1044,7 +1044,7 @@ static int uncomment_exec(bContext *C, wmOperator *UNUSED(op))
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
txt_order_cursors(text);
- uncomment(text);
+ txt_uncomment(text);
text_update_edited(text);
text_update_cursor_moved(C);
diff --git a/source/blender/editors/space_time/CMakeLists.txt b/source/blender/editors/space_time/CMakeLists.txt
index 654930fc95d..79081c7cfd4 100644
--- a/source/blender/editors/space_time/CMakeLists.txt
+++ b/source/blender/editors/space_time/CMakeLists.txt
@@ -28,6 +28,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -38,4 +41,4 @@ set(SRC
time_intern.h
)
-blender_add_lib(bf_editor_space_time "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_time "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index ca9d786c4de..e55fbe11e52 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -367,15 +367,11 @@ static void time_draw_keyframes(const bContext *C, SpaceTime *stime, ARegion *ar
static void time_refresh(const bContext *UNUSED(C), ScrArea *sa)
{
- SpaceTime *stime = (SpaceTime *)sa->spacedata.first;
- ARegion *ar;
-
/* find the main timeline region and refresh cache display*/
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype==RGN_TYPE_WINDOW) {
- time_cache_refresh(stime);
- break;
- }
+ ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if(ar) {
+ SpaceTime *stime = (SpaceTime *)sa->spacedata.first;
+ time_cache_refresh(stime);
}
}
diff --git a/source/blender/editors/space_userpref/CMakeLists.txt b/source/blender/editors/space_userpref/CMakeLists.txt
index 68fe9d3e04c..656a5d2f0ef 100644
--- a/source/blender/editors/space_userpref/CMakeLists.txt
+++ b/source/blender/editors/space_userpref/CMakeLists.txt
@@ -30,6 +30,10 @@ set(INC
../../../../intern/guardedalloc
)
+set(INC_SYS
+
+)
+
set(SRC
space_userpref.c
userpref_ops.c
@@ -37,4 +41,4 @@ set(SRC
userpref_intern.h
)
-blender_add_lib(bf_editor_space_userpref "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_userpref "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index f923c578769..0a12a28af8d 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -33,6 +33,9 @@ set(INC
../../render/extern/include
../../../../intern/guardedalloc
../../../../intern/smoke/extern
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -64,4 +67,4 @@ endif()
add_definitions(-DGLEW_STATIC)
-blender_add_lib(bf_editor_space_view3d "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_view3d "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 5e80b03dd5f..980b61e9715 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -147,7 +147,7 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int l
/* clipplanes in eye space */
if(rv3d->rflag & RV3D_CLIPPING) {
- if(view3d_test_clipping(rv3d, vec, local))
+ if(ED_view3d_test_clipping(rv3d, vec, local))
return;
}
@@ -630,7 +630,7 @@ void drawcircball(int mode, const float cent[3], float rad, float tmat[][4])
/* circle for object centers, special_color is for library or ob users */
static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3], int selstate, int special_color)
{
- const float size= view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f;
+ const float size= ED_view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f;
/* using gldepthfunc guarantees that it does write z values, but not checks for it, so centers remain visible independt order of drawing */
if(v3d->zbuf) glDepthFunc(GL_ALWAYS);
@@ -1015,7 +1015,7 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z)
static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt, int flag)
{
Object *ob= base->object;
- const float pixsize= view3d_pixel_size(rv3d, ob->obmat[3]);
+ const float pixsize= ED_view3d_pixel_size(rv3d, ob->obmat[3]);
Lamp *la= ob->data;
float vec[3], lvec[3], vvec[3], circrad, x,y,z;
float lampsize;
@@ -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);
@@ -2886,7 +2886,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
else {
/* don't create boundbox here with mesh_get_bb(), the derived system will make it, puts deformed bb's OK */
- if(me->totface<=4 || boundbox_clip(rv3d, ob->obmat, (ob->bb)? ob->bb: me->bb)) {
+ if(me->totface<=4 || ED_view3d_boundbox_clip(rv3d, ob->obmat, (ob->bb)? ob->bb: me->bb)) {
glsl = draw_glsl_material(scene, ob, v3d, dt);
check_alpha = check_material_alpha(base, me, glsl);
@@ -3672,7 +3672,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
case PART_DRAW_CROSS:
case PART_DRAW_AXIS:
/* lets calculate the scale: */
- pixsize= view3d_pixel_size(rv3d, ob->obmat[3]);
+ pixsize= ED_view3d_pixel_size(rv3d, ob->obmat[3]);
if(part->draw_size==0.0)
pixsize *= 2.0f;
@@ -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);
@@ -5522,7 +5524,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
hasfaces= displist_has_faces(&ob->disp);
}
- if (hasfaces && boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
+ if (hasfaces && ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
draw_index_wire= 0;
if (dm) {
draw_mesh_object_outline(v3d, ob, dm);
@@ -5575,7 +5577,7 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob)
if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
Curve *cu = ob->data;
- if (boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
+ if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
if (ob->type==OB_CURVE)
draw_index_wire= 0;
@@ -6012,7 +6014,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
draw_bounding_volume(scene, ob);
}
- else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb))
+ else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb))
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
break;
@@ -6028,7 +6030,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
draw_bounding_volume(scene, ob);
}
- else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
+ else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
//XXX old animsys if(cu->path)
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 02aed0e3a4a..354639d4734 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -71,16 +71,13 @@
ARegion *view3d_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_UI)
- return ar;
+
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if(ar) return ar;
/* add subdiv level; after header */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_HEADER)
- break;
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+
/* is error! */
if(ar==NULL) return NULL;
@@ -157,10 +154,10 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
if(rv3d==NULL) {
ScrArea *sa =CTX_wm_area(C);
if(sa && sa->spacetype==SPACE_VIEW3D) {
- ARegion *ar;
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_WINDOW)
- return ar->regiondata;
+ ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if(ar) {
+ rv3d= ar->regiondata;
+ }
}
}
return rv3d;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index f67ddab21e0..b328d39f1ee 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -61,6 +61,7 @@
#include "BKE_global.h"
#include "BKE_paint.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "BKE_unit.h"
#include "RE_engine.h"
@@ -206,7 +207,7 @@ static int test_clipping(const float vec[3], float clip[][4])
/* for 'local' ED_view3d_local_clipping must run first
* then all comparisons can be done in localspace */
-int view3d_test_clipping(RegionView3D *rv3d, const float vec[3], const int local)
+int ED_view3d_test_clipping(RegionView3D *rv3d, const float vec[3], const int local)
{
return test_clipping(vec, local ? rv3d->clip_local : rv3d->clip);
}
@@ -869,27 +870,14 @@ void view3d_viewborder_size_get(Scene *scene, ARegion *ar, float size_r[2])
}
}
-void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r, short do_shift)
+void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rctf *viewborder_r, short do_shift)
{
- float zoomfac, size[2];
+ const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom);
+ float size[2];
float dx= 0.0f, dy= 0.0f;
view3d_viewborder_size_get(scene, ar, size);
-
- if (rv3d == NULL)
- rv3d = ar->regiondata;
-
- /* magic zoom calculation, no idea what
- * it signifies, if you find out, tell me! -zr
- */
- /* simple, its magic dude!
- * well, to be honest, this gives a natural feeling zooming
- * with multiple keypad presses (ton)
- */
-
- zoomfac= ((float)M_SQRT2 + rv3d->camzoom/50.0f);
- zoomfac= (zoomfac*zoomfac) * 0.25f;
-
+
size[0]= size[0]*zoomfac;
size[1]= size[1]*zoomfac;
@@ -1008,7 +996,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
if(v3d->camera->type==OB_CAMERA)
ca = v3d->camera->data;
- view3d_calc_camera_border(scene, ar, rv3d, v3d, &viewborder, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
/* the offsets */
x1= viewborder.xmin;
y1= viewborder.ymin;
@@ -1166,6 +1154,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)) &&
@@ -1408,7 +1398,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
if(rv3d->persp==RV3D_CAMOB) {
rctf vb;
- view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
x1= vb.xmin;
y1= vb.ymin;
@@ -1417,17 +1407,18 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
}
else {
float sco[2];
+ const float mval_f[2]= {1.0f, 0.0f};
/* calc window coord */
initgrabz(rv3d, 0.0, 0.0, 0.0);
- window_to_3d_delta(ar, vec, 1, 0);
+ ED_view3d_win_to_delta(ar, mval_f, vec);
fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) );
fac= 1.0f/fac;
asp= ( (float)ibuf->y)/(float)ibuf->x;
vec[0] = vec[1] = vec[2] = 0.0;
- view3d_project_float(ar, vec, sco, rv3d->persmat);
+ ED_view3d_project_float(ar, vec, sco, rv3d->persmat);
cx = sco[0];
cy = sco[1];
@@ -1687,7 +1678,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
}
if(use_displist) {
glMultMatrixf(dob->mat);
- if(boundbox_clip(rv3d, dob->mat, &bb))
+ if(ED_view3d_boundbox_clip(rv3d, dob->mat, &bb))
glCallList(displist);
glLoadMatrixf(rv3d->viewmat);
}
@@ -1777,7 +1768,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
}
/* note, with nouveau drivers the glReadPixels() is very slow. [#24339] */
-void view3d_update_depths(ARegion *ar)
+void ED_view3d_depth_update(ARegion *ar)
{
RegionView3D *rv3d= ar->regiondata;
@@ -2605,16 +2596,10 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
}
if(v3d->lay_used != lay_used) { /* happens when loading old files or loading with UI load */
- ARegion *ar_iter;
- ScrArea *sa= CTX_wm_area(C);
-
/* find header and force tag redraw */
- for(ar_iter= sa->regionbase.first; ar_iter; ar_iter= ar_iter->next)
- if(ar_iter->regiontype==RGN_TYPE_HEADER) {
- ED_region_tag_redraw(ar_iter);
- break;
- }
-
+ ScrArea *sa= CTX_wm_area(C);
+ ARegion *ar_header= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+ ED_region_tag_redraw(ar_header); /* can be NULL */
v3d->lay_used= lay_used;
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 5e2b9fd5e3f..31aae28dd61 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -56,6 +56,7 @@
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "BKE_depsgraph.h" /* for ED_view3d_camera_lock_sync */
@@ -81,19 +82,57 @@
/* ********************** 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)) {
- ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist);
- DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB);
- WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d->camera);
+ 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)) {
+ Object *ob_update;
+ float view_mat[4][4];
+ float diff_mat[4][4];
+ float parent_mat[4][4];
+
+ while(root_parent->parent) {
+ root_parent= root_parent->parent;
+ }
+
+ ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
+
+ invert_m4_m4(v3d->camera->imat, v3d->camera->obmat);
+ mul_m4_m4m4(diff_mat, v3d->camera->imat, view_mat);
+
+ mul_m4_m4m4(parent_mat, root_parent->obmat, diff_mat);
+ object_apply_mat4(root_parent, parent_mat, TRUE, FALSE);
+
+ ob_update= v3d->camera;
+ while(ob_update) {
+ DAG_id_tag_update(&ob_update->id, OB_RECALC_OB);
+ WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, ob_update);
+ ob_update= ob_update->parent;
+ }
+ }
+ else {
+ ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist);
+ root_parent= v3d->camera;
+ DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB);
+ WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d->camera);
+ }
}
}
@@ -382,7 +421,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
view3d_operator_needs_opengl(C); /* needed for zbuf drawing */
- if((vod->use_dyn_ofs=view_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) {
+ if((vod->use_dyn_ofs=ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) {
if (rv3d->is_persp) {
float my_origin[3]; /* original G.vd->ofs */
float my_pivot[3]; /* view */
@@ -406,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);
@@ -417,8 +456,12 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
}
}
- /* for dolly */
- window_to_3d_vector(vod->ar, vod->mousevec, vod->oldx - vod->ar->winrct.xmin, vod->oldy - vod->ar->winrct.ymin);
+ {
+ /* for dolly */
+ float mval_f[2];
+ VECCOPY2D(mval_f, event->mval);
+ ED_view3d_win_to_vector(vod->ar, mval_f, vod->mousevec);
+ }
/* lookup, we dont pass on v3d to prevent confusement */
vod->grid= vod->v3d->grid;
@@ -778,7 +821,7 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
viewrotate_apply(vod, event->x, event->y);
}
else if (event_code==VIEW_CONFIRM) {
- request_depth_update(vod->rv3d);
+ ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -806,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;
}
}
@@ -817,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;
}
}
@@ -826,7 +869,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (event->type == MOUSEPAN) {
viewrotate_apply(vod, event->prevx, event->prevy);
- request_depth_update(rv3d);
+ ED_view3d_depth_tag_update(rv3d);
viewops_data_free(C, op);
@@ -835,7 +878,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
else if (event->type == MOUSEROTATE) {
/* MOUSEROTATE performs orbital rotation, so y axis delta is set to 0 */
viewrotate_apply(vod, event->prevx, event->y);
- request_depth_update(rv3d);
+ ED_view3d_depth_tag_update(rv3d);
viewops_data_free(C, op);
@@ -918,20 +961,21 @@ 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)) {
- float zoomfac= ((float)M_SQRT2 + (float)vod->rv3d->camzoom / 50.0f);
- zoomfac= (zoomfac * zoomfac) * 0.5f;
-
+ 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);
CLAMP(vod->rv3d->camdx, -1.0f, 1.0f);
CLAMP(vod->rv3d->camdy, -1.0f, 1.0f);
-// XXX preview3d_event= 0;
}
else {
float dvec[3];
+ float mval_f[2];
+
+ mval_f[0]= x - vod->oldx;
+ mval_f[1]= y - vod->oldy;
+ ED_view3d_win_to_delta(vod->ar, mval_f, dvec);
- window_to_3d_delta(vod->ar, dvec, x-vod->oldx, y-vod->oldy);
add_v3_v3(vod->rv3d->ofs, dvec);
if(vod->rv3d->viewlock & RV3D_BOXVIEW)
@@ -980,7 +1024,7 @@ static int viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
viewmove_apply(vod, event->x, event->y);
}
else if (event_code==VIEW_CONFIRM) {
- request_depth_update(vod->rv3d);
+ ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
@@ -1000,7 +1044,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (event->type == MOUSEPAN) {
viewmove_apply(vod, event->prevx, event->prevy);
- request_depth_update(vod->rv3d);
+ ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
@@ -1033,6 +1077,7 @@ void VIEW3D_OT_move(wmOperatorType *ot)
/* ************************ viewzoom ******************************** */
+/* viewdolly_modal_keymap has an exact copy of this, apply fixes to both */
/* called in transform_ops.c, on each regeneration of keymaps */
void viewzoom_modal_keymap(wmKeyConfig *keyconf)
{
@@ -1073,21 +1118,17 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
float dvec[3];
float tvec[3];
float tpos[3];
+ float mval_f[2];
float new_dist;
- int vb[2], mouseloc[2];
-
- mouseloc[0]= mx - ar->winrct.xmin;
- mouseloc[1]= my - ar->winrct.ymin;
-
- /* find the current window width and height */
- vb[0] = ar->winx;
- vb[1] = ar->winy;
negate_v3_v3(tpos, rv3d->ofs);
/* Project cursor position into 3D space */
initgrabz(rv3d, tpos[0], tpos[1], tpos[2]);
- window_to_3d_delta(ar, dvec, mouseloc[0]-vb[0]/2.0f, mouseloc[1]-vb[1]/2.0f);
+
+ mval_f[0]= (float)(((mx - ar->winrct.xmin) * 2) - ar->winx) / 2.0f;
+ mval_f[1]= (float)(((my - ar->winrct.ymin) * 2) - ar->winy) / 2.0f;
+ ED_view3d_win_to_delta(ar, mval_f, dvec);
/* Calculate view target position for dolly */
add_v3_v3v3(tvec, tpos, dvec);
@@ -1165,24 +1206,9 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
zfac * vod->rv3d->dist < 10.0f * vod->far)
view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy);
-
- if ((U.uiflag & USER_ORBIT_ZBUF) && (viewzoom==USER_ZOOM_CONT) && (vod->rv3d->persp==RV3D_PERSP)) {
- float upvec[3], mat[3][3];
-
- /* Secret apricot feature, translate the view when in continues mode */
- upvec[0] = upvec[1] = 0.0f;
- upvec[2] = (vod->dist0 - vod->rv3d->dist) * vod->grid;
- vod->rv3d->dist = vod->dist0;
- copy_m3_m4(mat, vod->rv3d->viewinv);
- mul_m3_v3(mat, upvec);
- add_v3_v3(vod->rv3d->ofs, upvec);
- } else {
- /* these limits were in old code too */
- if(vod->rv3d->dist<0.001f * vod->grid) vod->rv3d->dist= 0.001f * vod->grid;
- if(vod->rv3d->dist>10.0f * vod->far) vod->rv3d->dist=10.0f * vod->far;
- }
-
-// XXX if(vod->rv3d->persp==RV3D_ORTHO || vod->rv3d->persp==RV3D_CAMOB) preview3d_event= 0;
+ /* these limits were in old code too */
+ if(vod->rv3d->dist<0.001f * vod->grid) vod->rv3d->dist= 0.001f * vod->grid;
+ if(vod->rv3d->dist>10.0f * vod->far) vod->rv3d->dist=10.0f * vod->far;
if(vod->rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(vod->sa, vod->ar);
@@ -1229,7 +1255,7 @@ static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event)
viewzoom_apply(vod, event->x, event->y, U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0);
}
else if (event_code==VIEW_CONFIRM) {
- request_depth_update(vod->rv3d);
+ ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -1244,6 +1270,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
RegionView3D *rv3d;
ScrArea *sa;
ARegion *ar;
+ short use_cam_zoom;
int delta= RNA_int_get(op->ptr, "delta");
int mx, my;
@@ -1265,9 +1292,11 @@ 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) && !(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d));
+
if(delta < 0) {
/* this min and max is also in viewmove() */
- if((rv3d->persp==RV3D_CAMOB) && !(v3d->flag2 & V3D_LOCK_CAMERA)) {
+ if(use_cam_zoom) {
rv3d->camzoom-= 10;
if(rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom= RV3D_CAMZOOM_MIN;
}
@@ -1276,7 +1305,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
}
}
else {
- if((rv3d->persp==RV3D_CAMOB) && !(v3d->flag2 & V3D_LOCK_CAMERA)) {
+ if(use_cam_zoom) {
rv3d->camzoom+= 10;
if(rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom= RV3D_CAMZOOM_MAX;
}
@@ -1288,7 +1317,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
if(rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(sa, ar);
- request_depth_update(rv3d);
+ ED_view3d_depth_tag_update(rv3d);
ED_view3d_camera_lock_sync(v3d, rv3d);
@@ -1299,6 +1328,39 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
+/* this is an exact copy of viewzoom_modal_keymap */
+/* called in transform_ops.c, on each regeneration of keymaps */
+void viewdolly_modal_keymap(wmKeyConfig *keyconf)
+{
+ static EnumPropertyItem modal_items[] = {
+ {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
+
+ {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
+ {VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
+
+ {0, NULL, 0, NULL, NULL}};
+
+ wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Dolly Modal");
+
+ /* this function is called for each spacetype, only needs to add map once */
+ if(keymap) return;
+
+ keymap= WM_modalkeymap_add(keyconf, "View3D Dolly Modal", modal_items);
+
+ /* items for modal map */
+ WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
+ WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, VIEW_MODAL_CONFIRM);
+
+ /* disabled mode switching for now, can re-implement better, later on
+ WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
+ WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
+ WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
+ */
+
+ /* assign map to operators */
+ WM_modalkeymap_assign(keymap, "VIEW3D_OT_dolly");
+}
+
/* viewdolly_invoke() copied this function, changes here may apply there */
static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
@@ -1331,7 +1393,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
vod->origy = vod->oldy = vod->origy + event->x - event->prevx;
viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY, FALSE);
}
- request_depth_update(vod->rv3d);
+ ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -1447,7 +1509,7 @@ static int viewdolly_modal(bContext *C, wmOperator *op, wmEvent *event)
viewdolly_apply(vod, event->x, event->y, (U.uiflag & USER_ZOOM_INVERT) != 0);
}
else if (event_code==VIEW_CONFIRM) {
- request_depth_update(vod->rv3d);
+ ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -1498,7 +1560,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
if(rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(sa, ar);
- request_depth_update(rv3d);
+ ED_view3d_depth_tag_update(rv3d);
ED_region_tag_redraw(ar);
viewops_data_free(C, op);
@@ -1545,7 +1607,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event)
vod->origy = vod->oldy = vod->origy + event->x - event->prevx;
viewdolly_apply(vod, event->prevx, event->prevy, FALSE);
}
- request_depth_update(vod->rv3d);
+ ED_view3d_depth_tag_update(vod->rv3d);
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -1571,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;
}
}
@@ -1610,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");
@@ -1671,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);
}
@@ -1715,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];
@@ -1791,7 +1853,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca
sub_v3_v3v3(afm, max, min);
size= MAX3(afm[0], afm[1], afm[2]);
- if(rv3d->persp==RV3D_ORTHO) {
+ if(!rv3d->is_persp) {
if(size < 0.0001f) { /* if its a sinble point. dont even re-scale */
ok_dist= 0;
}
@@ -1818,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);
}
@@ -1900,8 +1962,8 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was
xfac= (float)ar->winx / (float)(size[0] + 4);
yfac= (float)ar->winy / (float)(size[1] + 4);
- rv3d->camzoom= (sqrtf(4.0f * MIN2(xfac, yfac)) - (float)M_SQRT2) * 50.0f;
- rv3d->camzoom= CLAMPIS(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
+ rv3d->camzoom= BKE_screen_view3d_zoom_from_fac(MIN2(xfac, yfac));
+ CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
@@ -1942,7 +2004,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
rect.ymax= RNA_int_get(op->ptr, "ymax");
/* calculate range */
- view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb, FALSE);
+ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin);
scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin);
@@ -2048,7 +2110,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
cent[0] = (((double)rect.xmin)+((double)rect.xmax)) / 2;
cent[1] = (((double)rect.ymin)+((double)rect.ymax)) / 2;
- if (rv3d->persp==RV3D_PERSP) {
+ if (rv3d->is_persp) {
double p_corner[3];
/* no depths to use, we cant do anything! */
@@ -2084,13 +2146,17 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
new_ofs[0] = -p[0];
new_ofs[1] = -p[1];
new_ofs[2] = -p[2];
- } else {
+ }
+ else {
+ float mval_f[2];
/* We cant use the depth, fallback to the old way that dosnt set the center depth */
copy_v3_v3(new_ofs, rv3d->ofs);
initgrabz(rv3d, -new_ofs[0], -new_ofs[1], -new_ofs[2]);
- window_to_3d_delta(ar, dvec, (rect.xmin+rect.xmax-vb[0])/2, (rect.ymin+rect.ymax-vb[1])/2);
+ mval_f[0]= (rect.xmin + rect.xmax - vb[0]) / 2.0f;
+ mval_f[1]= (rect.ymin + rect.ymax - vb[1]) / 2.0f;
+ ED_view3d_win_to_delta(ar, mval_f, dvec);
/* center the view to the center of the rectangle */
sub_v3_v3(new_ofs, dvec);
}
@@ -2118,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;
@@ -2157,9 +2223,9 @@ static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar)
int im_width= (scene->r.size*scene->r.xsch)/100;
view3d_viewborder_size_get(scene, ar, size);
-
- rv3d->camzoom= (sqrtf(4.0f * (float)im_width/size[0]) - (float)M_SQRT2) * 50.0f;
- rv3d->camzoom= CLAMPIS(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
+
+ rv3d->camzoom= BKE_screen_view3d_zoom_from_fac((float)im_width/size[0]);
+ CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
}
static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2432,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 */
@@ -2493,15 +2559,16 @@ static int viewpan_exec(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
float vec[3];
+ float mval_f[2]= {0.0f, 0.0f};
int pandir;
pandir = RNA_enum_get(op->ptr, "type");
initgrabz(rv3d, 0.0, 0.0, 0.0);
- if(pandir == V3D_VIEW_PANRIGHT) window_to_3d_delta(ar, vec, -32, 0);
- else if(pandir == V3D_VIEW_PANLEFT) window_to_3d_delta(ar, vec, 32, 0);
- else if(pandir == V3D_VIEW_PANUP) window_to_3d_delta(ar, vec, 0, -25);
- else if(pandir == V3D_VIEW_PANDOWN) window_to_3d_delta(ar, vec, 0, 25);
+ if(pandir == V3D_VIEW_PANRIGHT) { mval_f[0]= -32.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+ else if(pandir == V3D_VIEW_PANLEFT) { mval_f[0]= 32.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+ else if(pandir == V3D_VIEW_PANUP) { mval_f[1]= -25.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+ else if(pandir == V3D_VIEW_PANDOWN) { mval_f[1]= 25.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
add_v3_v3(rv3d->ofs, vec);
if(rv3d->viewlock & RV3D_BOXVIEW)
@@ -2737,7 +2804,7 @@ static int view3d_clipping_exec(bContext *C, wmOperator *op)
view3d_set_viewcontext(C, &vc);
view3d_get_transformation(vc.ar, vc.rv3d, NULL, &mats); /* NULL because we don't want it in object space */
- view3d_calculate_clipping(rv3d->clipbb, rv3d->clip, &mats, &rect);
+ ED_view3d_calc_clipping(rv3d->clipbb, rv3d->clip, &mats, &rect);
return OPERATOR_FINISHED;
}
@@ -2795,7 +2862,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3];
- int mx, my, mval[2];
+ int mval[2];
// short ctrl= 0; // XXX
int flip;
fp= give_cursor(scene, v3d);
@@ -2803,9 +2870,6 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
// if(obedit && ctrl) lr_click= 1;
copy_v3_v3(oldcurs, fp);
- mx= event->x - ar->winrct.xmin;
- my= event->y - ar->winrct.ymin;
-
project_int_noclip(ar, fp, mval);
flip= initgrabz(rv3d, fp[0], fp[1], fp[2]);
@@ -2822,23 +2886,22 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
short depth_used = 0;
if (U.uiflag & USER_ORBIT_ZBUF) { /* maybe this should be accessed some other way */
- int mval_depth[2];
- mval_depth[0]= mx;
- mval_depth[1]= my;
view3d_operator_needs_opengl(C);
- if (view_autodist(scene, ar, v3d, mval_depth, fp))
+ if (ED_view3d_autodist(scene, ar, v3d, event->mval, fp))
depth_used= 1;
}
if(depth_used==0) {
- window_to_3d_delta(ar, dvec, mval[0]-mx, mval[1]-my);
+ float mval_f[2];
+ VECSUB2D(mval_f, mval, event->mval);
+ ED_view3d_win_to_delta(ar, mval_f, dvec);
sub_v3_v3(fp, dvec);
}
}
else {
- dx= ((float)(mx-(ar->winx/2)))*rv3d->zfac/(ar->winx/2);
- dy= ((float)(my-(ar->winy/2)))*rv3d->zfac/(ar->winy/2);
+ dx= ((float)(event->mval[0]-(ar->winx/2)))*rv3d->zfac/(ar->winx/2);
+ dy= ((float)(event->mval[1]-(ar->winy/2)))*rv3d->zfac/(ar->winy/2);
fz= rv3d->persmat[0][3]*fp[0]+ rv3d->persmat[1][3]*fp[1]+ rv3d->persmat[2][3]*fp[2]+ rv3d->persmat[3][3];
fz= fz/rv3d->zfac;
@@ -2981,7 +3044,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
}
/* XXX todo Zooms in on a border drawn by the user */
-int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3] ) //, float *autodist )
+int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3] ) //, float *autodist )
{
bglMats mats; /* ZBuffer depth vars */
float depth_close= FLT_MAX;
@@ -3008,7 +3071,7 @@ int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], flo
return 1;
}
-int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, float *autodist )
+int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, float *autodist )
{
/* Get Z Depths, needed for perspective, nice for ortho */
switch(mode) {
@@ -3024,7 +3087,7 @@ int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, flo
}
// no 4x4 sampling, run view_autodist_init first
-int view_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth) //, float *autodist )
+int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth) //, float *autodist )
{
bglMats mats; /* ZBuffer depth vars, could cache? */
float depth;
@@ -3052,7 +3115,7 @@ int view_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldloc[3]
return 1;
}
-int view_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth)
+int ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth)
{
*depth= view_autodist_depth_margin(ar, mval, margin);
@@ -3079,7 +3142,7 @@ static int depth_segment_cb(int x, int y, void *userData)
}
}
-int view_autodist_depth_segment(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth)
+int ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth)
{
struct { struct ARegion *ar; int margin; float depth; } data = {NULL};
int p1[2];
@@ -3490,25 +3553,6 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int UNUSED(mode))
}
#endif // if 0, unused NDof code
-/* give a 4x4 matrix from a perspective view, only needs viewquat, ofs and dist
- * basically the same as...
- * rv3d->persp= RV3D_PERSP
- * setviewmatrixview3d(scene, v3d, rv3d);
- * setcameratoview3d(v3d, rv3d, v3d->camera);
- * ...but less of a hassle
- * */
-void view3d_persp_mat4(RegionView3D *rv3d, float mat[][4])
-{
- float qt[4], dvec[3];
- copy_qt_qt(qt, rv3d->viewquat);
- qt[0]= -qt[0];
- quat_to_mat4(mat, qt);
- mat[3][2] -= rv3d->dist;
- translate_m4(mat, rv3d->ofs[0], rv3d->ofs[1], rv3d->ofs[2]);
- mul_v3_v3fl(dvec, mat[2], -rv3d->dist);
- sub_v3_v3v3(mat[3], dvec, rv3d->ofs);
-}
-
/* Gets the view trasnformation from a camera
* currently dosnt take camzoom into account
@@ -3544,6 +3588,16 @@ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist)
}
}
+void ED_view3d_to_m4(float mat[][4], const float ofs[3], const float quat[4], const float dist)
+{
+ float iviewquat[4]= {-quat[0], quat[1], quat[2], quat[3]};
+ float dvec[3]= {0.0f, 0.0f, dist};
+
+ quat_to_mat4(mat, iviewquat);
+ mul_mat3_m4_v3(mat, dvec);
+ sub_v3_v3v3(mat[3], dvec, ofs);
+}
+
/* object -> view */
void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist, float *lens)
@@ -3551,19 +3605,14 @@ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist,
ED_view3d_from_m4(ob->obmat, ofs, quat, dist);
if (lens) {
- get_object_clip_range(ob, lens, NULL, NULL);
+ ED_view3d_ob_clip_range_get(ob, lens, NULL, NULL);
}
}
/* view -> object */
void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], const float dist)
{
- float mat4[4][4];
- float dvec[3]= {0.0f, 0.0f, dist};
- float iviewquat[4]= {-quat[0], quat[1], quat[2], quat[3]};
-
- quat_to_mat4(mat4, iviewquat);
- mul_mat3_m4_v3(mat4, dvec);
- sub_v3_v3v3(mat4[3], dvec, ofs);
- object_apply_mat4(ob, mat4, TRUE, TRUE);
+ float mat[4][4];
+ ED_view3d_to_m4(mat, ofs, quat, dist);
+ object_apply_mat4(ob, mat, TRUE, TRUE);
}
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index e37361fbc54..ed1ed5b3881 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -287,9 +287,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
fly->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
- fly->mval[0] = event->x - fly->ar->winrct.xmin;
- fly->mval[1] = event->y - fly->ar->winrct.ymin;
-
+ VECCOPY2D(fly->mval, event->mval)
fly->time_lastdraw= fly->time_lastwheel= PIL_check_seconds_timer();
@@ -309,7 +307,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
fly->dist_backup= fly->rv3d->dist;
if (fly->rv3d->persp==RV3D_CAMOB) {
Object *ob_back;
- if((fly->root_parent=fly->v3d->camera->parent)) {
+ if((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (fly->root_parent=fly->v3d->camera->parent)) {
while(fly->root_parent->parent)
fly->root_parent= fly->root_parent->parent;
ob_back= fly->root_parent;
@@ -418,8 +416,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
fly->redraw = 1;
}
else if (event->type == MOUSEMOVE) {
- fly->mval[0] = event->x - fly->ar->winrct.xmin;
- fly->mval[1] = event->y - fly->ar->winrct.ymin;
+ VECCOPY2D(fly->mval, event->mval);
} /* handle modal keymap first */
else if (event->type == EVT_MODAL_MAP) {
switch (event->val) {
@@ -480,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;
@@ -571,7 +568,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
apply_rotation= 1; /* if the user presses shift they can look about without movinf the direction there looking*/
if(fly->root_parent)
- view3d_persp_mat4(rv3d, prev_view_mat);
+ ED_view3d_to_m4(prev_view_mat, fly->rv3d->ofs, fly->rv3d->viewquat, fly->rv3d->dist);
/* the dist defines a vector that is infront of the offset
to rotate the view about.
@@ -800,7 +797,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
float parent_mat[4][4];
invert_m4_m4(prev_view_imat, prev_view_mat);
- view3d_persp_mat4(rv3d, view_mat);
+ ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
mul_m4_m4m4(diff_mat, prev_view_imat, view_mat);
mul_m4_m4m4(parent_mat, fly->root_parent->obmat, diff_mat);
object_apply_mat4(fly->root_parent, parent_mat, TRUE, FALSE);
@@ -820,7 +817,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
}
else {
float view_mat[4][4];
- view3d_persp_mat4(rv3d, view_mat);
+ ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
object_apply_mat4(v3d->camera, view_mat, TRUE, FALSE);
id_key= &v3d->camera->id;
}
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 503d1ffd891..df81310955c 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -91,7 +91,6 @@ void VIEW3D_OT_zoom_border(struct wmOperatorType *ot);
void VIEW3D_OT_drawtype(struct wmOperatorType *ot);
void view3d_boxview_copy(ScrArea *sa, ARegion *ar);
-void view3d_persp_mat4(struct RegionView3D *rv3d, float mat[][4]);
/* view3d_fly.c */
void view3d_keymap(struct wmKeyConfig *keyconf);
@@ -154,9 +153,7 @@ void VIEW3D_OT_localview(struct wmOperatorType *ot);
void VIEW3D_OT_game_start(struct wmOperatorType *ot);
-int boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb);
-
-void centerview(struct ARegion *ar, View3D *v3d);
+int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb);
void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens);
@@ -167,6 +164,7 @@ void fly_modal_keymap(struct wmKeyConfig *keyconf);
void viewrotate_modal_keymap(struct wmKeyConfig *keyconf);
void viewmove_modal_keymap(struct wmKeyConfig *keyconf);
void viewzoom_modal_keymap(struct wmKeyConfig *keyconf);
+void viewdolly_modal_keymap(struct wmKeyConfig *keyconf);
/* view3d_buttons.c */
void VIEW3D_OT_properties(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 94f77b18667..a2db8e7b443 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -306,5 +306,6 @@ void view3d_keymap(wmKeyConfig *keyconf)
viewrotate_modal_keymap(keyconf);
viewmove_modal_keymap(keyconf);
viewzoom_modal_keymap(keyconf);
+ viewdolly_modal_keymap(keyconf);
}
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index c4999b961f0..fb3c0a63b7d 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -106,7 +106,9 @@ int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int m
initgrabz(vc->rv3d, fp[0], fp[1], fp[2]);
if(mval_cpy[0]!=IS_CLIPPED) {
- window_to_3d_delta(vc->ar, dvec, mval_cpy[0]-mval[0], mval_cpy[1]-mval[1]);
+ float mval_f[2];
+ VECSUB2D(mval_f, mval_cpy, mval);
+ ED_view3d_win_to_delta(vc->ar, mval_f, dvec);
sub_v3_v3(fp, dvec);
return TRUE;
@@ -1232,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/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index 56bfb3c2273..50dd98b08a4 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -69,19 +69,6 @@
/* ******************* view3d space & buttons ************** */
-static wmOperator *view3d_last_operator(const bContext *C)
-{
- wmWindowManager *wm= CTX_wm_manager(C);
- wmOperator *op;
-
- /* only for operators that are registered and did an undo push */
- for(op= wm->operators.last; op; op= op->prev)
- if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO))
- break;
-
- return op;
-}
-
static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOperator *op)
{
uiLayoutOperatorButs(C, pa->layout, op, NULL, 'V', 0);
@@ -89,7 +76,7 @@ static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOper
static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa)
{
- wmOperator *op= view3d_last_operator(C);
+ wmOperator *op= WM_operator_last_redo(C);
if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
else BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname));
@@ -110,7 +97,7 @@ static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wm
static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
{
- wmOperator *op= view3d_last_operator(C);
+ wmOperator *op= WM_operator_last_redo(C);
uiBlock *block;
if(op==NULL)
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index dc8979e0bf3..32e8ae81f90 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -52,6 +52,7 @@
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -105,7 +106,7 @@ float *give_cursor(Scene *scene, View3D *v3d)
/* Gets the lens and clipping values from a camera of lamp type object */
-void get_object_clip_range(Object *ob, float *lens, float *clipsta, float *clipend)
+void ED_view3d_ob_clip_range_get(Object *ob, float *lens, float *clipsta, float *clipend)
{
if(ob->type==OB_LAMP ) {
Lamp *la = ob->data;
@@ -462,7 +463,7 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
/* ********************************** */
-void view3d_calculate_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rcti *rect)
+void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rcti *rect)
{
double xs, ys, p[3];
short val;
@@ -501,29 +502,20 @@ void view3d_calculate_clipping(BoundBox *bb, float planes[4][4], bglMats *mats,
}
/* create intersection coordinates in view Z direction at mouse coordinates */
-void viewline(ARegion *ar, View3D *v3d, float mval[2], float ray_start[3], float ray_end[3])
+void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
{
RegionView3D *rv3d= ar->regiondata;
- float vec[4];
- int a;
if(rv3d->is_persp) {
- vec[0]= 2.0f * mval[0] / ar->winx - 1;
- vec[1]= 2.0f * mval[1] / ar->winy - 1;
- vec[2]= -1.0f;
- vec[3]= 1.0f;
-
- mul_m4_v4(rv3d->persinv, vec);
- mul_v3_fl(vec, 1.0f / vec[3]);
-
+ float vec[3];
+ ED_view3d_win_to_vector(ar, mval, vec);
+
copy_v3_v3(ray_start, rv3d->viewinv[3]);
- sub_v3_v3(vec, ray_start);
- normalize_v3(vec);
-
VECADDFAC(ray_start, rv3d->viewinv[3], vec, v3d->near);
VECADDFAC(ray_end, rv3d->viewinv[3], vec, v3d->far);
}
else {
+ float vec[4];
vec[0] = 2.0f * mval[0] / ar->winx - 1;
vec[1] = 2.0f * mval[1] / ar->winy - 1;
vec[2] = 0.0f;
@@ -536,25 +528,27 @@ void viewline(ARegion *ar, View3D *v3d, float mval[2], float ray_start[3], float
}
/* clipping */
- if(rv3d->rflag & RV3D_CLIPPING)
- for(a=0; a<4; a++)
+ if(rv3d->rflag & RV3D_CLIPPING) {
+ int a;
+ for(a=0; a<4; a++) {
clip_line_plane(ray_start, ray_end, rv3d->clip[a]);
+ }
+ }
}
/* create intersection ray in view Z direction at mouse coordinates */
-void viewray(ARegion *ar, View3D *v3d, float mval[2], float ray_start[3], float ray_normal[3])
+void ED_view3d_win_to_ray(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3])
{
float ray_end[3];
- viewline(ar, v3d, mval, ray_start, ray_end);
+ ED_view3d_win_to_segment_clip(ar, v3d, mval, ray_start, ray_end);
sub_v3_v3v3(ray_normal, ray_end, ray_start);
normalize_v3(ray_normal);
}
-void viewvector(RegionView3D *rv3d, float coord[3], float vec[3])
+void ED_view3d_global_to_vector(RegionView3D *rv3d, const float coord[3], float vec[3])
{
- if (rv3d->persp != RV3D_ORTHO)
- {
+ if (rv3d->is_persp) {
float p1[4], p2[4];
copy_v3_v3(p1, coord);
@@ -598,7 +592,7 @@ int initgrabz(RegionView3D *rv3d, float x, float y, float z)
return flip;
}
-void window_to_3d(ARegion *ar, float out[3], const float depth_pt[3], const float mx, const float my)
+void ED_view3d_win_to_3d(ARegion *ar, const float depth_pt[3], const float mval[2], float out[3])
{
RegionView3D *rv3d= ar->regiondata;
@@ -608,7 +602,7 @@ void window_to_3d(ARegion *ar, float out[3], const float depth_pt[3], const floa
if(rv3d->is_persp) {
float mousevec[3];
copy_v3_v3(line_sta, rv3d->viewinv[3]);
- window_to_3d_vector(ar, mousevec, mx, my);
+ ED_view3d_win_to_vector(ar, mval, mousevec);
add_v3_v3v3(line_end, line_sta, mousevec);
if(isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], TRUE) == 0) {
@@ -617,8 +611,8 @@ void window_to_3d(ARegion *ar, float out[3], const float depth_pt[3], const floa
}
}
else {
- const float dx= (2.0f * (float)mx / (float)ar->winx) - 1.0f;
- const float dy= (2.0f * (float)my / (float)ar->winy) - 1.0f;
+ const float dx= (2.0f * mval[0] / (float)ar->winx) - 1.0f;
+ const float dy= (2.0f * mval[1] / (float)ar->winy) - 1.0f;
line_sta[0]= (rv3d->persinv[0][0] * dx) + (rv3d->persinv[1][0] * dy) + rv3d->viewinv[3][0];
line_sta[1]= (rv3d->persinv[0][1] * dx) + (rv3d->persinv[1][1] * dy) + rv3d->viewinv[3][1];
line_sta[2]= (rv3d->persinv[0][2] * dx) + (rv3d->persinv[1][2] * dy) + rv3d->viewinv[3][2];
@@ -630,13 +624,13 @@ void window_to_3d(ARegion *ar, float out[3], const float depth_pt[3], const floa
/* always call initgrabz */
/* only to detect delta motion */
-void window_to_3d_delta(ARegion *ar, float out[3], const float mx, const float my)
+void ED_view3d_win_to_delta(ARegion *ar, const float mval[2], float out[3])
{
RegionView3D *rv3d= ar->regiondata;
float dx, dy;
- dx= 2.0f*mx*rv3d->zfac/ar->winx;
- dy= 2.0f*my*rv3d->zfac/ar->winy;
+ dx= 2.0f*mval[0]*rv3d->zfac/ar->winx;
+ dy= 2.0f*mval[1]*rv3d->zfac/ar->winy;
out[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy);
out[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy);
@@ -646,23 +640,16 @@ void window_to_3d_delta(ARegion *ar, float out[3], const float mx, const float m
/* doesn't rely on initgrabz */
/* for perspective view, get the vector direction to
* the mouse cursor as a normalized vector */
-void window_to_3d_vector(ARegion *ar, float out[3], const float mx, const float my)
+void ED_view3d_win_to_vector(ARegion *ar, const float mval[2], float out[3])
{
RegionView3D *rv3d= ar->regiondata;
if(rv3d->is_persp) {
- float dx, dy;
- float viewvec[3];
-
- dx= (2.0f * mx / ar->winx) - 1.0f;
- dy= (2.0f * my / ar->winy) - 1.0f;
-
- /* normalize here so vecs are proportional to eachother */
- normalize_v3_v3(viewvec, rv3d->viewinv[2]);
-
- out[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy) - viewvec[0];
- out[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy) - viewvec[1];
- out[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy) - viewvec[2];
+ out[0]= 2.0f * (mval[0] / ar->winx) - 1.0f;
+ out[1]= 2.0f * (mval[1] / ar->winy) - 1.0f;
+ out[2]= -0.5f;
+ mul_project_m4_v3(rv3d->persinv, out);
+ sub_v3_v3(out, rv3d->viewinv[3]);
}
else {
copy_v3_v3(out, rv3d->viewinv[2]);
@@ -670,7 +657,7 @@ void window_to_3d_vector(ARegion *ar, float out[3], const float mx, const float
normalize_v3(out);
}
-float read_cached_depth(ViewContext *vc, int x, int y)
+float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
{
ViewDepths *vd = vc->rv3d->depths;
@@ -683,13 +670,13 @@ float read_cached_depth(ViewContext *vc, int x, int y)
return 1;
}
-void request_depth_update(RegionView3D *rv3d)
+void ED_view3d_depth_tag_update(RegionView3D *rv3d)
{
if(rv3d->depths)
rv3d->depths->damaged= 1;
}
-void view3d_get_object_project_mat(RegionView3D *rv3d, Object *ob, float pmat[4][4])
+void ED_view3d_ob_project_mat_get(RegionView3D *rv3d, Object *ob, float pmat[4][4])
{
float vmat[4][4];
@@ -697,6 +684,7 @@ void view3d_get_object_project_mat(RegionView3D *rv3d, Object *ob, float pmat[4]
mul_m4_m4m4(pmat, vmat, rv3d->winmat);
}
+#if 0
/* Uses window coordinates (x,y) and depth component z to find a point in
modelspace */
void view3d_unproject(bglMats *mats, float out[3], const short x, const short y, const float z)
@@ -709,9 +697,10 @@ void view3d_unproject(bglMats *mats, float out[3], const short x, const short y,
out[1] = uy;
out[2] = uz;
}
+#endif
/* use above call to get projecting mat */
-void view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4])
+void ED_view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float mat[4][4])
{
float vec4[4];
@@ -729,7 +718,7 @@ void view3d_project_float(ARegion *ar, const float vec[3], float adr[2], float m
}
}
-int boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb)
+int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb)
{
/* return 1: draw */
@@ -772,7 +761,7 @@ void project_short(ARegion *ar, const float vec[3], short adr[2]) /* clips */
adr[0]= IS_CLIPPED;
if(rv3d->rflag & RV3D_CLIPPING) {
- if(view3d_test_clipping(rv3d, vec, 0))
+ if(ED_view3d_test_clipping(rv3d, vec, 0))
return;
}
@@ -909,7 +898,7 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2])
}
/* copies logic of get_view3d_viewplane(), keep in sync */
-int get_view3d_cliprange(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend)
+int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend)
{
int orth= 0;
@@ -944,7 +933,7 @@ int get_view3d_cliprange(View3D *v3d, RegionView3D *rv3d, float *clipsta, float
}
/* also exposed in previewrender.c */
-int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize)
+int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize)
{
Camera *cam=NULL;
float lens, fac, x1, y1, x2, y2;
@@ -995,10 +984,11 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
else {
/* fac for zoom, also used for camdx */
if(rv3d->persp==RV3D_CAMOB) {
- fac= (1.41421f + ( (float)rv3d->camzoom )/50.0f);
- fac*= fac;
+ fac= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom) * 4.0f;
+ }
+ else {
+ fac= 2.0;
}
- else fac= 2.0;
/* viewplane size depends... */
if(cam && cam->type==CAM_ORTHO) {
@@ -1076,7 +1066,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for pick
float clipsta, clipend, x1, y1, x2, y2;
int orth;
- orth= get_view3d_viewplane(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL);
+ orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL);
rv3d->is_persp= !orth;
// printf("%d %d %f %f %f %f %f %f\n", winx, winy, viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax, clipsta, clipend);
@@ -1787,7 +1777,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS && startscene->gm.stereoflag != STEREO_DOME) { /* Letterbox */
rctf cam_framef;
- view3d_calc_camera_border(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef, FALSE);
+ ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, FALSE);
cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin;
cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin;
cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin;
@@ -1885,12 +1875,7 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f
}
}
-int view3d_is_ortho(View3D *v3d, RegionView3D *rv3d)
-{
- return (rv3d->persp == RV3D_ORTHO || (v3d->camera && ((Camera *)v3d->camera->data)->type == CAM_ORTHO));
-}
-
-float view3d_pixel_size(struct RegionView3D *rv3d, const float co[3])
+float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3])
{
return (rv3d->persmat[3][3] + (
rv3d->persmat[0][3]*co[0] +
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index 1455dc789c7..8eb8d538396 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -28,6 +28,9 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -46,4 +49,4 @@ set(SRC
transform.h
)
-blender_add_lib(bf_editor_transform "${SRC}" "${INC}")
+blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 4ea1e8742f5..27ca345e132 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -123,9 +123,11 @@ void setTransformViewMatrices(TransInfo *t)
void convertViewVec(TransInfo *t, float *vec, int dx, int dy)
{
if (t->spacetype==SPACE_VIEW3D) {
- if (t->ar->regiontype == RGN_TYPE_WINDOW)
- {
- window_to_3d_delta(t->ar, vec, dx, dy);
+ if (t->ar->regiontype == RGN_TYPE_WINDOW) {
+ float mval_f[2];
+ mval_f[0]= dx;
+ mval_f[1]= dy;
+ ED_view3d_win_to_delta(t->ar, mval_f, vec);
}
}
else if(t->spacetype==SPACE_IMAGE) {
@@ -567,8 +569,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
if (t->modifiers & MOD_CONSTRAINT_SELECT)
t->con.mode |= CON_SELECT;
- t->mval[0] = event->x - t->ar->winrct.xmin;
- t->mval[1] = event->y - t->ar->winrct.ymin;
+ VECCOPY2D(t->mval, event->mval);
// t->redraw |= TREDRAW_SOFT; /* Use this for soft redraw. Might cause flicker in object mode */
t->redraw |= TREDRAW_HARD;
@@ -4318,7 +4319,7 @@ static int createSlideVerts(TransInfo *t)
/*ok, let's try to survive this*/
unit_m4(projectMat);
} else {
- view3d_get_object_project_mat(v3d, t->obedit, projectMat);
+ ED_view3d_ob_project_mat_get(v3d, t->obedit, projectMat);
}
numsel =0;
@@ -4611,8 +4612,8 @@ static int createSlideVerts(TransInfo *t)
}
if (v3d) {
- view3d_project_float(t->ar, tempsv->up->v1->co, co, projectMat);
- view3d_project_float(t->ar, tempsv->up->v2->co, co2, projectMat);
+ ED_view3d_project_float(t->ar, tempsv->up->v1->co, co, projectMat);
+ ED_view3d_project_float(t->ar, tempsv->up->v2->co, co2, projectMat);
}
if (ev == tempsv->up->v1) {
@@ -4624,8 +4625,8 @@ static int createSlideVerts(TransInfo *t)
add_v3_v3(start, tvec);
if (v3d) {
- view3d_project_float(t->ar, tempsv->down->v1->co, co, projectMat);
- view3d_project_float(t->ar, tempsv->down->v2->co, co2, projectMat);
+ ED_view3d_project_float(t->ar, tempsv->down->v1->co, co, projectMat);
+ ED_view3d_project_float(t->ar, tempsv->down->v2->co, co2, projectMat);
}
if (ev == tempsv->down->v1) {
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index b55435fd0cf..0e0d452a9e6 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -648,7 +648,7 @@ typedef enum {
void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], int mval[2]);
void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode);
int handleMouseInput(struct TransInfo *t, struct MouseInput *mi, struct wmEvent *event);
-void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, int mval[2], float output[3]);
+void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, const int mval[2], float output[3]);
void setCustomPoints(TransInfo *t, MouseInput *mi, int start[2], int end[2]);
void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3]));
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 8d37b7aeabb..c7699f7249c 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -3699,7 +3699,7 @@ void flushTransGraphData(TransInfo *t)
/* if int-values only, truncate to integers */
if (td->flag & TD_INTVALUES)
- td2d->loc2d[1]= (float)((int)td2d->loc[1]);
+ td2d->loc2d[1]= floorf(td2d->loc[1] + 0.5f);
else
td2d->loc2d[1]= td2d->loc[1];
@@ -4937,8 +4937,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
/* when running transform non-interactively (operator exec),
* we need to update the pose otherwise no updates get called during
* transform and the auto-ik is not applied. see [#26164] */
- struct Object *ob=t->poseobj;
- where_is_pose(t->scene, ob);
+ struct Object *pose_ob=t->poseobj;
+ where_is_pose(t->scene, pose_ob);
}
/* if target-less IK grabbing, we calculate the pchan transforms and clear flag */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 67e04bbd34e..8699eb1cc2d 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -920,9 +920,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
if (event)
{
- t->imval[0] = event->x - t->ar->winrct.xmin;
- t->imval[1] = event->y - t->ar->winrct.ymin;
-
+ VECCOPY2D(t->imval, event->mval);
t->event_type = event->type;
}
else
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 7a16e25302c..b3608305a7a 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -372,7 +372,7 @@ void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3])
mi->post = post;
}
-void applyMouseInput(TransInfo *t, MouseInput *mi, int mval[2], float output[3])
+void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float output[3])
{
if (mi->apply != NULL)
{
@@ -398,8 +398,7 @@ int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event)
t->modifiers |= MOD_PRECISION;
/* shift is modifier for higher precision transform
* store the mouse position where the normal movement ended */
- mi->precision_mval[0] = event->x - t->ar->winrct.xmin;
- mi->precision_mval[1] = event->y - t->ar->winrct.ymin;
+ VECCOPY2D(mi->precision_mval, event->mval);
mi->precision = 1;
}
else
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 1933b11b308..65cd285cf48 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -557,7 +557,7 @@ static void test_manipulator_axis(const bContext *C)
float angle;
float vec[3];
- viewvector(rv3d, rv3d->twmat[3], vec);
+ ED_view3d_global_to_vector(rv3d, rv3d->twmat[3], vec);
angle = fabs(angle_v3v3(rv3d->twmat[0], vec));
if (angle > (float)M_PI / 2.0f) {
@@ -1457,7 +1457,7 @@ void BIF_draw_manipulator(const bContext *C)
break;
}
- mul_mat3_m4_fl(rv3d->twmat, view3d_pixel_size(rv3d, rv3d->twmat[3]) * U.tw_size * 5.0f);
+ mul_mat3_m4_fl(rv3d->twmat, ED_view3d_pixel_size(rv3d, rv3d->twmat[3]) * U.tw_size * 5.0f);
}
test_manipulator_axis(C);
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 789a262f075..e3e5e012920 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -162,11 +162,11 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
invert_m4_m4(imat, rv3d->viewmat);
for (p = t->tsnap.points.first; p; p = p->next) {
- drawcircball(GL_LINE_LOOP, p->co, view3d_pixel_size(rv3d, p->co) * size, imat);
+ drawcircball(GL_LINE_LOOP, p->co, ED_view3d_pixel_size(rv3d, p->co) * size, imat);
}
if (t->tsnap.status & POINT_INIT) {
- drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat);
+ drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, ED_view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat);
}
/* draw normal if needed */
@@ -1581,7 +1581,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f
int retval = 0;
float ray_start[3], ray_normal[3];
- viewray(ar, v3d, mval, ray_start, ray_normal);
+ ED_view3d_win_to_ray(ar, v3d, mval, ray_start, ray_normal);
if (mode == SNAP_ALL && obedit)
{
@@ -1613,9 +1613,9 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, f
for(dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
{
- Object *ob = dupli_ob->ob;
+ Object *dob = dupli_ob->ob;
- retval |= snapObject(scene, ar, ob, 0, dupli_ob->mat, ray_start, ray_normal, mval, loc, no, dist, &depth);
+ retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, loc, no, dist, &depth);
}
free_object_duplilist(lb);
@@ -1812,7 +1812,7 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
int retval = 0;
float ray_start[3], ray_normal[3];
- viewray(ar, v3d, mval, ray_start, ray_normal);
+ ED_view3d_win_to_ray(ar, v3d, mval, ray_start, ray_normal);
for ( base = scene->base.first; base != NULL; base = base->next ) {
if ( BASE_SELECTABLE(v3d, base) ) {
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index 0be6ccaee2c..8e5415945c7 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -30,6 +30,10 @@ set(INC
../../../../intern/guardedalloc
)
+set(INC_SYS
+
+)
+
set(SRC
ed_util.c
editmode_undo.c
@@ -83,4 +87,4 @@ set(SRC
../include/UI_view2d.h
)
-blender_add_lib(bf_editor_util "${SRC}" "${INC}")
+blender_add_lib(bf_editor_util "${SRC}" "${INC}" "${INC_SYS}")
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/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt
index 60d730e8c52..11e1703d84c 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -29,6 +29,9 @@ set(INC
../../windowmanager
../../../../intern/guardedalloc
../../../../intern/opennl/extern
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -43,4 +46,4 @@ set(SRC
uvedit_parametrizer.h
)
-blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}")
+blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 20d7ea21d5c..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);
@@ -1715,12 +1715,8 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
float co[2];
- int x, y;
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
-
- UI_view2d_region_to_view(&ar->v2d, x, y, &co[0], &co[1]);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
return select_exec(C, op);
@@ -1764,12 +1760,8 @@ static int select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
float co[2];
- int x, y;
-
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
- UI_view2d_region_to_view(&ar->v2d, x, y, &co[0], &co[1]);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
return select_loop_exec(C, op);
@@ -1825,12 +1817,8 @@ static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, i
if(event) {
/* invoke */
ARegion *ar= CTX_wm_region(C);
- int x, y;
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
-
- UI_view2d_region_to_view(&ar->v2d, x, y, &co[0], &co[1]);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
}
else {
@@ -3036,12 +3024,9 @@ static int set_2d_cursor_exec(bContext *C, wmOperator *op)
static int set_2d_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
- int x, y;
float location[2];
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
- UI_view2d_region_to_view(&ar->v2d, x, y, &location[0], &location[1]);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
RNA_float_set_array(op->ptr, "location", location);
return set_2d_cursor_exec(C, op);
@@ -3092,14 +3077,12 @@ static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event)
Image *ima= CTX_data_edit_image(C);
ARegion *ar= CTX_wm_region(C);
float fx, fy;
- int x, y, tile[2];
+ int tile[2];
if(!ima || !(ima->tpageflag & IMA_TILES))
return OPERATOR_CANCELLED;
- x= event->x - ar->winrct.xmin;
- y= event->y - ar->winrct.ymin;
- UI_view2d_region_to_view(&ar->v2d, x, y, &fx, &fy);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
if(fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
fx= fx*ima->xrep;
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index d6e2b56c065..ce3150476f9 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -34,6 +34,9 @@ set(INC
../makesrna
../../../intern/guardedalloc
../../../intern/smoke/extern
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -55,5 +58,5 @@ set(SRC
add_definitions(-DGLEW_STATIC)
-blender_add_lib(bf_gpu "${SRC}" "${INC}")
+blender_add_lib(bf_gpu "${SRC}" "${INC}" "${INC_SYS}")
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/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt
index 47c773756a9..da5c2f69635 100644
--- a/source/blender/ikplugin/CMakeLists.txt
+++ b/source/blender/ikplugin/CMakeLists.txt
@@ -33,6 +33,10 @@ set(INC
../../../intern/iksolver/extern
)
+set(INC_SYS
+
+)
+
set(SRC
intern/ikplugin_api.c
intern/iksolver_plugin.c
@@ -45,11 +49,13 @@ set(SRC
if(WITH_IK_ITASC)
add_definitions(-DWITH_IK_ITASC)
- list(APPEND INC ../../../extern/Eigen2)
- list(APPEND INC ../../../intern/itasc)
+ list(APPEND INC
+ ../../../extern/Eigen2
+ ../../../intern/itasc
+ )
list(APPEND SRC
- ./intern/itasc_plugin.cpp
+ intern/itasc_plugin.cpp
)
endif()
-blender_add_lib(bf_ikplugin "${SRC}" "${INC}")
+blender_add_lib(bf_ikplugin "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index 6404ae3de75..16bc7854617 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -38,6 +38,10 @@ set(INC
../makesdna
../../../intern/memutil
../../../intern/guardedalloc
+ ../../../intern/ffmpeg
+)
+
+set(INC_SYS
${JPEG_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
@@ -100,6 +104,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)
@@ -107,30 +114,28 @@ if(WITH_IMAGE_OPENEXR)
endif()
if(WITH_IMAGE_TIFF)
- list(APPEND INC ${TIFF_INCLUDE_DIR})
+ list(APPEND INC_SYS ${TIFF_INCLUDE_DIR})
add_definitions(-DWITH_TIFF)
endif()
if(WITH_IMAGE_OPENJPEG)
- list(APPEND INC ${OPENJPEG_INC})
+ list(APPEND INC_SYS ${OPENJPEG_INC})
add_definitions(-DWITH_OPENJPEG)
endif()
if(WITH_IMAGE_REDCODE)
- list(APPEND INC ${REDCODE_INC})
+ list(APPEND INC_SYS ${REDCODE_INC})
add_definitions(-DWITH_REDCODE)
endif()
if(WITH_CODEC_QUICKTIME)
- list(APPEND INC
- ../quicktime
- ${QUICKTIME_INC}
- )
+ list(APPEND INC ../quicktime)
+ list(APPEND INC_SYS ${QUICKTIME_INC})
add_definitions(-DWITH_QUICKTIME)
endif()
if(WITH_CODEC_FFMPEG)
- list(APPEND INC ${FFMPEG_INC})
+ list(APPEND INC_SYS ${FFMPEG_INC})
add_definitions(-DWITH_FFMPEG)
endif()
@@ -146,4 +151,4 @@ if(WITH_IMAGE_HDR)
add_definitions(-DWITH_HDR)
endif()
-blender_add_lib(bf_imbuf "${SRC}" "${INC}")
+blender_add_lib(bf_imbuf "${SRC}" "${INC}" "${INC_SYS}")
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/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h
index 4804d363628..fba0772dd93 100644
--- a/source/blender/imbuf/intern/IMB_anim.h
+++ b/source/blender/imbuf/intern/IMB_anim.h
@@ -107,7 +107,7 @@
#define SWAP_S(x) (((x << 8) & 0xff00) | ((x >> 8) & 0xff))
/* more endianness... should move to a separate file... */
-#if defined(__sgi) || defined (__sparc) || (__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__hppa__) || defined (__BIG_ENDIAN__)
+#if defined(__sgi) || defined (__sparc) || defined (__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__hppa__) || defined (__BIG_ENDIAN__)
#define GET_ID GET_BIG_LONG
#define LITTLE_LONG SWAP_LONG
#else
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/cineon/CMakeLists.txt b/source/blender/imbuf/intern/cineon/CMakeLists.txt
index 92cba72c094..079f34af773 100644
--- a/source/blender/imbuf/intern/cineon/CMakeLists.txt
+++ b/source/blender/imbuf/intern/cineon/CMakeLists.txt
@@ -25,14 +25,18 @@
# ***** END GPL LICENSE BLOCK *****
set(INC
- .
- ..
- ../..
- ../../../blenkernel
- ../../../blenloader
- ../../../blenlib
- ../../../makesdna
- ../../../../../intern/guardedalloc
+ .
+ ..
+ ../..
+ ../../../blenkernel
+ ../../../blenloader
+ ../../../blenlib
+ ../../../makesdna
+ ../../../../../intern/guardedalloc
+)
+
+set(INC_SYS
+
)
set(SRC
@@ -44,4 +48,4 @@ set(SRC
logmemfile.c
)
-blender_add_lib(bf_imbuf_cineon "${SRC}" "${INC}")
+blender_add_lib(bf_imbuf_cineon "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt
index 7564287ce4a..fd2b94547b4 100644
--- a/source/blender/imbuf/intern/dds/CMakeLists.txt
+++ b/source/blender/imbuf/intern/dds/CMakeLists.txt
@@ -28,13 +28,17 @@ set(INC
.
..
../..
- ./intern/include
+ intern/include
../../../blenlib
../../../blenkernel
../../../makesdna
../../../../../intern/guardedalloc
)
+set(INC_SYS
+
+)
+
set(SRC
BlockDXT.cpp
ColorBlock.cpp
@@ -48,4 +52,4 @@ if(WITH_IMAGE_DDS)
add_definitions(-DWITH_DDS)
endif()
-blender_add_lib(bf_imbuf_dds "${SRC}" "${INC}")
+blender_add_lib(bf_imbuf_dds "${SRC}" "${INC}" "${INC_SYS}")
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/md5.h b/source/blender/imbuf/intern/md5.h
index 5fc1f80216f..79c480d8152 100644
--- a/source/blender/imbuf/intern/md5.h
+++ b/source/blender/imbuf/intern/md5.h
@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <stdio.h>
-#if defined HAVE_LIMITS_H || _LIBC
+#if defined HAVE_LIMITS_H || defined _LIBC
# include <limits.h>
#endif
diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt
index ace4f4f9a65..c1140bc59a9 100644
--- a/source/blender/imbuf/intern/openexr/CMakeLists.txt
+++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt
@@ -33,7 +33,10 @@ set(INC
intern/include
../../../../../intern/guardedalloc
../../../makesdna
- ${OPENEXR_INC}
+)
+
+set(INC_SYS
+
)
set(SRC
@@ -41,7 +44,8 @@ set(SRC
)
if(WITH_IMAGE_OPENEXR)
+ list(APPEND INC_SYS ${OPENEXR_INC})
add_definitions(-DWITH_OPENEXR)
endif()
-blender_add_lib(bf_imbuf_openexr "${SRC}" "${INC}")
+blender_add_lib(bf_imbuf_openexr "${SRC}" "${INC}" "${INC_SYS}")
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/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 1be67a4501b..1057eeae40f 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -469,7 +469,7 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_HIDE_DOT (1 << 16)
#define USER_SHOW_ROTVIEWICON (1 << 17)
#define USER_SHOW_VIEWPORTNAME (1 << 18)
-// old flag for #define USER_KEYINSERTNEED (1 << 19)
+#define USER_CAM_LOCK_NO_PARENT (1 << 19)
#define USER_ZOOM_TO_MOUSEPOS (1 << 20)
#define USER_SHOW_FPS (1 << 21)
#define USER_MMB_PASTE (1 << 22)
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 095dc3837c4..11e14e6d3ed 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -99,7 +99,7 @@ typedef struct RegionView3D {
float pixsize; /* runtime only */
float ofs[3]; /* view center & orbit pivot, negative of worldspace location,
* also matches -viewinv[3][0:3] in ortho mode.*/
- short camzoom;
+ short camzoom; /* viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac */
short twdrawflag;
char is_persp; /* check if persp/ortho view, since 'persp' cant be used for this since
* it can have cameras assigned as well. (only set in setwinmatrixview3d) */
diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt
index bb95e2c0fbc..429db63b526 100644
--- a/source/blender/makesdna/intern/CMakeLists.txt
+++ b/source/blender/makesdna/intern/CMakeLists.txt
@@ -58,6 +58,11 @@ add_custom_command(
# Build bf_dna library
set(INC
+
+)
+
+set(INC_SYS
+
)
set(SRC
@@ -66,4 +71,4 @@ set(SRC
${SRC_DNA_INC}
)
-blender_add_lib(bf_dna "${SRC}" "${INC}")
+blender_add_lib(bf_dna "${SRC}" "${INC}" "${INC_SYS}")
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 0d3101187b7..3485807a0d5 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -743,6 +743,7 @@ LIBEXPORT int RNA_property_string_default_length(PointerRNA *ptr, PropertyRNA *p
LIBEXPORT int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop);
LIBEXPORT void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value);
LIBEXPORT int RNA_property_enum_get_default(PointerRNA *ptr, PropertyRNA *prop);
+void *RNA_property_enum_py_data_get(PropertyRNA *prop);
LIBEXPORT PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop);
LIBEXPORT 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 2e1102ae793..ebfdea4ef9a 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -51,6 +51,7 @@ extern "C" {
struct ParameterList;
struct FunctionRNA;
struct PropertyRNA;
+struct EnumPropertyRNA;
struct StructRNA;
struct BlenderRNA;
struct IDProperty;
@@ -267,7 +268,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/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 37123ea4ec1..4e4ff396e71 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -131,8 +131,14 @@ set(SRC
)
set(INC
+
+)
+
+set(INC_SYS
+
)
+
if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
@@ -171,7 +177,7 @@ if(WITH_CODEC_QUICKTIME)
endif()
if(WITH_CODEC_FFMPEG)
- list(APPEND INC ${FFMPEG_INC})
+ list(APPEND INC_SYS ${FFMPEG_INC})
add_definitions(-DWITH_FFMPEG)
endif()
@@ -217,6 +223,9 @@ blender_include_dirs(
../../../../intern/audaspace/intern
../../../../intern/guardedalloc
../../../../intern/memutil
+)
+
+blender_include_dirs_sys(
${GLEW_INCLUDE_PATH}
)
@@ -242,5 +251,4 @@ set(SRC
rna_nodetree_types.h
)
-blender_add_lib(bf_rna "${SRC}" "${INC}")
-
+blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 49f2969f72d..77648f7dabd 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_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 587346c4566..42d1e88f327 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -205,17 +205,17 @@ void rna_ID_fake_user_set(PointerRNA *ptr, int value)
}
}
-IDProperty *rna_PropertyGroup_idprops(PointerRNA *ptr, int create)
+IDProperty *rna_PropertyGroup_idprops(PointerRNA *ptr, int UNUSED(create))
{
return ptr->data;
}
-void rna_PropertyGroup_unregister(Main *bmain, StructRNA *type)
+void rna_PropertyGroup_unregister(Main *UNUSED(bmain), StructRNA *type)
{
RNA_struct_free(&BLENDER_RNA, type);
}
-StructRNA *rna_PropertyGroup_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc UNUSED(call), StructFreeFunc UNUSED(free))
{
PointerRNA dummyptr;
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 399b039a2d7..ad112b45a06 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -288,7 +288,7 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
}
}
-static int rna_ensure_property_array_check(PointerRNA *ptr, PropertyRNA *prop)
+static int rna_ensure_property_array_check(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
if(prop->magic == RNA_MAGIC) {
return (prop->getlength || prop->totarraylength) ? 1:0;
@@ -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) {
@@ -1304,7 +1304,7 @@ int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop)
return (prop->flag & PROP_EDITABLE);
}
-int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)
+int RNA_property_animated(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop))
{
/* would need to ask animation system */
@@ -1529,7 +1529,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde
}
}
-int RNA_property_boolean_get_default(PointerRNA *ptr, PropertyRNA *prop)
+int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
@@ -1538,7 +1538,7 @@ int RNA_property_boolean_get_default(PointerRNA *ptr, PropertyRNA *prop)
return bprop->defaultvalue;
}
-void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
+void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int *values)
{
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
@@ -1715,13 +1715,13 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i
}
}
-int RNA_property_int_get_default(PointerRNA *ptr, PropertyRNA *prop)
+int RNA_property_int_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
return iprop->defaultvalue;
}
-void RNA_property_int_get_default_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
+void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int *values)
{
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
@@ -1923,7 +1923,7 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index,
}
}
-float RNA_property_float_get_default(PointerRNA *ptr, PropertyRNA *prop)
+float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
@@ -1932,7 +1932,7 @@ float RNA_property_float_get_default(PointerRNA *ptr, PropertyRNA *prop)
return fprop->defaultvalue;
}
-void RNA_property_float_get_default_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
+void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, float *values)
{
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
@@ -2039,7 +2039,7 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val
}
}
-void RNA_property_string_get_default(PointerRNA *ptr, PropertyRNA *prop, char *value)
+void RNA_property_string_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop, char *value)
{
StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
@@ -2068,7 +2068,7 @@ char *RNA_property_string_get_default_alloc(PointerRNA *ptr, PropertyRNA *prop,
}
/* this is the length without \0 terminator */
-int RNA_property_string_default_length(PointerRNA *ptr, PropertyRNA *prop)
+int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
@@ -2116,7 +2116,7 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
}
}
-int RNA_property_enum_get_default(PointerRNA *ptr, PropertyRNA *prop)
+int RNA_property_enum_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
@@ -2125,6 +2125,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)
{
@@ -3380,7 +3388,7 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
}
-char *RNA_path_append(const char *path, PointerRNA *ptr, PropertyRNA *prop, int intkey, const char *strkey)
+char *RNA_path_append(const char *path, PointerRNA *UNUSED(ptr), PropertyRNA *prop, int intkey, const char *strkey)
{
DynStr *dynstr;
const char *s;
@@ -4258,12 +4266,12 @@ int RNA_function_defined(FunctionRNA *func)
return func->call != NULL;
}
-PropertyRNA *RNA_function_get_parameter(PointerRNA *ptr, FunctionRNA *func, int index)
+PropertyRNA *RNA_function_get_parameter(PointerRNA *UNUSED(ptr), FunctionRNA *func, int index)
{
return BLI_findlink(&func->cont.properties, index);
}
-PropertyRNA *RNA_function_find_parameter(PointerRNA *ptr, FunctionRNA *func, const char *identifier)
+PropertyRNA *RNA_function_find_parameter(PointerRNA *UNUSED(ptr), FunctionRNA *func, const char *identifier)
{
return BLI_findstring(&func->cont.properties, identifier, offsetof(PropertyRNA, identifier));
}
@@ -4275,7 +4283,7 @@ const struct ListBase *RNA_function_defined_parameters(FunctionRNA *func)
/* Utility */
-ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *ptr, FunctionRNA *func)
+ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSED(ptr), FunctionRNA *func)
{
PropertyRNA *parm;
void *data;
@@ -4413,7 +4421,7 @@ void RNA_parameter_list_next(ParameterIterator *iter)
}
}
-void RNA_parameter_list_end(ParameterIterator *iter)
+void RNA_parameter_list_end(ParameterIterator *UNUSED(iter))
{
/* nothing to do */
}
@@ -4513,12 +4521,12 @@ void RNA_parameter_length_set(ParameterList *parms, PropertyRNA *parm, int lengt
RNA_parameter_list_end(&iter);
}
-int RNA_parameter_length_get_data(ParameterList *parms, PropertyRNA *parm, void *data)
+int RNA_parameter_length_get_data(ParameterList *UNUSED(parms), PropertyRNA *UNUSED(parm), void *data)
{
return *((int *)((char *)data));
}
-void RNA_parameter_length_set_data(ParameterList *parms, PropertyRNA *parm, void *data, int length)
+void RNA_parameter_length_set_data(ParameterList *UNUSED(parms), PropertyRNA *UNUSED(parm), void *data, int length)
{
*((int *)data)= length;
}
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_armature.c b/source/blender/makesrna/intern/rna_armature.c
index d398bb4bb78..2060f75f9de 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -52,7 +52,7 @@
#include "ED_armature.h"
#include "BKE_armature.h"
-static void rna_Armature_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Armature_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
ID *id= ptr->id.data;
@@ -126,7 +126,7 @@ void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, EditBone
ED_armature_edit_bone_remove(arm, ebone);
}
-static void rna_Armature_update_layers(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
bArmature *arm= ptr->id.data;
Object *ob;
@@ -140,7 +140,7 @@ static void rna_Armature_update_layers(Main *bmain, Scene *scene, PointerRNA *pt
WM_main_add_notifier(NC_GEOM|ND_DATA, arm);
}
-static void rna_Armature_redraw_data(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Armature_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
ID *id= ptr->id.data;
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 7bb56380ba5..da735f25345 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"
@@ -116,7 +117,7 @@ static void rna_Brush_reset_icon(Brush *br, const char *UNUSED(type))
id->icon_id = 0;
}
-static void rna_Brush_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Brush *br= (Brush*)ptr->data;
WM_main_add_notifier(NC_BRUSH|NA_EDITED, br);
@@ -144,7 +145,7 @@ static void rna_Brush_imagepaint_tool_update(Main *bmain, Scene *scene, PointerR
rna_Brush_update(bmain, scene, ptr);
}
-static void rna_Brush_icon_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Brush_icon_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Brush *br= (Brush*)ptr->data;
@@ -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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
static EnumPropertyItem prop_default_items[]= {
{0, NULL, 0, NULL, NULL}};
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index afd30433c5d..1ce4108bab2 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -49,7 +49,7 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
-static void rna_cloth_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_cloth_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
@@ -57,7 +57,7 @@ static void rna_cloth_update(Main *bmain, Scene *scene, PointerRNA *ptr)
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
}
-static void rna_cloth_pinning_changed(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_cloth_pinning_changed(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
// ClothSimSettings *settings = (ClothSimSettings*)ptr->data;
@@ -69,7 +69,7 @@ static void rna_cloth_pinning_changed(Main *bmain, Scene *scene, PointerRNA *ptr
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
}
-static void rna_cloth_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_cloth_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
ClothSimSettings *settings = (ClothSimSettings*)ptr->data;
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 9709ba7e8f6..cea130a4b74 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -237,7 +237,7 @@ MEM_freeN(texture_path); \
return path;
}
-static void rna_ColorRamp_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
if (ptr->id.data) {
ID *id= ptr->id.data;
@@ -300,7 +300,7 @@ static void rna_ColorRampElement_remove(struct ColorBand *coba, ReportList *repo
}
-static void rna_Scopes_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Scopes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Scopes *s= (Scopes*)ptr->data;
s->ok = 0;
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index e7604b2beb4..a75ff601d08 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -205,7 +205,7 @@ static char *rna_Constraint_path(PointerRNA *ptr)
return BLI_sprintfN("constraints[\"%s\"]", con->name);
}
-static void rna_Constraint_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Constraint_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
ED_object_constraint_update(ptr->id.data);
}
@@ -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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
bConstraint *con= (bConstraint*)ptr->data;
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index ec640531fa0..df9071d7825 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -180,7 +180,7 @@ static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values)
bt->vec[1][2]= values[2];
}
-static void rna_Curve_texspace_set(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Curve *cu= (Curve*)ptr->data;
@@ -289,7 +289,7 @@ static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA
rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL);
}
-static void rna_Curve_update_data_id(Main *bmain, Scene *scene, ID *id)
+static void rna_Curve_update_data_id(Main *UNUSED(bmain), Scene *UNUSED(scene), ID *id)
{
DAG_id_tag_update(id, 0);
WM_main_add_notifier(NC_GEOM|ND_DATA, id);
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index d66f0042d88..66d1036ec44 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -446,7 +446,7 @@ BlenderRNA *RNA_create(void)
return brna;
}
-void RNA_define_free(BlenderRNA *brna)
+void RNA_define_free(BlenderRNA *UNUSED(brna))
{
StructDefRNA *ds;
FunctionDefRNA *dfunc;
@@ -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)
{
@@ -2556,7 +2562,7 @@ void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
RNA_def_function_output(func, ret);
}
-void RNA_def_function_output(FunctionRNA *func, PropertyRNA *ret)
+void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
{
ret->flag|= PROP_OUTPUT;
}
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 1b18f88efcc..a46f84a22d2 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -446,7 +446,7 @@ static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, FModif
remove_fmodifier(&fcu->modifiers, fcm);
}
-static void rna_FModifier_active_set(PointerRNA *ptr, int value)
+static void rna_FModifier_active_set(PointerRNA *ptr, int UNUSED(value))
{
FModifier *fm= (FModifier*)ptr->data;
@@ -454,7 +454,7 @@ static void rna_FModifier_active_set(PointerRNA *ptr, int value)
fm->flag |= FMODIFIER_FLAG_ACTIVE;
}
-static void rna_FModifier_active_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_FModifier_active_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
FModifier *fm, *fmo= (FModifier*)ptr->data;
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 3db90c2de0e..a52849b3366 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -55,7 +55,7 @@ static EnumPropertyItem image_source_items[]= {
#include "IMB_imbuf_types.h"
-static void rna_Image_animated_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Image_animated_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Image *ima= (Image*)ptr->data;
int nr;
@@ -80,14 +80,14 @@ static int rna_Image_dirty_get(PointerRNA *ptr)
return 0;
}
-static void rna_Image_source_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Image_source_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Image *ima= ptr->id.data;
BKE_image_signal(ima, NULL, IMA_SIGNAL_SRC_CHANGE);
DAG_id_tag_update(&ima->id, 0);
}
-static void rna_Image_fields_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Image_fields_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Image *ima= ptr->id.data;
ImBuf *ibuf;
@@ -108,20 +108,20 @@ static void rna_Image_fields_update(Main *bmain, Scene *scene, PointerRNA *ptr)
BKE_image_release_ibuf(ima, lock);
}
-static void rna_Image_reload_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Image_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Image *ima= ptr->id.data;
BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
DAG_id_tag_update(&ima->id, 0);
}
-static void rna_Image_generated_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Image_generated_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Image *ima= ptr->id.data;
BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
}
-static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_ImageUser_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
ImageUser *iuser= ptr->data;
@@ -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 *UNUSED(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_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index cd6ff4dad16..f4c873765c0 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -108,7 +108,7 @@ static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr)
}
}
-static void rna_Lamp_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Lamp_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
Lamp *la= ptr->id.data;
@@ -119,7 +119,7 @@ static void rna_Lamp_update(Main *bmain, Scene *scene, PointerRNA *ptr)
WM_main_add_notifier(NC_LAMP|ND_LIGHTING, la);
}
-static void rna_Lamp_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Lamp_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Lamp *la= ptr->id.data;
@@ -127,7 +127,7 @@ static void rna_Lamp_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
WM_main_add_notifier(NC_LAMP|ND_LIGHTING_DRAW, la);
}
-static void rna_Lamp_sky_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Lamp_sky_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Lamp *la= ptr->id.data;
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index a3503999a4c..8387b3286d6 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -92,7 +92,7 @@ static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRN
rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
}
-static void rna_Lattice_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Lattice_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
ID *id= ptr->id.data;
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index eedf199bf1c..bb13a3b1bf1 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -42,7 +42,7 @@
/* all the list begin functions are added manually here, Main is not in SDNA */
-static int rna_Main_is_saved_get(PointerRNA *ptr)
+static int rna_Main_is_saved_get(PointerRNA *UNUSED(ptr))
{
return G.relbase_valid;
}
@@ -50,8 +50,9 @@ static int rna_Main_is_saved_get(PointerRNA *ptr)
static int rna_Main_is_dirty_get(PointerRNA *ptr)
{
/* XXX, not totally nice to do it this way, should store in main ? */
+ Main *bmain= (Main*)ptr->data;
wmWindowManager *wm;
- for(wm= G.main->wm.first; wm; wm= wm->id.next) {
+ for(wm= bmain->wm.first; wm; wm= wm->id.next) {
return !wm->file_saved;
}
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 454c456e051..d9bb1619ca5 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -84,12 +84,12 @@
#include "ED_screen.h"
-Tex *rna_Main_add_texture(Main *bmain, const char *name)
+Tex *rna_Main_add_texture(Main *UNUSED(bmain), const char *name)
{
return add_texture(name);
}
-Camera *rna_Main_cameras_new(Main *bmain, const char *name)
+Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name)
{
ID *id= add_camera(name);
id_us_min(id);
@@ -105,7 +105,7 @@ void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *ca
/* XXX python now has invalid pointer? */
}
-Scene *rna_Main_scenes_new(Main *bmain, const char *name)
+Scene *rna_Main_scenes_new(Main *UNUSED(bmain), const char *name)
{
return add_scene(name);
}
@@ -129,7 +129,7 @@ void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struc
unlink_scene(bmain, scene, newscene);
}
-Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char *name, ID *data)
+Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const char *name, ID *data)
{
Object *ob;
int type= OB_EMPTY;
@@ -190,7 +190,7 @@ void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *ob
}
}
-struct Material *rna_Main_materials_new(Main *bmain, const char *name)
+struct Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name)
{
ID *id= (ID *)add_material(name);
id_us_min(id);
@@ -206,7 +206,7 @@ void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material
/* XXX python now has invalid pointer? */
}
-struct bNodeTree *rna_Main_nodetree_new(Main *bmain, const char *name, int type)
+struct bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, int type)
{
bNodeTree *tree = ntreeAddTree(name, type, TRUE);
@@ -225,7 +225,7 @@ void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree
/* XXX python now has invalid pointer? */
}
-Mesh *rna_Main_meshes_new(Main *bmain, const char *name)
+Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name)
{
Mesh *me= add_mesh(name);
id_us_min(&me->id);
@@ -241,7 +241,7 @@ LIBEXPORT void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *me
/* XXX python now has invalid pointer? */
}
-Lamp *rna_Main_lamps_new(Main *bmain, const char *name, int type)
+Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type)
{
Lamp *lamp= add_lamp(name);
lamp->type= type;
@@ -258,14 +258,14 @@ void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
/* XXX python now has invalid pointer? */
}
-Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, int alpha, int float_buffer)
+Image *rna_Main_images_new(Main *UNUSED(bmain), const char *name, int width, int height, int alpha, int float_buffer)
{
float color[4]= {0.0, 0.0, 0.0, 1.0};
Image *image= BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color);
id_us_min(&image->id);
return image;
}
-Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath)
+Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
{
Image *ima;
@@ -287,7 +287,7 @@ void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
/* XXX python now has invalid pointer? */
}
-Lattice *rna_Main_lattices_new(Main *bmain, const char *name)
+Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name)
{
Lattice *lt= add_lattice(name);
id_us_min(&lt->id);
@@ -301,7 +301,7 @@ void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *
BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d.", lt->id.name+2, ID_REAL_USERS(lt));
}
-Curve *rna_Main_curves_new(Main *bmain, const char *name, int type)
+Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int type)
{
Curve *cu= add_curve(name, type);
id_us_min(&cu->id);
@@ -315,7 +315,7 @@ void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu)
BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d.", cu->id.name+2, ID_REAL_USERS(cu));
}
-MetaBall *rna_Main_metaballs_new(Main *bmain, const char *name)
+MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name)
{
MetaBall *mb= add_mball(name);
id_us_min(&mb->id);
@@ -329,7 +329,7 @@ void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall
BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" must have zero users to be removed, found %d.", mb->id.name+2, ID_REAL_USERS(mb));
}
-VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath)
+VFont *rna_Main_fonts_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
{
VFont *font;
@@ -352,7 +352,7 @@ void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
/* XXX python now has invalid pointer? */
}
-Tex *rna_Main_textures_new(Main *bmain, const char *name, int type)
+Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int type)
{
Tex *tex= add_texture(name);
tex_set_type(tex, type);
@@ -367,7 +367,7 @@ void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex)
BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d.", tex->id.name+2, ID_REAL_USERS(tex));
}
-Brush *rna_Main_brushes_new(Main *bmain, const char *name)
+Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name)
{
Brush *brush = add_brush(name);
id_us_min(&brush->id);
@@ -381,7 +381,7 @@ void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *bru
BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d.", brush->id.name+2, ID_REAL_USERS(brush));
}
-World *rna_Main_worlds_new(Main *bmain, const char *name)
+World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name)
{
World *world = add_world(name);
id_us_min(&world->id);
@@ -395,7 +395,7 @@ void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *worl
BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d.", world->id.name+2, ID_REAL_USERS(world));
}
-Group *rna_Main_groups_new(Main *bmain, const char *name)
+Group *rna_Main_groups_new(Main *UNUSED(bmain), const char *name)
{
return add_group(name);
}
@@ -406,7 +406,7 @@ void rna_Main_groups_remove(Main *bmain, Group *group)
/* XXX python now has invalid pointer? */
}
-Text *rna_Main_texts_new(Main *bmain, const char *name)
+Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name)
{
return add_empty_text(name);
}
@@ -430,7 +430,7 @@ Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath
return txt;
}
-bArmature *rna_Main_armatures_new(Main *bmain, const char *name)
+bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name)
{
bArmature *arm= add_armature(name);
id_us_min(&arm->id);
@@ -446,7 +446,7 @@ void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm)
/* XXX python now has invalid pointer? */
}
-bAction *rna_Main_actions_new(Main *bmain, const char *name)
+bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name)
{
bAction *act= add_empty_action(name);
id_us_min(&act->id);
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 2cf25e216ea..1dbe2636001 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -89,7 +89,7 @@ EnumPropertyItem ramp_blend_items[] = {
#include "ED_node.h"
-static void rna_Material_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Material_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
Material *ma= ptr->id.data;
@@ -100,7 +100,7 @@ static void rna_Material_update(Main *bmain, Scene *scene, PointerRNA *ptr)
WM_main_add_notifier(NC_MATERIAL|ND_SHADING, ma);
}
-static void rna_Material_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Material *ma= ptr->id.data;
@@ -272,7 +272,7 @@ static void rna_Material_use_nodes_set(PointerRNA *ptr, int value)
ED_node_shader_default(&ma->id);
}
-static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *C, PointerRNA *ptr, int *free)
+static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(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_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 9e5a2e9f65a..2d3c3fe7a3a 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -58,7 +58,7 @@
#include "WM_api.h"
#include "WM_types.h"
-static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Mesh_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
ID *id= ptr->id.data;
@@ -69,7 +69,7 @@ static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
}
}
-static void rna_Mesh_update_select(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Mesh_update_select(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
ID *id= ptr->id.data;
/* cheating way for importers to avoid slow updates */
@@ -78,7 +78,7 @@ static void rna_Mesh_update_select(Main *bmain, Scene *scene, PointerRNA *ptr)
}
}
-void rna_Mesh_update_draw(Main *bmain, Scene *scene, PointerRNA *ptr)
+void rna_Mesh_update_draw(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
ID *id= ptr->id.data;
/* cheating way for importers to avoid slow updates */
@@ -234,7 +234,7 @@ static void rna_MeshColor_color4_set(PointerRNA *ptr, const float *values)
(&mcol[3].r)[0]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
}
-static void rna_Mesh_texspace_set(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Mesh_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Mesh *me= (Mesh*)ptr->data;
@@ -333,7 +333,7 @@ static int rna_CustomDataLayer_active_get(PointerRNA *ptr, int type, int render)
else return (n == CustomData_get_active_layer_index(fdata, type));
}
-static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, int type, int render)
+static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, int type, int UNUSED(render))
{
Mesh *me= (Mesh*)ptr->id.data;
CustomData *fdata= rna_mesh_fdata(me);
@@ -355,7 +355,7 @@ static void rna_CustomDataLayer_active_set(PointerRNA *ptr, int value, int type,
else CustomData_set_layer_active_index(fdata, type, n);
}
-static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, int value, int type, int render)
+static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, int value, int type, int UNUSED(render))
{
Mesh *me= (Mesh*)ptr->id.data;
CustomData *fdata= rna_mesh_fdata(me);
@@ -367,7 +367,7 @@ static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, int value, int type,
CustomData_set_layer_clone_index(fdata, type, n);
}
-static int rna_uv_texture_check(CollectionPropertyIterator *iter, void *data)
+static int rna_uv_texture_check(CollectionPropertyIterator *UNUSED(iter), void *data)
{
CustomDataLayer *layer= (CustomDataLayer*)data;
return (layer->type != CD_MTFACE);
@@ -690,7 +690,7 @@ static void rna_MeshTextureFaceLayer_name_set(PointerRNA *ptr, const char *value
CustomData_set_layer_unique_name(fdata, cdl - fdata->layers);
}
-static int rna_vertex_color_check(CollectionPropertyIterator *iter, void *data)
+static int rna_vertex_color_check(CollectionPropertyIterator *UNUSED(iter), void *data)
{
CustomDataLayer *layer= (CustomDataLayer*)data;
return (layer->type != CD_MCOL);
@@ -815,7 +815,7 @@ static int rna_MeshFloatPropertyLayer_data_length(PointerRNA *ptr)
return (me->edit_mesh)? 0: me->totface;
}
-static int rna_float_layer_check(CollectionPropertyIterator *iter, void *data)
+static int rna_float_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
{
CustomDataLayer *layer= (CustomDataLayer*)data;
return (layer->type != CD_PROP_FLT);
@@ -833,7 +833,7 @@ static int rna_Mesh_float_layers_length(PointerRNA *ptr)
return rna_CustomDataLayer_length(ptr, CD_PROP_FLT);
}
-static int rna_int_layer_check(CollectionPropertyIterator *iter, void *data)
+static int rna_int_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
{
CustomDataLayer *layer= (CustomDataLayer*)data;
return (layer->type != CD_PROP_INT);
@@ -864,7 +864,7 @@ static int rna_Mesh_int_layers_length(PointerRNA *ptr)
return rna_CustomDataLayer_length(ptr, CD_PROP_INT);
}
-static int rna_string_layer_check(CollectionPropertyIterator *iter, void *data)
+static int rna_string_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
{
CustomDataLayer *layer= (CustomDataLayer*)data;
return (layer->type != CD_PROP_STR);
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 333451e1d31..75f3f1ef238 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -214,7 +214,7 @@ static char *rna_Modifier_path(PointerRNA *ptr)
return BLI_sprintfN("modifiers[\"%s\"]", ((ModifierData*)ptr->data)->name);
}
-static void rna_Modifier_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Modifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ptr->id.data);
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 9bf5f53f8b7..71bff06a864 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -94,7 +94,7 @@ static char *rna_NlaStrip_path(PointerRNA *ptr)
return "";
}
-static void rna_NlaStrip_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_NlaStrip_transform_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
NlaStrip *strip= (NlaStrip*)ptr->data;
@@ -273,7 +273,7 @@ static void rna_NlaStrip_animated_time_set(PointerRNA *ptr, int value)
data->flag &= ~NLASTRIP_FLAG_USR_TIME;
}
-static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *reports, const char *name, int start, bAction *action)
+static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *reports, const char *UNUSED(name), int start, bAction *action)
{
NlaStrip *strip = add_nlastrip(action);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index c67830a01ae..77748d51619 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -281,7 +281,7 @@ static void rna_Node_scene_set(PointerRNA *ptr, PointerRNA value)
-static void node_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node)
+static void node_update(Main *bmain, Scene *UNUSED(scene), bNodeTree *ntree, bNode *node)
{
ED_node_generic_update(bmain, ntree, node);
}
@@ -391,7 +391,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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
bNode *node= (bNode*)ptr->data;
Image *ima = (Image *)node->id;
@@ -408,7 +408,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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
bNode *node= (bNode*)ptr->data;
Scene *sce = (Scene *)node->id;
@@ -425,7 +425,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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
bNode *node= (bNode*)ptr->data;
EnumPropertyItem *item= NULL;
@@ -475,7 +475,7 @@ static EnumPropertyItem *rna_Node_channel_itemf(bContext *C, PointerRNA *ptr, in
return item;
}
-static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group)
+static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), ReportList *reports, int type, bNodeTree *group)
{
bNode *node;
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 4407ca8ad4e..9305380d06c 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -155,7 +155,7 @@ EnumPropertyItem object_type_curve_items[] = {
#include "ED_curve.h"
#include "ED_lattice.h"
-static void rna_Object_internal_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Object_internal_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
DAG_id_tag_update(ptr->id.data, OB_RECALC_OB);
}
@@ -213,7 +213,7 @@ static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
object_apply_mat4(ob, (float(*)[4])values, FALSE, FALSE);
}
-void rna_Object_internal_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
+void rna_Object_internal_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data);
@@ -253,14 +253,14 @@ static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *
}
/* when changing the selection flag the scene needs updating */
-static void rna_Object_select_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT;
ED_base_object_select(object_in_scene(ob, scene), mode);
}
-static void rna_Base_select_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Base *base= (Base*)ptr->data;
short mode = base->flag & BA_SELECT ? BA_SELECT : BA_DESELECT;
@@ -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 *UNUSED(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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
Object *ob= (Object*)ptr->data;
EnumPropertyItem *item= NULL;
@@ -636,7 +636,7 @@ static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int val
psys_set_current_num(ob, value);
}
-static void rna_Object_particle_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
@@ -1186,27 +1186,27 @@ static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *report
}
/* generic poll functions */
-int rna_Lattice_object_poll(PointerRNA *ptr, PointerRNA value)
+int rna_Lattice_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_LATTICE;
}
-int rna_Curve_object_poll(PointerRNA *ptr, PointerRNA value)
+int rna_Curve_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_CURVE;
}
-int rna_Armature_object_poll(PointerRNA *ptr, PointerRNA value)
+int rna_Armature_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_ARMATURE;
}
-int rna_Mesh_object_poll(PointerRNA *ptr, PointerRNA value)
+int rna_Mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_MESH;
}
-int rna_Camera_object_poll(PointerRNA *ptr, PointerRNA value)
+int rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_CAMERA;
}
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 6955c7f8fa8..5d3c29b736b 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -101,7 +101,7 @@ EnumPropertyItem empty_vortex_shape_items[] = {
#include "ED_object.h"
-static void rna_Cache_change(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = (Object*)ptr->id.data;
PointCache *cache = (PointCache*)ptr->data;
@@ -132,7 +132,7 @@ static void rna_Cache_change(Main *bmain, Scene *scene, PointerRNA *ptr)
BLI_freelistN(&pidlist);
}
-static void rna_Cache_toggle_disk_cache(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Cache_toggle_disk_cache(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = (Object*)ptr->id.data;
PointCache *cache = (PointCache*)ptr->data;
@@ -158,7 +158,7 @@ static void rna_Cache_toggle_disk_cache(Main *bmain, Scene *scene, PointerRNA *p
BLI_freelistN(&pidlist);
}
-static void rna_Cache_idname_change(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = (Object*)ptr->id.data;
PointCache *cache = (PointCache*)ptr->data;
@@ -320,7 +320,7 @@ static void rna_PointCache_frame_step_range(PointerRNA *ptr, int *min, int *max)
BLI_freelistN(&pidlist);
}
-static char *rna_CollisionSettings_path(PointerRNA *ptr)
+static char *rna_CollisionSettings_path(PointerRNA *UNUSED(ptr))
{
/* both methods work ok, but return the shorter path */
#if 0
@@ -481,7 +481,7 @@ static int particle_id_check(PointerRNA *ptr)
return (GS(id->name) == ID_PA);
}
-static void rna_FieldSettings_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
if(particle_id_check(ptr)) {
ParticleSettings *part = (ParticleSettings*)ptr->id.data;
@@ -587,7 +587,7 @@ static char *rna_FieldSettings_path(PointerRNA *ptr)
return NULL;
}
-static void rna_EffectorWeight_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_EffectorWeight_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
DAG_id_tag_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET);
@@ -661,7 +661,7 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
}
-static void rna_CollisionSettings_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_CollisionSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
@@ -669,7 +669,7 @@ static void rna_CollisionSettings_update(Main *bmain, Scene *scene, PointerRNA *
WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
}
-static void rna_softbody_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_softbody_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
@@ -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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
Object *ob= NULL;
@@ -1056,8 +1056,8 @@ static void rna_def_field(BlenderRNA *brna)
static EnumPropertyItem field_type_items[] = {
{0, "NONE", 0, "None", ""},
{PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Gives a radial field toward the center of object"},
- {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Gives a constant force along the force object’s local Z axis"},
- {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Gives a spiraling force that twists the force object’s local Z axis"},
+ {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Gives a constant force along the force objects local Z axis"},
+ {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Gives a spiraling force that twists the force objects local Z axis"},
{PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", "Forcefield depends on the speed of the particles"},
{PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic", "The source of this force field is the zero point of a harmonic oscillator"},
{PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge", "Spherical forcefield based on the charge of particles, only influences other charge force fields"},
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index fa69fad253f..5615e7141ee 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -233,7 +233,7 @@ static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float
}
/* property update functions */
-static void particle_recalc(Main *bmain, Scene *scene, PointerRNA *ptr, short flag)
+static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr, short flag)
{
if(ptr->type==&RNA_ParticleSystem) {
ParticleSystem *psys = (ParticleSystem*)ptr->data;
@@ -325,7 +325,7 @@ static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr
WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
}
-static void rna_Particle_target_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Particle_target_redo(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
if(ptr->type==&RNA_ParticleTarget) {
Object *ob = (Object*)ptr->id.data;
@@ -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 *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *UNUSED(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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
ParticleSettings *part = ptr->id.data;
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 996a80548b3..949415fbf29 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -71,14 +71,14 @@
#include "RNA_access.h"
-static void rna_Pose_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Pose_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
// XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
}
-static void rna_Pose_IK_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Pose_IK_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
// XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
Object *ob= ptr->id.data;
@@ -254,7 +254,7 @@ static StructRNA *rna_Pose_ikparam_typef(PointerRNA *ptr)
}
}
-static void rna_Itasc_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Itasc_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = ptr->id.data;
bItasc *itasc = ptr->data;
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index fc5fb021d8e..20ae9cae5f6 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -160,7 +160,7 @@ static void engine_view_draw(RenderEngine *engine, const struct bContext *contex
/* RenderEngine registration */
-static void rna_RenderEngine_unregister(Main *bmain, StructRNA *type)
+static void rna_RenderEngine_unregister(Main *UNUSED(bmain), StructRNA *type)
{
RenderEngineType *et= RNA_struct_blender_type_get(type);
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 1991312babc..9f51f1995af 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -331,7 +331,7 @@ static void rna_Scene_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
DAG_on_visible_update(bmain, FALSE);
}
-static void rna_Scene_framelen_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
scene->r.framelen= (float)scene->r.framapto/(float)scene->r.images;
}
@@ -411,7 +411,7 @@ static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
data->r.pefra= value;
}
-static void rna_Scene_frame_update(bContext *C, PointerRNA *ptr)
+static void rna_Scene_frame_update(bContext *C, PointerRNA *UNUSED(ptr))
{
//Scene *scene= ptr->id.data;
//ED_update_for_newframe(C);
@@ -483,7 +483,7 @@ static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter)
}
-static char *rna_RenderSettings_path(PointerRNA *ptr)
+static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
{
return BLI_sprintfN("render");
}
@@ -600,7 +600,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, "", ""};
@@ -641,7 +641,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, "", ""};
@@ -712,7 +712,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 *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
RenderEngineType *type;
EnumPropertyItem *item= NULL;
@@ -745,19 +745,19 @@ static int rna_RenderSettings_engine_get(PointerRNA *ptr)
return 0;
}
-static void rna_RenderSettings_engine_update(Main *bmain, Scene *unused, PointerRNA *ptr)
+static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr))
{
ED_render_engine_changed(bmain);
}
-static void rna_Scene_glsl_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
+static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Scene *scene= (Scene*)ptr->id.data;
DAG_id_tag_update(&scene->id, 0);
}
-static void rna_RenderSettings_color_management_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
+static void rna_RenderSettings_color_management_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
/* reset image nodes */
Scene *scene= (Scene*)ptr->id.data;
@@ -802,7 +802,7 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
}
}
-static int rna_RenderSettings_multiple_engines_get(PointerRNA *ptr)
+static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
{
return (BLI_countlist(&R_engines) > 1);
}
@@ -825,7 +825,7 @@ static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values)
rl->lay= ED_view3d_scene_layer_set(rl->lay, values, NULL);
}
-static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
+static void rna_SceneRenderLayer_pass_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Scene *scene= (Scene*)ptr->id.data;
@@ -842,7 +842,7 @@ static void rna_Scene_use_nodes_set(PointerRNA *ptr, int value)
ED_node_composit_default(scene);
}
-static void rna_Physics_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
+static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Scene *scene= (Scene*)ptr->id.data;
Base *base;
@@ -870,7 +870,7 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value
}
}
-static void rna_Scene_editmesh_select_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
Mesh *me= NULL;
@@ -904,7 +904,7 @@ static void object_simplify_update(Object *ob)
}
}
-static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
{
Scene *sce_iter;
Base *base;
@@ -966,7 +966,7 @@ static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
}
}
-static int rna_GameSettings_auto_start_get(PointerRNA *ptr)
+static int rna_GameSettings_auto_start_get(PointerRNA *UNUSED(ptr))
{
if (G.fileflags & G_FILE_AUTOPLAY)
return 1;
@@ -974,7 +974,7 @@ static int rna_GameSettings_auto_start_get(PointerRNA *ptr)
return 0;
}
-static void rna_GameSettings_auto_start_set(PointerRNA *ptr, int value)
+static void rna_GameSettings_auto_start_set(PointerRNA *UNUSED(ptr), int value)
{
if(value)
G.fileflags |= G_FILE_AUTOPLAY;
@@ -2157,7 +2157,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_screen.c b/source/blender/makesrna/intern/rna_screen.c
index d129fccc717..be4adb405e2 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -82,7 +82,7 @@ static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr)
static void rna_Screen_redraw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bScreen *screen= (bScreen*)ptr->data;
-
+
/* the settings for this are currently only available from a menu in the TimeLine, hence refresh=SPACE_TIME */
ED_screen_animation_timer_update(screen, screen->redraws_flag, SPACE_TIME);
}
@@ -116,12 +116,29 @@ static void rna_Area_type_update(bContext *C, PointerRNA *ptr)
#else
+/* Area.spaces */
+static void rna_def_area_spaces(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "AreaSpaces");
+ srna= RNA_def_struct(brna, "AreaSpaces", NULL);
+ RNA_def_struct_sdna(srna, "ScrArea");
+ RNA_def_struct_ui_text(srna, "Area Spaces", "Collection of spaces");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "spacedata.first");
+ RNA_def_property_struct_type(prop, "Space");
+ RNA_def_property_ui_text(prop, "Active Space", "Space currently being displayed in this area");
+}
+
static void rna_def_area(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
FunctionRNA *func;
-
+
srna= RNA_def_struct(brna, "Area", NULL);
RNA_def_struct_ui_text(srna, "Area", "Area in a subdivided screen, containing an editor");
RNA_def_struct_sdna(srna, "ScrArea");
@@ -130,11 +147,7 @@ static void rna_def_area(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "spacedata", NULL);
RNA_def_property_struct_type(prop, "Space");
RNA_def_property_ui_text(prop, "Spaces", "Spaces contained in this area, the first being the active space. NOTE: Useful for example to restore a previously used 3d view space in a certain area to get the old view orientation.");
-
- prop= RNA_def_property(srna, "active_space", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "spacedata.first");
- RNA_def_property_struct_type(prop, "Space");
- RNA_def_property_ui_text(prop, "Active Space", "Space currently being displayed in this area");
+ rna_def_area_spaces(brna, prop);
prop= RNA_def_property(srna, "regions", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "regionbase", NULL);
@@ -144,7 +157,7 @@ static void rna_def_area(BlenderRNA *brna)
prop= RNA_def_property(srna, "show_menus", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", HEADER_NO_PULLDOWN);
RNA_def_property_ui_text(prop, "Show Menus", "Show menus in the header");
-
+
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spacetype");
RNA_def_property_enum_items(prop, space_type_items);
@@ -174,11 +187,11 @@ static void rna_def_region(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
-
+
srna= RNA_def_struct(brna, "Region", NULL);
RNA_def_struct_ui_text(srna, "Region", "Region in a subdivided screen area");
RNA_def_struct_sdna(srna, "ARegion");
-
+
prop= RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "swinid");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -199,7 +212,7 @@ static void rna_def_region(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "winy");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Height", "Region height");
-
+
RNA_def_function(srna, "tag_redraw", "ED_region_tag_redraw");
}
@@ -207,12 +220,12 @@ static void rna_def_screen(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
-
+
srna= RNA_def_struct(brna, "Screen", "ID");
RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */
RNA_def_struct_ui_text(srna, "Screen", "Screen datablock, defining the layout of areas in a window");
RNA_def_struct_ui_icon(srna, ICON_SPLITSCREEN);
-
+
/* pointers */
prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
@@ -220,55 +233,55 @@ static void rna_def_screen(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_Screen_scene_update");
-
+
/* collections */
prop= RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);
RNA_def_property_struct_type(prop, "Area");
RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into");
-
+
/* readonly status indicators */
prop= RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Screen_is_animation_playing_get", NULL);
RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active");
-
+
prop= RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL);
RNA_def_property_ui_text(prop, "Fullscreen", "An area is maximised, filling this screen");
-
+
/* Define Anim Playback Areas */
prop= RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION);
RNA_def_property_ui_text(prop, "Top-Left 3D Editor", "");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
-
+
prop= RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_3D_WIN);
RNA_def_property_ui_text(prop, "All 3D View Editors", "");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
-
+
prop= RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_ANIM_WIN);
RNA_def_property_ui_text(prop, "Animation Editors", "");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
-
+
prop= RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_BUTS_WIN);
RNA_def_property_ui_text(prop, "Property Editors", "");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
-
+
prop= RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_IMAGE_WIN);
RNA_def_property_ui_text(prop, "Image Editors", "");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
-
+
prop= RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_SEQ);
RNA_def_property_ui_text(prop, "Sequencer Editors", "");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
-
+
prop= RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_NODES);
RNA_def_property_ui_text(prop, "Node Editors", "");
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index da536f95cba..b350956047c 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -95,7 +95,7 @@ static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL);
}
-static void rna_ParticleEdit_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_ParticleEdit_redo(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
Object *ob= (scene->basact)? scene->basact->object: NULL;
PTCacheEdit *edit = PE_get_current(scene, ob);
@@ -106,7 +106,7 @@ static void rna_ParticleEdit_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
psys_free_path_cache(edit->psys, edit);
}
-static void rna_ParticleEdit_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_ParticleEdit_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
Object *ob= (scene->basact)? scene->basact->object: NULL;
@@ -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 *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
Scene *scene= CTX_data_scene(C);
Object *ob= (scene->basact)? scene->basact->object: NULL;
@@ -184,7 +184,7 @@ static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
return brush->ob_mode & mode;
}
-static void rna_Sculpt_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Sculpt_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
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..88ff5ebb628 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;
@@ -534,7 +551,7 @@ static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value)
BLI_strncpy(elem->name, name, sizeof(elem->name));
}*/
-static void rna_Sequence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
Editing *ed= seq_give_editing(scene, FALSE);
@@ -544,7 +561,7 @@ static void rna_Sequence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
seq_update_sound(scene, ptr->data);
}
-static void rna_Sequence_update_reopen_files(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
Editing *ed= seq_give_editing(scene, FALSE);
@@ -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_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 974f2fdecb8..43d1aa24229 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -53,7 +53,7 @@
#include "BKE_particle.h"
-static void rna_Smoke_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Smoke_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
}
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 4d22ee1ac14..dde91bf5e04 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -114,6 +114,7 @@ EnumPropertyItem viewport_shade_items[] = {
#include "BLI_math.h"
+#include "BKE_screen.h"
#include "BKE_animsys.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
@@ -221,7 +222,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;
@@ -315,7 +316,7 @@ static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values)
v3d->lay= ED_view3d_scene_layer_set(v3d->lay, values, &v3d->layact);
}
-static void rna_SpaceView3D_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
DAG_on_visible_update(bmain, FALSE);
}
@@ -397,7 +398,7 @@ static PointerRNA rna_SpaceView3D_region_quadview_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata);
}
-static void rna_RegionView3D_quadview_update(Main *main, Scene *scene, PointerRNA *ptr)
+static void rna_RegionView3D_quadview_update(Main *UNUSED(main), Scene *UNUSED(scene), PointerRNA *ptr)
{
ScrArea *sa;
ARegion *ar;
@@ -408,7 +409,7 @@ static void rna_RegionView3D_quadview_update(Main *main, Scene *scene, PointerRN
}
/* same as above but call clip==TRUE */
-static void rna_RegionView3D_quadview_clip_update(Main *main, Scene *scene, PointerRNA *ptr)
+static void rna_RegionView3D_quadview_clip_update(Main *UNUSED(main), Scene *UNUSED(scene), PointerRNA *ptr)
{
ScrArea *sa;
ARegion *ar;
@@ -456,7 +457,7 @@ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
}
-static void rna_SpaceImageEditor_paint_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_SpaceImageEditor_paint_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
{
paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
@@ -490,7 +491,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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
{
SpaceImage *sima= (SpaceImage*)ptr->data;
EnumPropertyItem *item= NULL;
@@ -532,17 +533,12 @@ static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values)
values[0] = values[1] = 1;
- sa = rna_area_from_space(ptr);
- if(!sa) return;
-
/* find aregion */
- for(ar=sa->regionbase.first; ar; ar=ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW)
- break;
+ sa= rna_area_from_space(ptr); /* can be NULL */
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if(ar) {
+ ED_space_image_zoom(sima, ar, &values[0], &values[1]);
}
- if(!ar) return;
-
- ED_space_image_zoom(sima, ar, &values[0], &values[1]);
}
static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *values)
@@ -575,7 +571,7 @@ static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const floa
}
}
-static void rna_SpaceImageEditor_curves_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_SpaceImageEditor_curves_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
SpaceImage *sima= (SpaceImage*)ptr->data;
ImBuf *ibuf;
@@ -589,7 +585,7 @@ static void rna_SpaceImageEditor_curves_update(Main *bmain, Scene *scene, Pointe
WM_main_add_notifier(NC_IMAGE, sima->image);
}
-static void rna_SpaceImageEditor_scopes_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_SpaceImageEditor_scopes_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
SpaceImage *sima= (SpaceImage*)ptr->data;
ImBuf *ibuf;
@@ -621,7 +617,7 @@ static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value)
st->top= 0;
}
-static void rna_SpaceTextEditor_updateEdited(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
SpaceText *st= (SpaceText*)ptr->data;
@@ -649,7 +645,7 @@ static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
return &RNA_ID;
}
-static void rna_SpaceProperties_pin_id_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_SpaceProperties_pin_id_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
SpaceButs *sbuts= (SpaceButs*)(ptr->data);
ID *id = sbuts->pinid;
@@ -763,7 +759,7 @@ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA valu
}
}
-static void rna_SpaceDopeSheetEditor_action_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
SpaceAction *saction= (SpaceAction*)(ptr->data);
Object *obact= (scene->basact)? scene->basact->object: NULL;
@@ -797,7 +793,7 @@ static void rna_SpaceDopeSheetEditor_action_update(Main *bmain, Scene *scene, Po
}
}
-static void rna_SpaceDopeSheetEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_SpaceDopeSheetEditor_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
SpaceAction *saction= (SpaceAction*)(ptr->data);
Object *obact= (scene->basact)? scene->basact->object: NULL;
@@ -831,7 +827,7 @@ static void rna_SpaceDopeSheetEditor_mode_update(Main *bmain, Scene *scene, Poin
/* Space Graph Editor */
-static void rna_SpaceGraphEditor_display_mode_update(bContext *C, PointerRNA *ptr)
+static void rna_SpaceGraphEditor_display_mode_update(bContext *C, PointerRNA *UNUSED(ptr))
{
//SpaceIpo *sipo= (SpaceIpo*)(ptr->data);
ScrArea *sa= CTX_wm_area(C);
@@ -867,7 +863,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 *UNUSED(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_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 13c7ac238a3..1e60f747b4e 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -148,7 +148,7 @@ static void panel_draw_header(const bContext *C, Panel *pnl)
RNA_parameter_list_free(&list);
}
-static void rna_Panel_unregister(Main *bmain, StructRNA *type)
+static void rna_Panel_unregister(Main *UNUSED(bmain), StructRNA *type)
{
ARegionType *art;
PanelType *pt= RNA_struct_blender_type_get(type);
@@ -261,7 +261,7 @@ static void header_draw(const bContext *C, Header *hdr)
RNA_parameter_list_free(&list);
}
-static void rna_Header_unregister(Main *bmain, StructRNA *type)
+static void rna_Header_unregister(Main *UNUSED(bmain), StructRNA *type)
{
ARegionType *art;
HeaderType *ht= RNA_struct_blender_type_get(type);
@@ -380,7 +380,7 @@ static void menu_draw(const bContext *C, Menu *hdr)
RNA_parameter_list_free(&list);
}
-static void rna_Menu_unregister(Main *bmain, StructRNA *type)
+static void rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type)
{
MenuType *mt= RNA_struct_blender_type_get(type);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index a914d875490..33808446757 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -64,7 +64,7 @@
#include "MEM_guardedalloc.h"
#include "MEM_CacheLimiterC-Api.h"
-static void rna_userdef_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
WM_main_add_notifier(NC_WINDOW, NULL);
}
@@ -97,7 +97,7 @@ static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, Point
}
-static void rna_userdef_script_autoexec_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
UserDef *userdef = (UserDef*)ptr->data;
if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE) G.f &= ~G_SCRIPT_AUTOEXEC;
@@ -212,12 +212,12 @@ static PointerRNA rna_UserDef_system_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesSystem, ptr->data);
}
-static void rna_UserDef_audio_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_UserDef_audio_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
sound_init(bmain);
}
-static void rna_Userdef_memcache_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Userdef_memcache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024);
}
@@ -263,13 +263,13 @@ static void rna_userdef_addon_remove(bAddon *bext)
BLI_freelinkN(&U.addons, bext);
}
-static void rna_userdef_temp_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_userdef_temp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
extern char btempdir[];
BLI_where_is_temp(btempdir, FILE_MAX, 1);
}
-static void rna_userdef_text_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
BLF_cache_clear();
WM_main_add_notifier(NC_WINDOW, NULL);
@@ -2040,6 +2040,10 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_ZBUF);
RNA_def_property_ui_text(prop, "Auto Depth", "Use the depth under the mouse to improve view pan/rotate/zoom functionality");
+ 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 than the camera");
+
/* view zoom */
prop= RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_TO_MOUSEPOS);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index e8b127b68bb..406ee6b3f3e 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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(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 *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(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 *UNUSED(free))
{
wmWindowManager *wm = CTX_wm_manager(C);
wmKeyConfig *kc;
@@ -568,7 +568,7 @@ static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc);
}
-static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr, PointerRNA value)
+static void rna_WindowManager_active_keyconfig_set(PointerRNA *UNUSED(ptr), PointerRNA value)
{
wmKeyConfig *kc= value.data;
@@ -631,7 +631,7 @@ static int rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
return kmi->id < 0;
}
-static void rna_wmClipboard_get(PointerRNA *ptr, char *value)
+static void rna_wmClipboard_get(PointerRNA *UNUSED(ptr), char *value)
{
char *pbuf;
@@ -645,7 +645,7 @@ static void rna_wmClipboard_get(PointerRNA *ptr, char *value)
}
}
-static int rna_wmClipboard_length(PointerRNA *ptr)
+static int rna_wmClipboard_length(PointerRNA *UNUSED(ptr))
{
char *pbuf;
int length;
@@ -663,7 +663,7 @@ static int rna_wmClipboard_length(PointerRNA *ptr)
return length;
}
-static void rna_wmClipboard_set(PointerRNA *ptr, const char *value)
+static void rna_wmClipboard_set(PointerRNA *UNUSED(ptr), const char *value)
{
WM_clipboard_text_set((void *) value, FALSE);
}
@@ -1118,7 +1118,7 @@ static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, const char *idname, int s
return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
}
-static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *keyconf, const char *idname)
+static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *UNUSED(keyconf), const char *idname)
{
wmOperatorType *ot = WM_operatortype_find(idname, 0);
@@ -1842,4 +1842,3 @@ void RNA_def_wm(BlenderRNA *brna)
}
#endif /* RNA_RUNTIME */
-
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 39cbea27388..85a81941e7e 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -89,7 +89,7 @@ static void rna_World_active_texture_set(PointerRNA *ptr, PointerRNA value)
set_current_world_texture(wo, value.data);
}
-static void rna_World_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_World_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
World *wo= ptr->id.data;
@@ -97,7 +97,7 @@ static void rna_World_update(Main *bmain, Scene *scene, PointerRNA *ptr)
WM_main_add_notifier(NC_WORLD, wo);
}
-static void rna_World_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_World_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
World *wo= ptr->id.data;
@@ -106,7 +106,7 @@ static void rna_World_draw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
}
/* so camera mist limits redraw */
-static void rna_World_draw_mist_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_World_draw_mist_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
World *wo= ptr->id.data;
@@ -115,7 +115,7 @@ static void rna_World_draw_mist_update(Main *bmain, Scene *scene, PointerRNA *pt
WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
}
-static void rna_World_stars_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_World_stars_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
World *wo= ptr->id.data;
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 7abcb331f08..cf66a27bda2 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -34,6 +34,9 @@ set(INC
../render/extern/include
../../../intern/guardedalloc
../../../intern/elbeem/extern
+)
+
+set(INC_SYS
${ZLIB_INCLUDE_DIRS}
)
@@ -85,9 +88,7 @@ set(SRC
if(WITH_MOD_BOOLEAN)
add_definitions(-DWITH_MOD_BOOLEAN)
- list(APPEND SRC
- intern/MOD_boolean_util.c
- )
+ list(APPEND SRC intern/MOD_boolean_util.c)
list(APPEND INC ../../../intern/bsp/extern)
endif()
@@ -100,4 +101,4 @@ if(NOT WITH_MOD_FLUID)
add_definitions(-DDISABLE_ELBEEM)
endif()
-blender_add_lib(bf_modifiers "${SRC}" "${INC}")
+blender_add_lib(bf_modifiers "${SRC}" "${INC}" "${INC_SYS}")
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/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index b054a5b0a6e..a5d2e0b38c7 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -271,7 +271,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
/* if only one projector, project coords to UVs */
if(num_projectors == 1 && projectors[0].uci==NULL)
for(i = 0, co = coords; i < numVerts; ++i, ++co)
- mul_project_m4_v4(projectors[0].projmat, *co);
+ mul_project_m4_v3(projectors[0].projmat, *co);
mface = dm->getFaceArray(dm);
numFaces = dm->getNumFaces(dm);
@@ -345,11 +345,11 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
project_from_camera(tface->uv[3], coords[mf->v4], best_projector->uci);
}
else {
- mul_project_m4_v4(best_projector->projmat, co1);
- mul_project_m4_v4(best_projector->projmat, co2);
- mul_project_m4_v4(best_projector->projmat, co3);
+ mul_project_m4_v3(best_projector->projmat, co1);
+ mul_project_m4_v3(best_projector->projmat, co2);
+ mul_project_m4_v3(best_projector->projmat, co3);
if(mf->v4)
- mul_project_m4_v4(best_projector->projmat, co4);
+ mul_project_m4_v3(best_projector->projmat, co4);
/* apply transformed coords as UVs */
tface->uv[0][0] = co1[0];
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index b5a902f9f0d..a6326a36b8e 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -34,6 +34,9 @@ set(INC
../makesrna
../render/extern/include
../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -181,9 +184,9 @@ set(SRC
)
if(WITH_PYTHON)
- set(INC ${INC} ../python ${PYTHON_INCLUDE_DIRS})
+ list(APPEND INC ../python)
+ list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS})
add_definitions(-DWITH_PYTHON)
endif()
-blender_add_lib(bf_nodes "${SRC}" "${INC}")
-
+blender_add_lib(bf_nodes "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt
index 5e4eae4f809..0889c77f9ad 100644
--- a/source/blender/python/generic/CMakeLists.txt
+++ b/source/blender/python/generic/CMakeLists.txt
@@ -25,6 +25,9 @@ set(INC
../../blenkernel
../../blenloader
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
${PYTHON_INCLUDE_DIRS}
)
@@ -60,4 +63,4 @@ set(SRC
)
-blender_add_lib(bf_python_ext "${SRC}" "${INC}")
+blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}")
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 2b9de49bf3f..982a8e63282 100644
--- a/source/blender/python/generic/mathutils_Matrix.c
+++ b/source/blender/python/generic/mathutils_Matrix.c
@@ -132,12 +132,12 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
const unsigned short row_size= PySequence_Size(arg); /* -1 is an error, size checks will accunt for this */
- if(IN_RANGE_INCL(row_size, 2, 4)) {
+ if(row_size >= 2 && row_size <= 4) {
PyObject *item= PySequence_GetItem(arg, 0);
const unsigned short col_size= PySequence_Size(item);
Py_XDECREF(item);
- if(IN_RANGE_INCL(col_size, 2, 4)) {
+ if(col_size >= 2 && col_size <= 4) {
/* sane row & col size, new matrix and assign as slice */
PyObject *matrix= newMatrixObject(NULL, row_size, col_size, Py_NEW, type);
if(Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) {
@@ -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/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index ab08dc14f07..454a706a16b 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -34,6 +34,9 @@ set(INC
../../editors/include
../../../../intern/guardedalloc
../../../../intern/audaspace/intern
+)
+
+set(INC_SYS
${PYTHON_INCLUDE_DIRS}
)
@@ -81,4 +84,4 @@ if(WITH_PYTHON_SAFETY)
add_definitions(-DWITH_PYTHON_SAFETY)
endif()
-blender_add_lib(bf_python "${SRC}" "${INC}")
+blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 340e3f4ac57..450151ee870 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -64,28 +64,28 @@
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);
char *path;
- path= BLI_get_folder(BLENDER_USER_SCRIPTS, NULL);
- PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
path= BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL);
+ PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
+ path= BLI_get_folder(BLENDER_USER_SCRIPTS, NULL);
PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
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/quicktime/CMakeLists.txt b/source/blender/quicktime/CMakeLists.txt
index 7e7f61036c6..3b70cf19a7f 100644
--- a/source/blender/quicktime/CMakeLists.txt
+++ b/source/blender/quicktime/CMakeLists.txt
@@ -24,24 +24,6 @@
#
# ***** END GPL LICENSE BLOCK *****
-if(USE_QTKIT)
- set(SRC
- apple/qtkit_import.m
- apple/qtkit_export.m
-
- quicktime_export.h
- quicktime_import.h
- )
-else()
- set(SRC
- apple/quicktime_import.c
- apple/quicktime_export.c
-
- quicktime_export.h
- quicktime_import.h
- )
-endif()
-
set(INC
.
../quicktime
@@ -58,9 +40,30 @@ set(INC
../windowmanager
../../../intern/audaspace/intern
../../../intern/guardedalloc
+)
+
+set(INC_SYS
${QUICKTIME_INC}
)
+if(USE_QTKIT)
+ set(SRC
+ apple/qtkit_import.m
+ apple/qtkit_export.m
+
+ quicktime_export.h
+ quicktime_import.h
+ )
+else()
+ set(SRC
+ apple/quicktime_import.c
+ apple/quicktime_export.c
+
+ quicktime_export.h
+ quicktime_import.h
+ )
+endif()
+
add_definitions(-DWITH_QUICKTIME)
-blender_add_lib(bf_quicktime "${SRC}" "${INC}")
+blender_add_lib(bf_quicktime "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt
index 5d80f68d8e2..ed450540090 100644
--- a/source/blender/render/CMakeLists.txt
+++ b/source/blender/render/CMakeLists.txt
@@ -41,6 +41,10 @@ set(INC
../../../intern/guardedalloc
)
+set(INC_SYS
+
+)
+
set(SRC
intern/raytrace/rayobject.cpp
intern/raytrace/rayobject_empty.cpp
@@ -126,7 +130,8 @@ IF(WITH_IMAGE_OPENEXR)
endif()
if(WITH_CODEC_QUICKTIME)
- list(APPEND INC ../quicktime ${QUICKTIME_INC})
+ list(APPEND INC ../quicktime)
+ list(APPEND INC_SYS ${QUICKTIME_INC})
add_definitions(-DWITH_QUICKTIME)
endif()
@@ -141,4 +146,4 @@ if(APPLE)
endif()
endif()
-blender_add_lib_nolist(bf_render "${SRC}" "${INC}")
+blender_add_lib_nolist(bf_render "${SRC}" "${INC}" "${INC_SYS}")
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/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 6f03928e1fc..76ba298cd5f 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -43,6 +43,9 @@ set(INC
../../../intern/ghost
../../../intern/opennl/extern
../../../source/gameengine/BlenderRoutines
+)
+
+set(INC_SYS
${ZLIB_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_PATH}
@@ -50,7 +53,6 @@ set(INC
set(SRC
intern/wm.c
- intern/wm_apple.c
intern/wm_cursors.c
intern/wm_dragdrop.c
intern/wm_draw.c
@@ -87,17 +89,19 @@ if(WITH_OPENCOLLADA)
endif()
if(WITH_CODEC_QUICKTIME)
- list(APPEND INC ../quicktime ${QUICKTIME_INC})
+ list(APPEND INC ../quicktime)
+ list(APPEND INC_SYS ${QUICKTIME_INC})
add_definitions(-DWITH_QUICKTIME)
endif()
if(WITH_CODEC_FFMPEG)
- list(APPEND INC ${FFMPEG_INC})
+ list(APPEND INC_SYS ${FFMPEG_INC})
add_definitions(-DWITH_FFMPEG)
endif()
if(WITH_PYTHON)
- list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS})
+ list(APPEND INC ../python)
+ list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS})
add_definitions(-DWITH_PYTHON)
if(WITH_PYTHON_SECURITY)
@@ -109,12 +113,14 @@ if(WITH_GAMEENGINE)
add_definitions(-DWITH_GAMEENGINE)
endif()
-if(WITH_COCOA)
- list(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/wm_apple.c")
+if(APPLE)
+ if(NOT WITH_COCOA)
+ list(APPEND SRC intern/wm_apple.c)
+ endif()
endif()
if(WITH_BUILDINFO)
add_definitions(-DNAN_BUILDINFO)
endif()
-blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}")
+blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript
index f52ac8ba3cb..5b6e8b1ab30 100644
--- a/source/blender/windowmanager/SConscript
+++ b/source/blender/windowmanager/SConscript
@@ -1,5 +1,6 @@
#!/usr/bin/python
Import ('env')
+import os
sources = env.Glob('intern/*.c')
@@ -32,8 +33,8 @@ if env['OURPLATFORM'] == 'linux2':
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
-if env['WITH_GHOST_COCOA']:
- sources.remove('intern/wm_apple.c')
+if env['OURPLATFORM'] != 'darwin' or env['WITH_GHOST_COCOA']:
+ sources.remove('intern' + os.sep + 'wm_apple.c')
if env['BF_BUILDINFO']:
defs.append('NAN_BUILDINFO')
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index e08e681f494..3f9a3f636d0 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -247,6 +247,8 @@ void WM_operator_properties_gesture_border(struct wmOperatorType *ot, int exten
void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor);
void WM_operator_properties_select_all(struct wmOperatorType *ot);
+wmOperator *WM_operator_last_redo(const struct bContext *C);
+
/* MOVE THIS SOMEWHERE ELSE */
#define SEL_TOGGLE 0
#define SEL_SELECT 1
diff --git a/source/blender/windowmanager/intern/wm_apple.c b/source/blender/windowmanager/intern/wm_apple.c
index 083500420a4..7748efb6f64 100644
--- a/source/blender/windowmanager/intern/wm_apple.c
+++ b/source/blender/windowmanager/intern/wm_apple.c
@@ -30,8 +30,7 @@
* \ingroup wm
*/
-
-#ifdef __APPLE__
+/* note, this file builds on apple-carbon only! */
#include "BKE_context.h"
#include "BKE_global.h"
@@ -137,8 +136,3 @@ void wm_set_apple_prefsize(int scr_x, int scr_y)
G.windowstate= 0;
}
}
-
-
-#endif /* __APPLE__ */
-
-
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index ba344997d8a..73aa0cca9dd 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -667,6 +667,11 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event)
event->mval[0]= event->x - ar->winrct.xmin;
event->mval[1]= event->y - ar->winrct.ymin;
}
+ else {
+ /* these values are invalid (avoid odd behavior by relying on old mval values) */
+ event->mval[0]= -1;
+ event->mval[1]= -1;
+ }
}
static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, PointerRNA *properties, ReportList *reports, short poll_only)
@@ -1782,6 +1787,8 @@ void wm_event_do_handlers(bContext *C)
/* MVC demands to not draw in event handlers... but we need to leave it for ogl selecting etc */
wm_window_make_drawable(C, win);
+ wm_region_mouse_co(C, event);
+
/* first we do priority handlers, modal + some limited keymaps */
action |= wm_handlers_do(C, event, &win->modalhandlers);
@@ -1817,10 +1824,12 @@ void wm_event_do_handlers(bContext *C)
if(wm_event_inside_i(event, &ar->winrct)) {
CTX_wm_region_set(C, ar);
+ /* call even on non mouse events, since the */
+ wm_region_mouse_co(C, event);
+
/* does polls for drop regions and checks uibuts */
/* need to be here to make sure region context is true */
if(ELEM(event->type, MOUSEMOVE, EVT_DROP)) {
- wm_region_mouse_co(C, event);
wm_drags_check_ops(C, event);
}
@@ -1840,9 +1849,10 @@ void wm_event_do_handlers(bContext *C)
CTX_wm_region_set(C, NULL);
- if((action & WM_HANDLER_BREAK) == 0)
+ if((action & WM_HANDLER_BREAK) == 0) {
+ wm_region_mouse_co(C, event); /* only invalidates event->mval in this case */
action |= wm_handlers_do(C, event, &sa->handlers);
-
+ }
CTX_wm_area_set(C, NULL);
/* NOTE: do not escape on WM_HANDLER_BREAK, mousemove needs handled for previous area */
@@ -1854,6 +1864,8 @@ void wm_event_do_handlers(bContext *C)
CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
+ wm_region_mouse_co(C, event);
+
action |= wm_handlers_do(C, event, &win->handlers);
/* fileread case */
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_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 674af7c8f19..a8642e2eff0 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -48,6 +48,7 @@
#include "BKE_blender.h"
#include "BKE_context.h"
+#include "BKE_screen.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BKE_DerivedMesh.h"
@@ -248,15 +249,7 @@ int WM_init_game(bContext *C)
CTX_wm_window_set(C, win);
sa = biggest_view3d(C);
-
- if(sa)
- {
- for(ar=sa->regionbase.first; ar; ar=ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
- break;
- }
- }
- }
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
// if we have a valid 3D view
if (sa && ar) {
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 336acd9f9bf..1720c738dd7 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -493,17 +493,17 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C, const char *op
}
else if(ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS))
- ar= BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
-
- if(ar)
- found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
+
+ if(ar)
+ found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
}
else if(ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) {
if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW))
- ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
-
- if(ar)
- found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+
+ if(ar)
+ found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
}
else {
if(ar)
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 745ae0ae47e..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;
@@ -882,6 +885,19 @@ int WM_operator_winactive(bContext *C)
return 1;
}
+wmOperator *WM_operator_last_redo(const bContext *C)
+{
+ wmWindowManager *wm= CTX_wm_manager(C);
+ wmOperator *op;
+
+ /* only for operators that are registered and did an undo push */
+ for(op= wm->operators.last; op; op= op->prev)
+ if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO))
+ break;
+
+ return op;
+}
+
static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
{
wmOperator *op= arg_op;
@@ -1444,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));
@@ -1626,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;
}
@@ -2822,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;
}
@@ -3081,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;
}
@@ -3632,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/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 5cf2f8932f5..82fe42f2b42 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1009,6 +1009,8 @@ void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *
if(wt==timer)
break;
if(wt) {
+ if(wm->reports.reporttimer == wt)
+ wm->reports.reporttimer= NULL;
BLI_remlink(&wm->timers, wt);
if(wt->customdata)