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:
authorAlexander Pinzon <apinzonf@gmail.com>2013-11-13 00:30:26 +0400
committerAlexander Pinzon <apinzonf@gmail.com>2013-11-13 00:30:26 +0400
commit494d2f98067268da2e2d17dd026a661a00f507c9 (patch)
tree680239f722ec81e3b5675eb8b76eb0bd05539619
parent7d0c00ec90194f2e2c0655fff3eea6492bbe2be0 (diff)
parentc53f80aeed256874c1e2bc683400f816ed80e469 (diff)
svn merge ^/trunk/blender 60972:61239
-rw-r--r--CMakeLists.txt76
-rw-r--r--SConstruct164
-rwxr-xr-xbuild_files/build_environment/install_deps.sh3
-rw-r--r--build_files/buildbot/config/user-config-mac-i386.py422
-rw-r--r--build_files/buildbot/config/user-config-mac-x86_64.py425
-rw-r--r--build_files/cmake/buildinfo.cmake84
-rw-r--r--build_files/cmake/macros.cmake30
-rw-r--r--build_files/scons/config/darwin-config.py226
-rw-r--r--build_files/scons/config/freebsd8-config.py5
-rw-r--r--build_files/scons/config/linux-config.py4
-rw-r--r--build_files/scons/config/linuxcross-config.py4
-rw-r--r--build_files/scons/config/win32-mingw-config.py4
-rw-r--r--build_files/scons/config/win32-vc-config.py6
-rw-r--r--build_files/scons/config/win64-mingw-config.py2
-rw-r--r--build_files/scons/tools/Blender.py28
-rw-r--r--build_files/scons/tools/btools.py8
-rw-r--r--extern/bullet2/patches/ghost_softbody.patch42
-rw-r--r--extern/bullet2/readme.txt3
-rw-r--r--extern/libmv/libmv-capi.cc3
-rw-r--r--extern/libmv/libmv/tracking/track_region.cc47
-rw-r--r--extern/libmv/libmv/tracking/track_region.h12
-rw-r--r--extern/libmv/third_party/ceres/SConscript2
-rwxr-xr-xextern/libmv/third_party/ceres/bundle.sh2
-rw-r--r--intern/audaspace/OpenAL/AUD_OpenALDevice.cpp24
-rw-r--r--intern/audaspace/intern/AUD_AnimateableProperty.cpp85
-rw-r--r--intern/audaspace/intern/AUD_AnimateableProperty.h14
-rw-r--r--intern/cycles/blender/addon/properties.py8
-rw-r--r--intern/cycles/blender/blender_shader.cpp86
-rw-r--r--intern/cycles/kernel/svm/svm_fresnel.h8
-rw-r--r--intern/cycles/render/graph.h3
-rw-r--r--intern/cycles/render/nodes.cpp8
-rw-r--r--intern/cycles/render/sky_model.h2
-rw-r--r--intern/ffmpeg/ffmpeg_compat.h2
-rw-r--r--intern/ghost/CMakeLists.txt68
-rw-r--r--intern/ghost/SConscript37
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp175
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerCarbon.h116
-rw-r--r--intern/ghost/intern/GHOST_ISystem.cpp10
-rw-r--r--intern/ghost/intern/GHOST_ISystemPaths.cpp8
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp1241
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h298
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm254
-rw-r--r--intern/ghost/intern/GHOST_SystemPathsCarbon.cpp88
-rw-r--r--intern/ghost/intern/GHOST_SystemPathsCarbon.h87
-rw-r--r--intern/ghost/intern/GHOST_WindowCarbon.cpp751
-rw-r--r--intern/ghost/intern/GHOST_WindowCarbon.h321
-rw-r--r--intern/guardedalloc/CMakeLists.txt3
-rw-r--r--intern/locale/CMakeLists.txt8
-rw-r--r--intern/locale/SConscript46
-rw-r--r--intern/locale/msgfmt.cc366
-rw-r--r--intern/rigidbody/CMakeLists.txt3
-rwxr-xr-xrelease/bin/blender-softwaregl9
-rw-r--r--release/datafiles/blender_icons.svg445
-rw-r--r--release/datafiles/blender_icons16.pngbin240983 -> 240844 bytes
-rw-r--r--release/datafiles/blender_icons32.pngbin605580 -> 605416 bytes
-rw-r--r--release/scripts/modules/animsys_refactor.py668
-rw-r--r--release/scripts/modules/bl_i18n_utils/bl_extract_messages.py4
-rw-r--r--release/scripts/modules/bl_i18n_utils/settings.py2
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils.py4
-rw-r--r--release/scripts/modules/bpy_extras/keyconfig_utils.py107
-rw-r--r--release/scripts/modules/bpy_extras/object_utils.py4
-rw-r--r--release/scripts/modules/sys_info.py14
-rw-r--r--release/scripts/presets/keyconfig/maya.py8
-rw-r--r--release/scripts/startup/bl_operators/anim.py11
-rw-r--r--release/scripts/startup/bl_operators/node.py2
-rw-r--r--release/scripts/startup/bl_operators/presets.py28
-rw-r--r--release/scripts/startup/bl_operators/screen_play_rendered_anim.py10
-rw-r--r--release/scripts/startup/bl_operators/view3d.py15
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py9
-rw-r--r--release/scripts/startup/bl_ui/properties_render.py11
-rw-r--r--release/scripts/startup/bl_ui/properties_scene.py2
-rw-r--r--release/scripts/startup/bl_ui/space_graph.py5
-rw-r--r--release/scripts/startup/bl_ui/space_info.py156
-rw-r--r--release/scripts/startup/bl_ui/space_node.py4
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py4
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py6
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py138
-rw-r--r--release/scripts/templates_py/custom_nodes.py5
-rw-r--r--release/scripts/templates_py/operator_modal_timer.py1
-rw-r--r--source/blender/blenfont/intern/blf_font.c1
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h1
-rw-r--r--source/blender/blenkernel/BKE_global.h1
-rw-r--r--source/blender/blenkernel/BKE_main.h2
-rw-r--r--source/blender/blenkernel/BKE_mask.h15
-rw-r--r--source/blender/blenkernel/BKE_modifier.h1
-rw-r--r--source/blender/blenkernel/BKE_node.h11
-rw-r--r--source/blender/blenkernel/BKE_rigidbody.h2
-rw-r--r--source/blender/blenkernel/BKE_writeffmpeg.h47
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c2
-rw-r--r--source/blender/blenkernel/intern/anim.c2
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c14
-rw-r--r--source/blender/blenkernel/intern/armature.c6
-rw-r--r--source/blender/blenkernel/intern/brush.c2
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c13
-rw-r--r--source/blender/blenkernel/intern/cloth.c4
-rw-r--r--source/blender/blenkernel/intern/constraint.c4
-rw-r--r--source/blender/blenkernel/intern/curve.c1
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c2
-rw-r--r--source/blender/blenkernel/intern/fcurve.c32
-rw-r--r--source/blender/blenkernel/intern/gpencil.c3
-rw-r--r--source/blender/blenkernel/intern/image.c2
-rw-r--r--source/blender/blenkernel/intern/mask.c22
-rw-r--r--source/blender/blenkernel/intern/mesh.c18
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c30
-rw-r--r--source/blender/blenkernel/intern/node.c10
-rw-r--r--source/blender/blenkernel/intern/object.c7
-rw-r--r--source/blender/blenkernel/intern/particle_system.c10
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c2
-rw-r--r--source/blender/blenkernel/intern/scene.c4
-rw-r--r--source/blender/blenkernel/intern/sequencer.c3
-rw-r--r--source/blender/blenkernel/intern/smoke.c8
-rw-r--r--source/blender/blenkernel/intern/unit.c18
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c18
-rw-r--r--source/blender/blenlib/BLI_rect.h2
-rw-r--r--source/blender/blenlib/BLI_utildefines.h9
-rw-r--r--source/blender/blenlib/BLI_voronoi.h2
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c2
-rw-r--r--source/blender/blenlib/intern/edgehash.c2
-rw-r--r--source/blender/blenlib/intern/rct.c26
-rw-r--r--source/blender/blenlib/intern/threads.c2
-rw-r--r--source/blender/blenlib/intern/voronoi.c10
-rw-r--r--source/blender/blenloader/CMakeLists.txt4
-rw-r--r--source/blender/blenloader/SConscript3
-rw-r--r--source/blender/blenloader/intern/readfile.c83
-rw-r--r--source/blender/blenloader/intern/versioning_250.c2
-rw-r--r--source/blender/blenloader/intern/writefile.c11
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c4
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.h8
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c66
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.h3
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c9
-rw-r--r--source/blender/bmesh/operators/bmo_fill_grid.c9
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c6
-rw-r--r--source/blender/bmesh/operators/bmo_wireframe.c6
-rw-r--r--source/blender/bmesh/tools/bmesh_beautify.c27
-rw-r--r--source/blender/bmesh/tools/bmesh_beautify.h4
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c97
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.h2
-rw-r--r--source/blender/bmesh/tools/bmesh_triangulate.c12
-rw-r--r--source/blender/bmesh/tools/bmesh_triangulate.h2
-rw-r--r--source/blender/collada/AnimationExporter.h4
-rw-r--r--source/blender/collada/ArmatureImporter.cpp2
-rw-r--r--source/blender/collada/DocumentExporter.cpp12
-rw-r--r--source/blender/collada/collada_utils.cpp8
-rw-r--r--source/blender/compositor/nodes/COM_ColorBalanceNode.cpp24
-rw-r--r--source/blender/compositor/nodes/COM_DespeckleNode.cpp2
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h12
-rw-r--r--source/blender/compositor/operations/COM_DespeckleOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_DespeckleOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.cpp4
-rw-r--r--source/blender/editors/animation/anim_draw.c136
-rw-r--r--source/blender/editors/animation/anim_filter.c44
-rw-r--r--source/blender/editors/animation/anim_markers.c5
-rw-r--r--source/blender/editors/animation/drivers.c4
-rw-r--r--source/blender/editors/armature/armature_edit.c49
-rw-r--r--source/blender/editors/armature/armature_intern.h3
-rw-r--r--source/blender/editors/armature/armature_ops.c7
-rw-r--r--source/blender/editors/armature/armature_select.c97
-rw-r--r--source/blender/editors/armature/armature_utils.c2
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c10
-rw-r--r--source/blender/editors/armature/pose_lib.c5
-rw-r--r--source/blender/editors/armature/pose_slide.c3
-rw-r--r--source/blender/editors/curve/editcurve.c56
-rw-r--r--source/blender/editors/curve/editcurve_add.c2
-rw-r--r--source/blender/editors/curve/editfont.c3
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c5
-rw-r--r--source/blender/editors/include/ED_anim_api.h14
-rw-r--r--source/blender/editors/include/ED_armature.h2
-rw-r--r--source/blender/editors/include/ED_node.h3
-rw-r--r--source/blender/editors/include/ED_render.h1
-rw-r--r--source/blender/editors/interface/interface.c6
-rw-r--r--source/blender/editors/interface/interface_eyedropper.c12
-rw-r--r--source/blender/editors/interface/interface_handlers.c11
-rw-r--r--source/blender/editors/interface/interface_layout.c7
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c9
-rw-r--r--source/blender/editors/interface/resources.c10
-rw-r--r--source/blender/editors/interface/view2d_ops.c11
-rw-r--r--source/blender/editors/mask/mask_add.c6
-rw-r--r--source/blender/editors/mask/mask_shapekey.c10
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c31
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c3
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c1782
-rw-r--r--source/blender/editors/mesh/editmesh_knife_project.c9
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c9
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c20
-rw-r--r--source/blender/editors/mesh/mesh_data.c2
-rw-r--r--source/blender/editors/mesh/mesh_intern.h3
-rw-r--r--source/blender/editors/mesh/mesh_ops.c7
-rw-r--r--source/blender/editors/mesh/meshtools.c101
-rw-r--r--source/blender/editors/metaball/mball_edit.c1
-rw-r--r--source/blender/editors/object/object_add.c3
-rw-r--r--source/blender/editors/object/object_bake.c35
-rw-r--r--source/blender/editors/object/object_constraint.c4
-rw-r--r--source/blender/editors/object/object_lattice.c2
-rw-r--r--source/blender/editors/object/object_modifier.c3
-rw-r--r--source/blender/editors/physics/particle_edit.c4
-rw-r--r--source/blender/editors/render/SConscript3
-rw-r--r--source/blender/editors/render/render_internal.c14
-rw-r--r--source/blender/editors/render/render_opengl.c4
-rw-r--r--source/blender/editors/render/render_ops.c8
-rw-r--r--source/blender/editors/screen/screen_ops.c39
-rw-r--r--source/blender/editors/screen/screendump.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h3
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c155
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c14
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c12
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c6
-rw-r--r--source/blender/editors/sound/SConscript6
-rw-r--r--source/blender/editors/sound/sound_ops.c3
-rw-r--r--source/blender/editors/space_action/space_action.c2
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c4
-rw-r--r--source/blender/editors/space_clip/clip_ops.c16
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c86
-rw-r--r--source/blender/editors/space_console/console_ops.c3
-rw-r--r--source/blender/editors/space_file/file_draw.c3
-rw-r--r--source/blender/editors/space_file/filelist.c68
-rw-r--r--source/blender/editors/space_file/fsmenu.c4
-rw-r--r--source/blender/editors/space_graph/graph_draw.c65
-rw-r--r--source/blender/editors/space_graph/graph_edit.c67
-rw-r--r--source/blender/editors/space_graph/graph_select.c47
-rw-r--r--source/blender/editors/space_image/image_ops.c30
-rw-r--r--source/blender/editors/space_image/space_image.c12
-rw-r--r--source/blender/editors/space_info/space_info.c2
-rw-r--r--source/blender/editors/space_nla/space_nla.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c12
-rw-r--r--source/blender/editors/space_node/node_draw.c15
-rw-r--r--source/blender/editors/space_node/node_edit.c10
-rw-r--r--source/blender/editors/space_node/node_intern.h2
-rw-r--r--source/blender/editors/space_node/node_ops.c6
-rw-r--r--source/blender/editors/space_node/node_relationships.c125
-rw-r--r--source/blender/editors/space_node/node_select.c57
-rw-r--r--source/blender/editors/space_node/node_view.c10
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c2
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c6
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_view.c4
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c3
-rw-r--r--source/blender/editors/space_text/text_ops.c10
-rw-r--r--source/blender/editors/space_view3d/drawobject.c18
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c62
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c20
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c4
-rw-r--r--source/blender/editors/transform/transform.c53
-rw-r--r--source/blender/editors/transform/transform.h5
-rw-r--r--source/blender/editors/transform/transform_constraints.c2
-rw-r--r--source/blender/editors/transform/transform_conversions.c85
-rw-r--r--source/blender/editors/transform/transform_generics.c8
-rw-r--r--source/blender/editors/transform/transform_ops.c6
-rw-r--r--source/blender/editors/transform/transform_snap.c84
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c43
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c28
-rw-r--r--source/blender/freestyle/intern/geometry/Grid.h2
-rw-r--r--source/blender/freestyle/intern/python/BPy_Convert.cpp202
-rw-r--r--source/blender/freestyle/intern/python/BPy_Convert.h28
-rw-r--r--source/blender/freestyle/intern/python/BPy_Freestyle.cpp27
-rw-r--r--source/blender/freestyle/intern/python/BPy_FrsNoise.cpp28
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp14
-rw-r--r--source/blender/freestyle/intern/python/Director.cpp28
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp8
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/Curve.h2
-rw-r--r--source/blender/freestyle/intern/stroke/Stroke.h4
-rw-r--r--source/blender/freestyle/intern/system/Id.h4
-rw-r--r--source/blender/freestyle/intern/system/TimeUtils.h2
-rw-r--r--source/blender/freestyle/intern/view_map/SteerableViewMap.h2
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMap.h4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl12
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.c4
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.c8
-rw-r--r--source/blender/imbuf/intern/util.c30
-rw-r--r--source/blender/makesdna/DNA_anim_types.h2
-rw-r--r--source/blender/makesdna/DNA_fileglobal_types.h3
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h18
-rw-r--r--source/blender/makesdna/DNA_node_types.h8
-rw-r--r--source/blender/makesdna/DNA_scene_types.h3
-rw-r--r--source/blender/makesdna/DNA_space_types.h4
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h1
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/RNA_enum_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_access.c4
-rw-r--r--source/blender/makesrna/intern/rna_curve.c1
-rw-r--r--source/blender/makesrna/intern/rna_dynamicpaint.c4
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c157
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c5
-rw-r--r--source/blender/makesrna/intern/rna_mask.c2
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c29
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c66
-rw-r--r--source/blender/makesrna/intern/rna_scene.c19
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c19
-rw-r--r--source/blender/makesrna/intern/rna_space.c30
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c17
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c12
-rw-r--r--source/blender/makesrna/intern/rna_wm.c9
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c4
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c3
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c2
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c6
-rw-r--r--source/blender/modifiers/intern/MOD_triangulate.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorbalance.c34
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_moviedistortion.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_switch.c2
-rw-r--r--source/blender/nodes/intern/node_common.c4
-rw-r--r--source/blender/nodes/intern/node_common.h2
-rw-r--r--source/blender/nodes/intern/node_exec.c6
-rw-r--r--source/blender/nodes/intern/node_exec.h2
-rw-r--r--source/blender/nodes/intern/node_util.c17
-rw-r--r--source/blender/nodes/intern/node_util.h8
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_common.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_fresnel.c7
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_material.c1
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_common.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c2
-rw-r--r--source/blender/python/generic/idprop_py_api.c12
-rw-r--r--source/blender/python/intern/bpy_app.c14
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c2
-rw-r--r--source/blender/python/intern/bpy_operator.c2
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c2
-rw-r--r--source/blender/quicktime/CMakeLists.txt22
-rw-r--r--source/blender/quicktime/SConscript13
-rw-r--r--source/blender/quicktime/apple/quicktime_export.c927
-rw-r--r--source/blender/quicktime/apple/quicktime_import.c833
-rw-r--r--source/blender/quicktime/quicktime_export.h9
-rw-r--r--source/blender/quicktime/quicktime_import.h12
-rw-r--r--source/blender/render/intern/source/initrender.c2
-rw-r--r--source/blender/render/intern/source/multires_bake.c35
-rw-r--r--source/blender/render/intern/source/pipeline.c2
-rw-r--r--source/blender/render/intern/source/shadeoutput.c26
-rw-r--r--source/blender/render/intern/source/sss.c2
-rw-r--r--source/blender/windowmanager/CMakeLists.txt8
-rw-r--r--source/blender/windowmanager/SConscript3
-rw-r--r--source/blender/windowmanager/WM_api.h15
-rw-r--r--source/blender/windowmanager/WM_types.h2
-rw-r--r--source/blender/windowmanager/intern/wm_apple.c137
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c6
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c12
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c34
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c162
-rw-r--r--source/blender/windowmanager/intern/wm_window.c30
-rw-r--r--source/blenderplayer/CMakeLists.txt1
-rw-r--r--source/blenderplayer/bad_level_call_stubs/CMakeLists.txt5
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c6
-rw-r--r--source/creator/CMakeLists.txt54
-rw-r--r--source/creator/buildinfo.c4
-rw-r--r--source/creator/creator.c29
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp15
-rw-r--r--source/gameengine/BlenderRoutines/CMakeLists.txt4
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp93
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderCanvas.h8
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.cpp348
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.h70
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp410
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h122
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp224
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.h2
-rw-r--r--source/gameengine/Converter/BL_ModifierDeformer.cpp2
-rw-r--r--source/gameengine/Converter/BlenderWorldInfo.cpp1
-rw-r--r--source/gameengine/Converter/BlenderWorldInfo.h1
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp39
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.h2
-rw-r--r--source/gameengine/Converter/KX_ConvertSensors.cpp1
-rw-r--r--source/gameengine/Converter/KX_SoftBodyDeformer.cpp3
-rw-r--r--source/gameengine/GameLogic/SCA_ExpressionController.cpp1
-rw-r--r--source/gameengine/GamePlayer/common/CMakeLists.txt2
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.cpp577
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.h115
-rw-r--r--source/gameengine/GamePlayer/common/SConscript1
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp20
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.h3
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp35
-rw-r--r--source/gameengine/Ketsji/BL_Action.cpp2
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt6
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.h4
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.cpp577
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.h102
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp3
-rw-r--r--source/gameengine/Ketsji/KX_CharacterWrapper.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintActuator.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp20
-rw-r--r--source/gameengine/Ketsji/KX_Dome.cpp5
-rw-r--r--source/gameengine/Ketsji/KX_Dome.h3
-rw-r--r--source/gameengine/Ketsji/KX_FontObject.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_FontObject.h6
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp193
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h37
-rw-r--r--source/gameengine/Ketsji/KX_IPO_SGController.cpp9
-rw-r--r--source/gameengine/Ketsji/KX_IPhysicsController.cpp49
-rw-r--r--source/gameengine/Ketsji/KX_IPhysicsController.h151
-rw-r--r--source/gameengine/Ketsji/KX_ISceneConverter.h2
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp69
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.h3
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_Light.h9
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp11
-rw-r--r--source/gameengine/Ketsji/KX_MotionState.cpp16
-rw-r--r--source/gameengine/Ketsji/KX_MotionState.h16
-rw-r--r--source/gameengine/Ketsji/KX_MouseFocusSensor.cpp3
-rw-r--r--source/gameengine/Ketsji/KX_NavMeshObject.cpp5
-rw-r--r--source/gameengine/Ketsji/KX_NearSensor.cpp16
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.cpp23
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.cpp14
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.cpp422
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.h156
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.cpp44
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_PythonInitTypes.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_RadarSensor.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_RayCast.cpp9
-rw-r--r--source/gameengine/Ketsji/KX_RayCast.h7
-rw-r--r--source/gameengine/Ketsji/KX_RaySensor.cpp3
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp1
-rw-r--r--source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp11
-rw-r--r--source/gameengine/Ketsji/KX_SCA_DynamicActuator.h1
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp65
-rw-r--r--source/gameengine/Ketsji/KX_Scene.h3
-rw-r--r--source/gameengine/Ketsji/KX_TouchEventManager.cpp14
-rw-r--r--source/gameengine/Ketsji/KX_TouchSensor.cpp24
-rw-r--r--source/gameengine/Physics/Bullet/CcdGraphicController.cpp28
-rw-r--r--source/gameengine/Physics/Bullet/CcdGraphicController.h18
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp492
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.h132
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp220
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h119
-rw-r--r--source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp20
-rw-r--r--source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h40
-rw-r--r--source/gameengine/Physics/common/PHY_IController.h4
-rw-r--r--source/gameengine/Physics/common/PHY_IGraphicController.h4
-rw-r--r--source/gameengine/Physics/common/PHY_IMotionState.h16
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsController.h62
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h77
-rw-r--r--source/gameengine/Rasterizer/CMakeLists.txt2
-rw-r--r--source/gameengine/Rasterizer/RAS_2DFilterManager.h3
-rw-r--r--source/gameengine/Rasterizer/RAS_BucketManager.cpp43
-rw-r--r--source/gameengine/Rasterizer/RAS_BucketManager.h11
-rw-r--r--source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp11
-rw-r--r--source/gameengine/Rasterizer/RAS_IPolygonMaterial.h3
-rw-r--r--source/gameengine/Rasterizer/RAS_IRasterizer.h83
-rw-r--r--source/gameengine/Rasterizer/RAS_IRenderTools.cpp59
-rw-r--r--source/gameengine/Rasterizer/RAS_IRenderTools.h227
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.cpp19
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.h26
-rw-r--r--source/gameengine/Rasterizer/RAS_MeshObject.cpp24
-rw-r--r--source/gameengine/Rasterizer/RAS_MeshObject.h17
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt6
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h17
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp482
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h78
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp5
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript6
-rw-r--r--source/gameengine/Rasterizer/RAS_Polygon.cpp1
-rw-r--r--source/gameengine/Rasterizer/RAS_Polygon.h8
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp8
-rw-r--r--source/gameengine/VideoTexture/ImageRender.h3
-rw-r--r--source/gameengine/VideoTexture/ImageViewport.cpp1
-rw-r--r--source/gameengine/VideoTexture/Texture.cpp10
473 files changed, 6921 insertions, 15267 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c34fc5acb31..f9ba78eab53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -218,7 +218,7 @@ option(WITH_CODEC_AVI "Enable Blenders own AVI file support (raw/jpeg)
option(WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
option(WITH_CODEC_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
-if(APPLE OR (WIN32 AND NOT UNIX))
+if(APPLE)
option(WITH_CODEC_QUICKTIME "Enable Quicktime Support" OFF)
endif()
@@ -380,12 +380,7 @@ if(APPLE)
add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
- option(WITH_COCOA "Use Cocoa framework instead of deprecated Carbon" ON)
- option(USE_QTKIT "Use QtKit instead of Carbon quicktime (needed for having partial quicktime for 64bit)" OFF)
option(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF)
- if(CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
- set(USE_QTKIT ON CACHE BOOL "ON" FORCE) # no Quicktime in 64bit
- endif()
endif()
@@ -492,14 +487,6 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS)
set(WITH_X11_XINPUT OFF)
endif()
-if(MINGW)
- if(WITH_CODEC_QUICKTIME)
- message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF "
- "because it is currently unsupported, remove this "
- "line if youre a developer who wants to add support.")
- endif()
-endif()
-
TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
TEST_STDBOOL_SUPPORT()
@@ -1030,13 +1017,6 @@ elseif(WIN32)
set(SDL_LIBPATH ${SDL}/lib)
endif()
- if(WITH_CODEC_QUICKTIME)
- set(QUICKTIME ${LIBDIR}/QTDevWin)
- set(QUICKTIME_INCLUDE_DIRS ${QUICKTIME}/CIncludes)
- set(QUICKTIME_LIBRARIES qtmlClient)
- set(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
- endif()
-
if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
add_definitions(-D__SSE__ -D__MMX__)
endif()
@@ -1612,47 +1592,37 @@ elseif(APPLE)
set(PLATFORM_LINKLIBS stdc++)
endif()
- if(WITH_COCOA)
- set(PLATFORM_CFLAGS "-pipe -funsigned-char -DGHOST_COCOA")
- set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio")
- if(USE_QTKIT)
- set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DUSE_QTKIT")
- set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
- if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
- set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
- # libSDL still needs 32bit carbon quicktime
- endif()
- elseif(WITH_CODEC_QUICKTIME)
+ set(PLATFORM_CFLAGS "-pipe -funsigned-char")
+ set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio")
+ if(WITH_CODEC_QUICKTIME)
+ set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
+ if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
+ # libSDL still needs 32bit carbon quicktime
+ endif()
+ endif()
+
+ # XXX - SOME MAC DEV PLEASE TEST WITH THE SDK INSTALLED!
+ # ALSO SHOULD BE MOVED INTO OWN MODULE WHEN FUNCTIONAL
+ if(WITH_INPUT_NDOF)
+ # This thread it *should* work and check the framework - campbell
+ # http://www.cmake.org/pipermail/cmake/2005-December/007740.html
+ find_library(3DCONNEXION_CLIENT_FRAMEWORK
+ NAMES 3DconnexionClient
+ )
+ if(NOT 3DCONNEXION_CLIENT_FRAMEWORK)
+ set(WITH_INPUT_NDOF OFF)
endif()
- # XXX - SOME MAC DEV PLEASE TEST WITH THE SDK INSTALLED!
- # ALSO SHOULD BE MOVED INTO OWN MODULE WHEN FUNCTIONAL
if(WITH_INPUT_NDOF)
- # This thread it *should* work and check the framework - campbell
- # http://www.cmake.org/pipermail/cmake/2005-December/007740.html
- find_library(3DCONNEXION_CLIENT_FRAMEWORK
- NAMES 3DconnexionClient
- )
- if(NOT 3DCONNEXION_CLIENT_FRAMEWORK)
- set(WITH_INPUT_NDOF OFF)
- endif()
-
- if(WITH_INPUT_NDOF)
- set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework 3DconnexionClient")
- set(NDOF_INCLUDE_DIRS /Library/Frameworks/3DconnexionClient.framework/Headers )
- endif()
+ set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework 3DconnexionClient")
+ set(NDOF_INCLUDE_DIRS /Library/Frameworks/3DconnexionClient.framework/Headers )
endif()
+ endif()
if(WITH_JACK)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework jackmp")
endif()
-
- else()
- set(PLATFORM_CFLAGS "-pipe -funsigned-char")
- set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
- set(WITH_INPUT_NDOF OFF) # unsupported
- endif()
if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")# force cmake to link right framework
diff --git a/SConstruct b/SConstruct
index 9f9eaa886a3..2c30e1b72b1 100644
--- a/SConstruct
+++ b/SConstruct
@@ -285,52 +285,153 @@ if 'cudakernels' in B.targets:
env['WITH_BF_CYCLES_CUDA_BINARIES'] = True
env['WITH_BF_PYTHON'] = False
-# Extended OSX_SDK and 3D_CONNEXION_CLIENT_LIBRARY and JAckOSX detection for OSX
+
+#############################################################################
+################### Automatic configuration for OSX ##################
+#############################################################################
+
if env['OURPLATFORM']=='darwin':
+
+ import commands
+
+ cmd = 'sw_vers -productVersion'
+ MAC_CUR_VER=cmd_res=commands.getoutput(cmd)
+ cmd = 'xcodebuild -version'
+ cmd_xcode=commands.getoutput(cmd)
+ env['XCODE_CUR_VER']=cmd_xcode[6:][:3] # truncate output to major.minor version
+ cmd = 'xcodebuild -showsdks'
+ cmd_sdk=commands.getoutput(cmd)
+ MACOSX_SDK_CHECK=cmd_sdk
+ cmd = 'xcode-select --print-path'
+ XCODE_SELECT_PATH=commands.getoutput(cmd)
+ if XCODE_SELECT_PATH.endswith("/Contents/Developer"):
+ XCODE_BUNDLE=XCODE_SELECT_PATH[:-19]
+ else:
+ XCODE_BUNDLE=XCODE_SELECT_PATH
+
print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'] + " --"
- print "Available " + env['MACOSX_SDK_CHECK']
- if not 'Mac OS X 10.6' in env['MACOSX_SDK_CHECK']:
- print B.bc.OKGREEN + "Building with user-defined OS X SDK ( Xcode 4.4 or newer )"
- elif not 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']:
- print B.bc.OKGREEN + "Auto-setting available MacOSX SDK -> " + B.bc.ENDC + "MacOSX10.6.sdk"
+ print B.bc.OKGREEN + "Available SDK's: \n" + B.bc.ENDC + MACOSX_SDK_CHECK.replace('\t', '')
+
+ if env['MACOSX_SDK'] == '': # no set sdk, choosing best one found
+ if 'OS X 10.9' in MACOSX_SDK_CHECK:
+ env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
+ env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.9.sdk'
+ elif 'OS X 10.8' in MACOSX_SDK_CHECK:
+ env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
+ env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.8.sdk'
+ elif 'OS X 10.7' in MACOSX_SDK_CHECK:
+ env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
+ env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.7.sdk'
+ elif 'OS X 10.6' in MACOSX_SDK_CHECK:
+ env['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
+ env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.6.sdk'
+ elif 'OS X 10.5' in MACOSX_SDK_CHECK:
+ env['MACOSX_DEPLOYMENT_TARGET'] = '10.5'
+ env['MACOSX_SDK']='/Developer/SDKs/MacOSX10.5.sdk'
else:
- print B.bc.OKGREEN + "Found recommended sdk :" + B.bc.ENDC + " using MacOSX10.5.sdk"
+ env['MACOSX_SDK']='/Developer/SDKs/MacOSX' + env['MACOSX_SDK'] + '.sdk'
+
+ if env['XCODE_CUR_VER'] >= '4.3': ## since version 4.3, XCode and developer dir are bundled ##
+ env['MACOSX_SDK'] = XCODE_BUNDLE + '/Contents/Developer/Platforms/MacOSX.platform' + env['MACOSX_SDK']
+
+ print B.bc.OKGREEN + "Using OSX SDK :" + B.bc.ENDC + env['MACOSX_SDK']
- if env['XCODE_CUR_VER'] >= '5' and not (env['CXX'][:-2].endswith('4.6') or env['CXX'][:-2].endswith('4.8')):
+ if not env['WITH_OSX_STATICPYTHON'] == 1:
+ # python 3.3 uses Python-framework additionally installed in /Library/Frameworks
+ env['BF_PYTHON'] = '/Library/Frameworks/Python.framework/Versions/'
+ env['BF_PYTHON_INC'] = env['BF_PYTHON'] + env['BF_PYTHON_VERSION'] + '/include/python' + env['BF_PYTHON_VERSION'] + 'm'
+ env['BF_PYTHON_BINARY'] = env['BF_PYTHON'] + env['BF_PYTHON_VERSION'] + '/bin/python' + env['BF_PYTHON_VERSION']
+ env['BF_PYTHON_LIB'] = ''
+ env['BF_PYTHON_LIBPATH'] = env['BF_PYTHON'] + env['BF_PYTHON_VERSION'] + '/lib/python' + env['BF_PYTHON_VERSION'] + '/config-' + env['BF_PYTHON_VERSION'] +'m'
+ env['PLATFORM_LINKFLAGS'] = env['PLATFORM_LINKFLAGS']+['-framework','Python'] # link to python framework
+
+ #Ray trace optimization
+ if env['WITH_BF_RAYOPTIMIZATION'] == 1:
+ if env['MACOSX_ARCHITECTURE'] == 'x86_64' or env['MACOSX_ARCHITECTURE'] == 'i386':
+ env['WITH_BF_RAYOPTIMIZATION'] = 1
+ else:
+ env['WITH_BF_RAYOPTIMIZATION'] = 0
+ if env['MACOSX_ARCHITECTURE'] == 'i386':
+ env['BF_RAYOPTIMIZATION_SSE_FLAGS'] = env['BF_RAYOPTIMIZATION_SSE_FLAGS']+['-msse']
+ elif env['MACOSX_ARCHITECTURE'] == 'x86_64':
+ env['BF_RAYOPTIMIZATION_SSE_FLAGS'] = env['BF_RAYOPTIMIZATION_SSE_FLAGS']+['-msse','-msse2']
+
+ if env['MACOSX_ARCHITECTURE'] == 'x86_64' or env['MACOSX_ARCHITECTURE'] == 'ppc64':
+ ARCH_FLAGS = ['-m64']
+ else:
+ ARCH_FLAGS = ['-m32']
+
+ env.Append(CPPFLAGS=ARCH_FLAGS)
+
+ SDK_FLAGS=['-isysroot', env['MACOSX_SDK'],'-mmacosx-version-min='+ env['MACOSX_DEPLOYMENT_TARGET'],'-arch',env['MACOSX_ARCHITECTURE']] # always used
+ env['PLATFORM_LINKFLAGS'] = ['-mmacosx-version-min='+ env['MACOSX_DEPLOYMENT_TARGET'],'-isysroot', env['MACOSX_SDK'],'-arch',env['MACOSX_ARCHITECTURE']]+ARCH_FLAGS+env['PLATFORM_LINKFLAGS']
+ env['CCFLAGS']=SDK_FLAGS+env['CCFLAGS']
+ env['CXXFLAGS']=SDK_FLAGS+env['CXXFLAGS']
+
+ #Intel Macs are CoreDuo and Up
+ if env['MACOSX_ARCHITECTURE'] == 'i386' or env['MACOSX_ARCHITECTURE'] == 'x86_64':
+ env['REL_CCFLAGS'] = env['REL_CCFLAGS']+['-ftree-vectorize','-msse','-msse2','-msse3']
+ else:
+ env['CCFLAGS'] = env['CCFLAGS']+['-fno-strict-aliasing']
+
+ # Intel 64bit Macs are Core2Duo and up
+ if env['MACOSX_ARCHITECTURE'] == 'x86_64':
+ env['REL_CCFLAGS'] = env['REL_CCFLAGS']+['-mssse3']
+
+ if env['XCODE_CUR_VER'] >= '5' and not env['CC'].split('/')[len(env['CC'].split('/'))-1][4:] >= '4.6.1':
env['CCFLAGS'].append('-ftemplate-depth=1024') # only valid for clang bundled with xcode 5
- # for now, Mac builders must download and install the 3DxWare 10 Beta 4 driver framework from 3Dconnexion
- # necessary header file lives here when installed:
- # /Library/Frameworks/3DconnexionClient.framework/Versions/Current/Headers/ConnexionClientAPI.h
+ # 3DconnexionClient.framework, optionally install
if env['WITH_BF_3DMOUSE'] == 1:
if not os.path.exists('/Library/Frameworks/3DconnexionClient.framework'):
- print "3D_CONNEXION_CLIENT_LIBRARY not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
env['WITH_BF_3DMOUSE'] = 0
+ print B.bc.OKGREEN + "3DconnexionClient install not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
else:
env.Append(LINKFLAGS=['-F/Library/Frameworks','-Xlinker','-weak_framework','-Xlinker','3DconnexionClient'])
env['BF_3DMOUSE_INC'] = '/Library/Frameworks/3DconnexionClient.framework/Headers'
+ print B.bc.OKGREEN + "Using 3Dconnexion"
- # for now, Mac builders must download and install the JackOSX framework
- # necessary header file lives here when installed:
- # /Library/Frameworks/Jackmp.framework/Versions/A/Headers/jack.h
+ # Jackmp.framework, optionally install
if env['WITH_BF_JACK'] == 1:
if not os.path.exists('/Library/Frameworks/Jackmp.framework'):
- print "JackOSX install not found, disabling WITH_BF_JACK" # avoid build errors !
env['WITH_BF_JACK'] = 0
+ print B.bc.OKGREEN + "JackOSX install not found, disabling WITH_BF_JACK" # avoid build errors !
else:
env.Append(LINKFLAGS=['-F/Library/Frameworks','-Xlinker','-weak_framework','-Xlinker','Jackmp'])
+ print B.bc.OKGREEN + "Using Jack"
+
+ if env['WITH_BF_QUICKTIME'] == 1:
+ env['PLATFORM_LINKFLAGS'] = env['PLATFORM_LINKFLAGS']+['-framework','QTKit']
+
+ #Defaults openMP to true if compiler handles it ( only gcc 4.6.1 and newer )
+ # if your compiler does not have accurate suffix you may have to enable it by hand !
+ if env['WITH_BF_OPENMP'] == 1:
+ if env['CC'].split('/')[len(env['CC'].split('/'))-1][4:] >= '4.6.1':
+ env['WITH_BF_OPENMP'] = 1 # multithreading for fluids, cloth, sculpt and smoke
+ print B.bc.OKGREEN + "Using OpenMP"
+ else:
+ env['WITH_BF_OPENMP'] = 0
+ print B.bc.OKGREEN + "Disabled OpenMP, not supported by compiler"
if env['WITH_BF_CYCLES_OSL'] == 1:
OSX_OSL_LIBPATH = Dir(env.subst(env['BF_OSL_LIBPATH'])).abspath
# we need 2 variants of passing the oslexec with the force_load option, string and list type atm
if env['CC'][:-2].endswith('4.8'):
- env.Append(LINKFLAGS=['-L'+OSX_OSL_LIBPATH,'-loslcomp','-loslexec','-loslquery'])
+ env.Append(LINKFLAGS=['-L'+OSX_OSL_LIBPATH,'-loslcomp','-loslexec','-loslquery'])
else:
env.Append(LINKFLAGS=['-L'+OSX_OSL_LIBPATH,'-loslcomp','-force_load '+ OSX_OSL_LIBPATH +'/liboslexec.a','-loslquery'])
env.Append(BF_PROGRAM_LINKFLAGS=['-Xlinker','-force_load','-Xlinker',OSX_OSL_LIBPATH +'/liboslexec.a'])
- # Trying to get rid of eventually clashes, we export some explicite as local symbols
+ # Trying to get rid of eventually clashes, we export some symbols explicite as local
env.Append(LINKFLAGS=['-Xlinker','-unexported_symbols_list','-Xlinker','./source/creator/osx_locals.map'])
+
+ #for < 10.7.sdk, SystemStubs needs to be linked
+ if env['MACOSX_SDK'].endswith("10.6.sdk") or env['MACOSX_SDK'].endswith("10.5.sdk"):
+ env['LLIBS'].append('SystemStubs')
+
+#############################################################################
+################### End Automatic configuration for OSX ##################
+#############################################################################
if env['WITH_BF_OPENMP'] == 1:
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
@@ -342,12 +443,6 @@ if env['WITH_BF_OPENMP'] == 1:
else:
env.Append(CCFLAGS=['-fopenmp'])
-if env['WITH_GHOST_COCOA'] == True:
- env.Append(CPPFLAGS=['-DGHOST_COCOA'])
-
-if env['USE_QTKIT'] == True:
- env.Append(CPPFLAGS=['-DUSE_QTKIT'])
-
#check for additional debug libnames
if env.has_key('BF_DEBUG_LIBS'):
@@ -847,6 +942,9 @@ if env['OURPLATFORM']!='darwin':
def check_path(path, member):
return (member in path.split(os.sep))
+ po_dir = os.path.join("release", "datafiles", "locale", "po")
+ need_compile_mo = os.path.exists(po_dir)
+
for intpath in internationalpaths:
for dp, dn, df in os.walk(intpath):
if '.svn' in dn:
@@ -855,7 +953,10 @@ if env['OURPLATFORM']!='darwin':
dn.remove('_svn')
# we only care about release/datafiles/fonts, release/datafiles/locales
- if check_path(dp, "fonts") or check_path(dp, "locale"):
+ if check_path(dp, "locale"):
+ if need_compile_mo and check_path(dp, "po"):
+ continue
+ elif check_path(dp, "fonts"):
pass
else:
continue
@@ -869,6 +970,19 @@ if env['OURPLATFORM']!='darwin':
env.Execute(Mkdir(dir))
scriptinstall.append(env.Install(dir=dir,source=source))
+ if need_compile_mo:
+ for f in os.listdir(po_dir):
+ if not f.endswith(".po"):
+ continue
+
+ locale_name = os.path.splitext(f)[0]
+
+ mo_file = os.path.join(B.root_build_dir, "locale", locale_name + ".mo")
+
+ dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
+ dir = os.path.join(dir, "datafiles", "locale", locale_name, "LC_MESSAGES")
+ scriptinstall.append(env.InstallAs(os.path.join(dir, "blender.mo"), mo_file))
+
#-- icons
if env['OURPLATFORM']=='linux':
iconlist = []
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index 6daa3831c08..4ca7400fe44 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -1091,11 +1091,12 @@ compile_OPENEXR() {
DESTINATION
\${CMAKE_INSTALL_PREFIX}/lib
)
-@@ -168,6 +167,7 @@
+@@ -168,6 +167,8 @@
INSTALL ( FILES
${CMAKE_SOURCE_DIR}/config/OpenEXRConfig.h
ImfForward.h
+ ImfNamespace.h
++ ImfPartHelper.h
ImfExport.h
ImfAttribute.h
ImfBoxAttribute.h
diff --git a/build_files/buildbot/config/user-config-mac-i386.py b/build_files/buildbot/config/user-config-mac-i386.py
index ad0fbcc78da..fa18b74cf87 100644
--- a/build_files/buildbot/config/user-config-mac-i386.py
+++ b/build_files/buildbot/config/user-config-mac-i386.py
@@ -1,425 +1,3 @@
-#
-# Note : if you want to alter this file
-# copy it as a whole in the upper folder
-# as user-config.py
-# dont create a new file with only some
-# vars changed.
-
-import commands
-
-# IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
-USE_SDK=True
-
-#############################################################################
-################### Cocoa & architecture settings ##################
-#############################################################################
-WITH_GHOST_COCOA=True
MACOSX_ARCHITECTURE = 'i386' # valid archs: ppc, i386, ppc64, x86_64
-
-
-cmd = 'uname -p'
-MAC_PROC=commands.getoutput(cmd)
-cmd = 'uname -r'
-cmd_res=commands.getoutput(cmd)
-
-if cmd_res[:1]=='7':
- MAC_CUR_VER='10.3'
-elif cmd_res[:1]=='8':
- MAC_CUR_VER='10.4'
-elif cmd_res[:1]=='9':
- MAC_CUR_VER='10.5'
-elif cmd_res[:2]=='10':
- MAC_CUR_VER='10.6'
-elif cmd_res[:2]=='11':
- MAC_CUR_VER='10.7'
-elif cmd_res[:2]=='12':
- MAC_CUR_VER='10.8'
-elif cmd_res[:2]=='13':
- MAC_CUR_VER='10.9'
-cmd = 'xcodebuild -version'
-cmd_xcode=commands.getoutput(cmd)
-XCODE_CUR_VER=cmd_xcode[6:][:3] # truncate output to major.minor version
-cmd = 'xcodebuild -showsdks'
-cmd_sdk=commands.getoutput(cmd)
-MACOSX_SDK_CHECK=cmd_sdk
-
-if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
- USE_QTKIT=True # Carbon quicktime is not available for 64bit
-
-
-# Default target OSX settings per architecture
-# Can be customized
-
-if MACOSX_ARCHITECTURE == 'ppc' and MAC_CUR_VER == '10.4':
-# all releases are now made for 10.5 !
-# MAC_MIN_VERS = '10.3'
-# MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
-# LCGDIR = '#../lib/darwin-6.1-powerpc'
-# CC = 'gcc-3.3'
-# CXX = 'g++-3.3'
- MAC_MIN_VERS = '10.4'
- MACOSX_DEPLOYMENT_TARGET = '10.4'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
- LCGDIR = '#../lib/darwin-8.0.0-powerpc'
- CC = 'gcc-4.0'
- CXX = 'g++-4.0'
-elif MACOSX_ARCHITECTURE == 'i386' and MAC_CUR_VER == '10.4':
- MAC_MIN_VERS = '10.4'
- MACOSX_DEPLOYMENT_TARGET = '10.4'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
- LCGDIR = '#../lib/darwin-8.x.i386'
- CC = 'gcc-4.0'
- CXX = 'g++-4.0'
-else :
- if 'Mac OS X 10.5' in MACOSX_SDK_CHECK:
- # OSX 10.5/6 with Xcode 3.x
- MAC_MIN_VERS = '10.5'
- MACOSX_DEPLOYMENT_TARGET = '10.5'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
- LCGDIR = '#../lib/darwin-9.x.universal'
- CC = 'gcc-4.2'
- CXX = 'g++-4.2'
- elif 'Mac OS X 10.6' in MACOSX_SDK_CHECK:
- # OSX 10.6/7 with Xcode 4.x
- MAC_MIN_VERS = '10.6'
- MACOSX_DEPLOYMENT_TARGET = '10.6'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk'
- LCGDIR = '#../lib/darwin-9.x.universal'
- CC = 'gcc-4.2'
- CXX = 'g++-4.2'
- else:
- # OSX 10.8 with Xcode 4.4 and higher (no 10.6sdk! )
- MAC_MIN_VERS = '10.6'
- MACOSX_DEPLOYMENT_TARGET = '10.6'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.7.sdk'
- LCGDIR = '#../lib/darwin-9.x.universal'
- CC = 'gcc'
- CXX = 'g++'
-
-LIBDIR = '${LCGDIR}'
-
-if XCODE_CUR_VER >= '4.3': ## since version 4.3, XCode and developer dir are bundled ##
- MACOSX_SDK = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform' + MACOSX_SDK
-
-#############################################################################
-################### Dependency settings ##################
-#############################################################################
-
-#Defaults openMP to true if compiler handles it ( only gcc 4.6.1 and newer )
-# if your compiler does not have accurate suffix you may have to enable it by hand !
-if CC[:-2].endswith('4.6'):
- WITH_BF_OPENMP = True # multithreading for fluids, cloth, sculpt and smoke
-else:
- WITH_BF_OPENMP = False
-
-# enable ffmpeg support
-WITH_BF_FFMPEG = True
-BF_FFMPEG = LIBDIR + '/ffmpeg'
-BF_FFMPEG_INC = "${BF_FFMPEG}/include"
-BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
-BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
-#bz2 is a standard osx dynlib
-
-BF_PYTHON_VERSION = '3.3'
-WITH_OSX_STATICPYTHON = True
-
-if WITH_OSX_STATICPYTHON:
- # python 3.3 uses precompiled libraries in bf svn /lib by default
-
- BF_PYTHON = LIBDIR + '/python'
- BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}m'
- # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
- BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}m'
- BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
- # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
-else:
- # python 3.2 uses Python-framework additionally installed in /Library/Frameworks
-
- BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
- BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
- BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
- #BF_PYTHON_LIB = ''
- BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-${BF_PYTHON_VERSION}m'
-
-WITH_BF_OPENAL = True
-#different lib must be used following version of gcc
-# for gcc 3.3
-#BF_OPENAL = LIBDIR + '/openal'
-# for gcc 3.4 and ulterior
-if MAC_PROC == 'powerpc':
- BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
-else :
- BF_OPENAL = LIBDIR + '/openal'
-
-WITH_BF_STATICOPENAL = False
-BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
-#BF_OPENAL_LIB = 'openal'
-#BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
-# Warning, this static lib configuration is untested! users of this OS please confirm.
-#BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
-
-# Warning, this static lib configuration is untested! users of this OS please confirm.
-BF_CXX = '/usr'
-WITH_BF_STATICCXX = False
-BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
-
-# we use simply jack framework
-WITH_BF_JACK = True
-BF_JACK = '/Library/Frameworks/Jackmp.framework'
-BF_JACK_INC = '${BF_JACK}/headers'
-#BF_JACK_LIB = 'jack' # not used due framework
-BF_JACK_LIBPATH = '${BF_JACK}'
-
-WITH_BF_SNDFILE = True
-BF_SNDFILE = LIBDIR + '/sndfile'
-BF_SNDFILE_INC = '${BF_SNDFILE}/include'
-BF_SNDFILE_LIB = 'sndfile FLAC ogg vorbis vorbisenc'
-BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib ${BF_FFMPEG}/lib' #ogg libs are stored in ffmpeg dir
-
-WITH_BF_SDL = True
-BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
-BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
-BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
-BF_SDL_LIBPATH = '${BF_SDL}/lib'
-
-WITH_BF_OPENEXR = True
-WITH_BF_STATICOPENEXR = False
-BF_OPENEXR = '${LCGDIR}/openexr'
-BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
-BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
-BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
-# Warning, this static lib configuration is untested! users of this OS please confirm.
-BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
-
-WITH_BF_DDS = True
-
-#Color Management System
-WITH_BF_LCMS = False
-BF_LCMS = LIBDIR + '/lcms'
-BF_LCMS_INC = '${BF_LCMS}/include'
-BF_LCMS_LIB = 'lcms'
-BF_LCMS_LIBPATH = '${BF_LCMS}/lib'
-
-WITH_BF_JPEG = True
-BF_JPEG = LIBDIR + '/jpeg'
-BF_JPEG_INC = '${BF_JPEG}/include'
-BF_JPEG_LIB = 'jpeg'
-BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
-
-WITH_BF_PNG = True
-BF_PNG = LIBDIR + '/png'
-BF_PNG_INC = '${BF_PNG}/include'
-BF_PNG_LIB = 'png'
-BF_PNG_LIBPATH = '${BF_PNG}/lib'
-
-WITH_BF_TIFF = True
-BF_TIFF = LIBDIR + '/tiff'
-BF_TIFF_INC = '${BF_TIFF}/include'
-BF_TIFF_LIB = 'tiff'
-BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
-
-WITH_BF_ZLIB = True
-BF_ZLIB = '/usr'
-BF_ZLIB_INC = '${BF_ZLIB}/include'
-BF_ZLIB_LIB = 'z'
-
-WITH_BF_INTERNATIONAL = True
-
-WITH_BF_GAMEENGINE = True
-WITH_BF_PLAYER = True
-WITH_BF_OCEANSIM = True
-
-WITH_BF_BULLET = True
-BF_BULLET = '#extern/bullet2/src'
-BF_BULLET_INC = '${BF_BULLET}'
-BF_BULLET_LIB = 'extern_bullet'
-
-WITH_BF_FFTW3 = True
-BF_FFTW3 = LIBDIR + '/fftw3'
-BF_FFTW3_INC = '${BF_FFTW3}/include'
-BF_FFTW3_LIB = 'libfftw3'
-BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
-
-BF_FREETYPE = LIBDIR + '/freetype'
-BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
-BF_FREETYPE_LIB = 'freetype'
-BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
-
-WITH_BF_QUICKTIME = True
-
-WITH_BF_ICONV = True
-BF_ICONV = '/usr'
-BF_ICONV_INC = '${BF_ICONV}/include'
-BF_ICONV_LIB = 'iconv'
-#BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
-
-# Mesa Libs should go here if your using them as well....
-WITH_BF_STATICOPENGL = True
-BF_OPENGL_LIB = 'GL GLU'
-BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
-BF_OPENGL_LINKFLAGS = ['-framework', 'OpenGL']
-
-#OpenCollada flags
-WITH_BF_COLLADA = True
-BF_COLLADA = '#source/blender/collada'
-BF_COLLADA_INC = '${BF_COLLADA}'
-BF_COLLADA_LIB = 'bf_collada'
-BF_OPENCOLLADA = LIBDIR + '/opencollada'
-BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
-BF_OPENCOLLADA_LIB = 'OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser UTF xml2 buffer ftoa'
-BF_OPENCOLLADA_LIBPATH = LIBDIR + '/opencollada'
-BF_PCRE = LIBDIR + '/opencollada'
-BF_PCRE_LIB = 'pcre'
-BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
-#BF_EXPAT = '/usr'
-#BF_EXPAT_LIB = 'expat'
-#BF_EXPAT_LIBPATH = '/usr/lib'
-
-# Cycles
-WITH_BF_CYCLES = True
-
-#OSL
-
-WITH_BF_CYCLES_OSL = True
-BF_OSL = LIBDIR + '/osl'
-BF_OSL_INC = '${BF_OSL}/include'
-# note oslexec would passed via program linkflags, which is needed to
-# make llvm happy with osl_allocate_closure_component
-#BF_OSL_LIB = 'oslcomp oslquery'
-BF_OSL_LIBPATH = '${BF_OSL}/lib'
-BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
-
-WITH_BF_LLVM = True
-BF_LLVM = LIBDIR + '/llvm'
-BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
- 'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
- 'LLVMTarget LLVMMC LLVMCore LLVMSupport'
-BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
-
-WITH_BF_OIIO = True
-BF_OIIO = LIBDIR + '/openimageio'
-BF_OIIO_INC = '${BF_OIIO}/include'
-BF_OIIO_LIB = 'OpenImageIO'
-BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
-
-WITH_BF_OCIO = True
-BF_OCIO = LIBDIR + '/opencolorio'
-BF_OCIO_INC = '${BF_OCIO}/include'
-BF_OCIO_LIB = 'OpenColorIO tinyxml yaml-cpp'
-BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
-
-WITH_BF_BOOST = True
-BF_BOOST = LIBDIR + '/boost'
-BF_BOOST_INC = '${BF_BOOST}/include'
-BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt boost_wave-mt'
-BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mt'
-BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
-
WITH_BF_CYCLES_CUDA_BINARIES = True
-BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35']
-
-#Freestyle
-WITH_BF_FREESTYLE = True
-
-#Ray trace optimization
-if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'i386':
- WITH_BF_RAYOPTIMIZATION = True
-else:
- WITH_BF_RAYOPTIMIZATION = False
-if MACOSX_ARCHITECTURE == 'i386':
- BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
-elif MACOSX_ARCHITECTURE == 'x86_64':
- BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-msse2']
-
-# SpaceNavigator and related 3D mice, driver must be 3DxWare 10 Beta 4 (Mac OS X) or later !
-WITH_BF_3DMOUSE = True
-
-#############################################################################
-################### various compile settings and flags ##################
-#############################################################################
-
-BF_QUIET = '1' # suppress verbose output
-
-if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
- ARCH_FLAGS = ['-m64']
-else:
- ARCH_FLAGS = ['-m32']
-
-CFLAGS = []
-CXXFLAGS = []
-CCFLAGS = ['-pipe','-funsigned-char']
-
-CPPFLAGS = list(ARCH_FLAGS)
-
-if WITH_GHOST_COCOA:
- PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
-else:
- PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
-
-if WITH_BF_QUICKTIME:
- if USE_QTKIT:
- PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
- else:
- PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
-
-if not WITH_OSX_STATICPYTHON:
- PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
-
-
-#note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4
-#for > 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
-if MACOSX_SDK.endswith("10.7.sdk") or MACOSX_SDK.endswith("10.8.sdk") or MACOSX_SDK.endswith("10.9.sdk"):
- LLIBS = ['stdc++']
-else:
- LLIBS = ['stdc++', 'SystemStubs']
-
-# some flags shuffling for different OS versions
-if MAC_MIN_VERS == '10.3':
- CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS
- PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS
- LLIBS.append('crt3.o')
-
-if USE_SDK:
- SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]
- PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
- CCFLAGS=SDK_FLAGS+CCFLAGS
- CXXFLAGS=SDK_FLAGS+CXXFLAGS
-
-#Intel Macs are CoreDuo and Up
-if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
- REL_CFLAGS = []
- REL_CXXFLAGS = []
- REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
-else:
- CCFLAGS += ['-fno-strict-aliasing']
- REL_CFLAGS = []
- REL_CXXFLAGS = []
- REL_CCFLAGS = ['-DNDEBUG', '-O2']
-
-# Intel 64bit Macs are Core2Duo and up
-if MACOSX_ARCHITECTURE == 'x86_64':
- REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
-
-CC_WARN = ['-Wall']
-C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes']
-CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
-
-##FIX_STUBS_WARNINGS = -Wno-unused
-
-##LOPTS = --dynamic
-##DYNLDFLAGS = -shared $(LDFLAGS)
-
-BF_PROFILE_CCFLAGS = ['-pg', '-g ']
-BF_PROFILE_LINKFLAGS = ['-pg']
-BF_PROFILE = False
-
-BF_DEBUG = False
-BF_DEBUG_CCFLAGS = ['-g', '-D_DEBUG']
-
-#############################################################################
-################### Output directories ##################
-#############################################################################
-BF_BUILDDIR='../build/darwin'
-BF_INSTALLDIR='../install/darwin'
diff --git a/build_files/buildbot/config/user-config-mac-x86_64.py b/build_files/buildbot/config/user-config-mac-x86_64.py
index fb0a084cf4d..2b12762f934 100644
--- a/build_files/buildbot/config/user-config-mac-x86_64.py
+++ b/build_files/buildbot/config/user-config-mac-x86_64.py
@@ -1,425 +1,2 @@
-#
-# Note : if you want to alter this file
-# copy it as a whole in the upper folder
-# as user-config.py
-# dont create a new file with only some
-# vars changed.
-
-import commands
-
-# IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
-USE_SDK=True
-
-#############################################################################
-################### Cocoa & architecture settings ##################
-#############################################################################
-WITH_GHOST_COCOA=True
MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64
-
-
-cmd = 'uname -p'
-MAC_PROC=commands.getoutput(cmd)
-cmd = 'uname -r'
-cmd_res=commands.getoutput(cmd)
-
-if cmd_res[:1]=='7':
- MAC_CUR_VER='10.3'
-elif cmd_res[:1]=='8':
- MAC_CUR_VER='10.4'
-elif cmd_res[:1]=='9':
- MAC_CUR_VER='10.5'
-elif cmd_res[:2]=='10':
- MAC_CUR_VER='10.6'
-elif cmd_res[:2]=='11':
- MAC_CUR_VER='10.7'
-elif cmd_res[:2]=='12':
- MAC_CUR_VER='10.8'
-elif cmd_res[:2]=='13':
- MAC_CUR_VER='10.9'
-cmd = 'xcodebuild -version'
-cmd_xcode=commands.getoutput(cmd)
-XCODE_CUR_VER=cmd_xcode[6:][:3] # truncate output to major.minor version
-cmd = 'xcodebuild -showsdks'
-cmd_sdk=commands.getoutput(cmd)
-MACOSX_SDK_CHECK=cmd_sdk
-
-if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
- USE_QTKIT=True # Carbon quicktime is not available for 64bit
-
-
-# Default target OSX settings per architecture
-# Can be customized
-
-if MACOSX_ARCHITECTURE == 'ppc' and MAC_CUR_VER == '10.4':
-# all releases are now made for 10.5 !
-# MAC_MIN_VERS = '10.3'
-# MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
-# LCGDIR = '#../lib/darwin-6.1-powerpc'
-# CC = 'gcc-3.3'
-# CXX = 'g++-3.3'
- MAC_MIN_VERS = '10.4'
- MACOSX_DEPLOYMENT_TARGET = '10.4'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
- LCGDIR = '#../lib/darwin-8.0.0-powerpc'
- CC = 'gcc-4.0'
- CXX = 'g++-4.0'
-elif MACOSX_ARCHITECTURE == 'i386' and MAC_CUR_VER == '10.4':
- MAC_MIN_VERS = '10.4'
- MACOSX_DEPLOYMENT_TARGET = '10.4'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
- LCGDIR = '#../lib/darwin-8.x.i386'
- CC = 'gcc-4.0'
- CXX = 'g++-4.0'
-else :
- if 'Mac OS X 10.5' in MACOSX_SDK_CHECK:
- # OSX 10.5/6 with Xcode 3.x
- MAC_MIN_VERS = '10.5'
- MACOSX_DEPLOYMENT_TARGET = '10.5'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
- LCGDIR = '#../lib/darwin-9.x.universal'
- CC = 'gcc-4.2'
- CXX = 'g++-4.2'
- elif 'Mac OS X 10.6' in MACOSX_SDK_CHECK:
- # OSX 10.6/7 with Xcode 4.x
- MAC_MIN_VERS = '10.6'
- MACOSX_DEPLOYMENT_TARGET = '10.6'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk'
- LCGDIR = '#../lib/darwin-9.x.universal'
- CC = 'gcc-4.2'
- CXX = 'g++-4.2'
- else:
- # OSX 10.8 with Xcode 4.4 and higher (no 10.6sdk! )
- MAC_MIN_VERS = '10.6'
- MACOSX_DEPLOYMENT_TARGET = '10.6'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.7.sdk'
- LCGDIR = '#../lib/darwin-9.x.universal'
- CC = 'gcc'
- CXX = 'g++'
-
-LIBDIR = '${LCGDIR}'
-
-if XCODE_CUR_VER >= '4.3': ## since version 4.3, XCode and developer dir are bundled ##
- MACOSX_SDK = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform' + MACOSX_SDK
-
-#############################################################################
-################### Dependency settings ##################
-#############################################################################
-
-#Defaults openMP to true if compiler handles it ( only gcc 4.6.1 and newer )
-# if your compiler does not have accurate suffix you may have to enable it by hand !
-if CC[:-2].endswith('4.6'):
- WITH_BF_OPENMP = True # multithreading for fluids, cloth, sculpt and smoke
-else:
- WITH_BF_OPENMP = False
-
-# enable ffmpeg support
-WITH_BF_FFMPEG = True
-BF_FFMPEG = LIBDIR + '/ffmpeg'
-BF_FFMPEG_INC = "${BF_FFMPEG}/include"
-BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
-BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
-#bz2 is a standard osx dynlib
-
-BF_PYTHON_VERSION = '3.3'
-WITH_OSX_STATICPYTHON = True
-
-if WITH_OSX_STATICPYTHON:
- # python 3.3 uses precompiled libraries in bf svn /lib by default
-
- BF_PYTHON = LIBDIR + '/python'
- BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}m'
- # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
- BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}m'
- BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
- # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
-else:
- # python 3.2 uses Python-framework additionally installed in /Library/Frameworks
-
- BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
- BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
- BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
- #BF_PYTHON_LIB = ''
- BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-${BF_PYTHON_VERSION}m'
-
-WITH_BF_OPENAL = True
-#different lib must be used following version of gcc
-# for gcc 3.3
-#BF_OPENAL = LIBDIR + '/openal'
-# for gcc 3.4 and ulterior
-if MAC_PROC == 'powerpc':
- BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
-else :
- BF_OPENAL = LIBDIR + '/openal'
-
-WITH_BF_STATICOPENAL = False
-BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
-#BF_OPENAL_LIB = 'openal'
-#BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
-# Warning, this static lib configuration is untested! users of this OS please confirm.
-#BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
-
-# Warning, this static lib configuration is untested! users of this OS please confirm.
-BF_CXX = '/usr'
-WITH_BF_STATICCXX = False
-BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
-
-# we use simply jack framework
-WITH_BF_JACK = True
-BF_JACK = '/Library/Frameworks/Jackmp.framework'
-BF_JACK_INC = '${BF_JACK}/headers'
-#BF_JACK_LIB = 'jack' # not used due framework
-BF_JACK_LIBPATH = '${BF_JACK}'
-
-WITH_BF_SNDFILE = True
-BF_SNDFILE = LIBDIR + '/sndfile'
-BF_SNDFILE_INC = '${BF_SNDFILE}/include'
-BF_SNDFILE_LIB = 'sndfile FLAC ogg vorbis vorbisenc'
-BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib ${BF_FFMPEG}/lib' #ogg libs are stored in ffmpeg dir
-
-WITH_BF_SDL = True
-BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
-BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
-BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
-BF_SDL_LIBPATH = '${BF_SDL}/lib'
-
-WITH_BF_OPENEXR = True
-WITH_BF_STATICOPENEXR = False
-BF_OPENEXR = '${LCGDIR}/openexr'
-BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
-BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
-BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
-# Warning, this static lib configuration is untested! users of this OS please confirm.
-BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
-
-WITH_BF_DDS = True
-
-#Color Management System
-WITH_BF_LCMS = False
-BF_LCMS = LIBDIR + '/lcms'
-BF_LCMS_INC = '${BF_LCMS}/include'
-BF_LCMS_LIB = 'lcms'
-BF_LCMS_LIBPATH = '${BF_LCMS}/lib'
-
-WITH_BF_JPEG = True
-BF_JPEG = LIBDIR + '/jpeg'
-BF_JPEG_INC = '${BF_JPEG}/include'
-BF_JPEG_LIB = 'jpeg'
-BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
-
-WITH_BF_PNG = True
-BF_PNG = LIBDIR + '/png'
-BF_PNG_INC = '${BF_PNG}/include'
-BF_PNG_LIB = 'png'
-BF_PNG_LIBPATH = '${BF_PNG}/lib'
-
-WITH_BF_TIFF = True
-BF_TIFF = LIBDIR + '/tiff'
-BF_TIFF_INC = '${BF_TIFF}/include'
-BF_TIFF_LIB = 'tiff'
-BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
-
-WITH_BF_ZLIB = True
-BF_ZLIB = '/usr'
-BF_ZLIB_INC = '${BF_ZLIB}/include'
-BF_ZLIB_LIB = 'z'
-
-WITH_BF_INTERNATIONAL = True
-
-WITH_BF_GAMEENGINE = True
-WITH_BF_PLAYER = True
-WITH_BF_OCEANSIM = True
-
-WITH_BF_BULLET = True
-BF_BULLET = '#extern/bullet2/src'
-BF_BULLET_INC = '${BF_BULLET}'
-BF_BULLET_LIB = 'extern_bullet'
-
-WITH_BF_FFTW3 = True
-BF_FFTW3 = LIBDIR + '/fftw3'
-BF_FFTW3_INC = '${BF_FFTW3}/include'
-BF_FFTW3_LIB = 'libfftw3'
-BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
-
-BF_FREETYPE = LIBDIR + '/freetype'
-BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
-BF_FREETYPE_LIB = 'freetype'
-BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
-
-WITH_BF_QUICKTIME = True
-
-WITH_BF_ICONV = True
-BF_ICONV = '/usr'
-BF_ICONV_INC = '${BF_ICONV}/include'
-BF_ICONV_LIB = 'iconv'
-#BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
-
-# Mesa Libs should go here if your using them as well....
-WITH_BF_STATICOPENGL = True
-BF_OPENGL_LIB = 'GL GLU'
-BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
-BF_OPENGL_LINKFLAGS = ['-framework', 'OpenGL']
-
-#OpenCollada flags
-WITH_BF_COLLADA = True
-BF_COLLADA = '#source/blender/collada'
-BF_COLLADA_INC = '${BF_COLLADA}'
-BF_COLLADA_LIB = 'bf_collada'
-BF_OPENCOLLADA = LIBDIR + '/opencollada'
-BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
-BF_OPENCOLLADA_LIB = 'OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser UTF xml2 buffer ftoa'
-BF_OPENCOLLADA_LIBPATH = LIBDIR + '/opencollada'
-BF_PCRE = LIBDIR + '/opencollada'
-BF_PCRE_LIB = 'pcre'
-BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
-#BF_EXPAT = '/usr'
-#BF_EXPAT_LIB = 'expat'
-#BF_EXPAT_LIBPATH = '/usr/lib'
-
-# Cycles
-WITH_BF_CYCLES = True
-
-#OSL
-
-WITH_BF_CYCLES_OSL = True
-BF_OSL = LIBDIR + '/osl'
-BF_OSL_INC = '${BF_OSL}/include'
-# note oslexec would passed via program linkflags, which is needed to
-# make llvm happy with osl_allocate_closure_component
-#BF_OSL_LIB = 'oslcomp oslquery'
-BF_OSL_LIBPATH = '${BF_OSL}/lib'
-BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
-
-WITH_BF_LLVM = True
-BF_LLVM = LIBDIR + '/llvm'
-BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
- 'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
- 'LLVMTarget LLVMMC LLVMCore LLVMSupport'
-BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
-
-WITH_BF_OIIO = True
-BF_OIIO = LIBDIR + '/openimageio'
-BF_OIIO_INC = '${BF_OIIO}/include'
-BF_OIIO_LIB = 'OpenImageIO'
-BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
-
-WITH_BF_OCIO = True
-BF_OCIO = LIBDIR + '/opencolorio'
-BF_OCIO_INC = '${BF_OCIO}/include'
-BF_OCIO_LIB = 'OpenColorIO tinyxml yaml-cpp'
-BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
-
-WITH_BF_BOOST = True
-BF_BOOST = LIBDIR + '/boost'
-BF_BOOST_INC = '${BF_BOOST}/include'
-BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt boost_wave-mt'
-BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mt'
-BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
-
-WITH_BF_CYCLES_CUDA_BINARIES = True
-BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
-BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35']
-
-#Freestyle
-WITH_BF_FREESTYLE = True
-
-#Ray trace optimization
-if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'i386':
- WITH_BF_RAYOPTIMIZATION = True
-else:
- WITH_BF_RAYOPTIMIZATION = False
-if MACOSX_ARCHITECTURE == 'i386':
- BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
-elif MACOSX_ARCHITECTURE == 'x86_64':
- BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-msse2']
-
-# SpaceNavigator and related 3D mice, driver must be 3DxWare 10 Beta 4 (Mac OS X) or later !
-WITH_BF_3DMOUSE = True
-
-#############################################################################
-################### various compile settings and flags ##################
-#############################################################################
-
-BF_QUIET = '1' # suppress verbose output
-
-if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
- ARCH_FLAGS = ['-m64']
-else:
- ARCH_FLAGS = ['-m32']
-
-CFLAGS = []
-CXXFLAGS = []
-CCFLAGS = ['-pipe','-funsigned-char']
-
-CPPFLAGS = list(ARCH_FLAGS)
-
-if WITH_GHOST_COCOA:
- PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
-else:
- PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
-
-if WITH_BF_QUICKTIME:
- if USE_QTKIT:
- PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
- else:
- PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
-
-if not WITH_OSX_STATICPYTHON:
- PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
-
-
-#note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4
-#for > 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
-if MACOSX_SDK.endswith("10.7.sdk") or MACOSX_SDK.endswith("10.8.sdk") or MACOSX_SDK.endswith("10.9.sdk"):
- LLIBS = ['stdc++']
-else:
- LLIBS = ['stdc++', 'SystemStubs']
-
-# some flags shuffling for different OS versions
-if MAC_MIN_VERS == '10.3':
- CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS
- PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS
- LLIBS.append('crt3.o')
-
-if USE_SDK:
- SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]
- PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
- CCFLAGS=SDK_FLAGS+CCFLAGS
- CXXFLAGS=SDK_FLAGS+CXXFLAGS
-
-#Intel Macs are CoreDuo and Up
-if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
- REL_CFLAGS = []
- REL_CXXFLAGS = []
- REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
-else:
- CCFLAGS += ['-fno-strict-aliasing']
- REL_CFLAGS = []
- REL_CXXFLAGS = []
- REL_CCFLAGS = ['-DNDEBUG', '-O2']
-
-# Intel 64bit Macs are Core2Duo and up
-if MACOSX_ARCHITECTURE == 'x86_64':
- REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
-
-CC_WARN = ['-Wall']
-C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes']
-CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
-
-##FIX_STUBS_WARNINGS = -Wno-unused
-
-##LOPTS = --dynamic
-##DYNLDFLAGS = -shared $(LDFLAGS)
-
-BF_PROFILE_CCFLAGS = ['-pg', '-g ']
-BF_PROFILE_LINKFLAGS = ['-pg']
-BF_PROFILE = False
-
-BF_DEBUG = False
-BF_DEBUG_CCFLAGS = ['-g', '-D_DEBUG']
-
-#############################################################################
-################### Output directories ##################
-#############################################################################
-
-BF_BUILDDIR='../build/darwin'
-BF_INSTALLDIR='../install/darwin'
+WITH_BF_CYCLES_CUDA_BINARIES = True \ No newline at end of file
diff --git a/build_files/cmake/buildinfo.cmake b/build_files/cmake/buildinfo.cmake
index e68015e36d3..ae2f87b49be 100644
--- a/build_files/cmake/buildinfo.cmake
+++ b/build_files/cmake/buildinfo.cmake
@@ -1,16 +1,82 @@
# This is called by cmake as an extermal process from
# ./source/creator/CMakeLists.txt to write ./source/creator/buildinfo.h
-# The FindSubversion.cmake module is part of the standard distribution
-include(FindSubversion)
-
# Extract working copy information for SOURCE_DIR into MY_XXX variables
# with a default in case anything fails, for examble when using git-svn
-set(MY_WC_REVISION "unknown")
+set(MY_WC_HASH "")
+set(MY_WC_BRANCH "")
+set(MY_WC_CHANGE "unknown")
+
# Guess if this is a SVN working copy and then look up the revision
-if(EXISTS ${SOURCE_DIR}/.svn/)
- if(Subversion_FOUND)
- Subversion_WC_INFO(${SOURCE_DIR} MY)
+if(EXISTS ${SOURCE_DIR}/.git/)
+ if(EXISTS ${SOURCE_DIR}/.git/)
+ # The FindSubversion.cmake module is part of the standard distribution
+ include(FindGit)
+ if(GIT_FOUND)
+ execute_process(COMMAND git rev-parse --short HEAD
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ OUTPUT_VARIABLE MY_WC_HASH
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process(COMMAND git rev-parse --abbrev-ref HEAD
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ OUTPUT_VARIABLE MY_WC_BRANCH
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ # Get latest version tag
+ execute_process(COMMAND git describe --match "v[0-9]*" --abbrev=0
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ OUTPUT_VARIABLE _git_latest_version_tag
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if(NOT _git_latest_version_tag STREQUAL "")
+ execute_process(COMMAND git rev-list HEAD ^${_git_latest_version_tag} --count
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ OUTPUT_VARIABLE MY_WC_CHANGE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ else()
+ # For the time being we don't have annotated release tags,
+ # count all the revisions in branch.
+ execute_process(COMMAND git rev-list HEAD --count
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ OUTPUT_VARIABLE MY_WC_CHANGE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+
+ # Update GIT index before getting dirty files
+ execute_process(COMMAND git update-index -q --refresh
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process(COMMAND git diff-index --name-only HEAD --
+ WORKING_DIRECTORY ${SOURCE_DIR}
+ OUTPUT_VARIABLE _git_changed_files
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if(NOT _git_changed_files STREQUAL "")
+ set(MY_WC_CHANGE "${MY_WC_CHANGE}M")
+ endif()
+
+ unset(_git_changed_files)
+ unset(_git_latest_version_tag)
+ endif()
+ endif()
+else()
+ # Some crazy folks like me could have hacked git-svn chekout in a way
+ # so svnversion gives proper svn revision for themm which required having
+ # empty .svn folder.
+ #
+ # For such a crazy blokes put svn check into an else branch.
+ #
+ # (sergey)
+ if(EXISTS ${SOURCE_DIR}/.svn/)
+ # The FindSubversion.cmake module is part of the standard distribution
+ include(FindSubversion)
+
+ if(Subversion_FOUND)
+ Subversion_WC_INFO(${SOURCE_DIR} MY)
+ set(MY_WC_CHANGE "${MY_WC_REVISION}")
+ endif()
endif()
endif()
@@ -27,7 +93,9 @@ endif()
# Write a file with the SVNVERSION define
file(WRITE buildinfo.h.txt
- "#define BUILD_REV \"${MY_WC_REVISION}\"\n"
+ "#define BUILD_HASH \"${MY_WC_HASH}\"\n"
+ "#define BUILD_CHANGE \"${MY_WC_CHANGE}\"\n"
+ "#define BUILD_BRANCH \"${MY_WC_BRANCH}\"\n"
"#define BUILD_DATE \"${BUILD_DATE}\"\n"
"#define BUILD_TIME \"${BUILD_TIME}\"\n"
)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index fdc0fb63c8e..7a06352ac70 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -870,3 +870,33 @@ macro(svg_to_png
unset(_file_to)
endmacro()
+
+macro(msgfmt_simple
+ file_from
+ list_to_add)
+
+ # remove ../'s
+ get_filename_component(_file_from_we ${file_from} NAME_WE)
+
+ get_filename_component(_file_from ${file_from} REALPATH)
+ get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${_file_from_we}.mo REALPATH)
+
+ list(APPEND ${list_to_add} ${_file_to})
+
+ get_filename_component(_file_to_path ${_file_to} PATH)
+
+ add_custom_command(
+ OUTPUT ${_file_to}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
+ COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/msgfmt ${_file_from} ${_file_to}
+ DEPENDS msgfmt)
+
+ message("${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/msgfmt ${_file_from} ${_file_to}")
+
+ set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
+
+ unset(_file_from_we)
+ unset(_file_from)
+ unset(_file_to)
+ unset(_file_to_path)
+endmacro()
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py
index 5a1069618b9..09dc32f082a 100644
--- a/build_files/scons/config/darwin-config.py
+++ b/build_files/scons/config/darwin-config.py
@@ -1,123 +1,23 @@
-#
-# Note : if you want to alter this file
-# copy it as a whole in the upper folder
-# as user-config.py
-# dont create a new file with only some
-# vars changed.
-
import commands
-# IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
-USE_SDK=True
-
#############################################################################
-################### Cocoa & architecture settings ##################
+################### Compiler & architecture settings ##################
#############################################################################
-WITH_GHOST_COCOA=True
-MACOSX_ARCHITECTURE = 'i386' # valid archs: ppc, i386, ppc64, x86_64
-
-
-cmd = 'uname -p'
-MAC_PROC=commands.getoutput(cmd)
-cmd = 'uname -r'
-cmd_res=commands.getoutput(cmd)
-
-if cmd_res[:1]=='7':
- MAC_CUR_VER='10.3'
-elif cmd_res[:1]=='8':
- MAC_CUR_VER='10.4'
-elif cmd_res[:1]=='9':
- MAC_CUR_VER='10.5'
-elif cmd_res[:2]=='10':
- MAC_CUR_VER='10.6'
-elif cmd_res[:2]=='11':
- MAC_CUR_VER='10.7'
-elif cmd_res[:2]=='12':
- MAC_CUR_VER='10.8'
-elif cmd_res[:2]=='13':
- MAC_CUR_VER='10.9'
-cmd = 'xcodebuild -version'
-cmd_xcode=commands.getoutput(cmd)
-XCODE_CUR_VER=cmd_xcode[6:][:3] # truncate output to major.minor version
-cmd = 'xcodebuild -showsdks'
-cmd_sdk=commands.getoutput(cmd)
-MACOSX_SDK_CHECK=cmd_sdk
-cmd = 'xcode-select --print-path'
-XCODE_SELECT_PATH=commands.getoutput(cmd)
-if XCODE_SELECT_PATH.endswith("/Contents/Developer"):
- XCODE_BUNDLE=XCODE_SELECT_PATH[:-19]
-else:
- XCODE_BUNDLE=XCODE_SELECT_PATH
-
-if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
- USE_QTKIT=True # Carbon quicktime is not available for 64bit
-
-
-# Default target OSX settings per architecture
-# Can be customized
-
-if MACOSX_ARCHITECTURE == 'ppc' and MAC_CUR_VER == '10.4':
-# all releases are now made for 10.5 !
-# MAC_MIN_VERS = '10.3'
-# MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
-# LCGDIR = '#../lib/darwin-6.1-powerpc'
-# CC = 'gcc-3.3'
-# CXX = 'g++-3.3'
- MAC_MIN_VERS = '10.4'
- MACOSX_DEPLOYMENT_TARGET = '10.4'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
- LCGDIR = '#../lib/darwin-8.0.0-powerpc'
- CC = 'gcc-4.0'
- CXX = 'g++-4.0'
-elif MACOSX_ARCHITECTURE == 'i386' and MAC_CUR_VER == '10.4':
- MAC_MIN_VERS = '10.4'
- MACOSX_DEPLOYMENT_TARGET = '10.4'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
- LCGDIR = '#../lib/darwin-8.x.i386'
- CC = 'gcc-4.0'
- CXX = 'g++-4.0'
-else :
- if 'Mac OS X 10.5' in MACOSX_SDK_CHECK:
- # OSX 10.5/6 with Xcode 3.x
- MAC_MIN_VERS = '10.5'
- MACOSX_DEPLOYMENT_TARGET = '10.5'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
- LCGDIR = '#../lib/darwin-9.x.universal'
- CC = 'gcc-4.2'
- CXX = 'g++-4.2'
- elif 'Mac OS X 10.6' in MACOSX_SDK_CHECK:
- # OSX 10.6/7 with Xcode 4.x
- MAC_MIN_VERS = '10.6'
- MACOSX_DEPLOYMENT_TARGET = '10.6'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk'
- LCGDIR = '#../lib/darwin-9.x.universal'
- CC = 'gcc-4.2'
- CXX = 'g++-4.2'
- else:
- # OSX 10.8 with Xcode 4.4 and higher (no 10.6sdk! )
- MAC_MIN_VERS = '10.6'
- MACOSX_DEPLOYMENT_TARGET = '10.6'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.7.sdk'
- LCGDIR = '#../lib/darwin-9.x.universal'
- CC = 'gcc'
- CXX = 'g++'
-LIBDIR = '${LCGDIR}'
+MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64
+MACOSX_SDK='' # set an sdk name like '10.7' or leave empty for automatic choosing highest available
+MACOSX_DEPLOYMENT_TARGET = '10.6'
-if XCODE_CUR_VER >= '4.3': ## since version 4.3, XCode and developer dir are bundled ##
- MACOSX_SDK = XCODE_BUNDLE + '/Contents/Developer/Platforms/MacOSX.platform' + MACOSX_SDK
+# gcc always defaults to the system standard compiler linked by a shim or symlink
+CC = 'gcc'
+CXX = 'g++'
+LCGDIR = '#../lib/darwin-9.x.universal'
+LIBDIR = '${LCGDIR}'
#############################################################################
################### Dependency settings ##################
#############################################################################
-#Defaults openMP to true if compiler handles it ( only gcc 4.6.1 and newer )
-# if your compiler does not have accurate suffix you may have to enable it by hand !
-if CC[:-2].endswith('4.6') or CC[:-2].endswith('4.8'):
- WITH_BF_OPENMP = True # multithreading for fluids, cloth, sculpt and smoke
-else:
- WITH_BF_OPENMP = False
-
# enable ffmpeg support
WITH_BF_FFMPEG = True
BF_FFMPEG = LIBDIR + '/ffmpeg'
@@ -129,33 +29,16 @@ BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore
BF_PYTHON_VERSION = '3.3'
WITH_OSX_STATICPYTHON = True
-if WITH_OSX_STATICPYTHON:
- # python 3.3 uses precompiled libraries in bf svn /lib by default
-
- BF_PYTHON = LIBDIR + '/python'
- BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}m'
- # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
- BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}m'
- BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
- # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
-else:
- # python 3.2 uses Python-framework additionally installed in /Library/Frameworks
-
- BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
- BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
- BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
- #BF_PYTHON_LIB = ''
- BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-${BF_PYTHON_VERSION}m'
+# python 3.3 uses precompiled libraries in bf svn /lib by default
+BF_PYTHON = LIBDIR + '/python'
+BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}m'
+# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
+BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}m'
+BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
+# BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
WITH_BF_OPENAL = True
-#different lib must be used following version of gcc
-# for gcc 3.3
-#BF_OPENAL = LIBDIR + '/openal'
-# for gcc 3.4 and ulterior
-if MAC_PROC == 'powerpc':
- BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
-else :
- BF_OPENAL = LIBDIR + '/openal'
+BF_OPENAL = LIBDIR + '/openal'
WITH_BF_STATICOPENAL = False
BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
@@ -328,15 +211,12 @@ BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35']
#Freestyle
WITH_BF_FREESTYLE = True
+#OpenMP ( will be checked for compiler support and turned off eventually )
+WITH_BF_OPENMP = True
+
#Ray trace optimization
-if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'i386':
- WITH_BF_RAYOPTIMIZATION = True
-else:
- WITH_BF_RAYOPTIMIZATION = False
-if MACOSX_ARCHITECTURE == 'i386':
- BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
-elif MACOSX_ARCHITECTURE == 'x86_64':
- BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-msse2']
+WITH_BF_RAYOPTIMIZATION = True
+BF_RAYOPTIMIZATION_SSE_FLAGS = []
# SpaceNavigator and related 3D mice, driver must be 3DxWare 10 Beta 4 (Mac OS X) or later !
WITH_BF_3DMOUSE = True
@@ -347,66 +227,18 @@ WITH_BF_3DMOUSE = True
BF_QUIET = '1' # suppress verbose output
-if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
- ARCH_FLAGS = ['-m64']
-else:
- ARCH_FLAGS = ['-m32']
-
CFLAGS = []
CXXFLAGS = []
CCFLAGS = ['-pipe','-funsigned-char']
+CPPFLAGS = []
+
+PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']
+LLIBS = ['stdc++']
-CPPFLAGS = list(ARCH_FLAGS)
-
-if WITH_GHOST_COCOA:
- PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
-else:
- PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
-
-if WITH_BF_QUICKTIME:
- if USE_QTKIT:
- PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
- else:
- PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
-
-if not WITH_OSX_STATICPYTHON:
- PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
-
-
-#note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4
-#for > 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
-if MACOSX_SDK.endswith("10.7.sdk") or MACOSX_SDK.endswith("10.8.sdk") or MACOSX_SDK.endswith("10.9.sdk"):
- LLIBS = ['stdc++']
-else:
- LLIBS = ['stdc++', 'SystemStubs']
-
-# some flags shuffling for different OS versions
-if MAC_MIN_VERS == '10.3':
- CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS
- PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS
- LLIBS.append('crt3.o')
-
-if USE_SDK:
- SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]
- PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
- CCFLAGS=SDK_FLAGS+CCFLAGS
- CXXFLAGS=SDK_FLAGS+CXXFLAGS
-
-#Intel Macs are CoreDuo and Up
-if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
- REL_CFLAGS = []
- REL_CXXFLAGS = []
- REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
-else:
- CCFLAGS += ['-fno-strict-aliasing']
- REL_CFLAGS = []
- REL_CXXFLAGS = []
- REL_CCFLAGS = ['-DNDEBUG', '-O2']
-
-# Intel 64bit Macs are Core2Duo and up
-if MACOSX_ARCHITECTURE == 'x86_64':
- REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
+REL_CFLAGS = []
+REL_CXXFLAGS = []
+REL_CCFLAGS = ['-DNDEBUG', '-O2']
CC_WARN = ['-Wall']
C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes']
diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py
index e94f61f7819..b7c6fed45c2 100644
--- a/build_files/scons/config/freebsd8-config.py
+++ b/build_files/scons/config/freebsd8-config.py
@@ -90,11 +90,6 @@ BF_FREETYPE = '/usr/local'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
-### XXX Find what this actually wants; it doesn't want libquicktime.
-WITH_BF_QUICKTIME = False
-BF_QUICKTIME = '/usr/local'
-BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
-
WITH_BF_ICONV = True
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py
index 93fa6137bb0..743131ab32e 100644
--- a/build_files/scons/config/linux-config.py
+++ b/build_files/scons/config/linux-config.py
@@ -100,10 +100,6 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
#BF_FREETYPE_LIB_STATIC = '${BF_FREETYPE}/lib/libfreetype.a'
-WITH_BF_QUICKTIME = False
-BF_QUICKTIME = '/usr/local'
-BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
-
WITH_BF_ICONV = False
BF_ICONV = "/usr"
BF_ICONV_INC = '${BF_ICONV}/include'
diff --git a/build_files/scons/config/linuxcross-config.py b/build_files/scons/config/linuxcross-config.py
index 5b958420f37..36b29a309af 100644
--- a/build_files/scons/config/linuxcross-config.py
+++ b/build_files/scons/config/linuxcross-config.py
@@ -101,10 +101,6 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
-WITH_BF_QUICKTIME = False
-BF_QUICKTIME = '/usr/local'
-BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
-
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/gcc/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py
index d71feb8d2e9..213efcbb2df 100644
--- a/build_files/scons/config/win32-mingw-config.py
+++ b/build_files/scons/config/win32-mingw-config.py
@@ -112,10 +112,6 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
-WITH_BF_QUICKTIME = False
-BF_QUICKTIME = '/usr/local'
-BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
-
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py
index f1597a66538..4eb6416ad59 100644
--- a/build_files/scons/config/win32-vc-config.py
+++ b/build_files/scons/config/win32-vc-config.py
@@ -133,12 +133,6 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype2ST'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
-WITH_BF_QUICKTIME = False
-BF_QUICKTIME = LIBDIR + '/QTDevWin'
-BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
-BF_QUICKTIME_LIB = 'qtmlClient'
-BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
-
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py
index e82b6e8a73f..bb55354d591 100644
--- a/build_files/scons/config/win64-mingw-config.py
+++ b/build_files/scons/config/win64-mingw-config.py
@@ -111,8 +111,6 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2/'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
-WITH_BF_QUICKTIME = False
-
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index f181f290104..06cc6b7f00a 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -410,9 +410,24 @@ def buildinfo(lenv, build_type):
"""
build_date = time.strftime ("%Y-%m-%d")
build_time = time.strftime ("%H:%M:%S")
- build_rev = os.popen('svnversion').read()[:-1] # remove \n
- if build_rev == '':
- build_rev = '-UNKNOWN-'
+ if os.path.isdir(os.path.abspath('.git')):
+ latest_version_tag = os.popen('git describe --match "v[0-9]*" --abbrev=0').read().strip()
+ if latest_version_tag:
+ build_change = os.popen('git rev-list HEAD ' + latest_version_tag + ' --count').read().strip()
+ else:
+ build_change = os.popen('git rev-list HEAD --count').read().strip()
+
+ build_hash = os.popen('git rev-parse --short HEAD').read().strip()
+ build_branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip()
+ elif os.path.isdir(os.path.abspath('.svn')):
+ build_hash = ''
+ build_change = os.popen('svnversion').read()[:-1] # remove \n
+ build_branch = ''
+ else:
+ build_hash = ''
+ build_change = 'unknown'
+ build_branch = ''
+
if lenv['BF_DEBUG']:
build_type = "Debug"
build_cflags = ' '.join(lenv['CFLAGS'] + lenv['CCFLAGS'] + lenv['BF_DEBUG_CCFLAGS'] + lenv['CPPFLAGS'])
@@ -429,7 +444,9 @@ def buildinfo(lenv, build_type):
lenv.Append (CPPDEFINES = ['BUILD_TIME=\\"%s\\"'%(build_time),
'BUILD_DATE=\\"%s\\"'%(build_date),
'BUILD_TYPE=\\"%s\\"'%(build_type),
- 'BUILD_REV=\\"%s\\"'%(build_rev),
+ 'BUILD_HASH=\\"%s\\"'%(build_hash),
+ 'BUILD_CHANGE=\\"%s\\"'%(build_change),
+ 'BUILD_BRANCH=\\"%s\\"'%(build_branch),
'WITH_BUILDINFO',
'BUILD_PLATFORM=\\"%s:%s\\"'%(platform.system(), platform.architecture()[0]),
'BUILD_CFLAGS=\\"%s\\"'%(build_cflags),
@@ -683,7 +700,8 @@ def AppIt(target=None, source=None, env=None):
commands.getoutput(cmd)
cmd = 'find %s/%s.app -name __MACOSX -exec rm -rf {} \;'%(installdir, binary)
commands.getoutput(cmd)
- if env['CC'][:-2].endswith('4.6') or env['CC'][:-2].endswith('4.8'): # for correct errorhandling with gcc 4.6/4.8.x we need the gcc.dylib and gomp.dylib to link, thus distribute in app-bundle
+ if env['CC'].split('/')[len(env['CC'].split('/'))-1][4:] >= '4.6.1': # for correct errorhandling with gcc <= 4.6.1 we need the gcc.dylib and gomp.dylib to link, thus distribute in app-bundle
+ print "Bundling libgcc and libgomp"
cmd = 'mkdir %s/%s.app/Contents/MacOS/lib'%(installdir, binary)
commands.getoutput(cmd)
instname = env['BF_CXX']
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index 8f0d3ff590b..607b761261c 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -138,13 +138,11 @@ def validate_arguments(args, bc):
'WITHOUT_BF_PYTHON_INSTALL', 'WITHOUT_BF_PYTHON_UNPACK', 'WITH_BF_PYTHON_INSTALL_NUMPY',
'WITHOUT_BF_OVERWRITE_INSTALL',
'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH', 'WITH_BF_STATICOPENMP', 'BF_OPENMP_STATIC_STATIC',
- 'WITH_GHOST_COCOA',
'WITH_GHOST_SDL',
'WITH_GHOST_XDND',
'WITH_X11_XINPUT',
'WITH_X11_XF86VMODE',
'BF_GHOST_DEBUG',
- 'USE_QTKIT',
'BF_FANCY', 'BF_QUIET', 'BF_LINE_OVERWRITE',
'BF_X264_CONFIG',
'BF_XVIDCORE_CONFIG',
@@ -181,7 +179,7 @@ def validate_arguments(args, bc):
'BF_PROFILE_CFLAGS', 'BF_PROFILE_CCFLAGS', 'BF_PROFILE_CXXFLAGS', 'BF_PROFILE_LINKFLAGS',
'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS',
'C_WARN', 'CC_WARN', 'CXX_WARN',
- 'LLIBS', 'PLATFORM_LINKFLAGS','MACOSX_ARCHITECTURE', 'MACOSX_SDK_CHECK', 'XCODE_CUR_VER',
+ 'LLIBS', 'PLATFORM_LINKFLAGS', 'MACOSX_ARCHITECTURE', 'MACOSX_SDK', 'XCODE_CUR_VER',
'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET'
]
@@ -424,11 +422,9 @@ def read_opts(env, cfg, args):
('BF_OPENMP', 'Base path to OpenMP (used when cross-compiling with older versions of WinGW)', ''),
('BF_OPENMP_INC', 'Path to OpenMP includes (used when cross-compiling with older versions of WinGW)', ''),
('BF_OPENMP_LIBPATH', 'Path to OpenMP libraries (used when cross-compiling with older versions of WinGW)', ''),
- (BoolVariable('WITH_GHOST_COCOA', 'Use Cocoa-framework if true', False)),
(BoolVariable('WITH_GHOST_SDL', 'Enable building blender against SDL for windowing rather then the native APIs', False)),
(BoolVariable('WITH_X11_XINPUT', 'Enable X11 Xinput (tablet support and unicode input)', True)),
(BoolVariable('WITH_X11_XF86VMODE', 'Enable X11 video mode switching', True)),
- (BoolVariable('USE_QTKIT', 'Use QTKIT if true', False)),
('BF_OPENMP_LIB_STATIC', 'OpenMP static library', ''),
(BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)),
@@ -505,7 +501,7 @@ def read_opts(env, cfg, args):
('LLIBS', 'Platform libs', []),
('PLATFORM_LINKFLAGS', 'Platform linkflags', []),
('MACOSX_ARCHITECTURE', 'python_arch.zip select', ''),
- ('MACOSX_SDK_CHECK', 'Detect available OS X SDK`s', ''),
+ ('MACOSX_SDK', 'Set OS X SDK', ''),
('XCODE_CUR_VER', 'Detect XCode version', ''),
('MACOSX_DEPLOYMENT_TARGET', 'Detect OS X target version', ''),
diff --git a/extern/bullet2/patches/ghost_softbody.patch b/extern/bullet2/patches/ghost_softbody.patch
deleted file mode 100644
index b150d57040d..00000000000
--- a/extern/bullet2/patches/ghost_softbody.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Index: extern/bullet2/src/BulletSoftBody/btSoftBody.cpp
-===================================================================
---- extern/bullet2/src/BulletSoftBody/btSoftBody.cpp (Revision 43904)
-+++ extern/bullet2/src/BulletSoftBody/btSoftBody.cpp (Revision 43905)
-@@ -2780,21 +2780,23 @@
- {
- const RContact& c = psb->m_rcontacts[i];
- const sCti& cti = c.m_cti;
-- btRigidBody* tmpRigid = btRigidBody::upcast(cti.m_colObj);
-
-- const btVector3 va = tmpRigid ? tmpRigid->getVelocityInLocalPoint(c.m_c1)*dt : btVector3(0,0,0);
-- const btVector3 vb = c.m_node->m_x-c.m_node->m_q;
-- const btVector3 vr = vb-va;
-- const btScalar dn = btDot(vr, cti.m_normal);
-- if(dn<=SIMD_EPSILON)
-- {
-- const btScalar dp = btMin( (btDot(c.m_node->m_x, cti.m_normal) + cti.m_offset), mrg );
-- const btVector3 fv = vr - (cti.m_normal * dn);
-- // c0 is the impulse matrix, c3 is 1 - the friction coefficient or 0, c4 is the contact hardness coefficient
-- const btVector3 impulse = c.m_c0 * ( (vr - (fv * c.m_c3) + (cti.m_normal * (dp * c.m_c4))) * kst );
-- c.m_node->m_x -= impulse * c.m_c2;
-- if (tmpRigid)
-- tmpRigid->applyImpulse(impulse,c.m_c1);
-+ if (cti.m_colObj->hasContactResponse()) {
-+ btRigidBody* tmpRigid = btRigidBody::upcast(cti.m_colObj);
-+ const btVector3 va = tmpRigid ? tmpRigid->getVelocityInLocalPoint(c.m_c1)*dt : btVector3(0,0,0);
-+ const btVector3 vb = c.m_node->m_x-c.m_node->m_q;
-+ const btVector3 vr = vb-va;
-+ const btScalar dn = btDot(vr, cti.m_normal);
-+ if(dn<=SIMD_EPSILON)
-+ {
-+ const btScalar dp = btMin( (btDot(c.m_node->m_x, cti.m_normal) + cti.m_offset), mrg );
-+ const btVector3 fv = vr - (cti.m_normal * dn);
-+ // c0 is the impulse matrix, c3 is 1 - the friction coefficient or 0, c4 is the contact hardness coefficient
-+ const btVector3 impulse = c.m_c0 * ( (vr - (fv * c.m_c3) + (cti.m_normal * (dp * c.m_c4))) * kst );
-+ c.m_node->m_x -= impulse * c.m_c2;
-+ if (tmpRigid)
-+ tmpRigid->applyImpulse(impulse,c.m_c1);
-+ }
- }
- }
- }
diff --git a/extern/bullet2/readme.txt b/extern/bullet2/readme.txt
index 33430fc8ee3..3c09dad1fbf 100644
--- a/extern/bullet2/readme.txt
+++ b/extern/bullet2/readme.txt
@@ -4,8 +4,5 @@ Questions? mail blender at erwincoumans.com, or check the bf-blender mailing lis
Thanks,
Erwin
-Apply patches/ghost_softbody.patch to prevent softbodies being hit by ghost objects.
-Originally committed in blender svn revision: 43905.
-
Apply patches/convex_hull.patch to add access to the convex hull
operation, used in the BMesh convex hull operator.
diff --git a/extern/libmv/libmv-capi.cc b/extern/libmv/libmv-capi.cc
index 0585bd3e8ac..f02ca0e98e0 100644
--- a/extern/libmv/libmv-capi.cc
+++ b/extern/libmv/libmv-capi.cc
@@ -306,6 +306,9 @@ int libmv_trackRegion(const libmv_TrackRegionOptions *options,
track_region_options.num_extra_points = 1;
track_region_options.image1_mask = NULL;
track_region_options.use_brute_initialization = options->use_brute;
+ /* TODO(keir): This will make some cases better, but may be a regression until
+ * the motion model is in. Since this is on trunk, enable it for now. */
+ track_region_options.attempt_refine_before_brute = true;
track_region_options.use_normalized_intensities = options->use_normalization;
if (options->image1_mask) {
diff --git a/extern/libmv/libmv/tracking/track_region.cc b/extern/libmv/libmv/tracking/track_region.cc
index 786f16bf219..9e0bf9a77da 100644
--- a/extern/libmv/libmv/tracking/track_region.cc
+++ b/extern/libmv/libmv/tracking/track_region.cc
@@ -1289,6 +1289,15 @@ bool BruteTranslationOnlyInitialize(const FloatImage &image1,
return true;
}
+void CopyQuad(double *src_x, double *src_y,
+ double *dst_x, double *dst_y,
+ int num_extra_points) {
+ for (int i = 0; i < 4 + num_extra_points; ++i) {
+ dst_x[i] = src_x[i];
+ dst_y[i] = src_y[i];
+ }
+}
+
} // namespace
template<typename Warp>
@@ -1298,11 +1307,46 @@ void TemplatedTrackRegion(const FloatImage &image1,
const TrackRegionOptions &options,
double *x2, double *y2,
TrackRegionResult *result) {
- for (int i = 0; i < 4; ++i) {
+ for (int i = 0; i < 4 + options.num_extra_points; ++i) {
LG << "P" << i << ": (" << x1[i] << ", " << y1[i] << "); guess ("
<< x2[i] << ", " << y2[i] << "); (dx, dy): (" << (x2[i] - x1[i]) << ", "
<< (y2[i] - y1[i]) << ").";
}
+
+ // Since (x2, y2) contains a prediction for where the tracked point should
+ // go, try a refinement immediately in the hope that the prediction is close
+ // enough.
+ if (options.attempt_refine_before_brute) {
+ TrackRegionOptions modified_options = options;
+ modified_options.use_brute_initialization = false;
+ modified_options.attempt_refine_before_brute = false;
+
+ double x2_first_try[5];
+ double y2_first_try[5];
+ CopyQuad(x2, y2, x2_first_try, y2_first_try, options.num_extra_points);
+
+ TemplatedTrackRegion<Warp>(image1, image2,
+ x1, y1, modified_options,
+ x2_first_try, y2_first_try, result);
+
+ // Of the things that can happen in the first pass, don't try the brute
+ // pass (and second attempt) if the error is one of the terminations below.
+ if (result->termination == TrackRegionResult::PARAMETER_TOLERANCE ||
+ result->termination == TrackRegionResult::FUNCTION_TOLERANCE ||
+ result->termination == TrackRegionResult::GRADIENT_TOLERANCE ||
+ result->termination == TrackRegionResult::SOURCE_OUT_OF_BOUNDS ||
+ result->termination == TrackRegionResult::DESTINATION_OUT_OF_BOUNDS ||
+ result->termination == TrackRegionResult::INSUFFICIENT_PATTERN_AREA) {
+ LG << "Terminated with first try at refinement; no brute needed.";
+ // TODO(keir): Also check correlation?
+ CopyQuad(x2_first_try, y2_first_try, x2, y2, options.num_extra_points);
+ LG << "Early termination correlation: " << result->correlation;
+ return;
+ } else {
+ LG << "Initial eager-refinement failed; retrying normally.";
+ }
+ }
+
if (options.use_normalized_intensities) {
LG << "Using normalized intensities.";
}
@@ -1368,7 +1412,6 @@ void TemplatedTrackRegion(const FloatImage &image1,
int num_samples_y;
PickSampling(x1, y1, x2, y2, &num_samples_x, &num_samples_y);
-
// Compute the warp from rectangular coordinates.
Mat3 canonical_homography = ComputeCanonicalHomography(x1, y1,
num_samples_x,
diff --git a/extern/libmv/libmv/tracking/track_region.h b/extern/libmv/libmv/tracking/track_region.h
index 6c7218f11d1..58742cab36c 100644
--- a/extern/libmv/libmv/tracking/track_region.h
+++ b/extern/libmv/libmv/tracking/track_region.h
@@ -55,6 +55,13 @@ struct TrackRegionOptions {
// that the nearby minima is correct, or the search area is too small.
bool use_brute_initialization;
+ // If true and brute initialization is enabled, first try refining with the
+ // initial guess instead of starting with the brute initialization. If the
+ // initial refinement fails, then a normal brute search followed by
+ // refinement is attempted. If the initial refinement succeeds, then the
+ // result is returned as is (skipping a costly brute search).
+ bool attempt_refine_before_brute;
+
// If true, normalize the image patches by their mean before doing the sum of
// squared error calculation. This is reasonable since the effect of
// increasing light intensity is multiplicative on the pixel intensities.
@@ -67,8 +74,9 @@ struct TrackRegionOptions {
// take the image derivative.
double sigma;
- // Extra points that should get transformed by the warp. This is useful
- // because the actual warp parameters are not exposed.
+ // Extra points that should get transformed by the warp. These points are
+ // appended to the x and y arrays. This is useful because the actual warp
+ // parameters are not exposed.
int num_extra_points;
// For motion models other than translation, the optimizer sometimes has
diff --git a/extern/libmv/third_party/ceres/SConscript b/extern/libmv/third_party/ceres/SConscript
index a914135fddc..164aedfe415 100644
--- a/extern/libmv/third_party/ceres/SConscript
+++ b/extern/libmv/third_party/ceres/SConscript
@@ -28,7 +28,7 @@ defs.append('CERES_HAVE_RWLOCK')
if env['WITH_BF_OPENMP']:
defs.append('CERES_USE_OPENMP')
-if 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']:
+if 'Mac OS X 10.5' in env['MACOSX_SDK']:
defs.append('CERES_NO_TR1')
incs = '. ../../ ../../../Eigen3 ./include ./internal ../gflags'
diff --git a/extern/libmv/third_party/ceres/bundle.sh b/extern/libmv/third_party/ceres/bundle.sh
index 6ab348af118..a6f040b6d29 100755
--- a/extern/libmv/third_party/ceres/bundle.sh
+++ b/extern/libmv/third_party/ceres/bundle.sh
@@ -225,7 +225,7 @@ defs.append('CERES_HAVE_RWLOCK')
if env['WITH_BF_OPENMP']:
defs.append('CERES_USE_OPENMP')
-if 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']:
+if 'Mac OS X 10.5' in env['MACOSX_SDK']:
defs.append('CERES_NO_TR1')
incs = '. ../../ ../../../Eigen3 ./include ./internal ../gflags'
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
index 676a86e88fe..c3877c2c9f2 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
@@ -119,6 +119,14 @@ AUD_OpenALDevice::AUD_OpenALHandle::AUD_OpenALHandle(AUD_OpenALDevice* device, A
{
length = m_device->m_buffersize;
reader->read(length, eos, m_device->m_buffer.getBuffer());
+
+ if(length == 0)
+ {
+ // AUD_XXX: TODO: don't fill all buffers and enqueue them later
+ length = 1;
+ memset(m_device->m_buffer.getBuffer(), 0, length * AUD_DEVICE_SAMPLE_SIZE(specs));
+ }
+
alBufferData(m_buffers[i], m_format, m_device->m_buffer.getBuffer(),
length * AUD_DEVICE_SAMPLE_SIZE(specs),
specs.rate);
@@ -132,8 +140,7 @@ AUD_OpenALDevice::AUD_OpenALHandle::AUD_OpenALHandle(AUD_OpenALDevice* device, A
try
{
- alSourceQueueBuffers(m_source, CYCLE_BUFFERS,
- m_buffers);
+ alSourceQueueBuffers(m_source, CYCLE_BUFFERS, m_buffers);
if(alGetError() != AL_NO_ERROR)
AUD_THROW(AUD_ERROR_OPENAL, queue_error);
}
@@ -289,6 +296,14 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::seek(float position)
{
length = m_device->m_buffersize;
m_reader->read(length, m_eos, m_device->m_buffer.getBuffer());
+
+ if(length == 0)
+ {
+ // AUD_XXX: TODO: don't fill all buffers and enqueue them later
+ length = 1;
+ memset(m_device->m_buffer.getBuffer(), 0, length * AUD_DEVICE_SAMPLE_SIZE(specs));
+ }
+
alBufferData(m_buffers[i], m_format, m_device->m_buffer.getBuffer(),
length * AUD_DEVICE_SAMPLE_SIZE(specs), specs.rate);
@@ -933,9 +948,8 @@ void AUD_OpenALDevice::updateStreams()
break;
}
- // unqueue buffer
- alSourceUnqueueBuffers(sound->m_source, 1,
- &sound->m_buffers[sound->m_current]);
+ // unqueue buffer (warning: this might fail for slow early returning sources (none exist so far) if the buffer was not queued due to recent changes - has to be tested)
+ alSourceUnqueueBuffers(sound->m_source, 1, &sound->m_buffers[sound->m_current]);
ALenum err;
if((err = alGetError()) != AL_NO_ERROR)
{
diff --git a/intern/audaspace/intern/AUD_AnimateableProperty.cpp b/intern/audaspace/intern/AUD_AnimateableProperty.cpp
index 0b333e687ff..6d1a307d868 100644
--- a/intern/audaspace/intern/AUD_AnimateableProperty.cpp
+++ b/intern/audaspace/intern/AUD_AnimateableProperty.cpp
@@ -47,6 +47,15 @@ AUD_AnimateableProperty::AUD_AnimateableProperty(int count) :
pthread_mutexattr_destroy(&attr);
}
+void AUD_AnimateableProperty::updateUnknownCache(int start, int end)
+{
+ float* buf = getBuffer();
+
+ for(int i = start; i <= end; i++)
+ // TODO: maybe first instead of zero order interpolation?
+ memcpy(buf + i * m_count, buf + (start - 1) * m_count, m_count * sizeof(float));
+}
+
AUD_AnimateableProperty::~AUD_AnimateableProperty()
{
pthread_mutex_destroy(&m_mutex);
@@ -67,6 +76,7 @@ void AUD_AnimateableProperty::write(const float* data)
AUD_MutexLock lock(*this);
m_isAnimated = false;
+ m_unknown.clear();
memcpy(getBuffer(), data, m_count * sizeof(float));
}
@@ -74,18 +84,85 @@ void AUD_AnimateableProperty::write(const float* data, int position, int count)
{
AUD_MutexLock lock(*this);
- m_isAnimated = true;
-
int pos = getSize() / (sizeof(float) * m_count);
+ if(!m_isAnimated)
+ pos = 0;
+
+ m_isAnimated = true;
+
assureSize((count + position) * m_count * sizeof(float), true);
float* buf = getBuffer();
memcpy(buf + position * m_count, data, count * m_count * sizeof(float));
- for(int i = pos; i < position; i++)
- memcpy(buf + i * m_count, buf + (pos - 1) * m_count, m_count * sizeof(float));
+ // have to fill up space between?
+ if(pos < position)
+ {
+ m_unknown.push_back(Unknown(pos, position - 1));
+
+ if(pos == 0)
+ {
+ memset(buf, 0, position * m_count * sizeof(float));
+ }
+ else
+ updateUnknownCache(pos, position - 1);
+ }
+ // otherwise it's not at the end, let's check if some unknown part got filled
+ else
+ {
+ for(std::list<Unknown>::iterator it = m_unknown.begin(); it != m_unknown.end(); it++)
+ {
+ // unknown area before position
+ if(it->end < position)
+ continue;
+
+ // we're after the new area, let's stop
+ if(it->start >= position + count)
+ break;
+
+ // we have an intersection, now 4 cases:
+ // the start is included
+ if(position <= it->start)
+ {
+ // the end is included
+ if(position + count > it->end)
+ {
+ // simply delete
+ std::list<Unknown>::iterator it2 = it;
+ it++;
+ m_unknown.erase(it2);
+ }
+ // the end is excluded, a second part remains
+ else
+ {
+ // update second part
+ it->start = position + count;
+ updateUnknownCache(it->start, it->end);
+ break;
+ }
+ }
+ // start is excluded, a first part remains
+ else
+ {
+ // the end is included
+ if(position + count > it->end)
+ {
+ // update first part
+ it->end = position - 1;
+ }
+ // the end is excluded, a second part remains
+ else
+ {
+ // add another item and update both parts
+ m_unknown.insert(it, Unknown(it->start, position - 1));
+ it->start = position + count;
+ updateUnknownCache(it->start, it->end);
+ }
+ }
+ }
+ }
}
void AUD_AnimateableProperty::read(float position, float* out)
diff --git a/intern/audaspace/intern/AUD_AnimateableProperty.h b/intern/audaspace/intern/AUD_AnimateableProperty.h
index 322748ad571..37eb8f84550 100644
--- a/intern/audaspace/intern/AUD_AnimateableProperty.h
+++ b/intern/audaspace/intern/AUD_AnimateableProperty.h
@@ -34,6 +34,7 @@
#include "AUD_ILockable.h"
#include <pthread.h>
+#include <list>
/**
* This class saves animation data for float properties.
@@ -41,6 +42,14 @@
class AUD_AnimateableProperty : private AUD_Buffer, public AUD_ILockable
{
private:
+ struct Unknown {
+ int start;
+ int end;
+
+ Unknown(int start, int end) :
+ start(start), end(end) {}
+ };
+
/// The count of floats for a single property.
const int m_count;
@@ -50,10 +59,15 @@ private:
/// The mutex for locking.
pthread_mutex_t m_mutex;
+ /// The list of unknown buffer areas.
+ std::list<Unknown> m_unknown;
+
// hide copy constructor and operator=
AUD_AnimateableProperty(const AUD_AnimateableProperty&);
AUD_AnimateableProperty& operator=(const AUD_AnimateableProperty&);
+ void updateUnknownCache(int start, int end);
+
public:
/**
* Creates a new animateable property.
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 367f021ee34..ac15acee0c5 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -253,26 +253,26 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
name="Max Bounces",
description="Total maximum number of bounces",
min=0, max=1024,
- default=8,
+ default=12,
)
cls.diffuse_bounces = IntProperty(
name="Diffuse Bounces",
description="Maximum number of diffuse reflection bounces, bounded by total maximum",
min=0, max=1024,
- default=128,
+ default=4,
)
cls.glossy_bounces = IntProperty(
name="Glossy Bounces",
description="Maximum number of glossy reflection bounces, bounded by total maximum",
min=0, max=1024,
- default=128,
+ default=4,
)
cls.transmission_bounces = IntProperty(
name="Transmission Bounces",
description="Maximum number of transmission bounces, bounded by total maximum",
min=0, max=1024,
- default=128,
+ default=12,
)
cls.transparent_min_bounces = IntProperty(
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index b576181d890..a6d2b537bc7 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -673,59 +673,73 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
return node;
}
+static bool node_use_modified_socket_name(ShaderNode *node)
+{
+ if (node->special_type == SHADER_SPECIAL_TYPE_SCRIPT)
+ return false;
+
+ return true;
+}
+
static ShaderInput *node_find_input_by_name(ShaderNode *node, BL::Node b_node, BL::NodeSocket b_socket)
{
- BL::Node::inputs_iterator b_input;
string name = b_socket.name();
- bool found = false;
- int counter = 0, total = 0;
- for (b_node.inputs.begin(b_input); b_input != b_node.inputs.end(); ++b_input) {
- if (b_input->name() == name) {
- if (!found)
- counter++;
- total++;
+ if (node_use_modified_socket_name(node)) {
+ BL::Node::inputs_iterator b_input;
+ bool found = false;
+ int counter = 0, total = 0;
+
+ for (b_node.inputs.begin(b_input); b_input != b_node.inputs.end(); ++b_input) {
+ if (b_input->name() == name) {
+ if (!found)
+ counter++;
+ total++;
+ }
+
+ if(b_input->ptr.data == b_socket.ptr.data)
+ found = true;
}
-
- if(b_input->ptr.data == b_socket.ptr.data)
- found = true;
+
+ /* rename if needed */
+ if (name == "Shader")
+ name = "Closure";
+
+ if (total > 1)
+ name = string_printf("%s%d", name.c_str(), counter);
}
- /* rename if needed */
- if (name == "Shader")
- name = "Closure";
-
- if (total > 1)
- name = string_printf("%s%d", name.c_str(), counter);
-
return node->input(name.c_str());
}
static ShaderOutput *node_find_output_by_name(ShaderNode *node, BL::Node b_node, BL::NodeSocket b_socket)
{
- BL::Node::outputs_iterator b_output;
string name = b_socket.name();
- bool found = false;
- int counter = 0, total = 0;
- for (b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) {
- if (b_output->name() == name) {
- if (!found)
- counter++;
- total++;
+ if (node_use_modified_socket_name(node)) {
+ BL::Node::outputs_iterator b_output;
+ bool found = false;
+ int counter = 0, total = 0;
+
+ for (b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) {
+ if (b_output->name() == name) {
+ if (!found)
+ counter++;
+ total++;
+ }
+
+ if(b_output->ptr.data == b_socket.ptr.data)
+ found = true;
}
-
- if(b_output->ptr.data == b_socket.ptr.data)
- found = true;
+
+ /* rename if needed */
+ if (name == "Shader")
+ name = "Closure";
+
+ if (total > 1)
+ name = string_printf("%s%d", name.c_str(), counter);
}
- /* rename if needed */
- if (name == "Shader")
- name = "Closure";
-
- if (total > 1)
- name = string_printf("%s%d", name.c_str(), counter);
-
return node->output(name.c_str());
}
diff --git a/intern/cycles/kernel/svm/svm_fresnel.h b/intern/cycles/kernel/svm/svm_fresnel.h
index 549c0351d83..d97d6a3738f 100644
--- a/intern/cycles/kernel/svm/svm_fresnel.h
+++ b/intern/cycles/kernel/svm/svm_fresnel.h
@@ -18,13 +18,17 @@ CCL_NAMESPACE_BEGIN
/* Fresnel Node */
-__device void svm_node_fresnel(ShaderData *sd, float *stack, uint ior_offset, uint ior_value, uint out_offset)
+__device void svm_node_fresnel(ShaderData *sd, float *stack, uint ior_offset, uint ior_value, uint node)
{
+ uint normal_offset, out_offset;
+ decode_node_uchar4(node, &normal_offset, &out_offset, NULL, NULL);
float eta = (stack_valid(ior_offset))? stack_load_float(stack, ior_offset): __uint_as_float(ior_value);
+ float3 normal_in = stack_valid(normal_offset)? stack_load_float3(stack, normal_offset): sd->N;
+
eta = fmaxf(eta, 1.0f + 1e-5f);
eta = (sd->flag & SD_BACKFACING)? 1.0f/eta: eta;
- float f = fresnel_dielectric_cos(dot(sd->I, sd->N), eta);
+ float f = fresnel_dielectric_cos(dot(sd->I, normal_in), eta);
stack_store_float(stack, out_offset, f);
}
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h
index 8ebdf3cc220..dfa737115e2 100644
--- a/intern/cycles/render/graph.h
+++ b/intern/cycles/render/graph.h
@@ -75,7 +75,8 @@ enum ShaderNodeSpecialType {
SHADER_SPECIAL_TYPE_PROXY,
SHADER_SPECIAL_TYPE_MIX_CLOSURE,
SHADER_SPECIAL_TYPE_AUTOCONVERT,
- SHADER_SPECIAL_TYPE_GEOMETRY
+ SHADER_SPECIAL_TYPE_GEOMETRY,
+ SHADER_SPECIAL_TYPE_SCRIPT
};
/* Enum
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 621d52bbbbf..4919222e81c 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -3166,12 +3166,17 @@ FresnelNode::FresnelNode()
void FresnelNode::compile(SVMCompiler& compiler)
{
+ ShaderInput *normal_in = input("Normal");
ShaderInput *ior_in = input("IOR");
ShaderOutput *fac_out = output("Fac");
compiler.stack_assign(ior_in);
compiler.stack_assign(fac_out);
- compiler.add_node(NODE_FRESNEL, ior_in->stack_offset, __float_as_int(ior_in->value.x), fac_out->stack_offset);
+
+ if(normal_in->link)
+ compiler.stack_assign(normal_in);
+
+ compiler.add_node(NODE_FRESNEL, ior_in->stack_offset, __float_as_int(ior_in->value.x), compiler.encode_uchar4(normal_in->stack_offset, fac_out->stack_offset));
}
void FresnelNode::compile(OSLCompiler& compiler)
@@ -3719,6 +3724,7 @@ void SetNormalNode::compile(OSLCompiler& compiler)
OSLScriptNode::OSLScriptNode()
: ShaderNode("osl_script")
{
+ special_type = SHADER_SPECIAL_TYPE_SCRIPT;
}
void OSLScriptNode::compile(SVMCompiler& compiler)
diff --git a/intern/cycles/render/sky_model.h b/intern/cycles/render/sky_model.h
index 4f0833aef5a..3814543c8b6 100644
--- a/intern/cycles/render/sky_model.h
+++ b/intern/cycles/render/sky_model.h
@@ -136,7 +136,7 @@ and solar radii: 'arhosekskymodelstate_alienworld_alloc_init()'.
See the notes about the "Alien World" functionality provided further down for a
discussion of the usefulness and limits of that second initalisation function.
-Sky model states that have been initialised with either function behave in a
+Sky model states that have been initialized with either function behave in a
completely identical fashion during use and cleanup.
Using the model to generate skydome samples
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index 3b0180fd71a..459bee48e0e 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -2,7 +2,7 @@
* compatibility macros to make every ffmpeg installation appear
* like the most current installation (wrapping some functionality sometimes)
* it also includes all ffmpeg header files at once, no need to do it
- * seperately.
+ * separately.
*
* Copyright (c) 2011 Peter Schlaile
*
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 2cc0f476d30..beca24fc5e9 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -131,17 +131,10 @@ if(WITH_HEADLESS OR WITH_GHOST_SDL)
# ack, this is still system dependant
if(APPLE)
- if(WITH_COCOA)
- list(APPEND SRC
- intern/GHOST_SystemPathsCocoa.mm
- intern/GHOST_SystemPathsCocoa.h
- )
- else()
- list(APPEND SRC
- intern/GHOST_SystemPathsCarbon.cpp
- intern/GHOST_SystemPathsCarbon.h
- )
- endif()
+ list(APPEND SRC
+ intern/GHOST_SystemPathsCocoa.mm
+ intern/GHOST_SystemPathsCocoa.h
+ )
elseif(UNIX)
list(APPEND SRC
@@ -172,41 +165,26 @@ if(WITH_HEADLESS OR WITH_GHOST_SDL)
endif()
elseif(APPLE)
- if(WITH_COCOA)
- list(APPEND SRC
- intern/GHOST_DisplayManagerCocoa.mm
- intern/GHOST_SystemCocoa.mm
- intern/GHOST_SystemPathsCocoa.mm
- intern/GHOST_WindowCocoa.mm
-
- intern/GHOST_DisplayManagerCocoa.h
- intern/GHOST_SystemCocoa.h
- intern/GHOST_SystemPathsCocoa.h
- intern/GHOST_WindowCocoa.h
- )
-
- if(WITH_INPUT_NDOF)
- list(APPEND SRC
- intern/GHOST_NDOFManagerCocoa.mm
- intern/GHOST_NDOFManagerCocoa.h
- )
- list(APPEND SRC_NDOF3DCONNEXION
- intern/GHOST_NDOFManager3Dconnexion.c
- intern/GHOST_NDOFManager3Dconnexion.h
- )
- endif()
+ list(APPEND SRC
+ intern/GHOST_DisplayManagerCocoa.mm
+ intern/GHOST_SystemCocoa.mm
+ intern/GHOST_SystemPathsCocoa.mm
+ intern/GHOST_WindowCocoa.mm
+
+ intern/GHOST_DisplayManagerCocoa.h
+ intern/GHOST_SystemCocoa.h
+ intern/GHOST_SystemPathsCocoa.h
+ intern/GHOST_WindowCocoa.h
+ )
- else()
+ if(WITH_INPUT_NDOF)
list(APPEND SRC
- intern/GHOST_DisplayManagerCarbon.cpp
- intern/GHOST_SystemCarbon.cpp
- intern/GHOST_SystemPathsCarbon.cpp
- intern/GHOST_WindowCarbon.cpp
-
- intern/GHOST_DisplayManagerCarbon.h
- intern/GHOST_SystemCarbon.h
- intern/GHOST_SystemPathsCarbon.h
- intern/GHOST_WindowCarbon.h
+ intern/GHOST_NDOFManagerCocoa.mm
+ intern/GHOST_NDOFManagerCocoa.h
+ )
+ list(APPEND SRC_NDOF3DCONNEXION
+ intern/GHOST_NDOFManager3Dconnexion.c
+ intern/GHOST_NDOFManager3Dconnexion.h
)
endif()
@@ -323,6 +301,6 @@ add_definitions(-DGLEW_STATIC)
blender_add_lib(bf_intern_ghost "${SRC}" "${INC}" "${INC_SYS}")
# workaround for apple clang mangling extern "C" symbols
-if(WITH_INPUT_NDOF AND WITH_COCOA)
+if(WITH_INPUT_NDOF AND APPLE)
blender_add_lib(bf_intern_ghostndof3dconnexion "${SRC_NDOF3DCONNEXION}" "${INC}" "${INC_SYS}")
endif()
diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript
index fed8cd7aa3c..df4efe60a11 100644
--- a/intern/ghost/SConscript
+++ b/intern/ghost/SConscript
@@ -55,7 +55,6 @@ incs += ' ' + env['BF_OPENGL_INC']
if env['WITH_GHOST_SDL']:
for f in pf:
try:
- sources.remove('intern' + os.sep + f + 'Carbon.cpp')
sources.remove('intern' + os.sep + f + 'Win32.cpp')
sources.remove('intern' + os.sep + f + 'X11.cpp')
except ValueError:
@@ -66,7 +65,6 @@ elif window_system in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'f
for f in pf:
try:
sources.remove('intern' + os.sep + f + 'Win32.cpp')
- sources.remove('intern' + os.sep + f + 'Carbon.cpp')
sources.remove('intern' + os.sep + f + 'SDL.cpp')
except ValueError:
pass
@@ -94,34 +92,19 @@ elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64
for f in pf:
try:
sources.remove('intern' + os.sep + f + 'X11.cpp')
- sources.remove('intern' + os.sep + f + 'Carbon.cpp')
sources.remove('intern' + os.sep + f + 'SDL.cpp')
except ValueError:
pass
elif window_system == 'darwin':
- if env['WITH_GHOST_COCOA']:
- if env['WITH_BF_QUICKTIME']:
- defs.append('WITH_QUICKTIME')
- if env['USE_QTKIT']:
- defs.append('USE_QTKIT')
- for f in pf:
- try:
- sources.remove('intern' + os.sep + f + 'Win32.cpp')
- sources.remove('intern' + os.sep + f + 'X11.cpp')
- sources.remove('intern' + os.sep + f + 'Carbon.cpp')
- sources.remove('intern' + os.sep + f + 'SDL.cpp')
- except ValueError:
- pass
- else:
- for f in pf:
- try:
- sources.remove('intern' + os.sep + f + 'Win32.cpp')
- sources.remove('intern' + os.sep + f + 'X11.cpp')
- sources.remove('intern' + os.sep + f + 'Cocoa.mm')
- sources.remove('intern' + os.sep + f + 'SDL.cpp')
- except ValueError:
- pass
-
+ if env['WITH_BF_QUICKTIME']:
+ defs.append('WITH_QUICKTIME')
+ for f in pf:
+ try:
+ sources.remove('intern' + os.sep + f + 'Win32.cpp')
+ sources.remove('intern' + os.sep + f + 'X11.cpp')
+ sources.remove('intern' + os.sep + f + 'SDL.cpp')
+ except ValueError:
+ pass
else:
print "Unknown window system specified."
Exit()
@@ -155,7 +138,7 @@ if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-v
if window_system in ('win32-vc', 'win64-vc'):
env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15]) #, cc_compileflags=env['CCFLAGS'].append('/WX') )
-elif env['WITH_GHOST_COCOA']: # always use default-Apple-gcc for objC language, for gnu-compilers do not support it fully yet
+elif window_system == 'darwin': # always use default-Apple-gcc for objC language, for gnu-compilers do not support it fully yet
env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15], cc_compilerchange='/usr/bin/gcc', cxx_compilerchange='/usr/bin/g++' )
print "GHOST COCOA WILL BE COMPILED WITH APPLE GCC"
if env['WITH_BF_3DMOUSE']:
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp b/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp
deleted file mode 100644
index 25e9123dae6..00000000000
--- a/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file ghost/intern/GHOST_DisplayManagerCarbon.cpp
- * \ingroup GHOST
- */
-
-
-/**
- * Copyright (C) 2001 NaN Technologies B.V.
- * \author Maarten Gribnau
- * \date September 21, 2001
- */
-
-#include "GHOST_DisplayManagerCarbon.h"
-#include "GHOST_Debug.h"
-
-// We do not support multiple monitors at the moment
-
-
-GHOST_DisplayManagerCarbon::GHOST_DisplayManagerCarbon(void)
-{
- if (::CGGetActiveDisplayList(0, NULL, &m_numDisplays) != CGDisplayNoErr)
- {
- m_numDisplays = 0;
- m_displayIDs = NULL;
- }
- if (m_numDisplays > 0)
- {
- m_displayIDs = new CGDirectDisplayID[m_numDisplays];
- GHOST_ASSERT((m_displayIDs != NULL), "GHOST_DisplayManagerCarbon::GHOST_DisplayManagerCarbon(): memory allocation failed");
- ::CGGetActiveDisplayList(m_numDisplays, m_displayIDs, &m_numDisplays);
- }
-}
-
-
-GHOST_TSuccess GHOST_DisplayManagerCarbon::getNumDisplays(GHOST_TUns8& numDisplays) const
-{
- numDisplays = (GHOST_TUns8) m_numDisplays;
- return GHOST_kSuccess;
-}
-
-
-GHOST_TSuccess GHOST_DisplayManagerCarbon::getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const
-{
- GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerCarbon::getNumDisplaySettings(): only main display is supported");
-
- CFArrayRef displayModes;
- displayModes = ::CGDisplayAvailableModes(m_displayIDs[display]);
- CFIndex numModes = ::CFArrayGetCount(displayModes);
- numSettings = (GHOST_TInt32)numModes;
-
- return GHOST_kSuccess;
-}
-
-
-GHOST_TSuccess GHOST_DisplayManagerCarbon::getDisplaySetting(GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting) const
-{
- GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerCarbon::getDisplaySetting(): only main display is supported");
-
- CFArrayRef displayModes;
- CGDirectDisplayID d = m_displayIDs[display];
- displayModes = ::CGDisplayAvailableModes(d);
- //CFIndex numModes = ::CFArrayGetCount(displayModes);/*unused*/
- //GHOST_TInt32 numSettings = (GHOST_TInt32)numModes; /*unused*/
- CFDictionaryRef displayModeValues = (CFDictionaryRef) ::CFArrayGetValueAtIndex(displayModes, index);
-
- setting.xPixels = getValue(displayModeValues, kCGDisplayWidth);
- setting.yPixels = getValue(displayModeValues, kCGDisplayHeight);
- setting.bpp = getValue(displayModeValues, kCGDisplayBitsPerPixel);
- setting.frequency = getValue(displayModeValues, kCGDisplayRefreshRate);
-
-#ifdef GHOST_DEBUG
- printf("display mode: width=%d, height=%d, bpp=%d, frequency=%d\n", setting.xPixels, setting.yPixels, setting.bpp, setting.frequency);
-#endif // GHOST_DEBUG
-
- return GHOST_kSuccess;
-}
-
-
-GHOST_TSuccess GHOST_DisplayManagerCarbon::getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting& setting) const
-{
- GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerCarbon::getCurrentDisplaySetting(): only main display is supported");
-
- CFDictionaryRef displayModeValues = ::CGDisplayCurrentMode(m_displayIDs[display]);
-
- setting.xPixels = getValue(displayModeValues, kCGDisplayWidth);
- setting.yPixels = getValue(displayModeValues, kCGDisplayHeight);
- setting.bpp = getValue(displayModeValues, kCGDisplayBitsPerPixel);
- setting.frequency = getValue(displayModeValues, kCGDisplayRefreshRate);
-
-#ifdef GHOST_DEBUG
- printf("current display mode: width=%d, height=%d, bpp=%d, frequency=%d\n", setting.xPixels, setting.yPixels, setting.bpp, setting.frequency);
-#endif // GHOST_DEBUG
-
- return GHOST_kSuccess;
-}
-
-
-GHOST_TSuccess GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting& setting)
-{
- GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): only main display is supported");
-
-#ifdef GHOST_DEBUG
- printf("GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): requested settings:\n");
- printf(" setting.xPixels=%d\n", setting.xPixels);
- printf(" setting.yPixels=%d\n", setting.yPixels);
- printf(" setting.bpp=%d\n", setting.bpp);
- printf(" setting.frequency=%d\n", setting.frequency);
-#endif // GHOST_DEBUG
-
- CFDictionaryRef displayModeValues = ::CGDisplayBestModeForParametersAndRefreshRate(
- m_displayIDs[display],
- (size_t)setting.bpp,
- (size_t)setting.xPixels,
- (size_t)setting.yPixels,
- (CGRefreshRate)setting.frequency,
- NULL);
-
-#ifdef GHOST_DEBUG
- printf("GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): switching to:\n");
- printf(" setting.xPixels=%d\n", getValue(displayModeValues, kCGDisplayWidth));
- printf(" setting.yPixels=%d\n", getValue(displayModeValues, kCGDisplayHeight));
- printf(" setting.bpp=%d\n", getValue(displayModeValues, kCGDisplayBitsPerPixel));
- printf(" setting.frequency=%d\n", getValue(displayModeValues, kCGDisplayRefreshRate));
-#endif // GHOST_DEBUG
-
- CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);
-
- return err == CGDisplayNoErr ? GHOST_kSuccess : GHOST_kFailure;
-}
-
-
-long GHOST_DisplayManagerCarbon::getValue(CFDictionaryRef values, CFStringRef key) const
-{
- CFNumberRef numberValue = (CFNumberRef) CFDictionaryGetValue(values, key);
-
- if (!numberValue)
- {
- return -1;
- }
-
- long intValue;
-
- if (!CFNumberGetValue(numberValue, kCFNumberLongType, &intValue))
- {
- return -1;
- }
-
- return intValue;
-}
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCarbon.h b/intern/ghost/intern/GHOST_DisplayManagerCarbon.h
deleted file mode 100644
index 1ac6540b7bd..00000000000
--- a/intern/ghost/intern/GHOST_DisplayManagerCarbon.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file ghost/intern/GHOST_DisplayManagerCarbon.h
- * \ingroup GHOST
- * Declaration of GHOST_DisplayManagerCarbon class.
- */
-
-#ifndef __GHOST_DISPLAYMANAGERCARBON_H__
-#define __GHOST_DISPLAYMANAGERCARBON_H__
-
-#ifndef __APPLE__
-#error Apple only!
-#endif // __APPLE__
-
-#include "GHOST_DisplayManager.h"
-
-#define __CARBONSOUND__
-#include <Carbon/Carbon.h>
-
-/**
- * Manages system displays (Mac OSX/Carbon implementation).
- * \see GHOST_DisplayManager
- * \author Maarten Gribnau
- * \date September 21, 2001
- */
-class GHOST_DisplayManagerCarbon : public GHOST_DisplayManager
-{
-public:
- /**
- * Constructor.
- */
- GHOST_DisplayManagerCarbon(void);
-
- /**
- * Returns the number of display devices on this system.
- * \param numDisplays The number of displays on this system.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess getNumDisplays(GHOST_TUns8& numDisplays) const;
-
- /**
- * Returns the number of display settings for this display device.
- * \param display The index of the display to query with 0 <= display < getNumDisplays().
- * \param setting The number of settings of the display device with this index.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const;
-
- /**
- * Returns the current setting for this display device.
- * \param display The index of the display to query with 0 <= display < getNumDisplays().
- * \param index The setting index to be returned.
- * \param setting The setting of the display device with this index.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting) const;
-
- /**
- * Returns the current setting for this display device.
- * \param display The index of the display to query with 0 <= display < getNumDisplays().
- * \param setting The current setting of the display device with this index.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting& setting) const;
-
- /**
- * Changes the current setting for this display device.
- * \param display The index of the display to query with 0 <= display < getNumDisplays().
- * \param setting The current setting of the display device with this index.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting& setting);
-
-protected:
- /**
- * Returns a value from a dictionary.
- * \param values Dictionary to return value from.
- * \param key Key to return value for.
- * \return The value for this key.
- */
- long getValue(CFDictionaryRef values, CFStringRef key) const;
-
- /** Cached number of displays. */
- CGDisplayCount m_numDisplays;
- /** Cached display id's for each display. */
- CGDirectDisplayID *m_displayIDs;
-};
-
-
-#endif // __GHOST_DISPLAYMANAGERCARBON_H__
-
diff --git a/intern/ghost/intern/GHOST_ISystem.cpp b/intern/ghost/intern/GHOST_ISystem.cpp
index f6973caad03..009753cb29e 100644
--- a/intern/ghost/intern/GHOST_ISystem.cpp
+++ b/intern/ghost/intern/GHOST_ISystem.cpp
@@ -46,11 +46,7 @@
# include "GHOST_SystemWin32.h"
#else
# ifdef __APPLE__
-# ifdef GHOST_COCOA
-# include "GHOST_SystemCocoa.h"
-# else
-# include "GHOST_SystemCarbon.h"
-# endif
+# include "GHOST_SystemCocoa.h"
# else
# include "GHOST_SystemX11.h"
# endif
@@ -72,11 +68,7 @@ GHOST_TSuccess GHOST_ISystem::createSystem()
m_system = new GHOST_SystemWin32();
#else
# ifdef __APPLE__
-# ifdef GHOST_COCOA
m_system = new GHOST_SystemCocoa();
-# else
- m_system = new GHOST_SystemCarbon();
-# endif
# else
m_system = new GHOST_SystemX11();
# endif
diff --git a/intern/ghost/intern/GHOST_ISystemPaths.cpp b/intern/ghost/intern/GHOST_ISystemPaths.cpp
index ae9a8e49057..581467fb666 100644
--- a/intern/ghost/intern/GHOST_ISystemPaths.cpp
+++ b/intern/ghost/intern/GHOST_ISystemPaths.cpp
@@ -42,11 +42,7 @@
# include "GHOST_SystemPathsWin32.h"
#else
# ifdef __APPLE__
-# ifdef GHOST_COCOA
# include "GHOST_SystemPathsCocoa.h"
-# else
-# include "GHOST_SystemPathsCarbon.h"
-# endif
# else
# include "GHOST_SystemPathsX11.h"
# endif
@@ -64,11 +60,7 @@ GHOST_TSuccess GHOST_ISystemPaths::create()
m_systemPaths = new GHOST_SystemPathsWin32();
#else
# ifdef __APPLE__
-# ifdef GHOST_COCOA
m_systemPaths = new GHOST_SystemPathsCocoa();
-# else
- m_systemPaths = new GHOST_SystemPathsCarbon();
-# endif
# else
m_systemPaths = new GHOST_SystemPathsX11();
# endif
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
deleted file mode 100644
index 6e72e26beb4..00000000000
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ /dev/null
@@ -1,1241 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file ghost/intern/GHOST_SystemCarbon.cpp
- * \ingroup GHOST
- */
-
-
-/**
- * Copyright (C) 2001 NaN Technologies B.V.
- * \author Maarten Gribnau
- * \date May 7, 2001
- */
-
-#include <Carbon/Carbon.h>
-#include <ApplicationServices/ApplicationServices.h>
-#include "GHOST_SystemCarbon.h"
-
-#include "GHOST_DisplayManagerCarbon.h"
-#include "GHOST_EventKey.h"
-#include "GHOST_EventButton.h"
-#include "GHOST_EventCursor.h"
-#include "GHOST_EventWheel.h"
-#ifdef WITH_INPUT_NDOF
-#include "GHOST_EventNDOF.h"
-#endif
-
-#include "GHOST_TimerManager.h"
-#include "GHOST_TimerTask.h"
-#include "GHOST_WindowManager.h"
-#include "GHOST_WindowCarbon.h"
-#include "GHOST_NDOFManager.h"
-#include "AssertMacros.h"
-
-/* blender class and types events */
-enum {
- kEventClassBlender = 'blnd'
-};
-
-enum {
- kEventBlenderNdofAxis = 1,
- kEventBlenderNdofButtons = 2
-};
-
-const EventTypeSpec kEvents[] =
-{
- { kEventClassAppleEvent, kEventAppleEvent },
-#if 0
- { kEventClassApplication, kEventAppActivated },
- { kEventClassApplication, kEventAppDeactivated },
- #endif
- { kEventClassKeyboard, kEventRawKeyDown },
- { kEventClassKeyboard, kEventRawKeyRepeat },
- { kEventClassKeyboard, kEventRawKeyUp },
- { kEventClassKeyboard, kEventRawKeyModifiersChanged },
-
- { kEventClassMouse, kEventMouseDown },
- { kEventClassMouse, kEventMouseUp },
- { kEventClassMouse, kEventMouseMoved },
- { kEventClassMouse, kEventMouseDragged },
- { kEventClassMouse, kEventMouseWheelMoved },
-
- { kEventClassWindow, kEventWindowClickZoomRgn }, /* for new zoom behaviour */
- { kEventClassWindow, kEventWindowZoom }, /* for new zoom behaviour */
- { kEventClassWindow, kEventWindowExpand }, /* for new zoom behaviour */
- { kEventClassWindow, kEventWindowExpandAll }, /* for new zoom behaviour */
-
- { kEventClassWindow, kEventWindowClose },
- { kEventClassWindow, kEventWindowActivated },
- { kEventClassWindow, kEventWindowDeactivated },
- { kEventClassWindow, kEventWindowUpdate },
- { kEventClassWindow, kEventWindowBoundsChanged },
-
- { kEventClassBlender, kEventBlenderNdofAxis },
- { kEventClassBlender, kEventBlenderNdofButtons }
-
-
-
-};
-
-
-
-static GHOST_TButtonMask convertButton(EventMouseButton button)
-{
- switch (button) {
- case kEventMouseButtonPrimary:
- return GHOST_kButtonMaskLeft;
- case kEventMouseButtonSecondary:
- return GHOST_kButtonMaskRight;
- case kEventMouseButtonTertiary:
- default:
- return GHOST_kButtonMaskMiddle;
- }
-}
-
-static GHOST_TKey convertKey(int rawCode)
-{
- /* This bit of magic converts the rawCode into a virtual
- * Mac key based on the current keyboard mapping, but
- * without regard to the modifiers (so we don't get 'a'
- * and 'A' for example.
- */
- static UInt32 dummy = 0;
- Handle transData = (Handle) GetScriptManagerVariable(smKCHRCache);
- unsigned char vk = KeyTranslate(transData, rawCode, &dummy);
- /* Map numpad based on rawcodes first, otherwise they
- * look like non-numpad events.
- * Added too: mapping the number keys, for french keyboards etc (ton)
- */
- // printf("GHOST: vk: %d %c raw: %d\n", vk, vk, rawCode);
-
- switch (rawCode) {
- case 18: return GHOST_kKey1;
- case 19: return GHOST_kKey2;
- case 20: return GHOST_kKey3;
- case 21: return GHOST_kKey4;
- case 23: return GHOST_kKey5;
- case 22: return GHOST_kKey6;
- case 26: return GHOST_kKey7;
- case 28: return GHOST_kKey8;
- case 25: return GHOST_kKey9;
- case 29: return GHOST_kKey0;
-
- case 82: return GHOST_kKeyNumpad0;
- case 83: return GHOST_kKeyNumpad1;
- case 84: return GHOST_kKeyNumpad2;
- case 85: return GHOST_kKeyNumpad3;
- case 86: return GHOST_kKeyNumpad4;
- case 87: return GHOST_kKeyNumpad5;
- case 88: return GHOST_kKeyNumpad6;
- case 89: return GHOST_kKeyNumpad7;
- case 91: return GHOST_kKeyNumpad8;
- case 92: return GHOST_kKeyNumpad9;
- case 65: return GHOST_kKeyNumpadPeriod;
- case 76: return GHOST_kKeyNumpadEnter;
- case 69: return GHOST_kKeyNumpadPlus;
- case 78: return GHOST_kKeyNumpadMinus;
- case 67: return GHOST_kKeyNumpadAsterisk;
- case 75: return GHOST_kKeyNumpadSlash;
- }
-
- if ((vk >= 'a') && (vk <= 'z')) {
- return (GHOST_TKey) (vk - 'a' + GHOST_kKeyA);
- }
- else if ((vk >= '0') && (vk <= '9')) {
- return (GHOST_TKey) (vk - '0' + GHOST_kKey0);
- }
- else if (vk == 16) {
- switch (rawCode) {
- case 122: return GHOST_kKeyF1;
- case 120: return GHOST_kKeyF2;
- case 99: return GHOST_kKeyF3;
- case 118: return GHOST_kKeyF4;
- case 96: return GHOST_kKeyF5;
- case 97: return GHOST_kKeyF6;
- case 98: return GHOST_kKeyF7;
- case 100: return GHOST_kKeyF8;
- case 101: return GHOST_kKeyF9;
- case 109: return GHOST_kKeyF10;
- case 103: return GHOST_kKeyF11;
- case 111: return GHOST_kKeyF12; // Never get, is used for ejecting the CD!
- }
- }
- else {
- switch (vk) {
- case kUpArrowCharCode: return GHOST_kKeyUpArrow;
- case kDownArrowCharCode: return GHOST_kKeyDownArrow;
- case kLeftArrowCharCode: return GHOST_kKeyLeftArrow;
- case kRightArrowCharCode: return GHOST_kKeyRightArrow;
-
- case kReturnCharCode: return GHOST_kKeyEnter;
- case kBackspaceCharCode: return GHOST_kKeyBackSpace;
- case kDeleteCharCode: return GHOST_kKeyDelete;
- case kEscapeCharCode: return GHOST_kKeyEsc;
- case kTabCharCode: return GHOST_kKeyTab;
- case kSpaceCharCode: return GHOST_kKeySpace;
-
- case kHomeCharCode: return GHOST_kKeyHome;
- case kEndCharCode: return GHOST_kKeyEnd;
- case kPageUpCharCode: return GHOST_kKeyUpPage;
- case kPageDownCharCode: return GHOST_kKeyDownPage;
-
- case '-': return GHOST_kKeyMinus;
- case '=': return GHOST_kKeyEqual;
- case ',': return GHOST_kKeyComma;
- case '.': return GHOST_kKeyPeriod;
- case '/': return GHOST_kKeySlash;
- case ';': return GHOST_kKeySemicolon;
- case '\'': return GHOST_kKeyQuote;
- case '\\': return GHOST_kKeyBackslash;
- case '[': return GHOST_kKeyLeftBracket;
- case ']': return GHOST_kKeyRightBracket;
- case '`': return GHOST_kKeyAccentGrave;
- }
- }
-
- // printf("GHOST: unknown key: %d %d\n", vk, rawCode);
-
- return GHOST_kKeyUnknown;
-}
-
-/* MacOSX returns a Roman charset with kEventParamKeyMacCharCodes
- * as defined here: http://developer.apple.com/documentation/mac/Text/Text-516.html
- * I am not sure how international this works...
- * For cross-platform convention, we'll use the Latin ascii set instead.
- * As defined at: http://www.ramsch.org/martin/uni/fmi-hp/iso8859-1.html
- *
- */
-static unsigned char convertRomanToLatin(unsigned char ascii)
-{
-
- if (ascii < 128) return ascii;
-
- switch (ascii) {
- case 128: return 142;
- case 129: return 143;
- case 130: return 128;
- case 131: return 201;
- case 132: return 209;
- case 133: return 214;
- case 134: return 220;
- case 135: return 225;
- case 136: return 224;
- case 137: return 226;
- case 138: return 228;
- case 139: return 227;
- case 140: return 229;
- case 141: return 231;
- case 142: return 233;
- case 143: return 232;
- case 144: return 234;
- case 145: return 235;
- case 146: return 237;
- case 147: return 236;
- case 148: return 238;
- case 149: return 239;
- case 150: return 241;
- case 151: return 243;
- case 152: return 242;
- case 153: return 244;
- case 154: return 246;
- case 155: return 245;
- case 156: return 250;
- case 157: return 249;
- case 158: return 251;
- case 159: return 252;
- case 160: return 0;
- case 161: return 176;
- case 162: return 162;
- case 163: return 163;
- case 164: return 167;
- case 165: return 183;
- case 166: return 182;
- case 167: return 223;
- case 168: return 174;
- case 169: return 169;
- case 170: return 174;
- case 171: return 180;
- case 172: return 168;
- case 173: return 0;
- case 174: return 198;
- case 175: return 216;
- case 176: return 0;
- case 177: return 177;
- case 178: return 0;
- case 179: return 0;
- case 180: return 165;
- case 181: return 181;
- case 182: return 0;
- case 183: return 0;
- case 184: return 215;
- case 185: return 0;
- case 186: return 0;
- case 187: return 170;
- case 188: return 186;
- case 189: return 0;
- case 190: return 230;
- case 191: return 248;
- case 192: return 191;
- case 193: return 161;
- case 194: return 172;
- case 195: return 0;
- case 196: return 0;
- case 197: return 0;
- case 198: return 0;
- case 199: return 171;
- case 200: return 187;
- case 201: return 201;
- case 202: return 0;
- case 203: return 192;
- case 204: return 195;
- case 205: return 213;
- case 206: return 0;
- case 207: return 0;
- case 208: return 0;
- case 209: return 0;
- case 210: return 0;
-
- case 214: return 247;
-
- case 229: return 194;
- case 230: return 202;
- case 231: return 193;
- case 232: return 203;
- case 233: return 200;
- case 234: return 205;
- case 235: return 206;
- case 236: return 207;
- case 237: return 204;
- case 238: return 211;
- case 239: return 212;
- case 240: return 0;
- case 241: return 210;
- case 242: return 218;
- case 243: return 219;
- case 244: return 217;
- case 245: return 0;
- case 246: return 0;
- case 247: return 0;
- case 248: return 0;
- case 249: return 0;
- case 250: return 0;
-
-
- default: return 0;
- }
-
-}
-
-
-/***/
-
-GHOST_SystemCarbon::GHOST_SystemCarbon() :
- m_modifierMask(0)
-{
- m_displayManager = new GHOST_DisplayManagerCarbon();
- GHOST_ASSERT(m_displayManager, "GHOST_SystemCarbon::GHOST_SystemCarbon(): m_displayManager==0\n");
- m_displayManager->initialize();
-
- UnsignedWide micros;
- ::Microseconds(&micros);
- m_start_time = UnsignedWideToUInt64(micros) / 1000;
- m_ignoreWindowSizedMessages = false;
-}
-
-GHOST_SystemCarbon::~GHOST_SystemCarbon()
-{
-}
-
-
-GHOST_TUns64 GHOST_SystemCarbon::getMilliSeconds() const
-{
- UnsignedWide micros;
- ::Microseconds(&micros);
- UInt64 millis;
- millis = UnsignedWideToUInt64(micros);
- return (millis / 1000) - m_start_time;
-}
-
-GHOST_TUns8 GHOST_SystemCarbon::getNumDisplays() const
-{
- // We do not support multiple monitors at the moment
- return 1;
-}
-
-
-void GHOST_SystemCarbon::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
-{
- BitMap screenBits;
- Rect bnds = GetQDGlobalsScreenBits(&screenBits)->bounds;
- width = bnds.right - bnds.left;
- height = bnds.bottom - bnds.top;
-}
-
-void GHOST_SystemCarbon::getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
-{
- /* TODO */
- getMainDisplayDimensions(width, height);
-}
-
-GHOST_IWindow *GHOST_SystemCarbon::createWindow(
- const STR_String& title,
- GHOST_TInt32 left,
- GHOST_TInt32 top,
- GHOST_TUns32 width,
- GHOST_TUns32 height,
- GHOST_TWindowState state,
- GHOST_TDrawingContextType type,
- bool stereoVisual,
- const bool exclusive,
- const GHOST_TUns16 numOfAASamples,
- const GHOST_TEmbedderWindowID parentWindow)
-{
- GHOST_IWindow *window = 0;
-
- window = new GHOST_WindowCarbon(title, left, top, width, height, state, type);
-
- if (window) {
- if (window->getValid()) {
- // Store the pointer to the window
- GHOST_ASSERT(m_windowManager, "m_windowManager not initialized");
- m_windowManager->addWindow(window);
- m_windowManager->setActiveWindow(window);
- pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
- }
- else {
- GHOST_PRINT("GHOST_SystemCarbon::createWindow(): window invalid\n");
- delete window;
- window = 0;
- }
- }
- else {
- GHOST_PRINT("GHOST_SystemCarbon::createWindow(): could not create window\n");
- }
- return window;
-}
-
-GHOST_TSuccess GHOST_SystemCarbon::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window, const bool stereoVisual)
-{
- GHOST_TSuccess success = GHOST_kFailure;
-
- // need yo make this Carbon all on 10.5 for fullscreen to work correctly
- CGCaptureAllDisplays();
-
- success = GHOST_System::beginFullScreen(setting, window, stereoVisual);
-
- if (success != GHOST_kSuccess) {
- // fullscreen failed for other reasons, release
- CGReleaseAllDisplays();
- }
-
- return success;
-}
-
-GHOST_TSuccess GHOST_SystemCarbon::endFullScreen(void)
-{
- CGReleaseAllDisplays();
- return GHOST_System::endFullScreen();
-}
-
-/* this is an old style low level event queue.
- * As we want to handle our own timers, this is ok.
- * the full screen hack should be removed */
-bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
-{
- bool anyProcessed = false;
- EventRef event;
-
-// SetMouseCoalescingEnabled(false, NULL);
-
- do {
- GHOST_TimerManager *timerMgr = getTimerManager();
-
- if (waitForEvent) {
- GHOST_TUns64 next = timerMgr->nextFireTime();
- double timeOut;
-
- if (next == GHOST_kFireTimeNever) {
- timeOut = kEventDurationForever;
- }
- else {
- timeOut = (double)(next - getMilliSeconds()) / 1000.0;
- if (timeOut < 0.0)
- timeOut = 0.0;
- }
-
- ::ReceiveNextEvent(0, NULL, timeOut, false, &event);
- }
-
- if (timerMgr->fireTimers(getMilliSeconds())) {
- anyProcessed = true;
- }
-
- if (getFullScreen()) {
- // Check if the full-screen window is dirty
- GHOST_IWindow *window = m_windowManager->getFullScreenWindow();
- if (((GHOST_WindowCarbon *)window)->getFullScreenDirty()) {
- pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
- anyProcessed = true;
- }
- }
-
- /* end loop when no more events available */
- while (::ReceiveNextEvent(0, NULL, 0, true, &event) == noErr) {
- OSStatus status = ::SendEventToEventTarget(event, ::GetEventDispatcherTarget());
- if (status == noErr) {
- anyProcessed = true;
- }
- else {
- UInt32 i = ::GetEventClass(event);
-
- /* Ignore 'cgs ' class, no documentation on what they
- * are, but we get a lot of them
- */
- if (i != 'cgs ') {
- if (i != 'tblt') { // tablet event. we use the one packaged in the mouse event
- ; //printf("Missed - Class: '%.4s', Kind: %d\n", &i, ::GetEventKind(event));
- }
- }
- }
- ::ReleaseEvent(event);
- }
- } while (waitForEvent && !anyProcessed);
-
- return anyProcessed;
-}
-
-
-GHOST_TSuccess GHOST_SystemCarbon::getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const
-{
- Point mouseLoc;
- // Get the position of the mouse in the active port
- ::GetGlobalMouse(&mouseLoc);
- // Convert the coordinates to screen coordinates
- x = (GHOST_TInt32)mouseLoc.h;
- y = (GHOST_TInt32)mouseLoc.v;
- return GHOST_kSuccess;
-}
-
-
-GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
-{
- float xf = (float)x, yf = (float)y;
-
- CGAssociateMouseAndMouseCursorPosition(false);
- CGSetLocalEventsSuppressionInterval(0);
- CGWarpMouseCursorPosition(CGPointMake(xf, yf));
- CGAssociateMouseAndMouseCursorPosition(true);
-
-//this doesn't work properly, see game engine mouse-look scripts
-// CGWarpMouseCursorPosition(CGPointMake(xf, yf));
- // this call below sends event, but empties other events (like shift)
- // CGPostMouseEvent(CGPointMake(xf, yf), TRUE, 1, FALSE, 0);
-
- return GHOST_kSuccess;
-}
-
-
-GHOST_TSuccess GHOST_SystemCarbon::getModifierKeys(GHOST_ModifierKeys& keys) const
-{
- UInt32 modifiers = ::GetCurrentKeyModifiers();
-
- keys.set(GHOST_kModifierKeyOS, (modifiers & cmdKey) ? true : false);
- keys.set(GHOST_kModifierKeyLeftAlt, (modifiers & optionKey) ? true : false);
- keys.set(GHOST_kModifierKeyLeftShift, (modifiers & shiftKey) ? true : false);
- keys.set(GHOST_kModifierKeyLeftControl, (modifiers & controlKey) ? true : false);
-
- return GHOST_kSuccess;
-}
-
-/* XXX, incorrect for multibutton mice */
-GHOST_TSuccess GHOST_SystemCarbon::getButtons(GHOST_Buttons& buttons) const
-{
- Boolean theOnlyButtonIsDown = ::Button();
- buttons.clear();
- buttons.set(GHOST_kButtonMaskLeft, theOnlyButtonIsDown);
- return GHOST_kSuccess;
-}
-
-#define FIRSTFILEBUFLG 512
-static bool g_hasFirstFile = false;
-static char g_firstFileBuf[512];
-
-extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
-{
- if (g_hasFirstFile) {
- strncpy(buf, g_firstFileBuf, FIRSTFILEBUFLG - 1);
- buf[FIRSTFILEBUFLG - 1] = '\0';
- return 1;
- }
- else {
- return 0;
- }
-}
-
-OSErr GHOST_SystemCarbon::sAEHandlerLaunch(const AppleEvent *event, AppleEvent *reply, SInt32 refCon)
-{
- //GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) refCon;
-
- return noErr;
-}
-
-OSErr GHOST_SystemCarbon::sAEHandlerOpenDocs(const AppleEvent *event, AppleEvent *reply, SInt32 refCon)
-{
- //GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) refCon;
- AEDescList docs;
- SInt32 ndocs;
- OSErr err;
-
- err = AEGetParamDesc(event, keyDirectObject, typeAEList, &docs);
- if (err != noErr) return err;
-
- err = AECountItems(&docs, &ndocs);
- if (err == noErr) {
- int i;
-
- for (i = 0; i < ndocs; i++) {
- FSSpec fss;
- AEKeyword kwd;
- DescType actType;
- Size actSize;
-
- err = AEGetNthPtr(&docs, i + 1, typeFSS, &kwd, &actType, &fss, sizeof(fss), &actSize);
- if (err != noErr)
- break;
-
- if (i == 0) {
- FSRef fsref;
-
- if (FSpMakeFSRef(&fss, &fsref) != noErr)
- break;
- if (FSRefMakePath(&fsref, (UInt8 *) g_firstFileBuf, sizeof(g_firstFileBuf)) != noErr)
- break;
-
- g_hasFirstFile = true;
- }
- }
- }
-
- AEDisposeDesc(&docs);
-
- return err;
-}
-
-OSErr GHOST_SystemCarbon::sAEHandlerPrintDocs(const AppleEvent *event, AppleEvent *reply, SInt32 refCon)
-{
- //GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) refCon;
-
- return noErr;
-}
-
-OSErr GHOST_SystemCarbon::sAEHandlerQuit(const AppleEvent *event, AppleEvent *reply, SInt32 refCon)
-{
- GHOST_SystemCarbon *sys = (GHOST_SystemCarbon *) refCon;
-
- sys->pushEvent(new GHOST_Event(sys->getMilliSeconds(), GHOST_kEventQuit, NULL) );
-
- return noErr;
-}
-
-
-GHOST_TSuccess GHOST_SystemCarbon::init()
-{
-
- GHOST_TSuccess success = GHOST_System::init();
- if (success) {
- /*
- * Initialize the cursor to the standard arrow shape (so that we can change it later on).
- * This initializes the cursor's visibility counter to 0.
- */
- ::InitCursor();
-
- MenuRef windMenu;
- ::CreateStandardWindowMenu(0, &windMenu);
- ::InsertMenu(windMenu, 0);
- ::DrawMenuBar();
-
- ::InstallApplicationEventHandler(sEventHandlerProc, GetEventTypeCount(kEvents), kEvents, this, &m_handler);
-
- ::AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, sAEHandlerLaunch, (SInt32) this, false);
- ::AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, sAEHandlerOpenDocs, (SInt32) this, false);
- ::AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, sAEHandlerPrintDocs, (SInt32) this, false);
- ::AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, sAEHandlerQuit, (SInt32) this, false);
-
- }
- return success;
-}
-
-
-GHOST_TSuccess GHOST_SystemCarbon::exit()
-{
- return GHOST_System::exit();
-}
-
-
-OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
-{
- WindowRef windowRef;
- GHOST_WindowCarbon *window;
- OSStatus err = eventNotHandledErr;
-
- // Check if the event was send to a GHOST window
- ::GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &windowRef);
- window = (GHOST_WindowCarbon *) ::GetWRefCon(windowRef);
- if (!validWindow(window)) {
- return err;
- }
-
- //if (!getFullScreen()) {
- err = noErr;
- switch (::GetEventKind(event))
- {
- case kEventWindowClose:
- pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window) );
- break;
- case kEventWindowActivated:
- m_windowManager->setActiveWindow(window);
- window->loadCursor(window->getCursorVisibility(), window->getCursorShape());
- pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window) );
- break;
- case kEventWindowDeactivated:
- m_windowManager->setWindowInactive(window);
- pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window) );
- break;
- case kEventWindowUpdate:
- //if (getFullScreen()) GHOST_PRINT("GHOST_SystemCarbon::handleWindowEvent(): full-screen update event\n");
- pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
- break;
- case kEventWindowBoundsChanged:
- if (!m_ignoreWindowSizedMessages)
- {
- window->updateDrawingContext();
- pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
- }
- break;
- default:
- err = eventNotHandledErr;
- break;
- }
-// }
- //else {
- //window = (GHOST_WindowCarbon*) m_windowManager->getFullScreenWindow();
- //GHOST_PRINT("GHOST_SystemCarbon::handleWindowEvent(): full-screen window event, " << window << "\n");
- //::RemoveEventFromQueue(::GetMainEventQueue(), event);
- //}
-
- return err;
-}
-
-OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
-{
- GHOST_IWindow *window = m_windowManager->getActiveWindow();
- TabletPointRec tabletPointRecord;
- TabletProximityRec tabletProximityRecord;
- UInt32 anInt32;
- GHOST_TabletData& ct = ((GHOST_WindowCarbon *)window)->GetCarbonTabletData();
- OSStatus err = eventNotHandledErr;
-
- ct.Pressure = 0;
- ct.Xtilt = 0;
- ct.Ytilt = 0;
-
- // is there an embedded tablet event inside this mouse event?
- if (noErr == GetEventParameter(event, kEventParamTabletEventType, typeUInt32, NULL, sizeof(UInt32), NULL, (void *)&anInt32))
- {
- // yes there is one!
- // Embedded tablet events can either be a proximity or pointer event.
- if (anInt32 == kEventTabletPoint)
- {
- //GHOST_PRINT("Embedded pointer event!\n");
-
- // Extract the tablet Pointer Event. If there is no Tablet Pointer data
- // in this event, then this call will return an error. Just ignore the
- // error and go on. This can occur when a proximity event is embedded in
- // a mouse event and you did not check the mouse event to see which type
- // of tablet event was embedded.
- if (noErr == GetEventParameter(event, kEventParamTabletPointRec,
- typeTabletPointRec, NULL,
- sizeof(TabletPointRec),
- NULL, (void *)&tabletPointRecord))
- {
- ct.Pressure = tabletPointRecord.pressure / 65535.0f;
- ct.Xtilt = tabletPointRecord.tiltX / 32767.0f; /* can be positive or negative */
- ct.Ytilt = tabletPointRecord.tiltY / 32767.0f; /* can be positive or negative */
- }
- }
- else {
- //GHOST_PRINT("Embedded proximity event\n");
-
- // Extract the Tablet Proximity record from the event.
- if (noErr == GetEventParameter(event, kEventParamTabletProximityRec,
- typeTabletProximityRec, NULL,
- sizeof(TabletProximityRec),
- NULL, (void *)&tabletProximityRecord))
- {
- if (tabletProximityRecord.enterProximity) {
- //pointer is entering tablet area proximity
-
- switch (tabletProximityRecord.pointerType)
- {
- case 1: /* stylus */
- ct.Active = GHOST_kTabletModeStylus;
- break;
- case 2: /* puck, not supported so far */
- ct.Active = GHOST_kTabletModeNone;
- break;
- case 3: /* eraser */
- ct.Active = GHOST_kTabletModeEraser;
- break;
- default:
- ct.Active = GHOST_kTabletModeNone;
- break;
- }
- }
- else {
- // pointer is leaving - return to mouse
- ct.Active = GHOST_kTabletModeNone;
- }
- }
- }
- err = noErr;
- }
- return err;
-}
-
-OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
-{
- OSStatus err = eventNotHandledErr;
- GHOST_IWindow *window = m_windowManager->getActiveWindow();
- UInt32 kind = ::GetEventKind(event);
-
- switch (kind)
- {
- case kEventMouseDown:
- case kEventMouseUp:
- // Handle Mac application responsibilities
- if ((kind == kEventMouseDown) && handleMouseDown(event)) {
- err = noErr;
- }
- else {
- GHOST_TEventType type = (kind == kEventMouseDown) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp;
- EventMouseButton button;
-
- /* Window still gets mouse up after command-H */
- if (m_windowManager->getActiveWindow()) {
- // handle any tablet events that may have come with the mouse event (optional)
- handleTabletEvent(event);
-
- ::GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
- pushEvent(new GHOST_EventButton(getMilliSeconds(), type, window, convertButton(button)));
- err = noErr;
- }
- }
- break;
-
- case kEventMouseMoved:
- case kEventMouseDragged:
- {
- Point mousePos;
-
- if (window) {
- //handle any tablet events that may have come with the mouse event (optional)
- handleTabletEvent(event);
-
- ::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos);
- pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, mousePos.h, mousePos.v));
- err = noErr;
- }
- break;
- }
- case kEventMouseWheelMoved:
- {
- OSStatus status;
- //UInt32 modifiers;
- EventMouseWheelAxis axis;
- SInt32 delta;
- //status = ::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifiers), NULL, &modifiers);
- //GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
- status = ::GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(axis), NULL, &axis);
- GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
- if (axis == kEventMouseWheelAxisY)
- {
- status = ::GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta);
- GHOST_ASSERT(status == noErr, "GHOST_SystemCarbon::handleMouseEvent(): GetEventParameter() failed");
- /*
- * Limit mouse wheel delta to plus and minus one.
- */
- delta = delta > 0 ? 1 : -1;
- pushEvent(new GHOST_EventWheel(getMilliSeconds(), window, delta));
- err = noErr;
- }
- }
- break;
- }
-
- return err;
-}
-
-
-OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
-{
- OSStatus err = eventNotHandledErr;
- GHOST_IWindow *window = m_windowManager->getActiveWindow();
- UInt32 kind = ::GetEventKind(event);
- UInt32 modifiers;
- UInt32 rawCode;
- GHOST_TKey key;
- unsigned char ascii;
-
- /* Can happen, very rarely - seems to only be when command-H makes
- * the window go away and we still get an HKey up.
- */
- if (!window) {
- //::GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &rawCode);
- //key = convertKey(rawCode);
- return err;
- }
-
- err = noErr;
- switch (kind) {
- case kEventRawKeyDown:
- case kEventRawKeyRepeat:
- case kEventRawKeyUp:
- ::GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &rawCode);
- ::GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &ascii);
-
- key = convertKey(rawCode);
- ascii = convertRomanToLatin(ascii);
-
- // if (key!=GHOST_kKeyUnknown) {
- GHOST_TEventType type;
- if (kind == kEventRawKeyDown) {
- type = GHOST_kEventKeyDown;
- }
- else if (kind == kEventRawKeyRepeat) {
- type = GHOST_kEventKeyDown; /* XXX, fixme */
- }
- else {
- type = GHOST_kEventKeyUp;
- }
- pushEvent(new GHOST_EventKey(getMilliSeconds(), type, window, key, ascii, NULL) );
-// }
- break;
-
- case kEventRawKeyModifiersChanged:
- /* ugh */
- ::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
- if ((modifiers & shiftKey) != (m_modifierMask & shiftKey)) {
- pushEvent(new GHOST_EventKey(getMilliSeconds(), (modifiers & shiftKey) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );
- }
- if ((modifiers & controlKey) != (m_modifierMask & controlKey)) {
- pushEvent(new GHOST_EventKey(getMilliSeconds(), (modifiers & controlKey) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl) );
- }
- if ((modifiers & optionKey) != (m_modifierMask & optionKey)) {
- pushEvent(new GHOST_EventKey(getMilliSeconds(), (modifiers & optionKey) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
- }
- if ((modifiers & cmdKey) != (m_modifierMask & cmdKey)) {
- pushEvent(new GHOST_EventKey(getMilliSeconds(), (modifiers & cmdKey) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyOS) );
- }
-
- m_modifierMask = modifiers;
- break;
-
- default:
- err = eventNotHandledErr;
- break;
- }
-
- return err;
-}
-
-
-bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
-{
- WindowPtr window;
- short part;
- BitMap screenBits;
- bool handled = true;
- GHOST_WindowCarbon *ghostWindow;
- Point mousePos = {0, 0};
-
- ::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos);
-
- part = ::FindWindow(mousePos, &window);
- ghostWindow = (GHOST_WindowCarbon *) ::GetWRefCon(window);
-
- switch (part) {
- case inMenuBar:
- handleMenuCommand(::MenuSelect(mousePos));
- break;
-
- case inDrag:
- /*
- * The DragWindow() routine creates a lot of kEventWindowBoundsChanged
- * events. By setting m_ignoreWindowSizedMessages these are suppressed.
- * \see GHOST_SystemCarbon::handleWindowEvent(EventRef event)
- */
- /* even worse: scale window also generates a load of events, and nothing
- * is handled (read: client's event proc called) until you release mouse (ton) */
-
- GHOST_ASSERT(validWindow(ghostWindow), "GHOST_SystemCarbon::handleMouseDown: invalid window");
- m_ignoreWindowSizedMessages = true;
- ::DragWindow(window, mousePos, &GetQDGlobalsScreenBits(&screenBits)->bounds);
- m_ignoreWindowSizedMessages = false;
-
- pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, ghostWindow) );
-
- break;
-
- case inContent:
- if (window != ::FrontWindow()) {
- ::SelectWindow(window);
- /*
- * We add a mouse down event on the newly actived window
- */
- //GHOST_PRINT("GHOST_SystemCarbon::handleMouseDown(): adding mouse down event, " << ghostWindow << "\n");
- EventMouseButton button;
- ::GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
- pushEvent(new GHOST_EventButton(getMilliSeconds(), GHOST_kEventButtonDown, ghostWindow, convertButton(button)));
- }
- else {
- handled = false;
- }
- break;
-
- case inGoAway:
- GHOST_ASSERT(ghostWindow, "GHOST_SystemCarbon::handleMouseEvent: ghostWindow==0");
- if (::TrackGoAway(window, mousePos))
- {
- // todo: add option-close, because it's in the HIG
- // if (event.modifiers & optionKey) {
- // Close the clean documents, others will be confirmed one by one.
- //}
- // else {
- pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, ghostWindow));
- //}
- }
- break;
-
- case inGrow:
- GHOST_ASSERT(ghostWindow, "GHOST_SystemCarbon::handleMouseEvent: ghostWindow==0");
- ::ResizeWindow(window, mousePos, NULL, NULL);
- break;
-
- case inZoomIn:
- case inZoomOut:
- GHOST_ASSERT(ghostWindow, "GHOST_SystemCarbon::handleMouseEvent: ghostWindow==0");
- if (::TrackBox(window, mousePos, part)) {
- int macState;
-
- macState = ghostWindow->getMac_windowState();
- if (macState == 0)
- ::ZoomWindow(window, part, true);
- else
- if (macState == 2) { // always ok
- ::ZoomWindow(window, part, true);
- ghostWindow->setMac_windowState(1);
- }
- else { // need to force size again
- // GHOST_TUns32 scr_x,scr_y; /*unused*/
- Rect outAvailableRect;
-
- ghostWindow->setMac_windowState(2);
- ::GetAvailableWindowPositioningBounds(GetMainDevice(), &outAvailableRect);
-
- //this->getMainDisplayDimensions(scr_x,scr_y);
- ::SizeWindow(window, outAvailableRect.right - outAvailableRect.left, outAvailableRect.bottom - outAvailableRect.top - 1, false);
- ::MoveWindow(window, outAvailableRect.left, outAvailableRect.top, true);
- }
-
- }
- break;
-
- default:
- handled = false;
- break;
- }
-
- return handled;
-}
-
-
-bool GHOST_SystemCarbon::handleMenuCommand(GHOST_TInt32 menuResult)
-{
- short menuID;
- short menuItem;
- UInt32 command;
- bool handled;
- OSErr err;
-
- menuID = HiWord(menuResult);
- menuItem = LoWord(menuResult);
-
- err = ::GetMenuItemCommandID(::GetMenuHandle(menuID), menuItem, &command);
-
- handled = false;
-
- if (err || command == 0) {
- }
- else {
- switch (command) {
- }
- }
-
- ::HiliteMenu(0);
- return handled;
-}
-
-
-OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void *userData)
-{
- GHOST_SystemCarbon *sys = (GHOST_SystemCarbon *) userData;
- OSStatus err = eventNotHandledErr;
- GHOST_IWindow *window;
-#ifdef WITH_INPUT_NDOF
- GHOST_TEventNDOFData data;
-#endif
- UInt32 kind;
-
- switch (::GetEventClass(event))
- {
- case kEventClassAppleEvent:
- EventRecord eventrec;
- if (ConvertEventRefToEventRecord(event, &eventrec)) {
- err = AEProcessAppleEvent(&eventrec);
- }
- break;
- case kEventClassMouse:
- err = sys->handleMouseEvent(event);
- break;
- case kEventClassWindow:
- err = sys->handleWindowEvent(event);
- break;
- case kEventClassKeyboard:
- err = sys->handleKeyEvent(event);
- break;
- case kEventClassBlender:
-#ifdef WITH_INPUT_NDOF
- window = sys->m_windowManager->getActiveWindow();
- sys->m_ndofManager->GHOST_NDOFGetDatas(data);
- kind = ::GetEventKind(event);
-
- switch (kind)
- {
- case 1:
- sys->m_eventManager->pushEvent(new GHOST_EventNDOF(sys->getMilliSeconds(), GHOST_kEventNDOFMotion, window, data));
- // printf("motion\n");
- break;
- case 2:
- sys->m_eventManager->pushEvent(new GHOST_EventNDOF(sys->getMilliSeconds(), GHOST_kEventNDOFButton, window, data));
-// printf("button\n");
- break;
- }
-#endif
- err = noErr;
- break;
- default:
- ;
- break;
- }
-
- return err;
-}
-
-GHOST_TUns8 *GHOST_SystemCarbon::getClipboard(bool selection) const
-{
- PasteboardRef inPasteboard;
- PasteboardItemID itemID;
- CFDataRef flavorData;
- OSStatus err = noErr;
- GHOST_TUns8 *temp_buff;
- CFRange range;
- OSStatus syncFlags;
-
- err = PasteboardCreate(kPasteboardClipboard, &inPasteboard);
- if (err != noErr) { return NULL; }
-
- syncFlags = PasteboardSynchronize(inPasteboard);
- /* as we always get in a new string, we can safely ignore sync flags if not an error*/
- if (syncFlags < 0) { return NULL; }
-
-
- err = PasteboardGetItemIdentifier(inPasteboard, 1, &itemID);
- if (err != noErr) { return NULL; }
-
- err = PasteboardCopyItemFlavorData(inPasteboard, itemID, CFSTR("public.utf8-plain-text"), &flavorData);
- if (err != noErr) { return NULL; }
-
- range = CFRangeMake(0, CFDataGetLength(flavorData));
-
- temp_buff = (GHOST_TUns8 *) malloc(range.length + 1);
-
- CFDataGetBytes(flavorData, range, (UInt8 *)temp_buff);
-
- temp_buff[range.length] = '\0';
-
- if (temp_buff) {
- return temp_buff;
- }
- else {
- return NULL;
- }
-}
-
-void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
-{
- if (selection) {return; } // for copying the selection, used on X11
-
- PasteboardRef inPasteboard;
- CFDataRef textData = NULL;
- OSStatus err = noErr; /*For error checking*/
- OSStatus syncFlags;
-
- err = PasteboardCreate(kPasteboardClipboard, &inPasteboard);
- if (err != noErr) { return; }
-
- syncFlags = PasteboardSynchronize(inPasteboard);
- /* as we always put in a new string, we can safely ignore sync flags */
- if (syncFlags < 0) { return; }
-
- err = PasteboardClear(inPasteboard);
- if (err != noErr) { return; }
-
- textData = CFDataCreate(kCFAllocatorDefault, (UInt8 *)buffer, strlen(buffer));
-
- if (textData) {
- err = PasteboardPutItemFlavor(inPasteboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), textData, 0);
- if (err != noErr) {
- if (textData) { CFRelease(textData); }
- return;
- }
- }
-
- if (textData) {
- CFRelease(textData);
- }
-}
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
deleted file mode 100644
index 9faf5423205..00000000000
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file ghost/intern/GHOST_SystemCarbon.h
- * \ingroup GHOST
- * Declaration of GHOST_SystemCarbon class.
- */
-
-#ifndef __GHOST_SYSTEMCARBON_H__
-#define __GHOST_SYSTEMCARBON_H__
-
-#ifndef __APPLE__
-#error Apple OSX only!
-#endif // __APPLE__
-
-#define __CARBONSOUND__
-#include <Carbon/Carbon.h>
-
-#include "GHOST_System.h"
-
-class GHOST_EventCursor;
-class GHOST_EventKey;
-class GHOST_EventWindow;
-
-/**
- * OSX/Carbon Implementation of GHOST_System class.
- * \see GHOST_System.
- * \author Maarten Gribnau
- * \date May 21, 2001
- */
-class GHOST_SystemCarbon : public GHOST_System {
-public:
- /**
- * Constructor.
- */
- GHOST_SystemCarbon();
-
- /**
- * Destructor.
- */
- ~GHOST_SystemCarbon();
-
- /***************************************************************************************
- ** Time(r) functionality
- ***************************************************************************************/
-
- /**
- * Returns the system time.
- * Returns the number of milliseconds since the start of the system process.
- * Based on ANSI clock() routine.
- * \return The number of milliseconds.
- */
- virtual GHOST_TUns64 getMilliSeconds() const;
-
- /***************************************************************************************
- ** Display/window management functionality
- ***************************************************************************************/
-
- /**
- * Returns the number of displays on this system.
- * \return The number of displays.
- */
- virtual GHOST_TUns8 getNumDisplays() const;
-
- /**
- * Returns the dimensions of the main display on this system.
- * \return The dimension of the main display.
- */
- virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
-
- /**
- * Returns the combine dimensions of all monitors.
- * \return The dimension of the workspace.
- */
- virtual void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
-
- /**
- * Create a new window.
- * The new window is added to the list of windows managed.
- * Never explicitly delete the window, use disposeWindow() instead.
- * \param title The name of the window (displayed in the title bar of the window if the OS supports it).
- * \param left The coordinate of the left edge of the window.
- * \param top The coordinate of the top edge of the window.
- * \param width The width the window.
- * \param height The height the window.
- * \param state The state of the window when opened.
- * \param type The type of drawing context installed in this window.
- * \param parentWindow Parent (embedder) window
- * \return The new window (or 0 if creation failed).
- */
- virtual GHOST_IWindow *createWindow(
- const STR_String& title,
- GHOST_TInt32 left,
- GHOST_TInt32 top,
- GHOST_TUns32 width,
- GHOST_TUns32 height,
- GHOST_TWindowState state,
- GHOST_TDrawingContextType type,
- const bool stereoVisual,
- const bool exclusive = false,
- const GHOST_TUns16 numOfAASamples = 0,
- const GHOST_TEmbedderWindowID parentWindow = 0
- );
-
- virtual GHOST_TSuccess beginFullScreen(
- const GHOST_DisplaySetting& setting,
- GHOST_IWindow **window,
- const bool stereoVisual
- );
-
- virtual GHOST_TSuccess endFullScreen(void);
-
- /***************************************************************************************
- ** Event management functionality
- ***************************************************************************************/
-
- /**
- * Gets events from the system and stores them in the queue.
- * \param waitForEvent Flag to wait for an event (or return immediately).
- * \return Indication of the presence of events.
- */
- virtual bool processEvents(bool waitForEvent);
-
- /***************************************************************************************
- ** Cursor management functionality
- ***************************************************************************************/
-
- /**
- * Returns the current location of the cursor (location in screen coordinates)
- * \param x The x-coordinate of the cursor.
- * \param y The y-coordinate of the cursor.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const;
-
- /**
- * Updates the location of the cursor (location in screen coordinates).
- * \param x The x-coordinate of the cursor.
- * \param y The y-coordinate of the cursor.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
-
- /***************************************************************************************
- ** Access to mouse button and keyboard states.
- ***************************************************************************************/
-
- /**
- * Returns the state of all modifier keys.
- * \param keys The state of all modifier keys (true == pressed).
- * \return Indication of success.
- */
- virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys& keys) const;
-
- /**
- * Returns the state of the mouse buttons (ouside the message queue).
- * \param buttons The state of the buttons.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const;
-
- /**
- * Returns Clipboard data
- * \param selection Indicate which buffer to return
- * \return Returns the selected buffer
- */
- virtual GHOST_TUns8 *getClipboard(bool selection) const;
-
- /**
- * Puts buffer to system clipboard
- * \param buffer The buffer to be copied
- * \param selection Indicates which buffer to copy too, only used on X11
- */
- virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
-
- /**
- * \see GHOST_ISystem
- */
- int toggleConsole(int action) {
- return 0;
- }
-
-protected:
- /**
- * Initializes the system.
- * For now, it justs registers the window class (WNDCLASS).
- * \return A success value.
- */
- virtual GHOST_TSuccess init();
-
- /**
- * Closes the system down.
- * \return A success value.
- */
- virtual GHOST_TSuccess exit();
-
-
- /**
- * Handles a tablet event.
- * \param event A Mac event.
- * \return Indication whether the event was handled.
- */
- OSStatus handleTabletEvent(EventRef event);
- /**
- * Handles a mouse event.
- * \param event A Mac event.
- * \return Indication whether the event was handled.
- */
- OSStatus handleMouseEvent(EventRef event);
-
- /**
- * Handles a key event.
- * \param event A Mac event.
- * \return Indication whether the event was handled.
- */
- OSStatus handleKeyEvent(EventRef event);
-
- /**
- * Handles a window event.
- * \param event A Mac event.
- * \return Indication whether the event was handled.
- */
- OSStatus handleWindowEvent(EventRef event);
-
- /**
- * Handles all basic Mac application stuff for a mouse down event.
- * \param event A Mac event.
- * \return Indication whether the event was handled.
- */
- bool handleMouseDown(EventRef event);
-
- /**
- * Handles a Mac menu command.
- * \param menuResult A Mac menu/item identifier.
- * \return Indication whether the event was handled.
- */
- bool handleMenuCommand(GHOST_TInt32 menuResult);
-
- /* callback for blender generated events */
- // static OSStatus blendEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData);
-
-
- /**
- * Callback for Carbon when it has events.
- */
- static OSStatus sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void *userData);
-
- /** Apple Event Handlers */
- static OSErr sAEHandlerLaunch(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);
- static OSErr sAEHandlerOpenDocs(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);
- static OSErr sAEHandlerPrintDocs(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);
- static OSErr sAEHandlerQuit(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);
-
- /**
- * Callback for Mac Timer tasks that expire.
- * \param tmTask Pointer to the timer task that expired.
- */
- //static void s_timerCallback(TMTaskPtr tmTask);
-
- /** Event handler reference. */
- EventHandlerRef m_handler;
-
- /** Start time at initialization. */
- GHOST_TUns64 m_start_time;
-
- /** State of the modifiers. */
- UInt32 m_modifierMask;
-
- /** Ignores window size messages (when window is dragged). */
- bool m_ignoreWindowSizedMessages;
-};
-
-#endif // __GHOST_SYSTEMCARBON_H__
-
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 84b4bb35768..c60ded15d6c 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -57,156 +57,6 @@
#include "AssertMacros.h"
#pragma mark KeyMap, mouse converters
-#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1040
-/* Keycodes not defined in Tiger */
-/*
- * Summary:
- * Virtual keycodes
- *
- * Discussion:
- * These constants are the virtual keycodes defined originally in
- * Inside Mac Volume V, pg. V-191. They identify physical keys on a
- * keyboard. Those constants with "ANSI" in the name are labeled
- * according to the key position on an ANSI-standard US keyboard.
- * For example, kVK_ANSI_A indicates the virtual keycode for the key
- * with the letter 'A' in the US keyboard layout. Other keyboard
- * layouts may have the 'A' key label on a different physical key;
- * in this case, pressing 'A' will generate a different virtual
- * keycode.
- */
-enum {
- kVK_ANSI_A = 0x00,
- kVK_ANSI_S = 0x01,
- kVK_ANSI_D = 0x02,
- kVK_ANSI_F = 0x03,
- kVK_ANSI_H = 0x04,
- kVK_ANSI_G = 0x05,
- kVK_ANSI_Z = 0x06,
- kVK_ANSI_X = 0x07,
- kVK_ANSI_C = 0x08,
- kVK_ANSI_V = 0x09,
- kVK_ANSI_B = 0x0B,
- kVK_ANSI_Q = 0x0C,
- kVK_ANSI_W = 0x0D,
- kVK_ANSI_E = 0x0E,
- kVK_ANSI_R = 0x0F,
- kVK_ANSI_Y = 0x10,
- kVK_ANSI_T = 0x11,
- kVK_ANSI_1 = 0x12,
- kVK_ANSI_2 = 0x13,
- kVK_ANSI_3 = 0x14,
- kVK_ANSI_4 = 0x15,
- kVK_ANSI_6 = 0x16,
- kVK_ANSI_5 = 0x17,
- kVK_ANSI_Equal = 0x18,
- kVK_ANSI_9 = 0x19,
- kVK_ANSI_7 = 0x1A,
- kVK_ANSI_Minus = 0x1B,
- kVK_ANSI_8 = 0x1C,
- kVK_ANSI_0 = 0x1D,
- kVK_ANSI_RightBracket = 0x1E,
- kVK_ANSI_O = 0x1F,
- kVK_ANSI_U = 0x20,
- kVK_ANSI_LeftBracket = 0x21,
- kVK_ANSI_I = 0x22,
- kVK_ANSI_P = 0x23,
- kVK_ANSI_L = 0x25,
- kVK_ANSI_J = 0x26,
- kVK_ANSI_Quote = 0x27,
- kVK_ANSI_K = 0x28,
- kVK_ANSI_Semicolon = 0x29,
- kVK_ANSI_Backslash = 0x2A,
- kVK_ANSI_Comma = 0x2B,
- kVK_ANSI_Slash = 0x2C,
- kVK_ANSI_N = 0x2D,
- kVK_ANSI_M = 0x2E,
- kVK_ANSI_Period = 0x2F,
- kVK_ANSI_Grave = 0x32,
- kVK_ANSI_KeypadDecimal = 0x41,
- kVK_ANSI_KeypadMultiply = 0x43,
- kVK_ANSI_KeypadPlus = 0x45,
- kVK_ANSI_KeypadClear = 0x47,
- kVK_ANSI_KeypadDivide = 0x4B,
- kVK_ANSI_KeypadEnter = 0x4C,
- kVK_ANSI_KeypadMinus = 0x4E,
- kVK_ANSI_KeypadEquals = 0x51,
- kVK_ANSI_Keypad0 = 0x52,
- kVK_ANSI_Keypad1 = 0x53,
- kVK_ANSI_Keypad2 = 0x54,
- kVK_ANSI_Keypad3 = 0x55,
- kVK_ANSI_Keypad4 = 0x56,
- kVK_ANSI_Keypad5 = 0x57,
- kVK_ANSI_Keypad6 = 0x58,
- kVK_ANSI_Keypad7 = 0x59,
- kVK_ANSI_Keypad8 = 0x5B,
- kVK_ANSI_Keypad9 = 0x5C
-};
-
-/* keycodes for keys that are independent of keyboard layout*/
-enum {
- kVK_Return = 0x24,
- kVK_Tab = 0x30,
- kVK_Space = 0x31,
- kVK_Delete = 0x33,
- kVK_Escape = 0x35,
- kVK_Command = 0x37,
- kVK_Shift = 0x38,
- kVK_CapsLock = 0x39,
- kVK_Option = 0x3A,
- kVK_Control = 0x3B,
- kVK_RightShift = 0x3C,
- kVK_RightOption = 0x3D,
- kVK_RightControl = 0x3E,
- kVK_Function = 0x3F,
- kVK_F17 = 0x40,
- kVK_VolumeUp = 0x48,
- kVK_VolumeDown = 0x49,
- kVK_Mute = 0x4A,
- kVK_F18 = 0x4F,
- kVK_F19 = 0x50,
- kVK_F20 = 0x5A,
- kVK_F5 = 0x60,
- kVK_F6 = 0x61,
- kVK_F7 = 0x62,
- kVK_F3 = 0x63,
- kVK_F8 = 0x64,
- kVK_F9 = 0x65,
- kVK_F11 = 0x67,
- kVK_F13 = 0x69,
- kVK_F16 = 0x6A,
- kVK_F14 = 0x6B,
- kVK_F10 = 0x6D,
- kVK_F12 = 0x6F,
- kVK_F15 = 0x71,
- kVK_Help = 0x72,
- kVK_Home = 0x73,
- kVK_PageUp = 0x74,
- kVK_ForwardDelete = 0x75,
- kVK_F4 = 0x76,
- kVK_End = 0x77,
- kVK_F2 = 0x78,
- kVK_PageDown = 0x79,
- kVK_F1 = 0x7A,
- kVK_LeftArrow = 0x7B,
- kVK_RightArrow = 0x7C,
- kVK_DownArrow = 0x7D,
- kVK_UpArrow = 0x7E
-};
-
-/* ISO keyboards only*/
-enum {
- kVK_ISO_Section = 0x0A
-};
-
-/* JIS keyboards only*/
-enum {
- kVK_JIS_Yen = 0x5D,
- kVK_JIS_Underscore = 0x5E,
- kVK_JIS_KeypadComma = 0x5F,
- kVK_JIS_Eisu = 0x66,
- kVK_JIS_Kana = 0x68
-};
-#endif
static GHOST_TButtonMask convertButton(int button)
{
@@ -361,47 +211,28 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
return (GHOST_TKey) (recvChar - 'a' + GHOST_kKeyA);
}
else {
-#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1040
- KeyboardLayoutRef keyLayout;
- UCKeyboardLayout *uchrData;
-
- KLGetCurrentKeyboardLayout(&keyLayout);
- KLGetKeyboardLayoutProperty(keyLayout, kKLuchrData, (const void **)
- &uchrData);
- /*get actual character value of the "remappable" keys in int'l keyboards,
- if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger),
- then fallback on using the received charactersIgnoringModifiers */
- if (uchrData)
- {
- UInt32 deadKeyState=0;
- UniCharCount actualStrLength=0;
-
- UCKeyTranslate(uchrData, rawCode, keyAction, 0,
- LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 1, &actualStrLength, &recvChar);
-
- }
-#else
- /* Leopard and Snow Leopard 64bit compatible API*/
- CFDataRef uchrHandle; /*the keyboard layout*/
- TISInputSourceRef kbdTISHandle;
+
+ /* Leopard and Snow Leopard 64bit compatible API*/
+ CFDataRef uchrHandle; /*the keyboard layout*/
+ TISInputSourceRef kbdTISHandle;
+
+ kbdTISHandle = TISCopyCurrentKeyboardLayoutInputSource();
+ uchrHandle = (CFDataRef)TISGetInputSourceProperty(kbdTISHandle,kTISPropertyUnicodeKeyLayoutData);
+ CFRelease(kbdTISHandle);
+
+ /*get actual character value of the "remappable" keys in int'l keyboards,
+ if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger),
+ then fallback on using the received charactersIgnoringModifiers */
+ if (uchrHandle)
+ {
+ UInt32 deadKeyState=0;
+ UniCharCount actualStrLength=0;
- kbdTISHandle = TISCopyCurrentKeyboardLayoutInputSource();
- uchrHandle = (CFDataRef)TISGetInputSourceProperty(kbdTISHandle,kTISPropertyUnicodeKeyLayoutData);
- CFRelease(kbdTISHandle);
+ UCKeyTranslate((UCKeyboardLayout*)CFDataGetBytePtr(uchrHandle), rawCode, keyAction, 0,
+ LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 1, &actualStrLength, &recvChar);
- /*get actual character value of the "remappable" keys in int'l keyboards,
- if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger),
- then fallback on using the received charactersIgnoringModifiers */
- if (uchrHandle)
- {
- UInt32 deadKeyState=0;
- UniCharCount actualStrLength=0;
-
- UCKeyTranslate((UCKeyboardLayout*)CFDataGetBytePtr(uchrHandle), rawCode, keyAction, 0,
- LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 1, &actualStrLength, &recvChar);
-
- }
-#endif
+ }
+
switch (recvChar) {
case '-': return GHOST_kKeyMinus;
case '=': return GHOST_kKeyEqual;
@@ -424,26 +255,6 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
#pragma mark defines for 10.6 api not documented in 10.5
-#if MAC_OS_X_VERSION_MIN_REQUIRED <= 1040
-enum {
- /* The following event types are available on some hardware on 10.5.2 and later */
- NSEventTypeGesture = 29,
- NSEventTypeMagnify = 30,
- NSEventTypeSwipe = 31,
- NSEventTypeRotate = 18,
- NSEventTypeBeginGesture = 19,
- NSEventTypeEndGesture = 20
-};
-
-@interface NSEvent(GestureEvents)
-- (float)magnification; // change in magnification.
-#else
-@interface NSEvent(GestureEvents)
-- (CGFloat)magnification; // change in magnification on 10.5.2 or later.
-@end
-
-#endif
-
#pragma mark Utility functions
@@ -464,29 +275,6 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
}
}
-#if defined(WITH_QUICKTIME) && !defined(USE_QTKIT)
-//Need to place this quicktime function in an ObjC file
-//It is used to avoid memory leak when raising the quicktime "compression settings" standard dialog
-extern "C" {
- struct bContext;
- struct wmOperator;
- extern int fromcocoa_request_qtcodec_settings(bContext *C, wmOperator *op);
-
-
-int cocoa_request_qtcodec_settings(bContext *C, wmOperator *op)
-{
- int result;
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- result = fromcocoa_request_qtcodec_settings(C, op);
-
- [pool drain];
- return result;
-}
-};
-#endif
-
-
#pragma mark Cocoa objects
/**
@@ -525,7 +313,7 @@ int cocoa_request_qtcodec_settings(bContext *C, wmOperator *op)
return NSTerminateCancel;
}
-// To avoid cancelling a log off process, we must use Cocoa termination process
+// To avoid canceling a log off process, we must use Cocoa termination process
// And this function is the only chance to perform clean up
// So WM_exit needs to be called directly, as the event loop will never run before termination
- (void)applicationWillTerminate:(NSNotification *)aNotification
diff --git a/intern/ghost/intern/GHOST_SystemPathsCarbon.cpp b/intern/ghost/intern/GHOST_SystemPathsCarbon.cpp
deleted file mode 100644
index 7d43392a79c..00000000000
--- a/intern/ghost/intern/GHOST_SystemPathsCarbon.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Damien Plisson 2010
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file ghost/intern/GHOST_SystemPathsCarbon.cpp
- * \ingroup GHOST
- */
-
-
-#include <Carbon/Carbon.h>
-#include <ApplicationServices/ApplicationServices.h>
-#include "GHOST_SystemPathsCarbon.h"
-
-
-/***/
-
-GHOST_SystemPathsCarbon::GHOST_SystemPathsCarbon()
-{
-}
-
-GHOST_SystemPathsCarbon::~GHOST_SystemPathsCarbon()
-{
-}
-
-const GHOST_TUns8 *GHOST_SystemPathsCarbon::getSystemDir(int, const char *versionstr) const
-{
- static char systemPath[1024];
-
- snprintf(systemPath, sizeof(systemPath), "/Library/Application Support/Blender/%s", versionstr);
-
- return (GHOST_TUns8*)systemPath;
-}
-
-const GHOST_TUns8 *GHOST_SystemPathsCarbon::getUserDir(int, const char *versionstr) const
-{
- static char usrPath[1024];
- char *env = getenv("HOME");
-
- if (env) {
- snprintf(usrPath, sizeof(usrPath), "%s/Library/Application Support/Blender/%s", env, versionstr);
- return (GHOST_TUns8*)usrPath;
- }
- else
- return NULL;
-}
-
-const GHOST_TUns8 *GHOST_SystemPathsCarbon::getBinaryDir() const
-{
- CFURLRef bundleURL;
- CFStringRef pathStr;
- static char path[256];
- CFBundleRef mainBundle = CFBundleGetMainBundle();
-
- bundleURL = CFBundleCopyBundleURL(mainBundle);
- pathStr = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);
- CFStringGetCString(pathStr, path, 255, kCFStringEncodingASCII);
- CFRelease(pathStr);
- CFRelease(bundleURL);
- return (GHOST_TUns8 *)path;
-}
-
-void GHOST_SystemPathsCarbon::addToSystemRecentFiles(const char *filename) const
-{
- /* XXXXX TODO: Implementation for Carbon if possible */
-
-}
diff --git a/intern/ghost/intern/GHOST_SystemPathsCarbon.h b/intern/ghost/intern/GHOST_SystemPathsCarbon.h
deleted file mode 100644
index 9d9a3a22564..00000000000
--- a/intern/ghost/intern/GHOST_SystemPathsCarbon.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2010 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Damien Plisson 2010
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file ghost/intern/GHOST_SystemPathsCarbon.h
- * \ingroup GHOST
- */
-
-
-#ifndef __GHOST_SYSTEMPATHSCARBON_H__
-#define __GHOST_SYSTEMPATHSCARBON_H__
-
-#ifndef __APPLE__
-#error Apple OSX only!
-#endif // __APPLE__
-
-#include <Carbon/Carbon.h>
-
-#include "GHOST_SystemPaths.h"
-
-/**
- * OSX/Carbon Implementation of GHOST_SystemPaths class.
- * \see GHOST_System.
- * \author Andrea Weikert
- * \date Aug 1, 2010
- */
-class GHOST_SystemPathsCarbon : public GHOST_SystemPaths {
-public:
- /**
- * Constructor.
- */
- GHOST_SystemPathsCarbon();
-
- /**
- * Destructor.
- */
- ~GHOST_SystemPathsCarbon();
-
- /**
- * Determine the base dir in which shared resources are located. It will first try to use
- * "unpack and run" path, then look for properly installed path, including versioning.
- * \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
- */
- virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
-
- /**
- * Determine the base dir in which user configuration is stored, including versioning.
- * If needed, it will create the base directory.
- * \return Unsigned char string pointing to user dir (eg ~/.blender/).
- */
- virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
-
- /**
- * Determine the directory of the current binary
- * \return Unsigned char string pointing to the binary dir
- */
- virtual const GHOST_TUns8 *getBinaryDir() const;
-
- /**
- * Add the file to the operating system most recently used files
- */
- void addToSystemRecentFiles(const char *filename) const;
-};
-
-#endif // __GHOST_SYSTEMPATHSCARBON_H__
diff --git a/intern/ghost/intern/GHOST_WindowCarbon.cpp b/intern/ghost/intern/GHOST_WindowCarbon.cpp
deleted file mode 100644
index 36d45b4790c..00000000000
--- a/intern/ghost/intern/GHOST_WindowCarbon.cpp
+++ /dev/null
@@ -1,751 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file ghost/intern/GHOST_WindowCarbon.cpp
- * \ingroup GHOST
- */
-
-
-/**
- * Copyright (C) 2001 NaN Technologies B.V.
- * \author Maarten Gribnau
- * \date May 10, 2001
- */
-
-#include "GHOST_WindowCarbon.h"
-#include "GHOST_Debug.h"
-
-AGLContext GHOST_WindowCarbon::s_firstaglCtx = NULL;
-#ifdef GHOST_DRAW_CARBON_GUTTER
-const GHOST_TInt32 GHOST_WindowCarbon::s_sizeRectSize = 16;
-#endif //GHOST_DRAW_CARBON_GUTTER
-
-static const GLint sPreferredFormatWindow[10] = {
- AGL_RGBA,
- AGL_DOUBLEBUFFER,
- AGL_ACCELERATED,
- AGL_DEPTH_SIZE, 32,
- AGL_NONE,
-};
-
-static const GLint sPreferredFormatFullScreen[11] = {
- AGL_RGBA,
- AGL_DOUBLEBUFFER,
- AGL_ACCELERATED,
- AGL_FULLSCREEN,
- AGL_DEPTH_SIZE, 32,
- AGL_NONE,
-};
-
-
-
-WindowRef ugly_hack = NULL;
-
-const EventTypeSpec kWEvents[] = {
- { kEventClassWindow, kEventWindowZoom }, /* for new zoom behaviour */
-};
-
-static OSStatus myWEventHandlerProc(EventHandlerCallRef handler, EventRef event, void *userData)
-{
- WindowRef mywindow;
- GHOST_WindowCarbon *ghost_window;
- OSStatus err;
- int theState;
-
- if (::GetEventKind(event) == kEventWindowZoom) {
- err = ::GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(mywindow), NULL, &mywindow);
- ghost_window = (GHOST_WindowCarbon *) GetWRefCon(mywindow);
- theState = ghost_window->getMac_windowState();
- if (theState == 1)
- ghost_window->setMac_windowState(2);
- else if (theState == 2)
- ghost_window->setMac_windowState(1);
-
- }
- return eventNotHandledErr;
-}
-
-GHOST_WindowCarbon::GHOST_WindowCarbon(
- const STR_String& title,
- GHOST_TInt32 left,
- GHOST_TInt32 top,
- GHOST_TUns32 width,
- GHOST_TUns32 height,
- GHOST_TWindowState state,
- GHOST_TDrawingContextType type,
- const bool stereoVisual,
- const GHOST_TUns16 numOfAASamples
- ) :
- GHOST_Window(width, height, state, GHOST_kDrawingContextTypeNone),
- m_windowRef(0),
- m_grafPtr(0),
- m_aglCtx(0),
- m_customCursor(0),
- m_fullScreenDirty(false)
-{
- Str255 title255;
- OSStatus err;
-
- //fprintf(stderr," main screen top %i left %i height %i width %i\n", top, left, height, width);
-
- if (state >= GHOST_kWindowState8Normal) {
- if (state == GHOST_kWindowState8Normal) state = GHOST_kWindowStateNormal;
- else if (state == GHOST_kWindowState8Maximized) state = GHOST_kWindowStateMaximized;
- else if (state == GHOST_kWindowState8Minimized) state = GHOST_kWindowStateMinimized;
- else if (state == GHOST_kWindowState8FullScreen) state = GHOST_kWindowStateFullScreen;
-
- // state = state - 8; this was the simple version of above code, doesnt work in gcc 4.0
-
- setMac_windowState(1);
- }
- else
- setMac_windowState(0);
-
- if (state != GHOST_kWindowStateFullScreen) {
- Rect bnds = { top, left, top + height, left + width };
- // Boolean visible = (state == GHOST_kWindowStateNormal) || (state == GHOST_kWindowStateMaximized); /*unused*/
- gen2mac(title, title255);
-
- err = ::CreateNewWindow(kDocumentWindowClass,
- kWindowStandardDocumentAttributes + kWindowLiveResizeAttribute,
- &bnds,
- &m_windowRef);
-
- if (err != noErr) {
- fprintf(stderr, " error creating window %i \n", (int)err);
- }
- else {
-
- ::SetWRefCon(m_windowRef, (SInt32) this);
- setTitle(title);
- err = InstallWindowEventHandler(m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents, NULL, NULL);
- if (err != noErr) {
- fprintf(stderr, " error creating handler %i \n", (int)err);
- }
- else {
- // ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL);
- ::ShowWindow(m_windowRef);
- ::MoveWindow(m_windowRef, left, top, true);
-
- }
- }
- if (m_windowRef) {
- m_grafPtr = ::GetWindowPort(m_windowRef);
- setDrawingContextType(type);
- updateDrawingContext();
- activateDrawingContext();
- }
- if (ugly_hack == NULL) {
- ugly_hack = m_windowRef;
- // when started from commandline, window remains in the back... also for play anim
- ProcessSerialNumber psn;
- GetCurrentProcess(&psn);
- SetFrontProcess(&psn);
- }
- }
- else {
-#if 0
- Rect bnds = { top, left, top + height, left + width };
- gen2mac("", title255);
- m_windowRef = ::NewCWindow(
- nil, // Storage
- &bnds, // Bounding rectangle of the window
- title255, // Title of the window
- 0, // Window initially visible
- plainDBox, // procID
- (WindowRef) - 1L, // Put window before all other windows
- 0, // Window has minimize box
- (SInt32) this); // Store a pointer to the class in the refCon
-#endif
- //GHOST_PRINT("GHOST_WindowCarbon::GHOST_WindowCarbon(): creating full-screen OpenGL context\n");
- setDrawingContextType(GHOST_kDrawingContextTypeOpenGL);
- installDrawingContext(GHOST_kDrawingContextTypeOpenGL);
- updateDrawingContext();
- activateDrawingContext();
-
- m_tablet.Active = GHOST_kTabletModeNone;
- }
-}
-
-
-GHOST_WindowCarbon::~GHOST_WindowCarbon()
-{
- if (m_customCursor) delete m_customCursor;
-
- if (ugly_hack == m_windowRef) ugly_hack = NULL;
-
- // printf("GHOST_WindowCarbon::~GHOST_WindowCarbon(): removing drawing context\n");
- if (ugly_hack == NULL) setDrawingContextType(GHOST_kDrawingContextTypeNone);
- if (m_windowRef) {
- ::DisposeWindow(m_windowRef);
- m_windowRef = 0;
- }
-}
-
-bool GHOST_WindowCarbon::getValid() const
-{
- bool valid;
- if (!m_fullScreen) {
- valid = (m_windowRef != 0) && (m_grafPtr != 0) && ::IsValidWindowPtr(m_windowRef);
- }
- else {
- valid = true;
- }
- return valid;
-}
-
-
-void GHOST_WindowCarbon::setTitle(const STR_String& title)
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setTitle(): window invalid");
- Str255 title255;
- gen2mac(title, title255);
- ::SetWTitle(m_windowRef, title255);
-}
-
-
-void GHOST_WindowCarbon::getTitle(STR_String& title) const
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getTitle(): window invalid");
- Str255 title255;
- ::GetWTitle(m_windowRef, title255);
- mac2gen(title255, title);
-}
-
-
-void GHOST_WindowCarbon::getWindowBounds(GHOST_Rect& bounds) const
-{
- OSStatus success;
- Rect rect;
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getWindowBounds(): window invalid");
- success = ::GetWindowBounds(m_windowRef, kWindowStructureRgn, &rect);
- bounds.m_b = rect.bottom;
- bounds.m_l = rect.left;
- bounds.m_r = rect.right;
- bounds.m_t = rect.top;
-}
-
-
-void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const
-{
- Rect rect;
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getClientBounds(): window invalid");
- //::GetPortBounds(m_grafPtr, &rect);
- ::GetWindowBounds(m_windowRef, kWindowContentRgn, &rect);
-
- bounds.m_b = rect.bottom;
- bounds.m_l = rect.left;
- bounds.m_r = rect.right;
- bounds.m_t = rect.top;
-
- // Subtract gutter height from bottom
-#ifdef GHOST_DRAW_CARBON_GUTTER
- if ((bounds.m_b - bounds.m_t) > s_sizeRectSize)
- {
- bounds.m_b -= s_sizeRectSize;
- }
- else {
- bounds.m_t = bounds.m_b;
- }
-#endif //GHOST_DRAW_CARBON_GUTTER
-}
-
-
-GHOST_TSuccess GHOST_WindowCarbon::setClientWidth(GHOST_TUns32 width)
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientWidth(): window invalid");
- GHOST_Rect cBnds, wBnds;
- getClientBounds(cBnds);
- if (((GHOST_TUns32)cBnds.getWidth()) != width) {
- ::SizeWindow(m_windowRef, width, cBnds.getHeight(), true);
- }
- return GHOST_kSuccess;
-}
-
-
-GHOST_TSuccess GHOST_WindowCarbon::setClientHeight(GHOST_TUns32 height)
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientHeight(): window invalid");
- GHOST_Rect cBnds, wBnds;
- getClientBounds(cBnds);
-#ifdef GHOST_DRAW_CARBON_GUTTER
- if (((GHOST_TUns32)cBnds.getHeight()) != height + s_sizeRectSize) {
- ::SizeWindow(m_windowRef, cBnds.getWidth(), height + s_sizeRectSize, true);
- }
-#else //GHOST_DRAW_CARBON_GUTTER
- if (((GHOST_TUns32)cBnds.getHeight()) != height) {
- ::SizeWindow(m_windowRef, cBnds.getWidth(), height, true);
- }
-#endif //GHOST_DRAW_CARBON_GUTTER
- return GHOST_kSuccess;
-}
-
-
-GHOST_TSuccess GHOST_WindowCarbon::setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setClientSize(): window invalid");
- GHOST_Rect cBnds, wBnds;
- getClientBounds(cBnds);
-#ifdef GHOST_DRAW_CARBON_GUTTER
- if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
- (((GHOST_TUns32)cBnds.getHeight()) != height + s_sizeRectSize))
- {
- ::SizeWindow(m_windowRef, width, height + s_sizeRectSize, true);
- }
-#else //GHOST_DRAW_CARBON_GUTTER
- if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
- (((GHOST_TUns32)cBnds.getHeight()) != height)) {
- ::SizeWindow(m_windowRef, width, height, true);
- }
-#endif //GHOST_DRAW_CARBON_GUTTER
- return GHOST_kSuccess;
-}
-
-
-GHOST_TWindowState GHOST_WindowCarbon::getState() const
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getState(): window invalid");
- GHOST_TWindowState state;
- if (::IsWindowVisible(m_windowRef) == false) {
- state = GHOST_kWindowStateMinimized;
- }
- else if (::IsWindowInStandardState(m_windowRef, nil, nil)) {
- state = GHOST_kWindowStateMaximized;
- }
- else {
- state = GHOST_kWindowStateNormal;
- }
- return state;
-}
-
-
-void GHOST_WindowCarbon::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::screenToClient(): window invalid");
- Point point;
- point.h = inX;
- point.v = inY;
- GrafPtr oldPort;
- ::GetPort(&oldPort);
- ::SetPort(m_grafPtr);
- ::GlobalToLocal(&point);
- ::SetPort(oldPort);
- outX = point.h;
- outY = point.v;
-}
-
-
-void GHOST_WindowCarbon::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::clientToScreen(): window invalid");
- Point point;
- point.h = inX;
- point.v = inY;
- GrafPtr oldPort;
- ::GetPort(&oldPort);
- ::SetPort(m_grafPtr);
- ::LocalToGlobal(&point);
- ::SetPort(oldPort);
- outX = point.h;
- outY = point.v;
-}
-
-
-GHOST_TSuccess GHOST_WindowCarbon::setState(GHOST_TWindowState state)
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setState(): window invalid");
- switch (state) {
- case GHOST_kWindowStateMinimized:
- ::HideWindow(m_windowRef);
- break;
- case GHOST_kWindowStateModified:
- SetWindowModified(m_windowRef, 1);
- break;
- case GHOST_kWindowStateUnModified:
- SetWindowModified(m_windowRef, 0);
- break;
- case GHOST_kWindowStateMaximized:
- case GHOST_kWindowStateNormal:
- default:
- ::ShowWindow(m_windowRef);
- break;
- }
- return GHOST_kSuccess;
-}
-
-
-GHOST_TSuccess GHOST_WindowCarbon::setOrder(GHOST_TWindowOrder order)
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setOrder(): window invalid");
- if (order == GHOST_kWindowOrderTop) {
- //::BringToFront(m_windowRef); is wrong, front window should be active for input too
- ::SelectWindow(m_windowRef);
- }
- else {
- /* doesnt work if you do this with a mouseclick */
- ::SendBehind(m_windowRef, nil);
- }
- return GHOST_kSuccess;
-}
-
-/*#define WAIT_FOR_VSYNC 1*/
-#ifdef WAIT_FOR_VSYNC
-#include <OpenGL/OpenGL.h>
-#endif
-
-GHOST_TSuccess GHOST_WindowCarbon::swapBuffers()
-{
-#ifdef WAIT_FOR_VSYNC
-/* wait for vsync, to avoid tearing artifacts */
- long VBL = 1;
- CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL);
-#endif
-
- GHOST_TSuccess succeeded = GHOST_kSuccess;
- if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
- if (m_aglCtx) {
- ::aglSwapBuffers(m_aglCtx);
- }
- else {
- succeeded = GHOST_kFailure;
- }
- }
- return succeeded;
-}
-
-GHOST_TSuccess GHOST_WindowCarbon::updateDrawingContext()
-{
- GHOST_TSuccess succeeded = GHOST_kSuccess;
- if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
- if (m_aglCtx) {
- ::aglUpdateContext(m_aglCtx);
- }
- else {
- succeeded = GHOST_kFailure;
- }
- }
- return succeeded;
-}
-
-GHOST_TSuccess GHOST_WindowCarbon::activateDrawingContext()
-{
- GHOST_TSuccess succeeded = GHOST_kSuccess;
- if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
- if (m_aglCtx) {
- ::aglSetCurrentContext(m_aglCtx);
-#ifdef GHOST_DRAW_CARBON_GUTTER
- // Restrict drawing to non-gutter area
- ::aglEnable(m_aglCtx, AGL_BUFFER_RECT);
- GHOST_Rect bnds;
- getClientBounds(bnds);
- GLint b[4] =
- {
- bnds.m_l,
- bnds.m_t + s_sizeRectSize,
- bnds.m_r - bnds.m_l,
- bnds.m_b - bnds.m_t
- };
- GLboolean result = ::aglSetInteger(m_aglCtx, AGL_BUFFER_RECT, b);
-#endif //GHOST_DRAW_CARBON_GUTTER
- }
- else {
- succeeded = GHOST_kFailure;
- }
- }
- return succeeded;
-}
-
-
-GHOST_TSuccess GHOST_WindowCarbon::installDrawingContext(GHOST_TDrawingContextType type)
-{
- GHOST_TSuccess success = GHOST_kFailure;
- switch (type) {
- case GHOST_kDrawingContextTypeOpenGL:
- {
- if (!getValid()) break;
-
- AGLPixelFormat pixelFormat;
- if (!m_fullScreen) {
- pixelFormat = ::aglChoosePixelFormat(0, 0, sPreferredFormatWindow);
- m_aglCtx = ::aglCreateContext(pixelFormat, s_firstaglCtx);
- if (!m_aglCtx) break;
- if (!s_firstaglCtx) s_firstaglCtx = m_aglCtx;
- success = ::aglSetDrawable(m_aglCtx, m_grafPtr) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
- }
- else {
- //GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL\n");
- GDHandle device = ::GetMainDevice(); pixelFormat = ::aglChoosePixelFormat(&device, 1, sPreferredFormatFullScreen);
- m_aglCtx = ::aglCreateContext(pixelFormat, 0);
- if (!m_aglCtx) break;
- if (!s_firstaglCtx) s_firstaglCtx = m_aglCtx;
- //GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): created OpenGL context\n");
- //::CGGetActiveDisplayList(0, NULL, &m_numDisplays)
- success = ::aglSetFullScreen(m_aglCtx, m_fullScreenWidth, m_fullScreenHeight, 75, 0) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
-#if 0
- if (success == GHOST_kSuccess) {
- GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL succeeded\n");
- }
- else {
- GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL failed\n");
- }
-#endif
- }
- ::aglDestroyPixelFormat(pixelFormat);
- }
- break;
-
- case GHOST_kDrawingContextTypeNone:
- success = GHOST_kSuccess;
- break;
-
- default:
- break;
- }
- return success;
-}
-
-
-GHOST_TSuccess GHOST_WindowCarbon::removeDrawingContext()
-{
- GHOST_TSuccess success = GHOST_kFailure;
- switch (m_drawingContextType) {
- case GHOST_kDrawingContextTypeOpenGL:
- if (m_aglCtx) {
- aglSetCurrentContext(NULL);
- aglSetDrawable(m_aglCtx, NULL);
- //aglDestroyContext(m_aglCtx);
- if (s_firstaglCtx == m_aglCtx) s_firstaglCtx = NULL;
- success = ::aglDestroyContext(m_aglCtx) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
- m_aglCtx = 0;
- }
- break;
- case GHOST_kDrawingContextTypeNone:
- success = GHOST_kSuccess;
- break;
- default:
- break;
- }
- return success;
-}
-
-
-GHOST_TSuccess GHOST_WindowCarbon::invalidate()
-{
- GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::invalidate(): window invalid");
- if (!m_fullScreen) {
- Rect rect;
- ::GetPortBounds(m_grafPtr, &rect);
- ::InvalWindowRect(m_windowRef, &rect);
- }
- else {
- //EventRef event;
- //OSStatus status = ::CreateEvent(NULL, kEventClassWindow, kEventWindowUpdate, 0, 0, &event);
- //GHOST_PRINT("GHOST_WindowCarbon::invalidate(): created event " << status << " \n");
- //status = ::SetEventParameter(event, kEventParamDirectObject, typeWindowRef, sizeof(WindowRef), this);
- //GHOST_PRINT("GHOST_WindowCarbon::invalidate(): set event parameter " << status << " \n");
- //status = ::PostEventToQueue(::GetMainEventQueue(), event, kEventPriorityStandard);
- //status = ::SendEventToEventTarget(event, ::GetApplicationEventTarget());
- //GHOST_PRINT("GHOST_WindowCarbon::invalidate(): added event to queue " << status << " \n");
- m_fullScreenDirty = true;
- }
- return GHOST_kSuccess;
-}
-
-
-void GHOST_WindowCarbon::gen2mac(const STR_String& in, Str255 out) const
-{
- STR_String tempStr = in;
- int num = tempStr.Length();
- if (num > 255) num = 255;
- ::memcpy(out + 1, tempStr.Ptr(), num);
- out[0] = num;
-}
-
-
-void GHOST_WindowCarbon::mac2gen(const Str255 in, STR_String& out) const
-{
- char tmp[256];
- ::memcpy(tmp, in + 1, in[0]);
- tmp[in[0]] = '\0';
- out = tmp;
-}
-
-void GHOST_WindowCarbon::loadCursor(bool visible, GHOST_TStandardCursor cursor) const
-{
- static bool systemCursorVisible = true;
-
- if (visible != systemCursorVisible) {
- if (visible) {
- ::ShowCursor();
- systemCursorVisible = true;
- }
- else {
- ::HideCursor();
- systemCursorVisible = false;
- }
- }
-
- if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
- ::SetCursor(m_customCursor);
- }
- else {
- int carbon_cursor;
-
-#define GCMAP(ghostCursor, carbonCursor) case ghostCursor: carbon_cursor = carbonCursor; break
- switch (cursor) {
- default:
- GCMAP(GHOST_kStandardCursorDefault, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorRightArrow, kThemeAliasArrowCursor);
- GCMAP(GHOST_kStandardCursorLeftArrow, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorInfo, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorDestroy, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorHelp, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorCycle, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorSpray, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorWait, kThemeWatchCursor);
- GCMAP(GHOST_kStandardCursorText, kThemeIBeamCursor);
- GCMAP(GHOST_kStandardCursorCrosshair, kThemeCrossCursor);
- GCMAP(GHOST_kStandardCursorUpDown, kThemeClosedHandCursor);
- GCMAP(GHOST_kStandardCursorLeftRight, kThemeClosedHandCursor);
- GCMAP(GHOST_kStandardCursorTopSide, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorBottomSide, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorLeftSide, kThemeResizeLeftCursor);
- GCMAP(GHOST_kStandardCursorRightSide, kThemeResizeRightCursor);
- GCMAP(GHOST_kStandardCursorTopLeftCorner, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorTopRightCorner, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorBottomRightCorner, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorBottomLeftCorner, kThemeArrowCursor);
- GCMAP(GHOST_kStandardCursorCopy, kThemeCopyArrowCursor);
- };
-#undef GCMAP
-
- ::SetThemeCursor(carbon_cursor);
- }
-}
-
-
-bool GHOST_WindowCarbon::getFullScreenDirty()
-{
- return m_fullScreen && m_fullScreenDirty;
-}
-
-
-GHOST_TSuccess GHOST_WindowCarbon::setWindowCursorVisibility(bool visible)
-{
- if (::FrontWindow() == m_windowRef) {
- loadCursor(visible, getCursorShape());
- }
-
- return GHOST_kSuccess;
-}
-
-GHOST_TSuccess GHOST_WindowCarbon::setWindowCursorShape(GHOST_TStandardCursor shape)
-{
- if (m_customCursor) {
- delete m_customCursor;
- m_customCursor = 0;
- }
-
- if (::FrontWindow() == m_windowRef) {
- loadCursor(getCursorVisibility(), shape);
- }
-
- return GHOST_kSuccess;
-}
-
-#if 0 /* UNUSED */
-/** Reverse the bits in a GHOST_TUns8 */
-static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
-{
- ch = ((ch >> 1) & 0x55) | ((ch << 1) & 0xAA);
- ch = ((ch >> 2) & 0x33) | ((ch << 2) & 0xCC);
- ch = ((ch >> 4) & 0x0F) | ((ch << 4) & 0xF0);
- return ch;
-}
-#endif
-
-
-/** Reverse the bits in a GHOST_TUns16 */
-static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
-{
- shrt = ((shrt >> 1) & 0x5555) | ((shrt << 1) & 0xAAAA);
- shrt = ((shrt >> 2) & 0x3333) | ((shrt << 2) & 0xCCCC);
- shrt = ((shrt >> 4) & 0x0F0F) | ((shrt << 4) & 0xF0F0);
- shrt = ((shrt >> 8) & 0x00FF) | ((shrt << 8) & 0xFF00);
- return shrt;
-}
-
-GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
- int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color)
-{
- int y;
-
- if (m_customCursor) {
- delete m_customCursor;
- m_customCursor = 0;
- }
-
- m_customCursor = new Cursor;
- if (!m_customCursor) return GHOST_kFailure;
-
- for (y = 0; y < 16; y++) {
-#if !defined(__LITTLE_ENDIAN__)
- m_customCursor->data[y] = uns16ReverseBits((bitmap[2 * y] << 0) | (bitmap[2 * y + 1] << 8));
- m_customCursor->mask[y] = uns16ReverseBits((mask[2 * y] << 0) | (mask[2 * y + 1] << 8));
-#else
- m_customCursor->data[y] = uns16ReverseBits((bitmap[2 * y + 1] << 0) | (bitmap[2 * y] << 8));
- m_customCursor->mask[y] = uns16ReverseBits((mask[2 * y + 1] << 0) | (mask[2 * y] << 8));
-#endif
-
- }
-
- m_customCursor->hotSpot.h = hotX;
- m_customCursor->hotSpot.v = hotY;
-
- if (::FrontWindow() == m_windowRef) {
- loadCursor(getCursorVisibility(), GHOST_kStandardCursorCustom);
- }
-
- return GHOST_kSuccess;
-}
-
-GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
- GHOST_TUns8 mask[16][2], int hotX, int hotY)
-{
- return setWindowCustomCursorShape((GHOST_TUns8 *)bitmap, (GHOST_TUns8 *) mask, 16, 16, hotX, hotY, 0, 1);
-}
-
-
-void GHOST_WindowCarbon::setMac_windowState(short value)
-{
- mac_windowState = value;
-}
-
-short GHOST_WindowCarbon::getMac_windowState()
-{
- return mac_windowState;
-}
diff --git a/intern/ghost/intern/GHOST_WindowCarbon.h b/intern/ghost/intern/GHOST_WindowCarbon.h
deleted file mode 100644
index 16f305e93c5..00000000000
--- a/intern/ghost/intern/GHOST_WindowCarbon.h
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file ghost/intern/GHOST_WindowCarbon.h
- * \ingroup GHOST
- * Declaration of GHOST_WindowCarbon class.
- */
-
-#ifndef __GHOST_WINDOWCARBON_H__
-#define __GHOST_WINDOWCARBON_H__
-
-#ifndef __APPLE__
-#error Apple OSX only!
-#endif // __APPLE__
-
-#include "GHOST_Window.h"
-#include "STR_String.h"
-
-#define __CARBONSOUND__
-#include <Carbon/Carbon.h>
-
-#include <AGL/agl.h>
-
-
-/**
- * Window on Mac OSX/Carbon.
- * Carbon windows have a size widget in the lower right corner of the window.
- * To force it to be visible, the height of the client rectangle is reduced so
- * that applications do not draw in that area. GHOST will manage that area
- * which is called the gutter.
- * When OpenGL contexts are active, GHOST will use AGL_BUFFER_RECT to prevent
- * OpenGL drawing outside the reduced client rectangle.
- * \author Maarten Gribnau
- * \date May 23, 2001
- */
-class GHOST_WindowCarbon : public GHOST_Window {
-public:
- /**
- * Constructor.
- * Creates a new window and opens it.
- * To check if the window was created properly, use the getValid() method.
- * \param title The text shown in the title bar of the window.
- * \param left The coordinate of the left edge of the window.
- * \param top The coordinate of the top edge of the window.
- * \param width The width the window.
- * \param height The height the window.
- * \param state The state the window is initially opened with.
- * \param type The type of drawing context installed in this window.
- * \param stereoVisual Stereo visual for quad buffered stereo.
- */
- GHOST_WindowCarbon(
- const STR_String& title,
- GHOST_TInt32 left,
- GHOST_TInt32 top,
- GHOST_TUns32 width,
- GHOST_TUns32 height,
- GHOST_TWindowState state,
- GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
- const bool stereoVisual = false,
- const GHOST_TUns16 numOfAASamples = 0
- );
-
- /**
- * Destructor.
- * Closes the window and disposes resources allocated.
- */
- virtual ~GHOST_WindowCarbon();
-
- /**
- * Returns indication as to whether the window is valid.
- * \return The validity of the window.
- */
- virtual bool getValid() const;
-
- /**
- * Sets the title displayed in the title bar.
- * \param title The title to display in the title bar.
- */
- virtual void setTitle(const STR_String& title);
-
- /**
- * Returns the title displayed in the title bar.
- * \param title The title displayed in the title bar.
- */
- virtual void getTitle(STR_String& title) const;
-
- /**
- * Returns the window rectangle dimensions.
- * The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
- * \param bounds The bounding rectangle of the window.
- */
- virtual void getWindowBounds(GHOST_Rect& bounds) const;
-
- /**
- * Returns the client rectangle dimensions.
- * The left and top members of the rectangle are always zero.
- * \param bounds The bounding rectangle of the cleient area of the window.
- */
- virtual void getClientBounds(GHOST_Rect& bounds) const;
-
- /**
- * Resizes client rectangle width.
- * \param width The new width of the client area of the window.
- */
- virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width);
-
- /**
- * Resizes client rectangle height.
- * \param height The new height of the client area of the window.
- */
- virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height);
-
- /**
- * Resizes client rectangle.
- * \param width The new width of the client area of the window.
- * \param height The new height of the client area of the window.
- */
- virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height);
-
- /**
- * Returns the state of the window (normal, minimized, maximized).
- * \return The state of the window.
- */
- virtual GHOST_TWindowState getState() const;
-
- /**
- * Converts a point in screen coordinates to client rectangle coordinates
- * \param inX The x-coordinate on the screen.
- * \param inY The y-coordinate on the screen.
- * \param outX The x-coordinate in the client rectangle.
- * \param outY The y-coordinate in the client rectangle.
- */
- virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
-
- /**
- * Converts a point in screen coordinates to client rectangle coordinates
- * \param inX The x-coordinate in the client rectangle.
- * \param inY The y-coordinate in the client rectangle.
- * \param outX The x-coordinate on the screen.
- * \param outY The y-coordinate on the screen.
- */
- virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
-
- /**
- * Sets the state of the window (normal, minimized, maximized).
- * \param state The state of the window.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess setState(GHOST_TWindowState state);
-
- /**
- * Sets the order of the window (bottom, top).
- * \param order The order of the window.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order);
-
- /**
- * Swaps front and back buffers of a window.
- * \return A boolean success indicator.
- */
- virtual GHOST_TSuccess swapBuffers();
-
- /**
- * Updates the drawing context of this window. Needed
- * whenever the window is changed.
- * \return Indication of success.
- */
- GHOST_TSuccess updateDrawingContext();
-
- /**
- * Activates the drawing context of this window.
- * \return A boolean success indicator.
- */
- virtual GHOST_TSuccess activateDrawingContext();
-
- virtual void loadCursor(bool visible, GHOST_TStandardCursor cursor) const;
-
- /**
- * Returns the dirty state of the window when in full-screen mode.
- * \return Whether it is dirty.
- */
- virtual bool getFullScreenDirty();
-
- /* accessor for fullscreen window */
- virtual void setMac_windowState(short value);
- virtual short getMac_windowState();
-
-
- const GHOST_TabletData *GetTabletData()
- {
- return &m_tablet;
- }
-
- GHOST_TabletData& GetCarbonTabletData()
- {
- return m_tablet;
- }
-
- GHOST_TSuccess beginFullScreen() const {return GHOST_kFailure;}
-
- GHOST_TSuccess endFullScreen() const {return GHOST_kFailure;}
-
-protected:
- /**
- * Tries to install a rendering context in this window.
- * \param type The type of rendering context installed.
- * \return Indication as to whether installation has succeeded.
- */
- virtual GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type);
-
- /**
- * Removes the current drawing context.
- * \return Indication as to whether removal has succeeded.
- */
- virtual GHOST_TSuccess removeDrawingContext();
-
- /**
- * Invalidates the contents of this window.
- * \return Indication of success.
- */
- virtual GHOST_TSuccess invalidate();
-
- /**
- * Sets the cursor visibility on the window using
- * native window system calls.
- */
- virtual GHOST_TSuccess setWindowCursorVisibility(bool visible);
-
- /**
- * Sets the cursor shape on the window using
- * native window system calls.
- */
- virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape);
-
- /**
- * Sets the cursor shape on the window using
- * native window system calls.
- */
- virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
- int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color);
-
- virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY);
-
- /**
- * Converts a string object to a Mac Pascal string.
- * \param in The string object to be converted.
- * \param out The converted string.
- */
- virtual void gen2mac(const STR_String& in, Str255 out) const;
-
- /**
- * Converts a Mac Pascal string to a string object.
- * \param in The string to be converted.
- * \param out The converted string object.
- */
- virtual void mac2gen(const Str255 in, STR_String& out) const;
-
- WindowRef m_windowRef;
- CGrafPtr m_grafPtr;
- AGLContext m_aglCtx;
-
- /** The first created OpenGL context (for sharing display lists) */
- static AGLContext s_firstaglCtx;
-
- Cursor *m_customCursor;
-
- GHOST_TabletData m_tablet;
-
- /** When running in full-screen this tells whether to refresh the window. */
- bool m_fullScreenDirty;
-
- /** specific MacOs X full screen window setting as we use partially system mechanism
- * values : 0 not maximizable default
- * 1 normal state
- * 2 maximized state
- *
- * this will be reworked when rebuilding GHOST carbon to use new OS X apis
- * in order to be unified with GHOST fullscreen/maximised settings
- *
- * (lukep)
- **/
-
- short mac_windowState;
-
-
- /**
- * The width/height of the size rectangle in the lower right corner of a
- * Mac/Carbon window. This is also the height of the gutter area.
- */
-#ifdef GHOST_DRAW_CARBON_GUTTER
- static const GHOST_TInt32 s_sizeRectSize;
-#endif // GHOST_DRAW_CARBON_GUTTER
-};
-
-#endif // __GHOST_WINDOWCARBON_H__
-
diff --git a/intern/guardedalloc/CMakeLists.txt b/intern/guardedalloc/CMakeLists.txt
index b7a59da7813..1d041ba5380 100644
--- a/intern/guardedalloc/CMakeLists.txt
+++ b/intern/guardedalloc/CMakeLists.txt
@@ -39,6 +39,9 @@ set(SRC
MEM_guardedalloc.h
./intern/mallocn_intern.h
+
+ # only so the header is known by cmake
+ ../atomic/atomic_ops.h
)
if(WIN32 AND NOT UNIX)
diff --git a/intern/locale/CMakeLists.txt b/intern/locale/CMakeLists.txt
index 1f14a0e7a6a..3599aa68545 100644
--- a/intern/locale/CMakeLists.txt
+++ b/intern/locale/CMakeLists.txt
@@ -45,3 +45,11 @@ if(WITH_INTERNATIONAL)
endif()
blender_add_lib(bf_intern_locale "${SRC}" "${INC}" "${INC_SYS}")
+
+# -----------------------------------------------------------------------------
+# Build msgfmt executable
+set(MSFFMT_SRC
+ msgfmt.cc
+)
+
+add_executable(msgfmt ${MSFFMT_SRC})
diff --git a/intern/locale/SConscript b/intern/locale/SConscript
index f60bd90fb38..546fd3e8b40 100644
--- a/intern/locale/SConscript
+++ b/intern/locale/SConscript
@@ -37,3 +37,49 @@ if env['WITH_BF_INTERNATIONAL']:
incs += ' ' + env['BF_BOOST_INC']
env.BlenderLib( 'bf_intern_locale', sources, Split(incs), defs, libtype=['intern','player'], priority=[10, 185])
+
+if env['WITH_BF_INTERNATIONAL']:
+ import os
+ from os.path import dirname
+
+ def normpath(path):
+ return os.path.abspath(os.path.normpath(path))
+
+ # build directory
+ source_dir = Dir('.').srcnode().path
+ root_build_dir = normpath(env['BF_BUILDDIR'])
+ root_source_dir = dirname(dirname(normpath(source_dir)))
+ po_dir = os.path.join(root_source_dir, "release", "datafiles", "locale", "po")
+ build_dir = os.path.join(root_build_dir, 'locale')
+
+ if os.path.exists(po_dir):
+ # create directory if needed
+ if not os.path.exists(build_dir):
+ os.makedirs(build_dir)
+
+ msgfmt_tool = env.Clone()
+ targetpath = root_build_dir + '/msgfmt'
+ msgfmt_target = msgfmt_tool.Program(target = targetpath, source = ['msgfmt.cc'])
+
+ locale = env.Clone()
+
+ # dependencies
+ dependencies = [targetpath]
+
+ # add command for each locale
+ all_mo_files = []
+ for f in os.listdir(po_dir):
+ if not f.endswith(".po"):
+ continue
+
+ po_file = os.path.join(po_dir, f)
+ mo_file = os.path.join(build_dir, os.path.splitext(f)[0] + ".mo")
+
+ command = "\"%s\" \"%s\" \"%s\"" % (targetpath, po_file, mo_file)
+
+ locale.Command(mo_file, po_file, command)
+ locale.Depends(mo_file, dependencies)
+
+ all_mo_files.append(mo_file)
+
+ env.Depends("boost_locale_wrapper.cpp", all_mo_files)
diff --git a/intern/locale/msgfmt.cc b/intern/locale/msgfmt.cc
new file mode 100644
index 00000000000..cd858cda82d
--- /dev/null
+++ b/intern/locale/msgfmt.cc
@@ -0,0 +1,366 @@
+// Written by Sergey Sharybin <sergey.vfx@gmail.com>
+// Added support for contexts
+//
+// Based on Python script msgfmt.py from Python source
+// code tree, which was written by Written by
+// Martin v. Löwis <loewis@informatik.hu-berlin.de>
+//
+// Generate binary message catalog from textual translation description.
+//
+// This program converts a textual Uniforum-style message catalog (.po file) into
+// a binary GNU catalog (.mo file). This is essentially the same function as the
+// GNU msgfmt program, however, it is a simpler implementation.
+//
+// Usage: msgfmt input.po output.po
+
+#include <algorithm>
+#include <fstream>
+#include <iostream>
+#include <map>
+#include <stdlib.h>
+#include <string>
+#include <vector>
+
+namespace {
+
+std::map<std::string, std::string> MESSAGES;
+
+bool starts_with(const std::string &string,
+ const std::string &prefix) {
+ return prefix.size() <= string.size() &&
+ string.compare(0, prefix.size(), prefix) == 0;
+}
+
+std::string ltrim(const std::string &s) {
+ std::string result = s;
+ result.erase(result.begin(),
+ std::find_if(result.begin(),
+ result.end(),
+ std::not1(std::ptr_fun<int, int>(std::isspace))));
+ return result;
+}
+
+std::string rtrim(const std::string &s) {
+ std::string result = s;
+ result.erase(
+ std::find_if(result.rbegin(),
+ result.rend(),
+ std::not1(std::ptr_fun<int, int>(std::isspace))).base(),
+ result.end());
+ return result;
+}
+
+std::string trim(const std::string &s) {
+ return ltrim(rtrim(s));
+}
+
+std::string unescape(const std::string &s) {
+ std::string result;
+ std::string::const_iterator it = s.begin();
+ while (it != s.end()) {
+ char current_char = *it++;
+ if (current_char == '\\' && it != s.end()) {
+ char next_char = *it++;
+ if (next_char == '\\') {
+ current_char = '\\';
+ } else if (next_char == 'n') {
+ current_char = '\n';
+ } else if (next_char == 't') {
+ current_char = '\t';
+ } else {
+ current_char = next_char;
+ }
+ }
+ result += current_char;
+ }
+
+ if (result[0] == '"' && result[result.size() - 1] == '"') {
+ result = result.substr(1, result.size() - 2);
+ }
+
+ return result;
+}
+
+// Add a non-fuzzy translation to the dictionary.
+void add(const std::string &msgctxt,
+ const std::string &msgid,
+ const std::string &msgstr,
+ bool fuzzy) {
+ if (fuzzy == false && msgstr.empty() == false) {
+ if (msgctxt.empty()) {
+ MESSAGES[msgid] = msgstr;
+ } else {
+ MESSAGES[msgctxt + (char)0x04 + msgid] = msgstr;
+ }
+ }
+}
+
+template<typename TKey, typename TValue>
+void get_keys(std::map<TKey, TValue> map,
+ std::vector<TKey> *keys) {
+ for (typename std::map<TKey, TValue>::iterator it = map.begin();
+ it != map.end();
+ it++) {
+ keys->push_back(it->first);
+ }
+}
+
+std::string intToBytes(int value) {
+ std::string result;
+ for (unsigned int i = 0; i < sizeof(value); i++) {
+ result += (unsigned char) ((value >> (i * 8)) & 0xff);
+ }
+ return result;
+}
+
+typedef enum {
+ SECTION_NONE = 0,
+ SECTION_CTX = 1,
+ SECTION_ID = 2,
+ SECTION_STR = 3
+} eSectionType;
+
+struct Offset {
+ unsigned int o1, l1, o2, l2;
+};
+
+// Return the generated output.
+std::string generate(void) {
+ // The keys are sorted in the .mo file
+ std::vector<std::string> keys;
+
+ // Get list of sorted keys.
+ get_keys(MESSAGES, &keys);
+ std::sort(keys.begin(), keys.end());
+
+ std::vector<Offset> offsets;
+ std::string ids = "", strs = "";
+ for (std::vector<std::string>::iterator it = keys.begin();
+ it != keys.end();
+ it++) {
+ std::string &id = *it;
+ // For each string, we need size and file offset. Each string is NUL
+ // terminated; the NUL does not count into the size.
+ Offset offset = {(unsigned int) ids.size(),
+ (unsigned int) id.size(),
+ (unsigned int) strs.size(),
+ (unsigned int) MESSAGES[id].size()};
+ offsets.push_back(offset);
+ ids += id + '\0';
+ strs += MESSAGES[id] + '\0';
+ }
+
+ // The header is 7 32-bit unsigned integers. We don't use hash tables, so
+ // the keys start right after the index tables.
+ // translated string.
+ int keystart = 7 * 4 + 16 * keys.size();
+ // and the values start after the keys
+ int valuestart = keystart + ids.size();
+ std::vector<int> koffsets;
+ std::vector<int> voffsets;
+ // The string table first has the list of keys, then the list of values.
+ // Each entry has first the size of the string, then the file offset.
+ for (std::vector<Offset>::iterator it = offsets.begin();
+ it != offsets.end();
+ it++) {
+ Offset &offset = *it;
+ koffsets.push_back(offset.l1);
+ koffsets.push_back(offset.o1 + keystart);
+ voffsets.push_back(offset.l2);
+ voffsets.push_back(offset.o2 + valuestart);
+ }
+
+ std::vector<int> all_offsets;
+ all_offsets.reserve(koffsets.size() + voffsets.size());
+ all_offsets.insert(all_offsets.end(), koffsets.begin(), koffsets.end());
+ all_offsets.insert(all_offsets.end(), voffsets.begin(), voffsets.end());
+
+ std::string output = "";
+ output += intToBytes(0x950412de); // Magic
+ output += intToBytes(0x0); // Version
+ output += intToBytes(keys.size()); // # of entries
+ output += intToBytes(7 * 4); // start of key index
+ output += intToBytes(7 * 4 + keys.size() * 8); // start of value index
+ output += intToBytes(0); // Size of hash table
+ output += intToBytes(0); // Offset of hash table
+
+ for (std::vector<int>::iterator it = all_offsets.begin();
+ it != all_offsets.end();
+ it++) {
+ int offset = *it;
+ output += intToBytes(offset);
+ }
+
+ output += ids;
+ output += strs;
+
+ return output;
+}
+
+void make(const char *input_file_name,
+ const char *output_file_name) {
+ std::map<std::string, std::string> messages;
+
+ // Start off assuming Latin-1, so everything decodes without failure,
+ // until we know the exact encoding.
+ // TODO(sergey): Support encoding.
+ // const char *encoding = "latin-1";
+
+ eSectionType section = SECTION_NONE;
+ bool fuzzy = false;
+ bool is_plural = false;
+ std::string msgctxt, msgid, msgstr;
+
+ std::ifstream input_file_stream(input_file_name);
+
+ // Parse the catalog.
+ int lno = 0;
+ for (std::string l; getline(input_file_stream, l); ) {
+ lno++;
+ // If we get a comment line after a msgstr, this is a new entry.
+ if (l[0] == '#' && section == SECTION_STR) {
+ add(msgctxt, msgid, msgstr, fuzzy);
+ section = SECTION_NONE;
+ fuzzy = false;
+ }
+ // Record a fuzzy mark.
+ if (starts_with(l, "#,") && l.find("fuzzy") != std::string::npos) {
+ fuzzy = 1;
+ }
+ // Skip comments
+ if (l[0] == '#') {
+ continue;
+ }
+ // Now we are in a msgid section, output previous section.
+ if (starts_with(l, "msgctxt")) {
+ if (section == SECTION_STR) {
+ add(msgctxt, msgid, msgstr, fuzzy);
+ }
+ section = SECTION_CTX;
+ l = l.substr(7, l.size() - 7);
+ msgctxt = msgid = msgstr = "";
+ }
+ else if (starts_with(l, "msgid") && !starts_with(l, "msgid_plural")) {
+ if (section == SECTION_STR) {
+ add(msgctxt, msgid, msgstr, fuzzy);
+ msgctxt = "";
+ if (msgid == "") {
+#if 0
+ // See whether there is an encoding declaration.
+ p = HeaderParser();
+ charset = p.parsestr(msgstr.decode(encoding)).get_content_charset();
+ if (charset) {
+ encoding = charset;
+ }
+#else
+ // Not ported to C++ yet.
+ std::cerr << "Encoding declarations are not supported yet.\n"
+ << std::endl;
+ abort();
+#endif
+ }
+ }
+ section = SECTION_ID;
+ l = l.substr(5, l.size() - 5);
+ msgid = msgstr = "";
+ is_plural = false;
+ } else if (starts_with(l, "msgid_plural")) {
+ // This is a message with plural forms.
+ if (section != SECTION_ID) {
+ std::cerr << "msgid_plural not preceeded by msgid on"
+ << input_file_name << ":"
+ << lno
+ << std::endl;
+ abort();
+ }
+ l = l.substr(12, l.size() - 12);
+ msgid += '\0'; // separator of singular and plural
+ is_plural = true;
+ } else if (starts_with(l, "msgstr")) {
+ // Now we are in a msgstr section
+ section = SECTION_STR;
+ if (starts_with(l, "msgstr[")) {
+ if (is_plural == false) {
+ std::cerr << "plural without msgid_plural on "
+ << input_file_name << ":"
+ << lno
+ << std::endl;
+ abort();
+ }
+ int bracket_position = l.find(']');
+ if (bracket_position == std::string::npos) {
+ std::cerr << "Syntax error on "
+ << input_file_name << ":"
+ << lno
+ << std::endl;
+ abort();
+ }
+ l = l.substr(bracket_position, l.size() - bracket_position);
+ if (msgstr != "") {
+ msgstr += '\0'; // Separator of the various plural forms;
+ }
+ } else {
+ if (is_plural) {
+ std::cerr << "indexed msgstr required for plural on "
+ << input_file_name << ":"
+ << lno
+ << std::endl;
+ abort();
+ }
+ l = l.substr(6, l.size() - 6);
+ }
+ }
+ // Skip empty lines.
+ l = trim(l);
+ if (l.empty()) {
+ continue;
+ }
+ l = unescape(l);
+ if (section == SECTION_CTX) {
+ // TODO(sergey): Support encoding.
+ // msgid += l.encode(encoding);
+ msgctxt += l;
+ }
+ else if (section == SECTION_ID) {
+ // TODO(sergey): Support encoding.
+ // msgid += l.encode(encoding);
+ msgid += l;
+ } else if (section == SECTION_STR) {
+ // TODO(sergey): Support encoding.
+ // msgstr += l.encode(encoding)
+ msgstr += l;
+ } else {
+ std::cerr << "Syntax error on "
+ << input_file_name << ":"
+ << lno
+ << std::endl;
+ abort();
+ }
+ // Add last entry
+ if (section == SECTION_STR) {
+ add(msgctxt, msgid, msgstr, fuzzy);
+ }
+ }
+
+ // Compute output
+ std::string output = generate();
+
+ std::ofstream output_file_stream(output_file_name,
+ std::ios::out | std::ios::binary);
+ output_file_stream << output;
+}
+
+} // namespace
+
+int main(int argc, char **argv) {
+ if (argc != 3) {
+ printf("Usage: %s <input.po> <output.mo>\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+ const char *input_file = argv[1];
+ const char *output_file = argv[2];
+
+ make(input_file, output_file);
+
+ return EXIT_SUCCESS;
+}
diff --git a/intern/rigidbody/CMakeLists.txt b/intern/rigidbody/CMakeLists.txt
index bea3075f6be..5d84c2cf082 100644
--- a/intern/rigidbody/CMakeLists.txt
+++ b/intern/rigidbody/CMakeLists.txt
@@ -23,11 +23,10 @@
set(INC
.
- ../../extern/bullet2/src
)
set(INC_SYS
-
+ ${BULLET_INCLUDE_DIRS}
)
set(SRC
diff --git a/release/bin/blender-softwaregl b/release/bin/blender-softwaregl
index 970a7870760..8628dca2202 100755
--- a/release/bin/blender-softwaregl
+++ b/release/bin/blender-softwaregl
@@ -1,7 +1,6 @@
#!/bin/sh
-BF_DIST_BIN=`dirname "$0"`
-BF_PROGRAM="blender" # BF_PROGRAM=`basename "$0"`-bin
-exitcode=0
+BF_DIST_BIN=$(dirname "$0")
+BF_PROGRAM="blender" # BF_PROGRAM=$(basename "$0")-bin
LD_LIBRARY_PATH=${BF_DIST_BIN}/lib:${LD_LIBRARY_PATH}
@@ -20,6 +19,4 @@ XLIB_SKIP_ARGB_VISUALS=1
export LD_LIBRARY_PATH LD_LIBRARYN32_PATH LD_LIBRARYN64_PATH LD_LIBRARY_PATH_64 LD_PRELOAD XLIB_SKIP_ARGB_VISUALS
-"$BF_DIST_BIN/$BF_PROGRAM" ${1+"$@"}
-exitcode=$?
-exit $exitcode
+exec "$BF_DIST_BIN/$BF_PROGRAM" ${1+"$@"}
diff --git a/release/datafiles/blender_icons.svg b/release/datafiles/blender_icons.svg
index fef2b047474..27b93f6b10f 100644
--- a/release/datafiles/blender_icons.svg
+++ b/release/datafiles/blender_icons.svg
@@ -27061,11 +27061,11 @@
objecttolerance="10000"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="8"
- inkscape:cx="336.81018"
- inkscape:cy="34.425847"
+ inkscape:zoom="11.313708"
+ inkscape:cx="256.37124"
+ inkscape:cy="2.0121538"
inkscape:document-units="px"
- inkscape:current-layer="g24559-2"
+ inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1366"
inkscape:window-height="695"
@@ -33313,222 +33313,225 @@
inkscape:connector-curvature="0" />
</g>
</a>
- <path
- inkscape:connector-curvature="0"
- id="path19537-6"
- d="m 12,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19539-5"
- d="m 33,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 L 35,2 33,2 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19541-3"
- d="m 54,2 0,1 2,0 0,1 1,0 0,-1.25 -1,0 L 56,2 54,2 z m 2,2 -1,0 0,1 1,0 0,-1 z m 0,1 0,1 -2,0 0,1 2,0 0,-0.75 1,0 L 57,5 56,5 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19543-9"
- d="m 75,2 0,3 1,0 1,0 0,2 1,0 0,-4 -1,0 0,1 -1,0 0,-2 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19545-2"
- d="m 96,2 0,3 1,0 1,0 0,1 -2,0 0,1 2,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -1,0 0,-1 2,0 0,-1 -2,0 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19547-4"
- d="m 118,2 0,0.75 -1,0 0,3.25 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-1 -0.75,0 0,-1 -1.25,0 0,-1 1.5,0 0,-1 -1.5,0 z m 0,3 1,0 0,1 -1,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19549-6"
- d="m 138,2 0,1 2,0 0,1 -1,0 0,3 1,0 0,-2.75 1,0 0,-1.25 0,-1 -3,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19551-18"
- d="m 159.75,2 0,1 -0.5,0 0,1 0.5,0 0,1 -0.75,0 0,1 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-1 -0.75,0 0,-1 0.5,0 0,-1 -0.5,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,1 -1,0 0,-1 z m 0,2 1,0 0,1 -1,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19553-2"
- d="m 180.75,2 0,1 -0.75,0 0,1 0.75,0 0,1 1.25,0 0,1 -1.5,0 0,1 1.5,0 0,-0.75 1,0 0,-3.25 -0.75,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,1 -1,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cccccccccccccccccc"
- id="path19555-1"
- d="m 202.75,2 0,1 -0.75,0 0,3 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-3 -0.75,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,3 -1,0 0,-3 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 514,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
- id="path19559-1" />
- <path
- inkscape:connector-curvature="0"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 476,2 0,1 2,0 0,1 1,0 0,-1.25 -1,0 0,-0.75 -2,0 z m 2,2 -1,0 0,1 1,0 0,-1 z m 0,1 0,1 -2,0 0,1 2,0 0,-0.75 1,0 0,-1.25 -1,0 z"
- id="path19561-9" />
- <path
- inkscape:connector-curvature="0"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 497,2 0,3 1,0 1,0 0,2 1,0 0,-4 -1,0 0,1 -1,0 0,-2 -1,0 z"
- id="path19563-7" />
- <path
- inkscape:connector-curvature="0"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 518,2 0,3 1,0 1,0 0,1 -2,0 0,1 2,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -1,0 0,-1 2,0 0,-1 -2,0 -1,0 z"
- id="path19565-6" />
- <path
- inkscape:connector-curvature="0"
- id="path19577-2"
- d="m 200,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19579-9"
- d="m 244,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19581-5"
- d="m 265,2 0,1 2,0 0,1 1,0 0,-1.25 -1,0 0,-0.75 -2,0 z m 2,2 -1,0 0,1 1,0 0,-1 z m 0,1 0,1 -2,0 0,1 2,0 0,-0.75 1,0 0,-1.25 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19583-2"
- d="m 286,2 0,3 1,0 1,0 0,2 1,0 0,-4 -1,0 0,1 -1,0 0,-2 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19585-0"
- d="m 307,2 0,3 1,0 1,0 0,1 -2,0 0,1 2,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -1,0 0,-1 2,0 0,-1 -2,0 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19587-0"
- d="m 329,2 0,0.75 -1,0 0,3.25 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-1 -0.75,0 0,-1 -1.25,0 0,-1 1.5,0 0,-1 -1.5,0 z m 0,3 1,0 0,1 -1,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19589-3"
- d="m 349,2 0,1 2,0 0,1 -1,0 0,3 1,0 0,-2.75 1,0 0,-1.25 0,-1 -3,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19591-9"
- d="m 370.75,2 0,1 -0.5,0 0,1 0.5,0 0,1 -0.75,0 0,1 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-1 -0.75,0 0,-1 0.5,0 0,-1 -0.5,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,1 -1,0 0,-1 z m 0,2 1,0 0,1 -1,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19593-1"
- d="m 391.75,2 0,1 -0.75,0 0,1 0.75,0 0,1 1.25,0 0,1 -1.5,0 0,1 1.5,0 0,-0.75 1,0 0,-3.25 -0.75,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,1 -1,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19595-8"
- d="m 413.75,2 0,1 -0.75,0 0,3 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-3 -0.75,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,3 -1,0 0,-3 z m 0.25,1 0,1 0.5,0 0,-1 -0.5,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19597-1"
- d="m 221,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 224,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- id="path19599-9" />
- <path
- inkscape:connector-curvature="0"
- id="path19601-5"
- d="m 242,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19603-3"
- d="m 263,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19605-2"
- d="m 284,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19607-5"
- d="m 305,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19609-2"
- d="m 326,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19611-5"
- d="m 347,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19613-8"
- d="m 368,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19615-6"
- d="m 389,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19617-7"
- d="m 409,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19619-7"
- d="m 435,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19621-2"
- d="m 430,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19623-2"
- d="m 451,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 455,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
- id="path19625-9" />
- <path
- inkscape:connector-curvature="0"
- id="path19627-4"
- d="m 472,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path19629-1"
- d="m 493,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- id="path11036-9"
- d="m 536,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- d="m 541,2 0,0.75 -1,0 0,3.25 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-1 -0.75,0 0,-1 -1.25,0 0,-1 1.5,0 0,-1 -1.5,0 z m 0,3 1,0 0,1 -1,0 0,-1 z"
- id="path11038-6" />
+ <g
+ id="g15986">
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 12,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19537-6"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 33,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 L 35,2 33,2 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
+ id="path19539-5"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 54,2 0,1 2,0 0,1 1,0 0,-1.25 -1,0 L 56,2 54,2 z m 2,2 -1,0 0,1 1,0 0,-1 z m 0,1 0,1 -2,0 0,1 2,0 0,-0.75 1,0 L 57,5 56,5 z"
+ id="path19541-3"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 75,2 0,3 1,0 1,0 0,2 1,0 0,-4 -1,0 0,1 -1,0 0,-2 -1,0 z"
+ id="path19543-9"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 96,2 0,3 1,0 1,0 0,1 -2,0 0,1 2,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -1,0 0,-1 2,0 0,-1 -2,0 -1,0 z"
+ id="path19545-2"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 118,2 0,0.75 -1,0 0,3.25 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-1 -0.75,0 0,-1 -1.25,0 0,-1 1.5,0 0,-1 -1.5,0 z m 0,3 1,0 0,1 -1,0 0,-1 z"
+ id="path19547-4"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 138,2 0,1 2,0 0,1 -1,0 0,3 1,0 0,-2.75 1,0 0,-1.25 0,-1 -3,0 z"
+ id="path19549-6"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 159.75,2 0,1 -0.5,0 0,1 0.5,0 0,1 -0.75,0 0,1 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-1 -0.75,0 0,-1 0.5,0 0,-1 -0.5,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,1 -1,0 0,-1 z m 0,2 1,0 0,1 -1,0 0,-1 z"
+ id="path19551-18"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 180.75,2 0,1 -0.75,0 0,1 0.75,0 0,1 1.25,0 0,1 -1.5,0 0,1 1.5,0 0,-0.75 1,0 0,-3.25 -0.75,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,1 -1,0 0,-1 z"
+ id="path19553-2"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 202.75,2 0,1 -0.75,0 0,3 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-3 -0.75,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,3 -1,0 0,-3 z"
+ id="path19555-1"
+ sodipodi:nodetypes="cccccccccccccccccc"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path19559-1"
+ d="m 514,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path19561-9"
+ d="m 476,2 0,1 2,0 0,1 1,0 0,-1.25 -1,0 0,-0.75 -2,0 z m 2,2 -1,0 0,1 1,0 0,-1 z m 0,1 0,1 -2,0 0,1 2,0 0,-0.75 1,0 0,-1.25 -1,0 z"
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path19563-7"
+ d="m 497,2 0,3 1,0 1,0 0,2 1,0 0,-4 -1,0 0,1 -1,0 0,-2 -1,0 z"
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path19565-6"
+ d="m 518,2 0,3 1,0 1,0 0,1 -2,0 0,1 2,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -1,0 0,-1 2,0 0,-1 -2,0 -1,0 z"
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 200,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19577-2"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 244,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
+ id="path19579-9"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 265,2 0,1 2,0 0,1 1,0 0,-1.25 -1,0 0,-0.75 -2,0 z m 2,2 -1,0 0,1 1,0 0,-1 z m 0,1 0,1 -2,0 0,1 2,0 0,-0.75 1,0 0,-1.25 -1,0 z"
+ id="path19581-5"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 286,2 0,3 1,0 1,0 0,2 1,0 0,-4 -1,0 0,1 -1,0 0,-2 -1,0 z"
+ id="path19583-2"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 307,2 0,3 1,0 1,0 0,1 -2,0 0,1 2,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -1,0 0,-1 2,0 0,-1 -2,0 -1,0 z"
+ id="path19585-0"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 329,2 0,0.75 -1,0 0,3.25 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-1 -0.75,0 0,-1 -1.25,0 0,-1 1.5,0 0,-1 -1.5,0 z m 0,3 1,0 0,1 -1,0 0,-1 z"
+ id="path19587-0"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 349,2 0,1 2,0 0,1 -1,0 0,3 1,0 0,-2.75 1,0 0,-1.25 0,-1 -3,0 z"
+ id="path19589-3"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 370.75,2 0,1 -0.5,0 0,1 0.5,0 0,1 -0.75,0 0,1 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-1 -0.75,0 0,-1 0.5,0 0,-1 -0.5,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,1 -1,0 0,-1 z m 0,2 1,0 0,1 -1,0 0,-1 z"
+ id="path19591-9"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 391.75,2 0,1 -0.75,0 0,1 0.75,0 0,1 1.25,0 0,1 -1.5,0 0,1 1.5,0 0,-0.75 1,0 0,-3.25 -0.75,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,1 -1,0 0,-1 z"
+ id="path19593-1"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 413.75,2 0,1 -0.75,0 0,3 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-3 -0.75,0 0,-1 -1.5,0 z m 0.25,1 1,0 0,3 -1,0 0,-3 z m 0.25,1 0,1 0.5,0 0,-1 -0.5,0 z"
+ id="path19595-8"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 221,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19597-1"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path19599-9"
+ d="m 224,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 242,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19601-5"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 263,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19603-3"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 284,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19605-2"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 305,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19607-5"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 326,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19609-2"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 347,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19611-5"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 368,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19613-8"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 389,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19615-6"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 409,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
+ id="path19617-7"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 435,2 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
+ id="path19619-7"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 430,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
+ id="path19621-2"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 451,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
+ id="path19623-2"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path19625-9"
+ d="m 455,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 472,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
+ id="path19627-4"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 493,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
+ id="path19629-1"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 536,2 0,1 2,0 0,1 -1,0 0,1 1,0 0,-0.75 1,0 0,-1.5 -1,0 0,-0.75 -2,0 z m 1,3 -1,0 0,1 0,1 3,0 0,-1 -2,0 0,-1 z"
+ id="path11036-9"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path11038-6"
+ d="m 541,2 0,0.75 -1,0 0,3.25 0.75,0 0,1 1.5,0 0,-1 0.75,0 0,-1 -0.75,0 0,-1 -1.25,0 0,-1 1.5,0 0,-1 -1.5,0 z m 0,3 1,0 0,1 -1,0 0,-1 z"
+ style="fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ inkscape:connector-curvature="0" />
+ </g>
<g
id="g11125-9"
transform="translate(547,1)"
@@ -33681,7 +33684,7 @@
<g
style="color:#000000;fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="g41041-8"
- transform="translate(0,634)">
+ transform="translate(0,636)">
<path
id="path41043-2"
d="m 12,1 0,1 -1,0 0,1 1,0 0,3 1,0 0,-5 -1,0 z"
diff --git a/release/datafiles/blender_icons16.png b/release/datafiles/blender_icons16.png
index 24d95d7ec5c..2f2f8deed68 100644
--- a/release/datafiles/blender_icons16.png
+++ b/release/datafiles/blender_icons16.png
Binary files differ
diff --git a/release/datafiles/blender_icons32.png b/release/datafiles/blender_icons32.png
index 3f8901fafd9..8b469238735 100644
--- a/release/datafiles/blender_icons32.png
+++ b/release/datafiles/blender_icons32.png
Binary files differ
diff --git a/release/scripts/modules/animsys_refactor.py b/release/scripts/modules/animsys_refactor.py
index fd6087b38e6..9730a05c2d2 100644
--- a/release/scripts/modules/animsys_refactor.py
+++ b/release/scripts/modules/animsys_refactor.py
@@ -22,7 +22,7 @@
This module has utility functions for renaming
rna values in fcurves and drivers.
-The main function to use is: update_data_paths(...)
+Currently unused, but might become useful later again.
"""
IS_TESTING = False
@@ -216,672 +216,6 @@ def update_data_paths(rna_update):
print("fcurve (%s): %s -> %s" % (id_data.name, data_path, data_path_new))
-# we could have this data in its own file but no point really
-data_2_56_to_2_59 = (
- ("ClothCollisionSettings", "min_distance", "distance_min"),
- ("ClothCollisionSettings", "self_min_distance", "self_distance_min"),
- ("ClothCollisionSettings", "enable_collision", "use_collision"),
- ("ClothCollisionSettings", "enable_self_collision", "use_self_collision"),
- ("ClothSettings", "pin_cloth", "use_pin_cloth"),
- ("ClothSettings", "stiffness_scaling", "use_stiffness_scale"),
- ("CollisionSettings", "random_damping", "damping_random"),
- ("CollisionSettings", "random_friction", "friction_random"),
- ("CollisionSettings", "inner_thickness", "thickness_inner"),
- ("CollisionSettings", "outer_thickness", "thickness_outer"),
- ("CollisionSettings", "kill_particles", "use_particle_kill"),
- ("Constraint", "proxy_local", "is_proxy_local"),
- ("ActionConstraint", "maximum", "max"),
- ("ActionConstraint", "minimum", "min"),
- ("FollowPathConstraint", "use_fixed_position", "use_fixed_location"),
- ("KinematicConstraint", "chain_length", "chain_count"),
- ("KinematicConstraint", "pos_lock_x", "lock_location_x"),
- ("KinematicConstraint", "pos_lock_y", "lock_location_y"),
- ("KinematicConstraint", "pos_lock_z", "lock_location_z"),
- ("KinematicConstraint", "rot_lock_x", "lock_rotation_x"),
- ("KinematicConstraint", "rot_lock_y", "lock_rotation_y"),
- ("KinematicConstraint", "rot_lock_z", "lock_rotation_z"),
- ("KinematicConstraint", "axis_reference", "reference_axis"),
- ("KinematicConstraint", "use_position", "use_location"),
- ("LimitLocationConstraint", "maximum_x", "max_x"),
- ("LimitLocationConstraint", "maximum_y", "max_y"),
- ("LimitLocationConstraint", "maximum_z", "max_z"),
- ("LimitLocationConstraint", "minimum_x", "min_x"),
- ("LimitLocationConstraint", "minimum_y", "min_y"),
- ("LimitLocationConstraint", "minimum_z", "min_z"),
- ("LimitLocationConstraint", "use_maximum_x", "use_max_x"),
- ("LimitLocationConstraint", "use_maximum_y", "use_max_y"),
- ("LimitLocationConstraint", "use_maximum_z", "use_max_z"),
- ("LimitLocationConstraint", "use_minimum_x", "use_min_x"),
- ("LimitLocationConstraint", "use_minimum_y", "use_min_y"),
- ("LimitLocationConstraint", "use_minimum_z", "use_min_z"),
- ("LimitLocationConstraint", "limit_transform", "use_transform_limit"),
- ("LimitRotationConstraint", "maximum_x", "max_x"),
- ("LimitRotationConstraint", "maximum_y", "max_y"),
- ("LimitRotationConstraint", "maximum_z", "max_z"),
- ("LimitRotationConstraint", "minimum_x", "min_x"),
- ("LimitRotationConstraint", "minimum_y", "min_y"),
- ("LimitRotationConstraint", "minimum_z", "min_z"),
- ("LimitRotationConstraint", "limit_transform", "use_transform_limit"),
- ("LimitScaleConstraint", "maximum_x", "max_x"),
- ("LimitScaleConstraint", "maximum_y", "max_y"),
- ("LimitScaleConstraint", "maximum_z", "max_z"),
- ("LimitScaleConstraint", "minimum_x", "min_x"),
- ("LimitScaleConstraint", "minimum_y", "min_y"),
- ("LimitScaleConstraint", "minimum_z", "min_z"),
- ("LimitScaleConstraint", "use_maximum_x", "use_max_x"),
- ("LimitScaleConstraint", "use_maximum_y", "use_max_y"),
- ("LimitScaleConstraint", "use_maximum_z", "use_max_z"),
- ("LimitScaleConstraint", "use_minimum_x", "use_min_x"),
- ("LimitScaleConstraint", "use_minimum_y", "use_min_y"),
- ("LimitScaleConstraint", "use_minimum_z", "use_min_z"),
- ("LimitScaleConstraint", "limit_transform", "use_transform_limit"),
- ("PivotConstraint", "enabled_rotation_range", "rotation_range"),
- ("PivotConstraint", "use_relative_position", "use_relative_location"),
- ("PythonConstraint", "number_of_targets", "target_count"),
- ("SplineIKConstraint", "chain_length", "chain_count"),
- ("SplineIKConstraint", "chain_offset", "use_chain_offset"),
- ("SplineIKConstraint", "even_divisions", "use_even_divisions"),
- ("SplineIKConstraint", "y_stretch", "use_y_stretch"),
- ("SplineIKConstraint", "xz_scaling_mode", "xz_scale_mode"),
- ("StretchToConstraint", "original_length", "rest_length"),
- ("TrackToConstraint", "target_z", "use_target_z"),
- ("TransformConstraint", "extrapolate_motion", "use_motion_extrapolate"),
- ("FieldSettings", "do_location", "apply_to_location"),
- ("FieldSettings", "do_rotation", "apply_to_rotation"),
- ("FieldSettings", "maximum_distance", "distance_max"),
- ("FieldSettings", "minimum_distance", "distance_min"),
- ("FieldSettings", "radial_maximum", "radial_max"),
- ("FieldSettings", "radial_minimum", "radial_min"),
- ("FieldSettings", "force_2d", "use_2d_force"),
- ("FieldSettings", "do_absorption", "use_absorption"),
- ("FieldSettings", "global_coordinates", "use_global_coords"),
- ("FieldSettings", "guide_path_add", "use_guide_path_add"),
- ("FieldSettings", "multiple_springs", "use_multiple_springs"),
- ("FieldSettings", "use_coordinates", "use_object_coords"),
- ("FieldSettings", "root_coordinates", "use_root_coords"),
- ("ControlFluidSettings", "reverse_frames", "use_reverse_frames"),
- ("DomainFluidSettings", "real_world_size", "simulation_scale"),
- ("DomainFluidSettings", "surface_smoothing", "surface_smooth"),
- ("DomainFluidSettings", "reverse_frames", "use_reverse_frames"),
- ("DomainFluidSettings", "generate_speed_vectors", "use_speed_vectors"),
- ("DomainFluidSettings", "override_time", "use_time_override"),
- ("FluidFluidSettings", "export_animated_mesh", "use_animated_mesh"),
- ("InflowFluidSettings", "export_animated_mesh", "use_animated_mesh"),
- ("InflowFluidSettings", "local_coordinates", "use_local_coords"),
- ("ObstacleFluidSettings", "export_animated_mesh", "use_animated_mesh"),
- ("OutflowFluidSettings", "export_animated_mesh", "use_animated_mesh"),
- ("ParticleFluidSettings", "drops", "use_drops"),
- ("ParticleFluidSettings", "floats", "use_floats"),
- ("Armature", "drawtype", "draw_type"),
- ("Armature", "layer_protection", "layers_protected"),
- ("Armature", "auto_ik", "use_auto_ik"),
- ("Armature", "delay_deform", "use_deform_delay"),
- ("Armature", "deform_envelope", "use_deform_envelopes"),
- ("Armature", "deform_quaternion", "use_deform_preserve_volume"),
- ("Armature", "deform_vertexgroups", "use_deform_vertex_groups"),
- ("Armature", "x_axis_mirror", "use_mirror_x"),
- ("Curve", "width", "offset"),
- ("Image", "animation_speed", "fps"),
- ("Image", "animation_end", "frame_end"),
- ("Image", "animation_start", "frame_start"),
- ("Image", "animated", "use_animation"),
- ("Image", "clamp_x", "use_clamp_x"),
- ("Image", "clamp_y", "use_clamp_y"),
- ("Image", "premultiply", "use_premultiply"),
- ("AreaLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"),
- ("AreaLamp", "only_shadow", "use_only_shadow"),
- ("AreaLamp", "shadow_layer", "use_shadow_layer"),
- ("AreaLamp", "umbra", "use_umbra"),
- ("PointLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"),
- ("PointLamp", "only_shadow", "use_only_shadow"),
- ("PointLamp", "shadow_layer", "use_shadow_layer"),
- ("PointLamp", "sphere", "use_sphere"),
- ("SpotLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"),
- ("SpotLamp", "auto_clip_end", "use_auto_clip_end"),
- ("SpotLamp", "auto_clip_start", "use_auto_clip_start"),
- ("SpotLamp", "only_shadow", "use_only_shadow"),
- ("SpotLamp", "shadow_layer", "use_shadow_layer"),
- ("SpotLamp", "sphere", "use_sphere"),
- ("SunLamp", "only_shadow", "use_only_shadow"),
- ("SunLamp", "shadow_layer", "use_shadow_layer"),
- ("Material", "z_offset", "offset_z"),
- ("Material", "shadow_casting_alpha", "shadow_cast_alpha"),
- ("Material", "cast_approximate", "use_cast_approximate"),
- ("Material", "cast_buffer_shadows", "use_cast_buffer_shadows"),
- ("Material", "cast_shadows_only", "use_cast_shadows_only"),
- ("Material", "face_texture", "use_face_texture"),
- ("Material", "face_texture_alpha", "use_face_texture_alpha"),
- ("Material", "full_oversampling", "use_full_oversampling"),
- ("Material", "light_group_exclusive", "use_light_group_exclusive"),
- ("Material", "object_color", "use_object_color"),
- ("Material", "only_shadow", "use_only_shadow"),
- ("Material", "ray_shadow_bias", "use_ray_shadow_bias"),
- ("Material", "traceable", "use_raytrace"),
- ("Material", "shadeless", "use_shadeless"),
- ("Material", "tangent_shading", "use_tangent_shading"),
- ("Material", "transparency", "use_transparency"),
- ("Material", "receive_transparent_shadows", "use_transparent_shadows"),
- ("Material", "vertex_color_light", "use_vertex_color_light"),
- ("Material", "vertex_color_paint", "use_vertex_color_paint"),
- ("Mesh", "autosmooth_angle", "auto_smooth_angle"),
- ("Mesh", "autosmooth", "use_auto_smooth"),
- ("Object", "max_draw_type", "draw_type"),
- ("Object", "use_dupli_verts_rotation", "use_dupli_vertices_rotation"),
- ("Object", "shape_key_edit_mode", "use_shape_key_edit_mode"),
- ("Object", "slow_parent", "use_slow_parent"),
- ("Object", "time_offset_add_parent", "use_time_offset_add_parent"),
- ("Object", "time_offset_edit", "use_time_offset_edit"),
- ("Object", "time_offset_parent", "use_time_offset_parent"),
- ("Object", "time_offset_particle", "use_time_offset_particle"),
- ("ParticleSettings", "adaptive_pix", "adaptive_pixel"),
- ("ParticleSettings", "child_effector", "apply_effector_to_children"),
- ("ParticleSettings", "child_guide", "apply_guide_to_children"),
- ("ParticleSettings", "billboard_split_offset", "billboard_offset_split"),
- ("ParticleSettings", "billboard_random_tilt", "billboard_tilt_random"),
- ("ParticleSettings", "child_length_thres", "child_length_threshold"),
- ("ParticleSettings", "child_random_size", "child_size_random"),
- ("ParticleSettings", "clumppow", "clump_shape"),
- ("ParticleSettings", "damp_factor", "damping"),
- ("ParticleSettings", "draw_as", "draw_method"),
- ("ParticleSettings", "random_factor", "factor_random"),
- ("ParticleSettings", "grid_invert", "invert_grid"),
- ("ParticleSettings", "random_length", "length_random"),
- ("ParticleSettings", "random_lifetime", "lifetime_random"),
- ("ParticleSettings", "billboard_lock", "lock_billboard"),
- ("ParticleSettings", "boids_2d", "lock_boids_to_surface"),
- ("ParticleSettings", "object_aligned_factor", "object_align_factor"),
- ("ParticleSettings", "random_phase_factor", "phase_factor_random"),
- ("ParticleSettings", "ren_as", "render_type"),
- ("ParticleSettings", "rendered_child_nbr", "rendered_child_count"),
- ("ParticleSettings", "random_rotation_factor", "rotation_factor_random"),
- ("ParticleSettings", "rough1", "roughness_1"),
- ("ParticleSettings", "rough1_size", "roughness_1_size"),
- ("ParticleSettings", "rough2", "roughness_2"),
- ("ParticleSettings", "rough2_size", "roughness_2_size"),
- ("ParticleSettings", "rough2_thres", "roughness_2_threshold"),
- ("ParticleSettings", "rough_end_shape", "roughness_end_shape"),
- ("ParticleSettings", "rough_endpoint", "roughness_endpoint"),
- ("ParticleSettings", "random_size", "size_random"),
- ("ParticleSettings", "abs_path_time", "use_absolute_path_time"),
- ("ParticleSettings", "animate_branching", "use_animate_branching"),
- ("ParticleSettings", "branching", "use_branching"),
- ("ParticleSettings", "died", "use_dead"),
- ("ParticleSettings", "die_on_collision", "use_die_on_collision"),
- ("ParticleSettings", "rotation_dynamic", "use_dynamic_rotation"),
- ("ParticleSettings", "even_distribution", "use_even_distribution"),
- ("ParticleSettings", "rand_group", "use_group_pick_random"),
- ("ParticleSettings", "hair_bspline", "use_hair_bspline"),
- ("ParticleSettings", "sizemass", "use_multiply_size_mass"),
- ("ParticleSettings", "react_multiple", "use_react_multiple"),
- ("ParticleSettings", "react_start_end", "use_react_start_end"),
- ("ParticleSettings", "render_adaptive", "use_render_adaptive"),
- ("ParticleSettings", "self_effect", "use_self_effect"),
- ("ParticleSettings", "enable_simplify", "use_simplify"),
- ("ParticleSettings", "size_deflect", "use_size_deflect"),
- ("ParticleSettings", "render_strand", "use_strand_primitive"),
- ("ParticleSettings", "symmetric_branching", "use_symmetric_branching"),
- ("ParticleSettings", "velocity_length", "use_velocity_length"),
- ("ParticleSettings", "whole_group", "use_whole_group"),
- ("CloudsTexture", "noise_size", "noise_scale"),
- ("DistortedNoiseTexture", "noise_size", "noise_scale"),
- ("EnvironmentMapTexture", "filter_size_minimum", "use_filter_size_min"),
- ("EnvironmentMapTexture", "mipmap_gauss", "use_mipmap_gauss"),
- ("ImageTexture", "calculate_alpha", "use_calculate_alpha"),
- ("ImageTexture", "checker_even", "use_checker_even"),
- ("ImageTexture", "checker_odd", "use_checker_odd"),
- ("ImageTexture", "filter_size_minimum", "use_filter_size_min"),
- ("ImageTexture", "flip_axis", "use_flip_axis"),
- ("ImageTexture", "mipmap_gauss", "use_mipmap_gauss"),
- ("ImageTexture", "mirror_x", "use_mirror_x"),
- ("ImageTexture", "mirror_y", "use_mirror_y"),
- ("ImageTexture", "normal_map", "use_normal_map"),
- ("MarbleTexture", "noise_size", "noise_scale"),
- ("MarbleTexture", "noisebasis2", "noise_basis_2"),
- ("MarbleTexture", "noisebasis_2", "noise_basis_2"),
- ("MusgraveTexture", "highest_dimension", "dimension_max"),
- ("MusgraveTexture", "noise_size", "noise_scale"),
- ("StucciTexture", "noise_size", "noise_scale"),
- ("VoronoiTexture", "coloring", "color_mode"),
- ("VoronoiTexture", "noise_size", "noise_scale"),
- ("WoodTexture", "noise_size", "noise_scale"),
- ("WoodTexture", "noisebasis2", "noise_basis_2"),
- ("WoodTexture", "noisebasis_2", "noise_basis_2"),
- ("World", "blend_sky", "use_sky_blend"),
- ("World", "paper_sky", "use_sky_paper"),
- ("World", "real_sky", "use_sky_real"),
- ("ImageUser", "auto_refresh", "use_auto_refresh"),
- ("MaterialHalo", "flares_sub", "flare_subflare_count"),
- ("MaterialHalo", "flare_subsize", "flare_subflare_size"),
- ("MaterialHalo", "line_number", "line_count"),
- ("MaterialHalo", "rings", "ring_count"),
- ("MaterialHalo", "star_tips", "star_tip_count"),
- ("MaterialHalo", "xalpha", "use_extreme_alpha"),
- ("MaterialHalo", "flare_mode", "use_flare_mode"),
- ("MaterialHalo", "vertex_normal", "use_vertex_normal"),
- ("MaterialPhysics", "align_to_normal", "use_normal_align"),
- ("MaterialStrand", "min_size", "size_min"),
- ("MaterialStrand", "blender_units", "use_blender_units"),
- ("MaterialStrand", "surface_diffuse", "use_surface_diffuse"),
- ("MaterialStrand", "tangent_shading", "use_tangent_shading"),
- ("MaterialSubsurfaceScattering", "error_tolerance", "error_threshold"),
- ("MaterialVolume", "depth_cutoff", "depth_threshold"),
- ("MaterialVolume", "lighting_mode", "light_method"),
- ("MaterialVolume", "step_calculation", "step_method"),
- ("MaterialVolume", "external_shadows", "use_external_shadows"),
- ("MaterialVolume", "light_cache", "use_light_cache"),
- ("ArmatureModifier", "multi_modifier", "use_multi_modifier"),
- ("ArrayModifier", "constant_offset_displacement", "constant_offset_displace"),
- ("ArrayModifier", "merge_distance", "merge_threshold"),
- ("ArrayModifier", "relative_offset_displacement", "relative_offset_displace"),
- ("ArrayModifier", "constant_offset", "use_constant_offset"),
- ("ArrayModifier", "merge_adjacent_vertices", "use_merge_vertices"),
- ("ArrayModifier", "merge_end_vertices", "use_merge_vertices_cap"),
- ("ArrayModifier", "add_offset_object", "use_object_offset"),
- ("ArrayModifier", "relative_offset", "use_relative_offset"),
- ("BevelModifier", "only_vertices", "use_only_vertices"),
- ("CastModifier", "from_radius", "use_radius_as_size"),
- ("DisplaceModifier", "midlevel", "mid_level"),
- ("DisplaceModifier", "texture_coordinates", "texture_coords"),
- ("EdgeSplitModifier", "use_sharp", "use_edge_sharp"),
- ("ExplodeModifier", "split_edges", "use_edge_split"),
- ("MirrorModifier", "merge_limit", "merge_threshold"),
- ("MirrorModifier", "mirror_u", "use_mirror_u"),
- ("MirrorModifier", "mirror_v", "use_mirror_v"),
- ("MirrorModifier", "mirror_vertex_groups", "use_mirror_vertex_groups"),
- ("ParticleInstanceModifier", "particle_system_number", "particle_system_index"),
- ("ParticleInstanceModifier", "keep_shape", "use_preserve_shape"),
- ("ShrinkwrapModifier", "cull_back_faces", "use_cull_back_faces"),
- ("ShrinkwrapModifier", "cull_front_faces", "use_cull_front_faces"),
- ("ShrinkwrapModifier", "keep_above_surface", "use_keep_above_surface"),
- ("SimpleDeformModifier", "lock_x_axis", "lock_x"),
- ("SimpleDeformModifier", "lock_y_axis", "lock_y"),
- ("SmokeModifier", "smoke_type", "type"),
- ("SubsurfModifier", "subsurf_uv", "use_subsurf_uv"),
- ("UVProjectModifier", "num_projectors", "projector_count"),
- ("UVProjectModifier", "override_image", "use_image_override"),
- ("WaveModifier", "texture_coordinates", "texture_coords"),
- ("WaveModifier", "x_normal", "use_normal_x"),
- ("WaveModifier", "y_normal", "use_normal_y"),
- ("WaveModifier", "z_normal", "use_normal_z"),
- ("NlaStrip", "blending", "blend_type"),
- ("NlaStrip", "animated_influence", "use_animated_influence"),
- ("NlaStrip", "animated_time", "use_animated_time"),
- ("NlaStrip", "animated_time_cyclic", "use_animated_time_cyclic"),
- ("NlaStrip", "auto_blending", "use_auto_blend"),
- ("CompositorNodeAlphaOver", "convert_premul", "use_premultiply"),
- ("CompositorNodeBlur", "sizex", "size_x"),
- ("CompositorNodeBlur", "sizey", "size_y"),
- ("CompositorNodeChannelMatte", "algorithm", "limit_method"),
- ("CompositorNodeChromaMatte", "acceptance", "tolerance"),
- ("CompositorNodeColorBalance", "correction_formula", "correction_method"),
- ("CompositorNodeColorSpill", "algorithm", "limit_method"),
- ("CompositorNodeColorSpill", "unspill", "use_unspill"),
- ("CompositorNodeCrop", "x2", "max_x"),
- ("CompositorNodeCrop", "y2", "max_y"),
- ("CompositorNodeCrop", "x1", "min_x"),
- ("CompositorNodeCrop", "y1", "min_y"),
- ("CompositorNodeCrop", "crop_size", "use_crop_size"),
- ("CompositorNodeDefocus", "max_blur", "blur_max"),
- ("CompositorNodeDefocus", "gamma_correction", "use_gamma_correction"),
- ("CompositorNodeGlare", "rotate_45", "use_rotate_45"),
- ("CompositorNodeImage", "auto_refresh", "use_auto_refresh"),
- ("CompositorNodeLensdist", "projector", "use_projector"),
- ("CompositorNodeVecBlur", "max_speed", "speed_max"),
- ("CompositorNodeVecBlur", "min_speed", "speed_min"),
- ("ShaderNodeMapping", "maximum", "max"),
- ("ShaderNodeMapping", "minimum", "min"),
- ("ShaderNodeMapping", "clamp_maximum", "use_max"),
- ("ShaderNodeMapping", "clamp_minimum", "use_min"),
- ("ParticleEdit", "add_keys", "default_key_count"),
- ("ParticleEdit", "selection_mode", "select_mode"),
- ("ParticleEdit", "auto_velocity", "use_auto_velocity"),
- ("ParticleEdit", "add_interpolate", "use_default_interpolate"),
- ("ParticleEdit", "emitter_deflect", "use_emitter_deflect"),
- ("ParticleEdit", "fade_time", "use_fade_time"),
- ("ParticleEdit", "keep_lengths", "use_preserve_length"),
- ("ParticleEdit", "keep_root", "use_preserve_root"),
- ("ParticleSystem", "vertex_group_clump_negate", "invert_vertex_group_clump"),
- ("ParticleSystem", "vertex_group_density_negate", "invert_vertex_group_density"),
- ("ParticleSystem", "vertex_group_field_negate", "invert_vertex_group_field"),
- ("ParticleSystem", "vertex_group_kink_negate", "invert_vertex_group_kink"),
- ("ParticleSystem", "vertex_group_length_negate", "invert_vertex_group_length"),
- ("ParticleSystem", "vertex_group_rotation_negate", "invert_vertex_group_rotation"),
- ("ParticleSystem", "vertex_group_roughness1_negate", "invert_vertex_group_roughness_1"),
- ("ParticleSystem", "vertex_group_roughness2_negate", "invert_vertex_group_roughness_2"),
- ("ParticleSystem", "vertex_group_roughness_end_negate", "invert_vertex_group_roughness_end"),
- ("ParticleSystem", "vertex_group_size_negate", "invert_vertex_group_size"),
- ("ParticleSystem", "vertex_group_tangent_negate", "invert_vertex_group_tangent"),
- ("ParticleSystem", "vertex_group_velocity_negate", "invert_vertex_group_velocity"),
- ("ParticleSystem", "hair_dynamics", "use_hair_dynamics"),
- ("ParticleSystem", "keyed_timing", "use_keyed_timing"),
- ("PointDensity", "falloff_softness", "falloff_soft"),
- ("PointDensity", "particle_cache", "particle_cache_space"),
- ("PointDensity", "turbulence_size", "turbulence_scale"),
- ("PointDensity", "turbulence", "use_turbulence"),
- ("PointDensity", "vertices_cache", "vertex_cache_space"),
- ("PoseBone", "ik_lin_weight", "ik_linear_weight"),
- ("PoseBone", "ik_rot_weight", "ik_rotation_weight"),
- ("PoseBone", "ik_limit_x", "use_ik_limit_x"),
- ("PoseBone", "ik_limit_y", "use_ik_limit_y"),
- ("PoseBone", "ik_limit_z", "use_ik_limit_z"),
- ("PoseBone", "ik_lin_control", "use_ik_linear_control"),
- ("PoseBone", "ik_rot_control", "use_ik_rotation_control"),
- ("Bone", "use_hinge", "use_inherit_rotation"),
- ("SPHFluidSettings", "spring_k", "spring_force"),
- ("SPHFluidSettings", "stiffness_k", "stiffness"),
- ("SPHFluidSettings", "stiffness_knear", "stiffness_near"),
- ("SceneGameData", "framing_color", "frame_color"),
- ("SceneGameData", "framing_type", "frame_type"),
- ("SceneGameData", "eye_separation", "stereo_eye_separation"),
- ("SceneGameData", "activity_culling", "use_activity_culling"),
- ("SceneGameData", "auto_start", "use_auto_start"),
- ("SceneGameData", "glsl_extra_textures", "use_glsl_extra_textures"),
- ("SceneGameData", "glsl_lights", "use_glsl_lights"),
- ("SceneGameData", "glsl_nodes", "use_glsl_nodes"),
- ("SceneGameData", "glsl_ramps", "use_glsl_ramps"),
- ("SceneGameData", "glsl_shaders", "use_glsl_shaders"),
- ("SceneGameData", "glsl_shadows", "use_glsl_shadows"),
- ("Sequence", "blend_opacity", "blend_alpha"),
- ("Sequence", "blend_mode", "blend_type"),
- ("Sequence", "frame_final_length", "frame_final_duration"),
- ("Sequence", "use_effect_default_fade", "use_default_fade"),
- ("SequenceColorBalance", "inverse_gain", "invert_gain"),
- ("SequenceColorBalance", "inverse_gamma", "invert_gamma"),
- ("SequenceColorBalance", "inverse_lift", "invert_lift"),
- ("EffectSequence", "multiply_colors", "color_multiply"),
- ("EffectSequence", "de_interlace", "use_deinterlace"),
- ("EffectSequence", "flip_x", "use_flip_x"),
- ("EffectSequence", "flip_y", "use_flip_y"),
- ("EffectSequence", "convert_float", "use_float"),
- ("EffectSequence", "premultiply", "use_premultiply"),
- ("EffectSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
- ("EffectSequence", "proxy_custom_file", "use_proxy_custom_file"),
- ("EffectSequence", "reverse_frames", "use_reverse_frames"),
- ("GlowSequence", "blur_distance", "blur_radius"),
- ("GlowSequence", "only_boost", "use_only_boost"),
- ("SpeedControlSequence", "curve_compress_y", "use_curve_compress_y"),
- ("SpeedControlSequence", "curve_velocity", "use_curve_velocity"),
- ("SpeedControlSequence", "frame_blending", "use_frame_blend"),
- ("TransformSequence", "uniform_scale", "use_uniform_scale"),
- ("ImageSequence", "animation_end_offset", "animation_offset_end"),
- ("ImageSequence", "animation_start_offset", "animation_offset_start"),
- ("ImageSequence", "multiply_colors", "color_multiply"),
- ("ImageSequence", "de_interlace", "use_deinterlace"),
- ("ImageSequence", "flip_x", "use_flip_x"),
- ("ImageSequence", "flip_y", "use_flip_y"),
- ("ImageSequence", "convert_float", "use_float"),
- ("ImageSequence", "premultiply", "use_premultiply"),
- ("ImageSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
- ("ImageSequence", "proxy_custom_file", "use_proxy_custom_file"),
- ("ImageSequence", "reverse_frames", "use_reverse_frames"),
- ("MetaSequence", "animation_end_offset", "animation_offset_end"),
- ("MetaSequence", "animation_start_offset", "animation_offset_start"),
- ("MetaSequence", "multiply_colors", "color_multiply"),
- ("MetaSequence", "de_interlace", "use_deinterlace"),
- ("MetaSequence", "flip_x", "use_flip_x"),
- ("MetaSequence", "flip_y", "use_flip_y"),
- ("MetaSequence", "convert_float", "use_float"),
- ("MetaSequence", "premultiply", "use_premultiply"),
- ("MetaSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
- ("MetaSequence", "proxy_custom_file", "use_proxy_custom_file"),
- ("MetaSequence", "reverse_frames", "use_reverse_frames"),
- ("MovieSequence", "animation_end_offset", "animation_offset_end"),
- ("MovieSequence", "animation_start_offset", "animation_offset_start"),
- ("MovieSequence", "multiply_colors", "color_multiply"),
- ("MovieSequence", "de_interlace", "use_deinterlace"),
- ("MovieSequence", "flip_x", "use_flip_x"),
- ("MovieSequence", "flip_y", "use_flip_y"),
- ("MovieSequence", "convert_float", "use_float"),
- ("MovieSequence", "premultiply", "use_premultiply"),
- ("MovieSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
- ("MovieSequence", "proxy_custom_file", "use_proxy_custom_file"),
- ("MovieSequence", "reverse_frames", "use_reverse_frames"),
- ("MulticamSequence", "animation_end_offset", "animation_offset_end"),
- ("MulticamSequence", "animation_start_offset", "animation_offset_start"),
- ("MulticamSequence", "multiply_colors", "color_multiply"),
- ("MulticamSequence", "de_interlace", "use_deinterlace"),
- ("MulticamSequence", "flip_x", "use_flip_x"),
- ("MulticamSequence", "flip_y", "use_flip_y"),
- ("MulticamSequence", "convert_float", "use_float"),
- ("MulticamSequence", "premultiply", "use_premultiply"),
- ("MulticamSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
- ("MulticamSequence", "proxy_custom_file", "use_proxy_custom_file"),
- ("MulticamSequence", "reverse_frames", "use_reverse_frames"),
- ("SceneSequence", "animation_end_offset", "animation_offset_end"),
- ("SceneSequence", "animation_start_offset", "animation_offset_start"),
- ("SceneSequence", "multiply_colors", "color_multiply"),
- ("SceneSequence", "de_interlace", "use_deinterlace"),
- ("SceneSequence", "flip_x", "use_flip_x"),
- ("SceneSequence", "flip_y", "use_flip_y"),
- ("SceneSequence", "convert_float", "use_float"),
- ("SceneSequence", "premultiply", "use_premultiply"),
- ("SceneSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
- ("SceneSequence", "proxy_custom_file", "use_proxy_custom_file"),
- ("SceneSequence", "reverse_frames", "use_reverse_frames"),
- ("SoundSequence", "animation_end_offset", "animation_offset_end"),
- ("SoundSequence", "animation_start_offset", "animation_offset_start"),
- ("SmokeDomainSettings", "smoke_domain_colli", "collision_extents"),
- ("SmokeDomainSettings", "smoke_cache_high_comp", "point_cache_compress_high_type"),
- ("SmokeDomainSettings", "smoke_cache_comp", "point_cache_compress_type"),
- ("SmokeDomainSettings", "maxres", "resolution_max"),
- ("SmokeDomainSettings", "smoothemitter", "smooth_emitter"),
- ("SmokeDomainSettings", "dissolve_smoke", "use_dissolve_smoke"),
- ("SmokeDomainSettings", "dissolve_smoke_log", "use_dissolve_smoke_log"),
- ("SmokeDomainSettings", "highres", "use_high_resolution"),
- ("SoftBodySettings", "bending", "bend"),
- ("SoftBodySettings", "error_limit", "error_threshold"),
- ("SoftBodySettings", "lcom", "location_mass_center"),
- ("SoftBodySettings", "lrot", "rotation_estimate"),
- ("SoftBodySettings", "lscale", "scale_estimate"),
- ("SoftBodySettings", "maxstep", "step_max"),
- ("SoftBodySettings", "minstep", "step_min"),
- ("SoftBodySettings", "diagnose", "use_diagnose"),
- ("SoftBodySettings", "edge_collision", "use_edge_collision"),
- ("SoftBodySettings", "estimate_matrix", "use_estimate_matrix"),
- ("SoftBodySettings", "face_collision", "use_face_collision"),
- ("SoftBodySettings", "self_collision", "use_self_collision"),
- ("SoftBodySettings", "stiff_quads", "use_stiff_quads"),
- ("TexMapping", "maximum", "max"),
- ("TexMapping", "minimum", "min"),
- ("TexMapping", "has_maximum", "use_max"),
- ("TexMapping", "has_minimum", "use_min"),
- ("TextCharacterFormat", "bold", "use_bold"),
- ("TextCharacterFormat", "italic", "use_italic"),
- ("TextCharacterFormat", "underline", "use_underline"),
- ("TextureSlot", "rgb_to_intensity", "use_rgb_to_intensity"),
- ("TextureSlot", "stencil", "use_stencil"),
- ("LampTextureSlot", "texture_coordinates", "texture_coords"),
- ("LampTextureSlot", "map_color", "use_map_color"),
- ("LampTextureSlot", "map_shadow", "use_map_shadow"),
- ("MaterialTextureSlot", "coloremission_factor", "color_emission_factor"),
- ("MaterialTextureSlot", "colordiff_factor", "diffuse_color_factor"),
- ("MaterialTextureSlot", "x_mapping", "mapping_x"),
- ("MaterialTextureSlot", "y_mapping", "mapping_y"),
- ("MaterialTextureSlot", "z_mapping", "mapping_z"),
- ("MaterialTextureSlot", "colorreflection_factor", "reflection_color_factor"),
- ("MaterialTextureSlot", "colorspec_factor", "specular_color_factor"),
- ("MaterialTextureSlot", "texture_coordinates", "texture_coords"),
- ("MaterialTextureSlot", "colortransmission_factor", "transmission_color_factor"),
- ("MaterialTextureSlot", "from_dupli", "use_from_dupli"),
- ("MaterialTextureSlot", "from_original", "use_from_original"),
- ("MaterialTextureSlot", "map_alpha", "use_map_alpha"),
- ("MaterialTextureSlot", "map_ambient", "use_map_ambient"),
- ("MaterialTextureSlot", "map_colordiff", "use_map_color_diff"),
- ("MaterialTextureSlot", "map_coloremission", "use_map_color_emission"),
- ("MaterialTextureSlot", "map_colorreflection", "use_map_color_reflection"),
- ("MaterialTextureSlot", "map_colorspec", "use_map_color_spec"),
- ("MaterialTextureSlot", "map_colortransmission", "use_map_color_transmission"),
- ("MaterialTextureSlot", "map_density", "use_map_density"),
- ("MaterialTextureSlot", "map_diffuse", "use_map_diffuse"),
- ("MaterialTextureSlot", "map_displacement", "use_map_displacement"),
- ("MaterialTextureSlot", "map_emission", "use_map_emission"),
- ("MaterialTextureSlot", "map_emit", "use_map_emit"),
- ("MaterialTextureSlot", "map_hardness", "use_map_hardness"),
- ("MaterialTextureSlot", "map_mirror", "use_map_mirror"),
- ("MaterialTextureSlot", "map_normal", "use_map_normal"),
- ("MaterialTextureSlot", "map_raymir", "use_map_raymir"),
- ("MaterialTextureSlot", "map_reflection", "use_map_reflect"),
- ("MaterialTextureSlot", "map_scattering", "use_map_scatter"),
- ("MaterialTextureSlot", "map_specular", "use_map_specular"),
- ("MaterialTextureSlot", "map_translucency", "use_map_translucency"),
- ("MaterialTextureSlot", "map_warp", "use_map_warp"),
- ("WorldTextureSlot", "texture_coordinates", "texture_coords"),
- ("WorldTextureSlot", "map_blend", "use_map_blend"),
- ("WorldTextureSlot", "map_horizon", "use_map_horizon"),
- ("WorldTextureSlot", "map_zenith_down", "use_map_zenith_down"),
- ("WorldTextureSlot", "map_zenith_up", "use_map_zenith_up"),
- ("VoxelData", "still_frame_number", "still_frame"),
- ("WorldLighting", "ao_blend_mode", "ao_blend_type"),
- ("WorldLighting", "error_tolerance", "error_threshold"),
- ("WorldLighting", "use_ambient_occlusion", "use_ambient_occlusian"),
- ("WorldLighting", "pixel_cache", "use_cache"),
- ("WorldLighting", "use_environment_lighting", "use_environment_light"),
- ("WorldLighting", "use_indirect_lighting", "use_indirect_light"),
- ("WorldStarsSettings", "color_randomization", "color_random"),
- ("WorldStarsSettings", "min_distance", "distance_min"),
- ("WorldLighting", "falloff", "use_falloff"),
- ("Constraint", "disabled", "is_valid"),
- ("ClampToConstraint", "cyclic", "use_cyclic"),
- ("ImageTexture", "filter", "filter_type"),
- ("ImageTexture", "interpolation", "use_interpolation"),
- ("ImageTexture", "mipmap", "use_mipmap"),
- ("ImageUser", "frames", "frame_duration"),
- ("ImageUser", "offset", "frame_offset"),
- ("ImageUser", "cyclic", "use_cyclic"),
- ("ArmatureModifier", "invert", "invert_vertex_group"),
- ("ArmatureModifier", "quaternion", "use_deform_preserve_volume"),
- ("ArrayModifier", "length", "fit_length"),
- ("BevelModifier", "angle", "angle_limit"),
- ("BuildModifier", "length", "frame_duration"),
- ("BuildModifier", "randomize", "use_random_order"),
- ("CastModifier", "x", "use_x"),
- ("CastModifier", "y", "use_y"),
- ("CastModifier", "z", "use_z"),
- ("ExplodeModifier", "size", "use_size"),
- ("MaskModifier", "invert", "invert_vertex_group"),
- ("MeshDeformModifier", "invert", "invert_vertex_group"),
- ("MeshDeformModifier", "dynamic", "use_dynamic_bind"),
- ("MirrorModifier", "clip", "use_clip"),
- ("MirrorModifier", "x", "use_x"),
- ("MirrorModifier", "y", "use_y"),
- ("MirrorModifier", "z", "use_z"),
- ("ParticleInstanceModifier", "children", "use_children"),
- ("ParticleInstanceModifier", "normal", "use_normal"),
- ("ParticleInstanceModifier", "size", "use_size"),
- ("ShrinkwrapModifier", "negative", "use_negative_direction"),
- ("ShrinkwrapModifier", "positive", "use_positive_direction"),
- ("ShrinkwrapModifier", "x", "use_project_x"),
- ("ShrinkwrapModifier", "y", "use_project_y"),
- ("ShrinkwrapModifier", "z", "use_project_z"),
- ("ShrinkwrapModifier", "mode", "wrap_method"),
- ("SimpleDeformModifier", "mode", "deform_method"),
- ("SimpleDeformModifier", "relative", "use_relative"),
- ("SmoothModifier", "repeat", "iterations"),
- ("SmoothModifier", "x", "use_x"),
- ("SmoothModifier", "y", "use_y"),
- ("SmoothModifier", "z", "use_z"),
- ("SolidifyModifier", "invert", "invert_vertex_group"),
- ("WaveModifier", "cyclic", "use_cyclic"),
- ("WaveModifier", "normals", "use_normal"),
- ("WaveModifier", "x", "use_x"),
- ("WaveModifier", "y", "use_y"),
- ("DampedTrackConstraint", "track", "track_axis"),
- ("FloorConstraint", "sticky", "use_sticky"),
- ("FollowPathConstraint", "forward", "forward_axis"),
- ("FollowPathConstraint", "up", "up_axis"),
- ("LockedTrackConstraint", "lock", "lock_axis"),
- ("LockedTrackConstraint", "track", "track_axis"),
- ("MaintainVolumeConstraint", "axis", "free_axis"),
- ("TrackToConstraint", "track", "track_axis"),
- ("TrackToConstraint", "up", "up_axis"),
- ("GameProperty", "debug", "show_debug"),
- ("Image", "tiles", "use_tiles"),
- ("Lamp", "diffuse", "use_diffuse"),
- ("Lamp", "negative", "use_negative"),
- ("Lamp", "layer", "use_own_layer"),
- ("Lamp", "specular", "use_specular"),
- ("AreaLamp", "dither", "use_dither"),
- ("AreaLamp", "jitter", "use_jitter"),
- ("SpotLamp", "square", "use_square"),
- ("Material", "cubic", "use_cubic"),
- ("Material", "shadows", "use_shadows"),
- ("ParticleSettings", "amount", "count"),
- ("ParticleSettings", "display", "draw_percentage"),
- ("ParticleSettings", "velocity", "show_velocity"),
- ("ParticleSettings", "trand", "use_emit_random"),
- ("ParticleSettings", "parent", "use_parent_particles"),
- ("ParticleSettings", "emitter", "use_render_emitter"),
- ("ParticleSettings", "viewport", "use_simplify_viewport"),
- ("Texture", "brightness", "intensity"),
- ("CloudsTexture", "stype", "cloud_type"),
- ("EnvironmentMapTexture", "filter", "filter_type"),
- ("EnvironmentMapTexture", "mipmap", "use_mipmap"),
- ("MarbleTexture", "stype", "marble_type"),
- ("StucciTexture", "stype", "stucci_type"),
- ("WoodTexture", "stype", "wood_type"),
- ("World", "range", "color_range"),
- ("World", "lighting", "light_settings"),
- ("World", "mist", "mist_settings"),
- ("World", "stars", "star_settings"),
- ("MaterialHalo", "lines", "use_lines"),
- ("MaterialHalo", "ring", "use_ring"),
- ("MaterialHalo", "soft", "use_soft"),
- ("MaterialHalo", "star", "use_star"),
- ("MaterialHalo", "texture", "use_texture"),
- ("MaterialPhysics", "damp", "damping"),
- ("MaterialRaytraceTransparency", "limit", "depth_max"),
- ("NlaStrip", "reversed", "use_reverse"),
- ("CompositorNodeBlur", "bokeh", "use_bokeh"),
- ("CompositorNodeBlur", "gamma", "use_gamma_correction"),
- ("CompositorNodeBlur", "relative", "use_relative"),
- ("CompositorNodeChannelMatte", "high", "limit_max"),
- ("CompositorNodeChannelMatte", "low", "limit_min"),
- ("CompositorNodeChannelMatte", "channel", "matte_channel"),
- ("CompositorNodeChromaMatte", "cutoff", "threshold"),
- ("CompositorNodeColorMatte", "h", "color_hue"),
- ("CompositorNodeColorMatte", "s", "color_saturation"),
- ("CompositorNodeColorMatte", "v", "color_value"),
- ("CompositorNodeDBlur", "wrap", "use_wrap"),
- ("CompositorNodeDefocus", "preview", "use_preview"),
- ("CompositorNodeHueSat", "hue", "color_hue"),
- ("CompositorNodeHueSat", "sat", "color_saturation"),
- ("CompositorNodeHueSat", "val", "color_value"),
- ("CompositorNodeImage", "frames", "frame_duration"),
- ("CompositorNodeImage", "offset", "frame_offset"),
- ("CompositorNodeImage", "start", "frame_start"),
- ("CompositorNodeImage", "cyclic", "use_cyclic"),
- ("CompositorNodeInvert", "alpha", "invert_alpha"),
- ("CompositorNodeInvert", "rgb", "invert_rgb"),
- ("CompositorNodeLensdist", "fit", "use_fit"),
- ("CompositorNodeLensdist", "jitter", "use_jitter"),
- ("CompositorNodeMixRGB", "alpha", "use_alpha"),
- ("CompositorNodeRotate", "filter", "filter_type"),
- ("CompositorNodeTime", "end", "frame_end"),
- ("CompositorNodeTime", "start", "frame_start"),
- ("CompositorNodeVecBlur", "curved", "use_curved"),
- ("ShaderNodeExtendedMaterial", "diffuse", "use_diffuse"),
- ("ShaderNodeExtendedMaterial", "specular", "use_specular"),
- ("ShaderNodeMaterial", "diffuse", "use_diffuse"),
- ("ShaderNodeMaterial", "specular", "use_specular"),
- ("ShaderNodeMixRGB", "alpha", "use_alpha"),
- ("TextureNodeCurveTime", "end", "frame_end"),
- ("TextureNodeCurveTime", "start", "frame_start"),
- ("TextureNodeMixRGB", "alpha", "use_alpha"),
- ("TextureSlot", "negate", "invert"),
- ("TextureSlot", "size", "scale"),
- ("SoftBodySettings", "damp", "damping"),
- ("SequenceCrop", "right", "max_x"),
- ("SequenceCrop", "top", "max_y"),
- ("SequenceCrop", "bottom", "min_x"),
- ("SequenceCrop", "left", "min_y"),
- ("Sequence", "speed_fader", "speed_factor"),
- ("SpeedControlSequence", "global_speed", "multiply_speed"),
- ("SpeedControlSequence", "use_curve_velocity", "use_as_speed"),
- ("SpeedControlSequence", "use_curve_compress_y", "scale_to_length"),
- ("Key", "keys", "key_blocks"),
- )
-
-
if __name__ == "__main__":
# Example, should be called externally
diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
index e9ed9a8de5b..429fea60d7a 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -791,10 +791,10 @@ def dump_src_messages(msgs, reports, settings):
##### Main functions! #####
def dump_messages(do_messages, do_checks, settings):
bl_ver = "Blender " + bpy.app.version_string
- bl_rev = bpy.app.build_revision
+ bl_hash = bpy.app.build_hash or b'0000000000000000000000000000000000000000'
bl_date = datetime.datetime.strptime(bpy.app.build_date.decode() + "T" + bpy.app.build_time.decode(),
"%Y-%m-%dT%H:%M:%S")
- pot = utils.I18nMessages.gen_empty_messages(settings.PARSER_TEMPLATE_ID, bl_ver, bl_rev, bl_date, bl_date.year,
+ pot = utils.I18nMessages.gen_empty_messages(settings.PARSER_TEMPLATE_ID, bl_ver, bl_hash, bl_date, bl_date.year,
settings=settings)
msgs = pot.msgs
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index dba5099607c..300cd7ae955 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -146,7 +146,7 @@ PO_MSGSTR = "msgstr "
PO_HEADER_KEY = (DEFAULT_CONTEXT, "")
PO_HEADER_MSGSTR = (
- "Project-Id-Version: {blender_ver} (r{blender_rev})\\n\n"
+ "Project-Id-Version: {blender_ver} ({blender_hash})\\n\n"
"Report-Msgid-Bugs-To: \\n\n"
"POT-Creation-Date: {time}\\n\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\n"
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py
index feefd14fd28..53146fd0287 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -408,10 +408,10 @@ class I18nMessages:
return getattr(collections, 'OrderedDict', dict)()
@classmethod
- def gen_empty_messages(cls, uid, blender_ver, blender_rev, time, year, default_copyright=True, settings=settings):
+ def gen_empty_messages(cls, uid, blender_ver, blender_hash, time, year, default_copyright=True, settings=settings):
"""Generate an empty I18nMessages object (only header is present!)."""
fmt = settings.PO_HEADER_MSGSTR
- msgstr = fmt.format(blender_ver=str(blender_ver), blender_rev=int(blender_rev), time=str(time), uid=str(uid))
+ msgstr = fmt.format(blender_ver=str(blender_ver), blender_hash=blender_hash, time=str(time), uid=str(uid))
comment = ""
if default_copyright:
comment = settings.PO_HEADER_COMMENT_COPYRIGHT.format(year=str(year))
diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py b/release/scripts/modules/bpy_extras/keyconfig_utils.py
index 1baab5654c6..4b673b2e0de 100644
--- a/release/scripts/modules/bpy_extras/keyconfig_utils.py
+++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py
@@ -151,7 +151,7 @@ def keyconfig_merge(kc1, kc2):
return merged_keymaps
-def _export_properties(prefix, properties, lines=None):
+def _export_properties(prefix, properties, kmi_id, lines=None):
from bpy.types import OperatorProperties
if lines is None:
@@ -171,20 +171,58 @@ def _export_properties(prefix, properties, lines=None):
if pname != "rna_type":
value = getattr(properties, pname)
if isinstance(value, OperatorProperties):
- _export_properties(prefix + "." + pname, value, lines)
+ _export_properties(prefix + "." + pname, value, kmi_id, lines)
elif properties.is_property_set(pname):
value = string_value(value)
if value != "":
- lines.append("%s.%s = %s\n" % (prefix, pname, value))
+ lines.append("set_kmi_prop(%s, '%s', %s, '%s')\n" % (prefix, pname, value, kmi_id))
return lines
+def _kmistr(kmi, is_modal):
+ if is_modal:
+ kmi_id = kmi.propvalue
+ kmi_newfunc = 'new_modal'
+ else:
+ kmi_id = kmi.idname
+ kmi_newfunc = 'new'
+ s = ["kmi = km.keymap_items.%s(\'%s\', \'%s\', \'%s\'" % (kmi_newfunc, kmi_id, kmi.type, kmi.value)]
+
+ if kmi.any:
+ s.append(", any=True")
+ else:
+ if kmi.shift:
+ s.append(", shift=True")
+ if kmi.ctrl:
+ s.append(", ctrl=True")
+ if kmi.alt:
+ s.append(", alt=True")
+ if kmi.oskey:
+ s.append(", oskey=True")
+ if kmi.key_modifier and kmi.key_modifier != 'NONE':
+ s.append(", key_modifier=\'%s\'" % kmi.key_modifier)
+
+ s.append(")\n")
+
+ props = kmi.properties
+
+ if props is not None:
+ _export_properties("kmi.properties", props, kmi_id, s)
+
+ return "".join(s)
+
+
def keyconfig_export(wm, kc, filepath):
f = open(filepath, "w")
f.write("import bpy\n")
f.write("import os\n\n")
+ f.write("def set_kmi_prop(kmiprops, prop, value, kmiid):\n"
+ " if hasattr(kmiprops, prop):\n"
+ " setattr(kmiprops, prop, value)\n"
+ " else:\n"
+ " print(\"Warning: property '%s' not found in keymap item '%s'\" % (prop, kmiid))\n\n")
f.write("wm = bpy.context.window_manager\n")
f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n") # keymap must be created by caller
@@ -216,30 +254,7 @@ def keyconfig_export(wm, kc, filepath):
f.write("# Map %s\n" % km.name)
f.write("km = kc.keymaps.new('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.is_modal))
for kmi in km.keymap_items:
- if km.is_modal:
- f.write("kmi = km.keymap_items.new_modal('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value))
- else:
- f.write("kmi = km.keymap_items.new('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value))
- if kmi.any:
- f.write(", any=True")
- else:
- if kmi.shift:
- f.write(", shift=True")
- if kmi.ctrl:
- f.write(", ctrl=True")
- if kmi.alt:
- f.write(", alt=True")
- if kmi.oskey:
- f.write(", oskey=True")
- if kmi.key_modifier and kmi.key_modifier != 'NONE':
- f.write(", key_modifier='%s'" % kmi.key_modifier)
- f.write(")\n")
-
- props = kmi.properties
-
- if props is not None:
- f.write("".join(_export_properties("kmi.properties", props)))
-
+ f.write(_kmistr(kmi, km.is_modal))
f.write("\n")
f.close()
@@ -250,50 +265,22 @@ def keyconfig_test(kc):
def testEntry(kc, entry, src=None, parent=None):
result = False
- def kmistr(kmi):
- if km.is_modal:
- s = ["kmi = km.keymap_items.new_modal(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)]
- else:
- s = ["kmi = km.keymap_items.new(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)]
-
- if kmi.any:
- s.append(", any=True")
- else:
- if kmi.shift:
- s.append(", shift=True")
- if kmi.ctrl:
- s.append(", ctrl=True")
- if kmi.alt:
- s.append(", alt=True")
- if kmi.oskey:
- s.append(", oskey=True")
- if kmi.key_modifier and kmi.key_modifier != 'NONE':
- s.append(", key_modifier=\'%s\'" % kmi.key_modifier)
-
- s.append(")\n")
-
- props = kmi.properties
-
- if props is not None:
- _export_properties("kmi.properties", props, s)
-
- return "".join(s).strip()
-
idname, spaceid, regionid, children = entry
km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid)
if km:
km = km.active()
+ is_modal = km.is_modal
if src:
for item in km.keymap_items:
if src.compare(item):
print("===========")
print(parent.name)
- print(kmistr(src))
+ print(_kmistr(src, is_modal).strip())
print(km.name)
- print(kmistr(item))
+ print(_kmistr(item, is_modal).strip())
result = True
for child in children:
@@ -312,8 +299,8 @@ def keyconfig_test(kc):
if src.compare(item):
print("===========")
print(km.name)
- print(kmistr(src))
- print(kmistr(item))
+ print(_kmistr(src, is_modal).strip())
+ print(_kmistr(item, is_modal).strip())
result = True
for child in children:
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py
index 7ce5aff581a..a14f0128444 100644
--- a/release/scripts/modules/bpy_extras/object_utils.py
+++ b/release/scripts/modules/bpy_extras/object_utils.py
@@ -201,6 +201,10 @@ class AddObjectHelper:
subtype='EULER',
)
+ @classmethod
+ def poll(self, context):
+ return context.scene.library is None
+
def object_add_grid_scale(context):
"""
diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py
index ea75bfde809..3fd4a60d0b1 100644
--- a/release/scripts/modules/sys_info.py
+++ b/release/scripts/modules/sys_info.py
@@ -67,7 +67,19 @@ def write_sysinfo(op):
# build info
output.write("\nBlender:\n")
output.write(lilies)
- output.write("version %s, revision %r. %r\n" % (bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type))
+ if bpy.app.build_branch and bpy.app.build_branch != "Unknown":
+ output.write("version %s, branch %r, chage %r, hash %r, %r\n" %
+ (bpy.app.version_string,
+ bpy.app.build_branch,
+ bpy.app.build_change,
+ bpy.app.build_hash,
+ bpy.app.build_type))
+ else:
+ output.write("version %s, revision %r. %r\n" %
+ (bpy.app.version_string,
+ bpy.app.build_change,
+ bpy.app.build_type))
+
output.write("build date: %r, %r\n" % (bpy.app.build_date, bpy.app.build_time))
output.write("platform: %r\n" % (bpy.app.build_platform))
output.write("binary path: %r\n" % (bpy.app.binary_path))
diff --git a/release/scripts/presets/keyconfig/maya.py b/release/scripts/presets/keyconfig/maya.py
index 21fd757c4e5..e6e0062c112 100644
--- a/release/scripts/presets/keyconfig/maya.py
+++ b/release/scripts/presets/keyconfig/maya.py
@@ -697,8 +697,10 @@ km = kc.keymaps.new('Knife Tool Modal Map', space_type='EMPTY', region_type='WIN
kmi = km.keymap_items.new_modal('CANCEL', 'ESC', 'ANY', any=True)
kmi = km.keymap_items.new_modal('PANNING', 'LEFTMOUSE', 'ANY', alt=True)
+kmi = km.keymap_items.new_modal('PANNING', 'MIDDLEMOUSE', 'ANY', alt=True)
+kmi = km.keymap_items.new_modal('PANNING', 'RIGHTMOUSE', 'ANY', alt=True)
kmi = km.keymap_items.new_modal('ADD_CUT', 'LEFTMOUSE', 'PRESS', any=True)
-kmi = km.keymap_items.new_modal('CANCEL', 'RIGHTMOUSE', 'ANY', any=True)
+kmi = km.keymap_items.new_modal('CANCEL', 'RIGHTMOUSE', 'ANY')
kmi = km.keymap_items.new_modal('CONFIRM', 'RET', 'PRESS', any=True)
kmi = km.keymap_items.new_modal('CONFIRM', 'NUMPAD_ENTER', 'PRESS', any=True)
kmi = km.keymap_items.new_modal('CONFIRM', 'SPACE', 'PRESS', any=True)
@@ -1587,8 +1589,11 @@ kmi = km.keymap_items.new('action.view_all', 'A', 'PRESS')
kmi = km.keymap_items.new('action.view_selected', 'F', 'PRESS')
kmi = km.keymap_items.new('anim.channels_editable_toggle', 'TAB', 'PRESS')
kmi = km.keymap_items.new('transform.transform', 'W', 'PRESS')
+kmi.properties.mode = 'TIME_TRANSLATE'
kmi = km.keymap_items.new('transform.transform', 'EVT_TWEAK_M', 'ANY')
+kmi.properties.mode = 'TIME_TRANSLATE'
kmi = km.keymap_items.new('transform.transform', 'S', 'PRESS')
+kmi.properties.mode = 'TIME_SCALE'
kmi = km.keymap_items.new('transform.transform', 'T', 'PRESS', shift=True)
kmi = km.keymap_items.new('marker.add', 'M', 'PRESS')
kmi = km.keymap_items.new('marker.rename', 'M', 'PRESS', ctrl=True)
@@ -1662,6 +1667,7 @@ kmi = km.keymap_items.new('nla.fmodifier_add', 'M', 'PRESS', shift=True, ctrl=Tr
kmi = km.keymap_items.new('transform.transform', 'W', 'PRESS')
kmi = km.keymap_items.new('transform.transform', 'EVT_TWEAK_M', 'ANY')
kmi = km.keymap_items.new('transform.transform', 'R', 'PRESS')
+kmi.properties.mode = 'TIME_SCALE'
kmi = km.keymap_items.new('marker.add', 'M', 'PRESS')
kmi = km.keymap_items.new('marker.rename', 'M', 'PRESS', ctrl=True)
kmi = km.keymap_items.new('nla.select_all_toggle', 'LEFTMOUSE', 'DOUBLE_CLICK')
diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py
index 6193611504e..3c4b66514de 100644
--- a/release/scripts/startup/bl_operators/anim.py
+++ b/release/scripts/startup/bl_operators/anim.py
@@ -282,14 +282,3 @@ class ClearUselessActions(Operator):
% removed)
return {'FINISHED'}
-
-class UpdateAnimData(Operator):
- """Update data paths from 2.56 and previous versions, """ \
- """modifying data paths of drivers and fcurves"""
- bl_idname = "anim.update_data_paths"
- bl_label = "Update Animation Data"
-
- def execute(self, context):
- import animsys_refactor
- animsys_refactor.update_data_paths(animsys_refactor.data_2_56_to_2_59)
- return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py
index 77978c71ed9..0814d0144ab 100644
--- a/release/scripts/startup/bl_operators/node.py
+++ b/release/scripts/startup/bl_operators/node.py
@@ -222,7 +222,7 @@ class NODE_OT_add_search(NodeAddOperator, Operator):
self.create_node(context, item.nodetype)
if self.use_transform:
- bpy.ops.transform.translate('INVOKE_DEFAULT')
+ bpy.ops.transform.translate('INVOKE_DEFAULT', remove_on_cancel=True)
return {'FINISHED'}
else:
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index 05dfd882180..ae6ec3946f1 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -221,7 +221,7 @@ class ExecutePreset(Operator):
class AddPresetRender(AddPresetBase, Operator):
- """Add a Render Preset"""
+ """Add or remove a Render Preset"""
bl_idname = "render.preset_add"
bl_label = "Add Render Preset"
preset_menu = "RENDER_MT_presets"
@@ -247,7 +247,7 @@ class AddPresetRender(AddPresetBase, Operator):
class AddPresetCamera(AddPresetBase, Operator):
- """Add a Camera Preset"""
+ """Add or remove a Camera Preset"""
bl_idname = "camera.preset_add"
bl_label = "Add Camera Preset"
preset_menu = "CAMERA_MT_presets"
@@ -266,7 +266,7 @@ class AddPresetCamera(AddPresetBase, Operator):
class AddPresetSSS(AddPresetBase, Operator):
- """Add a Subsurface Scattering Preset"""
+ """Add or remove a Subsurface Scattering Preset"""
bl_idname = "material.sss_preset_add"
bl_label = "Add SSS Preset"
preset_menu = "MATERIAL_MT_sss_presets"
@@ -294,7 +294,7 @@ class AddPresetSSS(AddPresetBase, Operator):
class AddPresetCloth(AddPresetBase, Operator):
- """Add a Cloth Preset"""
+ """Add or remove a Cloth Preset"""
bl_idname = "cloth.preset_add"
bl_label = "Add Cloth Preset"
preset_menu = "CLOTH_MT_presets"
@@ -316,7 +316,7 @@ class AddPresetCloth(AddPresetBase, Operator):
class AddPresetFluid(AddPresetBase, Operator):
- """Add a Fluid Preset"""
+ """Add or remove a Fluid Preset"""
bl_idname = "fluid.preset_add"
bl_label = "Add Fluid Preset"
preset_menu = "FLUID_MT_presets"
@@ -334,7 +334,7 @@ class AddPresetFluid(AddPresetBase, Operator):
class AddPresetSunSky(AddPresetBase, Operator):
- """Add a Sky & Atmosphere Preset"""
+ """Add or remove a Sky & Atmosphere Preset"""
bl_idname = "lamp.sunsky_preset_add"
bl_label = "Add Sunsky Preset"
preset_menu = "LAMP_MT_sunsky_presets"
@@ -363,7 +363,7 @@ class AddPresetSunSky(AddPresetBase, Operator):
class AddPresetInteraction(AddPresetBase, Operator):
- """Add an Application Interaction Preset"""
+ """Add or remove an Application Interaction Preset"""
bl_idname = "wm.interaction_preset_add"
bl_label = "Add Interaction Preset"
preset_menu = "USERPREF_MT_interaction_presets"
@@ -389,7 +389,7 @@ class AddPresetInteraction(AddPresetBase, Operator):
class AddPresetTrackingCamera(AddPresetBase, Operator):
- """Add a Tracking Camera Intrinsics Preset"""
+ """Add or remove a Tracking Camera Intrinsics Preset"""
bl_idname = "clip.camera_preset_add"
bl_label = "Add Camera Preset"
preset_menu = "CLIP_MT_camera_presets"
@@ -412,7 +412,7 @@ class AddPresetTrackingCamera(AddPresetBase, Operator):
class AddPresetTrackingTrackColor(AddPresetBase, Operator):
- """Add a Clip Track Color Preset"""
+ """Add or remove a Clip Track Color Preset"""
bl_idname = "clip.track_color_preset_add"
bl_label = "Add Track Color Preset"
preset_menu = "CLIP_MT_track_color_presets"
@@ -430,7 +430,7 @@ class AddPresetTrackingTrackColor(AddPresetBase, Operator):
class AddPresetTrackingSettings(AddPresetBase, Operator):
- """Add a motion tracking settings preset"""
+ """Add or remove a motion tracking settings preset"""
bl_idname = "clip.tracking_settings_preset_add"
bl_label = "Add Tracking Settings Preset"
preset_menu = "CLIP_MT_tracking_settings_presets"
@@ -459,7 +459,7 @@ class AddPresetTrackingSettings(AddPresetBase, Operator):
class AddPresetNodeColor(AddPresetBase, Operator):
- """Add a Node Color Preset"""
+ """Add or remove a Node Color Preset"""
bl_idname = "node.node_color_preset_add"
bl_label = "Add Node Color Preset"
preset_menu = "NODE_MT_node_color_presets"
@@ -477,7 +477,7 @@ class AddPresetNodeColor(AddPresetBase, Operator):
class AddPresetInterfaceTheme(AddPresetBase, Operator):
- """Add a theme preset"""
+ """Add or remove a theme preset"""
bl_idname = "wm.interface_theme_preset_add"
bl_label = "Add Theme Preset"
preset_menu = "USERPREF_MT_interface_theme_presets"
@@ -485,7 +485,7 @@ class AddPresetInterfaceTheme(AddPresetBase, Operator):
class AddPresetKeyconfig(AddPresetBase, Operator):
- """Add a Key-config Preset"""
+ """Add or remove a Key-config Preset"""
bl_idname = "wm.keyconfig_preset_add"
bl_label = "Add Keyconfig Preset"
preset_menu = "USERPREF_MT_keyconfigs"
@@ -508,7 +508,7 @@ class AddPresetKeyconfig(AddPresetBase, Operator):
class AddPresetOperator(AddPresetBase, Operator):
- """Add an Operator Preset"""
+ """Add or remove an Operator Preset"""
bl_idname = "wm.operator_preset_add"
bl_label = "Operator Preset"
preset_menu = "WM_MT_operator_presets"
diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
index 6d1f35fe937..04c28500089 100644
--- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
+++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
@@ -115,11 +115,17 @@ class PlayRenderedAnim(Operator):
cmd = [player_path]
# extra options, fps controls etc.
+ if scene.use_preview_range:
+ frame_start = scene.frame_preview_start
+ frame_end = scene.frame_preview_end
+ else:
+ frame_start = scene.frame_start
+ frame_end = scene.frame_end
if preset in {'BLENDER24', 'INTERNAL'}:
opts = ["-a",
"-f", str(rd.fps), str(rd.fps_base),
- "-s", str(scene.frame_start),
- "-e", str(scene.frame_end),
+ "-s", str(frame_start),
+ "-e", str(frame_end),
"-j", str(scene.frame_step),
file]
cmd.extend(opts)
diff --git a/release/scripts/startup/bl_operators/view3d.py b/release/scripts/startup/bl_operators/view3d.py
index 27d2a2361a1..bf51dc5672a 100644
--- a/release/scripts/startup/bl_operators/view3d.py
+++ b/release/scripts/startup/bl_operators/view3d.py
@@ -29,6 +29,11 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
bl_label = "Extrude Individual and Move"
bl_idname = "view3d.edit_mesh_extrude_individual_move"
+ @classmethod
+ def poll(cls, context):
+ obj = context.active_object
+ return obj.mode == 'EDIT'
+
def execute(self, context):
mesh = context.object.data
select_mode = context.tool_settings.mesh_select_mode
@@ -62,6 +67,11 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
bl_label = "Extrude and Move on Normals"
bl_idname = "view3d.edit_mesh_extrude_move_normal"
+ @classmethod
+ def poll(cls, context):
+ obj = context.active_object
+ return obj.mode == 'EDIT'
+
@staticmethod
def extrude_region(context, use_vert_normals):
mesh = context.object.data
@@ -107,6 +117,11 @@ class VIEW3D_OT_edit_mesh_extrude_shrink_fatten(Operator):
bl_label = "Extrude and Move on Individual Normals"
bl_idname = "view3d.edit_mesh_extrude_move_shrink_fatten"
+ @classmethod
+ def poll(cls, context):
+ obj = context.active_object
+ return obj.mode == 'EDIT'
+
def execute(self, context):
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, True)
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 272e59c5d05..87b0941799e 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1104,7 +1104,14 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.prop(md, "use_z_symmetry")
def TRIANGULATE(self, layout, ob, md):
- layout.prop(md, "use_beauty")
+ row = layout.row()
+
+ col = row.column()
+ col.label(text="Quad Method:")
+ col.prop(md, "quad_method", text="")
+ col = row.column()
+ col.label(text="Ngon Method:")
+ col.prop(md, "ngon_method", text="")
def UV_WARP(self, layout, ob, md):
split = layout.split()
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 288f95ca4b0..5061e534c9b 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -67,9 +67,11 @@ class RENDER_PT_render(RenderButtonsPanel, Panel):
row = layout.row(align=True)
row.operator("render.render", text="Render", icon='RENDER_STILL')
row.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
- row.operator("render.play_rendered_anim", text="Play", icon='PLAY')
+ row.operator("sound.mixdown", text="Audio", icon='PLAY_AUDIO')
- layout.prop(rd, "display_mode", text="Display")
+ split = layout.split(1 / 3)
+ split.operator("render.play_rendered_anim", text="Play", icon='PLAY')
+ split.prop(rd, "display_mode", text="Display")
class RENDER_PT_dimensions(RenderButtonsPanel, Panel):
@@ -395,10 +397,7 @@ class RENDER_PT_output(RenderButtonsPanel, Panel):
layout.template_image_settings(image_settings, color_management=False)
- if file_format == 'QUICKTIME_CARBON':
- layout.operator("scene.render_data_set_quicktime_codec")
-
- elif file_format == 'QUICKTIME_QTKIT':
+ if file_format == 'QUICKTIME':
quicktime = rd.quicktime
split = layout.split()
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index 5e9cbbda21f..91a5abd0ad0 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -227,8 +227,6 @@ class SCENE_PT_audio(SceneButtonsPanel, Panel):
col.prop(ffmpeg, "audio_channels", text="")
col.prop(ffmpeg, "audio_mixrate", text="Rate")
- layout.operator("sound.mixdown")
-
class SCENE_PT_physics(SceneButtonsPanel, Panel):
bl_label = "Gravity"
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py
index 2d0b1c93d13..61e2f10a057 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -46,6 +46,11 @@ class GRAPH_HT_header(Header):
dopesheet_filter(layout, context)
+ layout.prop(st, "use_normalization", text="Normalize")
+ row = layout.row()
+ row.active = st.use_normalization
+ row.prop(st, "use_auto_normalization", text="Auto")
+
layout.prop(st, "auto_snap", text="")
layout.prop(st, "pivot_point", text="", icon_only=True)
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index 5a570d18312..f7bca1404bf 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -37,7 +37,6 @@ class INFO_HT_header(Header):
if context.area.show_menus:
sub = row.row(align=True)
sub.menu("INFO_MT_file")
- sub.menu("INFO_MT_add")
if rd.use_game_engine:
sub.menu("INFO_MT_game")
else:
@@ -79,35 +78,6 @@ class INFO_HT_header(Header):
row.operator("wm.splash", text="", icon='BLENDER', emboss=False)
row.label(text=scene.statistics(), translate=False)
- # XXX: BEFORE RELEASE, MOVE FILE MENU OUT OF INFO!!!
- """
- sinfo = context.space_data
- row = layout.row(align=True)
- row.prop(sinfo, "show_report_debug", text="Debug")
- row.prop(sinfo, "show_report_info", text="Info")
- row.prop(sinfo, "show_report_operator", text="Operators")
- row.prop(sinfo, "show_report_warning", text="Warnings")
- row.prop(sinfo, "show_report_error", text="Errors")
-
- row = layout.row()
- row.enabled = sinfo.show_report_operator
- row.operator("info.report_replay")
-
- row.menu("INFO_MT_report")
- """
-
-
-class INFO_MT_report(Menu):
- bl_label = "Report"
-
- def draw(self, context):
- layout = self.layout
-
- layout.operator("console.select_all_toggle")
- layout.operator("console.select_border")
- layout.operator("console.report_delete")
- layout.operator("console.report_copy")
-
class INFO_MT_file(Menu):
bl_label = "File"
@@ -199,131 +169,6 @@ class INFO_MT_file_external_data(Menu):
layout.operator("file.find_missing_files")
-class INFO_MT_mesh_add(Menu):
- bl_idname = "INFO_MT_mesh_add"
- bl_label = "Mesh"
-
- def draw(self, context):
- layout = self.layout
-
- layout.operator_context = 'INVOKE_REGION_WIN'
- layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
- layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
- layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
- layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
- layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
- layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text="Cylinder")
- layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
- layout.separator()
- layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
- layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
- layout.operator("mesh.primitive_torus_add", icon='MESH_TORUS', text="Torus")
-
-
-class INFO_MT_curve_add(Menu):
- bl_idname = "INFO_MT_curve_add"
- bl_label = "Curve"
-
- def draw(self, context):
- layout = self.layout
-
- layout.operator_context = 'INVOKE_REGION_WIN'
- layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
- layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
- layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text="Nurbs Curve")
- layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
- layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
-
-
-class INFO_MT_surface_add(Menu):
- bl_idname = "INFO_MT_surface_add"
- bl_label = "Surface"
-
- def draw(self, context):
- layout = self.layout
-
- layout.operator_context = 'INVOKE_REGION_WIN'
- layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
- layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
- layout.operator("surface.primitive_nurbs_surface_surface_add", icon='SURFACE_NSURFACE', text="NURBS Surface")
- layout.operator("surface.primitive_nurbs_surface_cylinder_add", icon='SURFACE_NCYLINDER', text="NURBS Cylinder")
- layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
- layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
-
-
-class INFO_MT_edit_curve_add(Menu):
- bl_idname = "INFO_MT_edit_curve_add"
- bl_label = "Add"
-
- def draw(self, context):
- is_surf = context.active_object.type == 'SURFACE'
-
- layout = self.layout
- layout.operator_context = 'EXEC_REGION_WIN'
-
- if is_surf:
- INFO_MT_surface_add.draw(self, context)
- else:
- INFO_MT_curve_add.draw(self, context)
-
-
-class INFO_MT_armature_add(Menu):
- bl_idname = "INFO_MT_armature_add"
- bl_label = "Armature"
-
- def draw(self, context):
- layout = self.layout
-
- layout.operator_context = 'EXEC_REGION_WIN'
- layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
-
-
-class INFO_MT_add(Menu):
- bl_label = "Add"
-
- def draw(self, context):
- layout = self.layout
-
- # note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
-
- # Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
- # "align_view" to work on first call (see [#32719]).
- layout.operator_context = 'EXEC_REGION_WIN'
-
- #layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
- layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
-
- #layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
- layout.menu("INFO_MT_curve_add", icon='OUTLINER_OB_CURVE')
- #layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
- layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
- layout.operator_context = 'INVOKE_REGION_WIN'
- layout.operator_menu_enum("object.metaball_add", "type", text="Metaball", icon='OUTLINER_OB_META')
- layout.operator_context = 'EXEC_REGION_WIN'
- layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
- layout.separator()
-
- layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
- layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
- layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
- layout.separator()
-
- layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
- layout.separator()
-
- layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
- layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP')
- layout.separator()
-
- layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
- layout.separator()
-
- if len(bpy.data.groups) > 10:
- layout.operator_context = 'INVOKE_REGION_WIN'
- layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
- else:
- layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')
-
class INFO_MT_game(Menu):
bl_label = "Game"
@@ -409,7 +254,6 @@ class INFO_MT_help(Menu):
layout.operator("wm.operator_cheat_sheet", icon='TEXT')
layout.operator("wm.sysinfo", icon='TEXT')
layout.separator()
- layout.operator("anim.update_data_paths", text="FCurve/Driver Version fix", icon='HELP')
layout.operator("logic.texface_convert", text="TexFace to Material Convert", icon='GAME')
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index 1721eacd8ac..8d577bb22c5 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -105,7 +105,7 @@ class NODE_HT_header(Header):
row = layout.row(align=True)
row.prop(toolsettings, "use_snap", text="")
row.prop(toolsettings, "snap_node_element", text="", icon_only=True)
- if toolsettings.snap_node_element != 'INCREMENT':
+ if toolsettings.snap_node_element != 'GRID':
row.prop(toolsettings, "snap_target", text="")
row = layout.row(align=True)
@@ -169,6 +169,7 @@ class NODE_MT_select(Menu):
layout = self.layout
layout.operator("node.select_border")
+ layout.operator("node.select_circle")
layout.separator()
layout.operator("node.select_all").action = 'TOGGLE'
@@ -233,7 +234,6 @@ class NODE_MT_node(Menu):
layout.separator()
- layout.operator("node.show_cyclic_dependencies")
layout.operator("node.read_renderlayers")
layout.operator("node.read_fullsamplelayers")
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index ea88d35b4e9..6f28bcb2225 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -416,6 +416,10 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
+ else:
+ row = layout.row(align=True)
+ row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF')
+ row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED')
col = layout.column()
sub = col.column()
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 1e9c9e7ff7e..697c070ffad 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -268,12 +268,16 @@ class USERPREF_PT_edit(Panel):
col = row.column()
col.label(text="Grease Pencil:")
+ col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
+ col.separator()
col.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
- col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
+ col.separator()
col.prop(edit, "use_grease_pencil_smooth_stroke", text="Smooth Stroke")
col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
col.separator()
+ col.prop(edit, "grease_pencil_default_color", text="Default Color")
+ col.separator()
col.separator()
col.separator()
col.label(text="Playback:")
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 1c6c901dfb7..4567e8d6b28 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -54,6 +54,9 @@ class VIEW3D_HT_header(Header):
elif mode_string not in {'EDIT_TEXT', 'SCULPT'}:
sub.menu("VIEW3D_MT_select_%s" % mode_string.lower())
+ if mode_string in {'OBJECT', 'EDIT_MESH', 'EDIT_CURVE', 'EDIT_SURFACE', 'EDIT_METABALL'}:
+ sub.menu("INFO_MT_add")
+
if edit_object:
sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
elif obj:
@@ -132,6 +135,7 @@ class VIEW3D_HT_header(Header):
# ********** Menu **********
+
# ********** Utilities **********
@@ -754,6 +758,7 @@ class VIEW3D_MT_select_edit_armature(Menu):
layout.operator("armature.select_all").action = 'TOGGLE'
layout.operator("armature.select_all", text="Inverse").action = 'INVERT'
+ layout.operator("armature.select_mirror", text="Mirror").extend = False
layout.separator()
@@ -816,6 +821,135 @@ class VIEW3D_MT_select_paint_mask_vertex(Menu):
layout.operator("paint.vert_select_ungrouped", text="Ungrouped Verts")
+# ********** Add menu **********
+
+# XXX: INFO_MT_ names used to keep backwards compatibility (Addons etc that hook into the menu)
+
+class INFO_MT_mesh_add(Menu):
+ bl_idname = "INFO_MT_mesh_add"
+ bl_label = "Mesh"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
+ layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
+ layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
+ layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
+ layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
+ layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text="Cylinder")
+ layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
+ layout.separator()
+ layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
+ layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
+ layout.operator("mesh.primitive_torus_add", icon='MESH_TORUS', text="Torus")
+
+
+class INFO_MT_curve_add(Menu):
+ bl_idname = "INFO_MT_curve_add"
+ bl_label = "Curve"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
+ layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
+ layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text="Nurbs Curve")
+ layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
+ layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
+
+
+class INFO_MT_surface_add(Menu):
+ bl_idname = "INFO_MT_surface_add"
+ bl_label = "Surface"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
+ layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
+ layout.operator("surface.primitive_nurbs_surface_surface_add", icon='SURFACE_NSURFACE', text="NURBS Surface")
+ layout.operator("surface.primitive_nurbs_surface_cylinder_add", icon='SURFACE_NCYLINDER', text="NURBS Cylinder")
+ layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
+ layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
+
+
+class INFO_MT_edit_curve_add(Menu):
+ bl_idname = "INFO_MT_edit_curve_add"
+ bl_label = "Add"
+
+ def draw(self, context):
+ is_surf = context.active_object.type == 'SURFACE'
+
+ layout = self.layout
+ layout.operator_context = 'EXEC_REGION_WIN'
+
+ if is_surf:
+ INFO_MT_surface_add.draw(self, context)
+ else:
+ INFO_MT_curve_add.draw(self, context)
+
+
+class INFO_MT_armature_add(Menu):
+ bl_idname = "INFO_MT_armature_add"
+ bl_label = "Armature"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'EXEC_REGION_WIN'
+ layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
+
+
+class INFO_MT_add(Menu):
+ bl_label = "Add"
+
+ def draw(self, context):
+ layout = self.layout
+
+ # note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
+
+ # Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
+ # "align_view" to work on first call (see [#32719]).
+ layout.operator_context = 'EXEC_REGION_WIN'
+
+ #layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
+ layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
+
+ #layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
+ layout.menu("INFO_MT_curve_add", icon='OUTLINER_OB_CURVE')
+ #layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
+ layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator_menu_enum("object.metaball_add", "type", text="Metaball", icon='OUTLINER_OB_META')
+ layout.operator_context = 'EXEC_REGION_WIN'
+ layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
+ layout.separator()
+
+ layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
+ layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
+ layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
+ layout.separator()
+
+ layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
+ layout.separator()
+
+ layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
+ layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP')
+ layout.separator()
+
+ layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
+ layout.separator()
+
+ if len(bpy.data.groups) > 10:
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
+ else:
+ layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')
+
# ********** Object menu **********
@@ -1445,6 +1579,9 @@ class VIEW3D_MT_hide_mask(Menu):
props = layout.operator("paint.mask_flood_fill", text="Clear Mask")
props.mode = 'VALUE'
props.value = 0
+
+ props = layout.operator("view3d.select_border", text="Box Mask")
+ props = layout.operator("paint.mask_lasso_gesture", text="Lasso Mask")
# ********** Particle menu **********
@@ -2390,6 +2527,7 @@ class VIEW3D_MT_edit_armature(Menu):
layout.operator("armature.merge")
layout.operator("armature.fill")
layout.operator("armature.delete")
+ layout.operator("armature.split")
layout.operator("armature.separate")
layout.separator()
diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py
index 975ae1881f2..bf89c0debad 100644
--- a/release/scripts/templates_py/custom_nodes.py
+++ b/release/scripts/templates_py/custom_nodes.py
@@ -109,6 +109,11 @@ class MyCustomNode(Node, MyCustomTreeNode):
# myStringProperty button will only be visible in the sidebar
layout.prop(self, "myStringProperty")
+ # Optional: custom label
+ # Explicit user label overrides this, but here we can define a label dynamically
+ def draw_label(self):
+ return "I am a custom node"
+
### Node Categories ###
# Node categories are a python system for automatically
diff --git a/release/scripts/templates_py/operator_modal_timer.py b/release/scripts/templates_py/operator_modal_timer.py
index b8211126daf..4d36860b9e3 100644
--- a/release/scripts/templates_py/operator_modal_timer.py
+++ b/release/scripts/templates_py/operator_modal_timer.py
@@ -29,7 +29,6 @@ class ModalTimerOperator(bpy.types.Operator):
def cancel(self, context):
wm = context.window_manager
wm.event_timer_remove(self._timer)
- return {'CANCELLED'}
def register():
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index d46df829295..998b415a6af 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -210,6 +210,7 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, size_t len)
blf_font_ensure_ascii_table(font);
while ((c = *(str++)) && len--) {
+ BLI_assert(c < 128);
if ((g = glyph_ascii_table[c]) == NULL)
continue;
if (has_kerning)
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 5b32e7229d5..f2d9c0efc13 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 269
-#define BLENDER_SUBVERSION 1
+#define BLENDER_SUBVERSION 2
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 262
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index ddb36df74ca..560617db474 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -122,6 +122,7 @@ void CDDM_recalc_tessellation_ex(struct DerivedMesh *dm, const int do_face_nor_c
*/
void CDDM_lower_num_verts(struct DerivedMesh *dm, int numVerts);
void CDDM_lower_num_edges(struct DerivedMesh *dm, int numEdges);
+void CDDM_lower_num_loops(struct DerivedMesh *dm, int numLoops);
void CDDM_lower_num_polys(struct DerivedMesh *dm, int numPolys);
void CDDM_lower_num_tessfaces(DerivedMesh *dm, int numTessFaces);
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 9d33af1a0f4..d0341ab8c89 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -192,6 +192,7 @@ enum {
#define G_TRANSFORM_OBJ 1
#define G_TRANSFORM_EDIT 2
#define G_TRANSFORM_SEQ 4
+#define G_TRANSFORM_FCURVES 8
/* G.special1 */
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 264a7421e91..36c1f5dcf1f 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -53,7 +53,7 @@ typedef struct Main {
char name[1024]; /* 1024 = FILE_MAX */
short versionfile, subversionfile; /* see BLENDER_VERSION, BLENDER_SUBVERSION */
short minversionfile, minsubversionfile;
- int revision; /* svn revision of binary that saved file */
+ char build_change[16], build_hash[16]; /* change number and hash from buildinfo */
short recovered; /* indicate the main->name (file) is the recovered one */
struct Library *curlib;
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index 9e73e0662ce..d73249041e8 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -90,7 +90,7 @@ float BKE_mask_spline_project_co(struct MaskSpline *spline, struct MaskSplinePoi
/* point */
int BKE_mask_point_has_handle(struct MaskSplinePoint *point);
void BKE_mask_point_handle(struct MaskSplinePoint *point, float handle[2]);
-void BKE_mask_point_set_handle(struct MaskSplinePoint *point, float loc[2], int keep_direction,
+void BKE_mask_point_set_handle(struct MaskSplinePoint *point, float loc[2], bool keep_direction,
float orig_handle[2], float orig_vec[3][3]);
void BKE_mask_point_segment_co(struct MaskSpline *spline, struct MaskSplinePoint *point, float u, float co[2]);
@@ -123,9 +123,9 @@ void BKE_mask_coord_to_image(struct Image *image, struct ImageUser *iuser, float
void BKE_mask_update_display(struct Mask *mask, float ctime);
-void BKE_mask_evaluate_all_masks(struct Main *bmain, float ctime, const int do_newframe);
-void BKE_mask_evaluate(struct Mask *mask, const float ctime, const int do_newframe);
-void BKE_mask_layer_evaluate(struct MaskLayer *masklay, const float ctime, const int do_newframe);
+void BKE_mask_evaluate_all_masks(struct Main *bmain, float ctime, const bool do_newframe);
+void BKE_mask_evaluate(struct Mask *mask, const float ctime, const bool do_newframe);
+void BKE_mask_layer_evaluate(struct MaskLayer *masklay, const float ctime, const bool do_newframe);
void BKE_mask_update_scene(struct Main *bmain, struct Scene *scene);
void BKE_mask_parent_init(struct MaskParent *parent);
void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
@@ -156,17 +156,18 @@ int BKE_mask_layer_shape_find_frame_range(struct MaskLayer *masklay, const float
struct MaskLayerShape **r_masklay_shape_b);
struct MaskLayerShape *BKE_mask_layer_shape_alloc(struct MaskLayer *masklay, const int frame);
void BKE_mask_layer_shape_free(struct MaskLayerShape *masklay_shape);
-struct MaskLayerShape *BKE_mask_layer_shape_varify_frame(struct MaskLayer *masklay, const int frame);
+struct MaskLayerShape *BKE_mask_layer_shape_verify_frame(struct MaskLayer *masklay, const int frame);
struct MaskLayerShape *BKE_mask_layer_shape_duplicate(struct MaskLayerShape *masklay_shape);
void BKE_mask_layer_shape_unlink(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape);
void BKE_mask_layer_shape_sort(struct MaskLayer *masklay);
-int BKE_mask_layer_shape_spline_from_index(struct MaskLayer *masklay, int index,
+bool BKE_mask_layer_shape_spline_from_index(struct MaskLayer *masklay, int index,
struct MaskSpline **r_masklay_shape, int *r_index);
int BKE_mask_layer_shape_spline_to_index(struct MaskLayer *masklay, struct MaskSpline *spline);
+/* TODO(sergey): do_init and do_init_interpolate are always true, so let's wipe them later. */
void BKE_mask_layer_shape_changed_add(struct MaskLayer *masklay, int index,
- int do_init, int do_init_interpolate);
+ bool do_init, bool do_init_interpolate);
void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, int count);
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 6bf42a3e885..65038c7f09c 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -357,6 +357,7 @@ bool modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
bool modifiers_isCorrectableDeformed(struct Scene *scene, struct Object *ob);
void modifier_freeTemporaryData(struct ModifierData *md);
bool modifiers_isPreview(struct Object *ob);
+void modifier_skin_customdata_ensure(struct Object *ob);
typedef struct CDMaskLink {
struct CDMaskLink *next;
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 7cc8c7290f7..b700cbb16db 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -132,7 +132,7 @@ typedef struct bNodeSocketType {
} bNodeSocketType;
typedef void *(*NodeInitExecFunction)(struct bNodeExecContext *context, struct bNode *node, bNodeInstanceKey key);
-typedef void (*NodeFreeExecFunction)(struct bNode *node, void *nodedata);
+typedef void (*NodeFreeExecFunction)(void *nodedata);
typedef void (*NodeExecFunction)(void *data, int thread, struct bNode *, struct bNodeExecData *execdata, struct bNodeStack **in, struct bNodeStack **out);
typedef int (*NodeGPUExecFunction)(struct GPUMaterial *mat, struct bNode *node, struct bNodeExecData *execdata, struct GPUNodeStack *in, struct GPUNodeStack *out);
@@ -175,7 +175,7 @@ typedef struct bNodeType {
void (*draw_backdrop)(struct SpaceNode *snode, struct ImBuf *backdrop, struct bNode *node, int x, int y);
/// Optional custom label function for the node header.
- const char *(*labelfunc)(struct bNode *);
+ void (*labelfunc)(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
/// Optional custom resize handle polling.
int (*resize_area_func)(struct bNode *node, int x, int y);
/// Optional selection area polling.
@@ -556,7 +556,7 @@ void BKE_node_preview_set_pixel(struct bNodePreview *preview, const f
/* ************** NODE TYPE ACCESS *************** */
-const char *nodeLabel(struct bNode *node);
+void nodeLabel(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
int nodeGroupPoll(struct bNodeTree *nodetree, struct bNodeTree *grouptree);
@@ -571,7 +571,7 @@ void node_type_storage(struct bNodeType *ntype,
const char *storagename,
void (*freefunc)(struct bNode *node),
void (*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, struct bNode *src_node));
-void node_type_label(struct bNodeType *ntype, const char *(*labelfunc)(struct bNode *));
+void node_type_label(struct bNodeType *ntype, void (*labelfunc)(struct bNodeTree *ntree, struct bNode *, char *label, int maxlen));
void node_type_update(struct bNodeType *ntype,
void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node),
void (*verifyfunc)(struct bNodeTree *ntree, struct bNode *node, struct ID *id));
@@ -944,6 +944,9 @@ void ntreeCompositOutputFileSetLayer(struct bNode *node, struct bNodeSocket *soc
void ntreeCompositOutputFileUniquePath(struct ListBase *list, struct bNodeSocket *sock, const char defname[], char delim);
void ntreeCompositOutputFileUniqueLayer(struct ListBase *list, struct bNodeSocket *sock, const char defname[], char delim);
+void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *ntree, bNode *node);
+void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *ntree, bNode *node);
+
/* ************** TEXTURE NODES *************** */
struct TexResult;
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index ef5b8349d60..34ed4f2c8b1 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -57,7 +57,7 @@ void BKE_rigidbody_relink_constraint(struct RigidBodyCon *rbc);
/* -------------- */
/* Setup */
-/* create Blender-side settings data - physics objects not initialised yet */
+/* create Blender-side settings data - physics objects not initialized yet */
struct RigidBodyWorld *BKE_rigidbody_create_world(struct Scene *scene);
struct RigidBodyOb *BKE_rigidbody_create_object(struct Scene *scene, struct Object *ob, short type);
struct RigidBodyCon *BKE_rigidbody_create_constraint(struct Scene *scene, struct Object *ob, short type);
diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h
index 8a11d48d063..347c8b60532 100644
--- a/source/blender/blenkernel/BKE_writeffmpeg.h
+++ b/source/blender/blenkernel/BKE_writeffmpeg.h
@@ -38,31 +38,34 @@
extern "C" {
#endif
-#define FFMPEG_MPEG1 0
-#define FFMPEG_MPEG2 1
-#define FFMPEG_MPEG4 2
-#define FFMPEG_AVI 3
-#define FFMPEG_MOV 4
-#define FFMPEG_DV 5
-#define FFMPEG_H264 6
-#define FFMPEG_XVID 7
-#define FFMPEG_FLV 8
-#define FFMPEG_MKV 9
-#define FFMPEG_OGG 10
-#define FFMPEG_WAV 11
-#define FFMPEG_MP3 12
+enum {
+ FFMPEG_MPEG1 = 0,
+ FFMPEG_MPEG2 = 1,
+ FFMPEG_MPEG4 = 2,
+ FFMPEG_AVI = 3,
+ FFMPEG_MOV = 4,
+ FFMPEG_DV = 5,
+ FFMPEG_H264 = 6,
+ FFMPEG_XVID = 7,
+ FFMPEG_FLV = 8,
+ FFMPEG_MKV = 9,
+ FFMPEG_OGG = 10,
+ FFMPEG_INVALID = 11,
+};
-#define FFMPEG_PRESET_NONE 0
-#define FFMPEG_PRESET_DVD 1
-#define FFMPEG_PRESET_SVCD 2
-#define FFMPEG_PRESET_VCD 3
-#define FFMPEG_PRESET_DV 4
-#define FFMPEG_PRESET_H264 5
-#define FFMPEG_PRESET_THEORA 6
-#define FFMPEG_PRESET_XVID 7
+enum {
+ FFMPEG_PRESET_NONE = 0,
+ FFMPEG_PRESET_DVD = 1,
+ FFMPEG_PRESET_SVCD = 2,
+ FFMPEG_PRESET_VCD = 3,
+ FFMPEG_PRESET_DV = 4,
+ FFMPEG_PRESET_H264 = 5,
+ FFMPEG_PRESET_THEORA = 6,
+ FFMPEG_PRESET_XVID = 7,
+};
struct IDProperty;
-struct RenderData;
+struct RenderData;
struct ReportList;
struct Scene;
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 884e7a813a8..731196c2480 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1259,7 +1259,7 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
}
if (dm->type == DM_TYPE_EDITBMESH) {
- /* editmesh draw function checks spesifically for this */
+ /* editmesh draw function checks specifically for this */
}
else {
const int dm_totpoly = dm->getNumPolys(dm);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 225be335c6d..9226538910c 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -285,7 +285,7 @@ void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
/* ........ */
/* Note on evaluation optimizations:
- * Optimisations currently used here play tricks with the depsgraph in order to try and
+ * Optimization's currently used here play tricks with the depsgraph in order to try and
* evaluate as few objects as strictly necessary to get nicer performance under standard
* production conditions. For those people who really need the accurate version,
* disable the ifdef (i.e. 1 -> 0) and comment out the call to motionpaths_calc_optimise_depsgraph()
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index d2189468f53..cb628db8cd2 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1567,11 +1567,11 @@ static float nlastrip_get_influence(NlaStrip *strip, float cframe)
strip->blendout = fabsf(strip->blendout);
/* result depends on where frame is in respect to blendin/out values */
- if (IS_EQ(strip->blendin, 0) == 0 && (cframe <= (strip->start + strip->blendin))) {
+ if (IS_EQF(strip->blendin, 0.0f) == false && (cframe <= (strip->start + strip->blendin))) {
/* there is some blend-in */
return fabsf(cframe - strip->start) / (strip->blendin);
}
- else if (IS_EQ(strip->blendout, 0) == 0 && (cframe >= (strip->end - strip->blendout))) {
+ else if (IS_EQF(strip->blendout, 0.0f) == false && (cframe >= (strip->end - strip->blendout))) {
/* there is some blend-out */
return fabsf(strip->end - cframe) / (strip->blendout);
}
@@ -1856,7 +1856,7 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, float
inf *= nes->strip_time;
/* optimisation: no need to try applying if there is no influence */
- if (IS_EQ(inf, 0)) return;
+ if (IS_EQF(inf, 0.0f)) return;
/* perform blending */
switch (blendmode) {
@@ -2074,7 +2074,7 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr, ListBase *channels, Li
tmp_nes = *nes;
/* evaluate these strips into a temp-buffer (tmp_channels) */
- /* FIXME: modifier evalation here needs some work... */
+ /* FIXME: modifier evaluation here needs some work... */
/* first strip */
tmp_nes.strip_mode = NES_TIME_TRANSITION_START;
tmp_nes.strip = s1;
@@ -2086,7 +2086,7 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr, ListBase *channels, Li
nlastrip_evaluate(ptr, &tmp_channels, &tmp_modifiers, &tmp_nes);
- /* assumulate temp-buffer and full-buffer, using the 'real' strip */
+ /* accumulate temp-buffer and full-buffer, using the 'real' strip */
nlaevalchan_buffers_accumulate(channels, &tmp_channels, nes);
/* unlink this strip's modifiers from the parent's modifiers again */
@@ -2124,7 +2124,7 @@ static void nlastrip_evaluate_meta(PointerRNA *ptr, ListBase *channels, ListBase
*/
nlastrip_evaluate(ptr, &tmp_channels, &tmp_modifiers, tmp_nes);
- /* assumulate temp-buffer and full-buffer, using the 'real' strip */
+ /* accumulate temp-buffer and full-buffer, using the 'real' strip */
nlaevalchan_buffers_accumulate(channels, &tmp_channels, nes);
/* free temp eval-strip */
@@ -2334,7 +2334,7 @@ static void animsys_calculate_nla(PointerRNA *ptr, AnimData *adt, float ctime)
/* ***************************************** */
/* Overrides System - Public API */
-/* Clear all overides */
+/* Clear all overrides */
/* Add or get existing Override for given setting */
#if 0
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 83161801069..3be80a7e30d 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -285,7 +285,7 @@ int bone_autoside_name(char name[MAXBONENAME], int UNUSED(strip_number), short a
*/
if (axis == 2) {
/* z-axis - vertical (top/bottom) */
- if (IS_EQ(head, 0)) {
+ if (IS_EQF(head, 0.0f)) {
if (tail < 0)
strcpy(extension, "Bot");
else if (tail > 0)
@@ -300,7 +300,7 @@ int bone_autoside_name(char name[MAXBONENAME], int UNUSED(strip_number), short a
}
else if (axis == 1) {
/* y-axis - depth (front/back) */
- if (IS_EQ(head, 0)) {
+ if (IS_EQF(head, 0.0f)) {
if (tail < 0)
strcpy(extension, "Fr");
else if (tail > 0)
@@ -315,7 +315,7 @@ int bone_autoside_name(char name[MAXBONENAME], int UNUSED(strip_number), short a
}
else {
/* x-axis - horizontal (left/right) */
- if (IS_EQ(head, 0)) {
+ if (IS_EQF(head, 0.0f)) {
if (tail < 0)
strcpy(extension, "R");
else if (tail > 0)
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 790c1f09ff0..33c6f3eb7c0 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -762,7 +762,7 @@ float BKE_brush_sample_masktex(const Scene *scene, Brush *br,
* 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
+ * available. my usual 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 any case, a better solution is needed to prevent
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 370dbc62ef8..dba7a291a46 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -557,7 +557,7 @@ BVHTree *bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *dm, float e
data->cached = true;
/* a NULL nearest callback works fine
- * remeber the min distance to point is the same as the min distance to BV of point */
+ * remember the min distance to point is the same as the min distance to BV of point */
data->nearest_callback = NULL;
data->raycast_callback = NULL;
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 4846199b9d9..d57d9180697 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -2786,6 +2786,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
void CDDM_lower_num_verts(DerivedMesh *dm, int numVerts)
{
+ BLI_assert(numVerts >= 0);
if (numVerts < dm->numVertData)
CustomData_free_elem(&dm->vertData, numVerts, dm->numVertData - numVerts);
@@ -2794,6 +2795,7 @@ void CDDM_lower_num_verts(DerivedMesh *dm, int numVerts)
void CDDM_lower_num_edges(DerivedMesh *dm, int numEdges)
{
+ BLI_assert(numEdges >= 0);
if (numEdges < dm->numEdgeData)
CustomData_free_elem(&dm->edgeData, numEdges, dm->numEdgeData - numEdges);
@@ -2802,14 +2804,25 @@ void CDDM_lower_num_edges(DerivedMesh *dm, int numEdges)
void CDDM_lower_num_tessfaces(DerivedMesh *dm, int numTessFaces)
{
+ BLI_assert(numTessFaces >= 0);
if (numTessFaces < dm->numTessFaceData)
CustomData_free_elem(&dm->faceData, numTessFaces, dm->numTessFaceData - numTessFaces);
dm->numTessFaceData = numTessFaces;
}
+void CDDM_lower_num_loops(DerivedMesh *dm, int numLoops)
+{
+ BLI_assert(numLoops >= 0);
+ if (numLoops < dm->numLoopData)
+ CustomData_free_elem(&dm->loopData, numLoops, dm->numLoopData - numLoops);
+
+ dm->numLoopData = numLoops;
+}
+
void CDDM_lower_num_polys(DerivedMesh *dm, int numPolys)
{
+ BLI_assert(numPolys >= 0);
if (numPolys < dm->numPolyData)
CustomData_free_elem(&dm->polyData, numPolys, dm->numPolyData - numPolys);
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index e4c6f7790d7..cab4adf46bf 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -1114,8 +1114,8 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
if ( numedges==0 )
return 0;
- /* NOTE: handling ownership of sptings and edgehash is quite sloppy
- * currenlty they are never initialized but assert just to be sure */
+ /* NOTE: handling ownership of springs and edgehash is quite sloppy
+ * currently they are never initialized but assert just to be sure */
BLI_assert(cloth->springs == NULL);
BLI_assert(cloth->edgehash == NULL);
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 1f892432d80..aa81ea130ad 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3075,7 +3075,7 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
float offset;
/* check to make sure len is not so close to zero that it'll cause errors */
- if (IS_EQ(len, 0) == 0) {
+ if (IS_EQF(len, 0.0f) == false) {
/* find bounding-box range where target is located */
if (ownLoc[clamp_axis] < curveMin[clamp_axis]) {
/* bounding-box range is before */
@@ -3107,7 +3107,7 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
curvetime = 0.0f;
else if (ownLoc[clamp_axis] >= curveMax[clamp_axis])
curvetime = 1.0f;
- else if (IS_EQ((curveMax[clamp_axis] - curveMin[clamp_axis]), 0) == 0)
+ else if (IS_EQF((curveMax[clamp_axis] - curveMin[clamp_axis]), 0.0f) == false)
curvetime = (ownLoc[clamp_axis] - curveMin[clamp_axis]) / (curveMax[clamp_axis] - curveMin[clamp_axis]);
else
curvetime = 0.0f;
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index ca9f97b754c..4524b3ac7ac 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -230,6 +230,7 @@ Curve *BKE_curve_copy(Curve *cu)
cun->editnurb = NULL;
cun->editfont = NULL;
cun->selboxes = NULL;
+ cun->lastsel = NULL;
#if 0 // XXX old animation system
/* single user ipo too */
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 453d96a11af..6fb5dd56ce5 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -34,7 +34,7 @@
* to three loops per triangle. the derivedmesh stores a cache of tessellations
* for each face. this cache will smartly update as needed (though at first
* it'll simply be more brute force). keeping track of face/edge counts may
- * be a small problbm.
+ * be a small problem.
*
* this won't be the most efficient thing, considering that internal edges and
* faces of tessellations are exposed. looking up an edge by index in particular
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index dbdf30ea63d..a40d7401566 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2139,11 +2139,39 @@ float evaluate_fcurve(FCurve *fcu, float evaltime)
/* if there is a driver (only if this F-Curve is acting as 'driver'), evaluate it to find value to use as "evaltime"
* since drivers essentially act as alternative input (i.e. in place of 'time') for F-Curves
- * - this value will also be returned as the value of the 'curve', if there are no keyframes
*/
if (fcu->driver) {
/* evaltime now serves as input for the curve */
- evaltime = cvalue = evaluate_driver(fcu->driver, evaltime);
+ evaltime = evaluate_driver(fcu->driver, evaltime);
+
+ /* only do a default 1-1 mapping if it's unlikely that anything else will set a value... */
+ if (fcu->totvert == 0) {
+ FModifier *fcm;
+ bool do_linear = true;
+
+ /* out-of-range F-Modifiers will block, as will those which just plain overwrite the values
+ * XXX: additive is a bit more dicey; it really depends then if things are in range or not...
+ */
+ for (fcm = fcu->modifiers.first; fcm; fcm = fcm->next) {
+ /* if there are range-restrictions, we must definitely block [#36950] */
+ if ((fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) == 0 ||
+ ((fcm->sfra <= evaltime) && (fcm->efra >= evaltime)) )
+ {
+ /* within range: here it probably doesn't matter, though we'd want to check on additive... */
+ }
+ else {
+ /* outside range: modifier shouldn't contribute to the curve here, though it does in other areas,
+ * so neither should the driver!
+ */
+ do_linear = false;
+ }
+ }
+
+ /* only copy over results if none of the modifiers disagreed with this */
+ if (do_linear) {
+ cvalue = evaltime;
+ }
+ }
}
/* evaluate modifiers which modify time to evaluate the base curve at */
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 4d17bd286b4..42e146301a2 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLI_math_vector.h"
#include "BLF_translation.h"
@@ -182,7 +183,7 @@ bGPDlayer *gpencil_layer_addnew(bGPdata *gpd, const char *name, int setactive)
BLI_addtail(&gpd->layers, gpl);
/* set basic settings */
- gpl->color[3] = 0.9f;
+ copy_v4_v4(gpl->color, U.gpencil_new_layer_col);
gpl->thickness = 3;
/* auto-name */
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 52f3c90754a..6a411f8c308 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2241,7 +2241,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
#else
/* image buffers for non-sequence multilayer will share buffers with RenderResult,
* however sequence multilayer will own buffers. Such logic makes switching from
- * single multilayer file to sequence completely instable
+ * single multilayer file to sequence completely unstable
* since changes in nodes seems this workaround isn't needed anymore, all sockets
* are nicely detecting anyway, but freeing buffers always here makes multilayer
* sequences behave stable
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index c856d8cfea4..b20b4294f84 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -462,7 +462,7 @@ void BKE_mask_point_handle(MaskSplinePoint *point, float handle[2])
handle[1] = (point->bezt.vec[1][1] - vec[0]);
}
-void BKE_mask_point_set_handle(MaskSplinePoint *point, float loc[2], int keep_direction,
+void BKE_mask_point_set_handle(MaskSplinePoint *point, float loc[2], bool keep_direction,
float orig_handle[2], float orig_vec[3][3])
{
BezTriple *bezt = &point->bezt;
@@ -1443,7 +1443,7 @@ void BKE_mask_spline_ensure_deform(MaskSpline *spline)
}
}
-void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const int do_newframe)
+void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const bool do_newframe)
{
/* animation if available */
if (do_newframe) {
@@ -1521,7 +1521,7 @@ void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const int do
}
}
-void BKE_mask_evaluate(Mask *mask, const float ctime, const int do_newframe)
+void BKE_mask_evaluate(Mask *mask, const float ctime, const bool do_newframe)
{
MaskLayer *masklay;
@@ -1562,10 +1562,10 @@ void BKE_mask_update_display(Mask *mask, float ctime)
}
#endif
- BKE_mask_evaluate(mask, ctime, FALSE);
+ BKE_mask_evaluate(mask, ctime, false);
}
-void BKE_mask_evaluate_all_masks(Main *bmain, float ctime, const int do_newframe)
+void BKE_mask_evaluate_all_masks(Main *bmain, float ctime, const bool do_newframe)
{
Mask *mask;
@@ -1772,7 +1772,7 @@ int BKE_mask_layer_shape_find_frame_range(MaskLayer *masklay, const float frame,
}
}
-MaskLayerShape *BKE_mask_layer_shape_varify_frame(MaskLayer *masklay, const int frame)
+MaskLayerShape *BKE_mask_layer_shape_verify_frame(MaskLayer *masklay, const int frame)
{
MaskLayerShape *masklay_shape;
@@ -1835,8 +1835,8 @@ void BKE_mask_layer_shape_sort(MaskLayer *masklay)
BLI_sortlist(&masklay->splines_shapes, mask_layer_shape_sort_cb);
}
-int BKE_mask_layer_shape_spline_from_index(MaskLayer *masklay, int index,
- MaskSpline **r_masklay_shape, int *r_index)
+bool BKE_mask_layer_shape_spline_from_index(MaskLayer *masklay, int index,
+ MaskSpline **r_masklay_shape, int *r_index)
{
MaskSpline *spline;
@@ -1844,12 +1844,12 @@ int BKE_mask_layer_shape_spline_from_index(MaskLayer *masklay, int index,
if (index < spline->tot_point) {
*r_masklay_shape = spline;
*r_index = index;
- return TRUE;
+ return true;
}
index -= spline->tot_point;
}
- return FALSE;
+ return false;
}
int BKE_mask_layer_shape_spline_to_index(MaskLayer *masklay, MaskSpline *spline)
@@ -1891,7 +1891,7 @@ static void interp_weights_uv_v2_apply(const float uv[2], float r_pt[2], const f
/* when a new points added - resize all shapekey array */
void BKE_mask_layer_shape_changed_add(MaskLayer *masklay, int index,
- int do_init, int do_init_interpolate)
+ bool do_init, bool do_init_interpolate)
{
MaskLayerShape *masklay_shape;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index a77f768835a..844252c583c 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -708,26 +708,32 @@ bool BKE_mesh_uv_cdlayer_rename(Mesh *me, const char *old_name, const char *new_
return false;
}
else {
- lidx = lidx_start + (fidx - fidx_start);
+ lidx = fidx;
}
}
- pidx = pidx_start + (lidx - lidx_start);
+ pidx = lidx;
}
else {
if (lidx == -1) {
- lidx = lidx_start + (pidx - pidx_start);
+ lidx = pidx;
}
if (fidx == -1 && do_tessface) {
- fidx = fidx_start + (pidx - pidx_start);
+ fidx = pidx;
}
}
#if 0
/* For now, we do not consider mismatch in indices (i.e. same name leading to (relative) different indices). */
- else if ((pidx - pidx_start) != (lidx - lidx_start)) {
- lidx = lidx_start + (pidx - pidx_start);
+ else if (pidx != lidx) {
+ lidx = pidx;
}
#endif
+ /* Go back to absolute indices! */
+ pidx += pidx_start;
+ lidx += lidx_start;
+ if (fidx != -1)
+ fidx += fidx_start;
+
return BKE_mesh_uv_cdlayer_rename_index(me, pidx, lidx, fidx, new_name, do_tessface);
}
}
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 1c9576d74d0..a4f5529ee43 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -922,7 +922,7 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
{
bool is_valid = true;
bool is_change_v, is_change_e, is_change_l, is_change_p;
- int tot_texpoly, tot_uvloop;
+ int tot_texpoly, tot_uvloop, tot_vcolloop;
CustomDataMask mask = check_meshmask ? CD_MASK_MESH : 0;
is_valid &= mesh_validate_customdata(vdata, mask, do_verbose, do_fixes, &is_change_v);
@@ -932,10 +932,23 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
tot_texpoly = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
tot_uvloop = CustomData_number_of_layers(ldata, CD_MLOOPUV);
+ tot_vcolloop = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
if (tot_texpoly != tot_uvloop) {
PRINT_ERR("\tCustomDataLayer mismatch, tot_texpoly(%d), tot_uvloop(%d)\n",
tot_texpoly, tot_uvloop);
}
+ if (tot_texpoly > MAX_MTFACE) {
+ PRINT_ERR("\tMore UV layers than %d allowed, %d last ones won't be available for render, shaders, etc.\n",
+ MAX_MTFACE, tot_texpoly - MAX_MTFACE);
+ }
+ if (tot_uvloop > MAX_MTFACE) {
+ PRINT_ERR("\tMore UV layers than %d allowed, %d last ones won't be available for render, shaders, etc.\n",
+ MAX_MTFACE, tot_uvloop - MAX_MTFACE);
+ }
+ if (tot_vcolloop > MAX_MCOL) {
+ PRINT_ERR("\tMore VCol layers than %d allowed, %d last ones won't be available for render, shaders, etc.\n",
+ MAX_MCOL, tot_vcolloop - MAX_MCOL);
+ }
*r_change = (is_change_v || is_change_e || is_change_l || is_change_p);
@@ -989,10 +1002,25 @@ void BKE_mesh_cd_validate(Mesh *me)
{
int totlayer_mtex = CustomData_number_of_layers(&me->pdata, CD_MTEXPOLY);
int totlayer_uv = CustomData_number_of_layers(&me->ldata, CD_MLOOPUV);
+ int totlayer_mcol = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL);
int mtex_index = CustomData_get_layer_index(&me->pdata, CD_MTEXPOLY);
int uv_index = CustomData_get_layer_index(&me->ldata, CD_MLOOPUV);
int i;
+ /* XXX For now, do not delete those, just warn they are not really usable. */
+ if (UNLIKELY(totlayer_mtex > MAX_MTFACE)) {
+ printf("WARNING! More UV layers than %d allowed, %d last ones won't be available for render, shaders, etc.\n",
+ MAX_MTFACE, totlayer_mtex - MAX_MTFACE);
+ }
+ if (UNLIKELY(totlayer_uv > MAX_MTFACE)) {
+ printf("WARNING! More UV layers than %d allowed, %d last ones won't be available for render, shaders, etc.\n",
+ MAX_MTFACE, totlayer_uv - MAX_MTFACE);
+ }
+ if (UNLIKELY(totlayer_mcol > MAX_MCOL)) {
+ printf("WARNING! More VCol layers than %d allowed, %d last ones won't be available for render, shaders, etc.\n",
+ MAX_MCOL, totlayer_mcol - MAX_MCOL);
+ }
+
if (LIKELY(totlayer_mtex == totlayer_uv)) {
/* pass */
}
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index cc4263f4392..869dbe032c9 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -3089,14 +3089,14 @@ void nodeSynchronizeID(bNode *node, bool copy_to_id)
/* ************* node type access ********** */
-const char *nodeLabel(bNode *node)
+void nodeLabel(bNodeTree *ntree, bNode *node, char *label, int maxlen)
{
if (node->label[0] != '\0')
- return node->label;
+ BLI_strncpy(label, node->label, maxlen);
else if (node->typeinfo->labelfunc)
- return node->typeinfo->labelfunc(node);
+ node->typeinfo->labelfunc(ntree, node, label, maxlen);
else
- return IFACE_(node->typeinfo->ui_name);
+ BLI_strncpy(label, IFACE_(node->typeinfo->ui_name), maxlen);
}
static void node_type_base_defaults(bNodeType *ntype)
@@ -3267,7 +3267,7 @@ void node_type_storage(bNodeType *ntype,
ntype->freefunc = freefunc;
}
-void node_type_label(struct bNodeType *ntype, const char *(*labelfunc)(struct bNode *))
+void node_type_label(struct bNodeType *ntype, void (*labelfunc)(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen))
{
ntype->labelfunc = labelfunc;
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index bef0263b2f5..45d9d144f55 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -32,7 +32,7 @@
#include <string.h>
#include <math.h>
-#include <stdio.h>
+#include <stdio.h>
#include "MEM_guardedalloc.h"
@@ -256,6 +256,11 @@ void BKE_object_link_modifiers(struct Object *ob_dst, struct Object *ob_src)
if (!BKE_object_support_modifier_type_check(ob_dst, md->type))
continue;
+
+ if (md->type == eModifierType_Skin) {
+ /* ensure skin-node customdata exists */
+ modifier_skin_customdata_ensure(ob_dst);
+ }
nmd = modifier_new(md->type);
BLI_strncpy(nmd->name, md->name, sizeof(nmd->name));
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 526d54a97fa..41217110cd8 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -2006,6 +2006,12 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
pa->lifetime = 100.0f;
}
else {
+ /* initialize the lifetime, in case the texture coordinates
+ * are from Particles/Strands, which would cause undefined values
+ */
+ pa->lifetime = part->lifetime * (1.0f - part->randlife * PSYS_FRAND(p + 21));
+ pa->dietime = pa->time + pa->lifetime;
+
/* get possible textural influence */
psys_get_texture(sim, pa, &ptex, PAMAP_LIFE, cfra);
@@ -2844,10 +2850,10 @@ static void sphclassical_force_cb(void *sphdata_v, ParticleKey *state, float *fo
continue;
}
- /* Find vector to neighbour. Exclude particles that are more than 2h
+ /* Find vector to neighbor. Exclude particles that are more than 2h
* away. Can't use current state here because it may have changed on
* another thread - so do own mini integration. Unlike basic_integrate,
- * SPH integration depends on neighbouring particles. - z0r */
+ * SPH integration depends on neighboring particles. - z0r */
madd_v3_v3v3fl(co, npa->prev_state.co, npa->prev_state.vel, state->time);
sub_v3_v3v3(vec, co, state->co);
rij = normalize_v3(vec);
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 42147be33e4..600805e71ce 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1211,7 +1211,7 @@ void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime)
}
}
-/* Used when cancelling transforms - return rigidbody and object to initial states */
+/* Used when canceling transforms - return rigidbody and object to initial states */
void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], float quat[4], float rotAxis[3], float rotAngle)
{
RigidBodyOb *rbo = ob->rigidbody_object;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index d4618e28191..05e1ec82392 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -504,6 +504,8 @@ Scene *BKE_scene_add(Main *bmain, const char *name)
sce->toolsettings->normalsize = 0.1;
sce->toolsettings->autokey_mode = U.autokey_mode;
+ sce->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
+
sce->toolsettings->skgen_resolution = 100;
sce->toolsettings->skgen_threshold_internal = 0.01f;
sce->toolsettings->skgen_threshold_external = 0.01f;
@@ -1303,7 +1305,7 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
* so don't call within 'scene_update_tagged_recursive' */
DAG_scene_update_flags(bmain, sce, lay, TRUE); // only stuff that moves or needs display still
- BKE_mask_evaluate_all_masks(bmain, ctime, TRUE);
+ BKE_mask_evaluate_all_masks(bmain, ctime, true);
/* All 'standard' (i.e. without any dependencies) animation is handled here,
* with an 'local' to 'macro' order of evaluation. This should ensure that
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 925355d9383..49b237fc3ea 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -463,6 +463,7 @@ void BKE_sequencer_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, int make_
if (!STREQ(float_colorspace, to_colorspace)) {
IMB_colormanagement_transform_threaded(ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels,
from_colorspace, to_colorspace, true);
+ sequencer_imbuf_assign_spaces(scene, ibuf);
}
}
}
@@ -2341,7 +2342,7 @@ static ImBuf *seq_render_mask(SeqRenderData context, Mask *mask, float nr, short
mask_temp = BKE_mask_copy_nolib(mask);
- BKE_mask_evaluate(mask_temp, mask->sfra + nr, TRUE);
+ BKE_mask_evaluate(mask_temp, mask->sfra + nr, true);
maskbuf = MEM_mallocN(sizeof(float) * context.rectx * context.recty, __func__);
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index b7251a5e795..23f7dd6ccfb 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -276,21 +276,21 @@ static void smoke_set_domain_from_derivedmesh(SmokeDomainSettings *sds, Object *
/* define grid resolutions from longest domain side */
if (size[0] >= MAX2(size[1], size[2])) {
scale = res / size[0];
- sds->scale = size[0] / fabs(ob->size[0]);
+ sds->scale = size[0] / fabsf(ob->size[0]);
sds->base_res[0] = res;
sds->base_res[1] = (int)(size[1] * scale + 0.5f);
sds->base_res[2] = (int)(size[2] * scale + 0.5f);
}
else if (size[1] >= MAX2(size[0], size[2])) {
scale = res / size[1];
- sds->scale = size[1] / fabs(ob->size[1]);
+ sds->scale = size[1] / fabsf(ob->size[1]);
sds->base_res[0] = (int)(size[0] * scale + 0.5f);
sds->base_res[1] = res;
sds->base_res[2] = (int)(size[2] * scale + 0.5f);
}
else {
scale = res / size[2];
- sds->scale = size[2] / fabs(ob->size[2]);
+ sds->scale = size[2] / fabsf(ob->size[2]);
sds->base_res[0] = (int)(size[0] * scale + 0.5f);
sds->base_res[1] = (int)(size[1] * scale + 0.5f);
sds->base_res[2] = res;
@@ -1338,7 +1338,7 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke
float hr = 1.0f / ((float)hires_multiplier);
/* slightly adjust high res antialias smoothness based on number of divisions
* to allow smaller details but yet not differing too much from the low res size */
- float hr_smooth = smooth * pow(hr, 1.0f/3.0f);
+ const float hr_smooth = smooth * powf(hr, 1.0f / 3.0f);
/* setup loop bounds */
for (i = 0; i < 3; i++) {
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index a69df62f505..4b6ac824fd8 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -95,11 +95,6 @@ typedef struct bUnitDef {
#define B_UNIT_DEF_SUPPRESS 1 /* Use for units that are not used enough to be translated into for common use */
#define B_UNIT_DEF_TENTH 2 /* Display a unit even if its value is 0.1, eg 0.1mm instead of 100um */
-/* workaround encoding issue with "µm", bug [#36090] */
-#define B_UNIT_CHAR_MICRO "\xb5"
-#define UM B_UNIT_CHAR_MICRO"m"
-#define US B_UNIT_CHAR_MICRO"s"
-
/* define a single unit */
typedef struct bUnitCollection {
struct bUnitDef *units;
@@ -121,7 +116,7 @@ static struct bUnitDef buMetricLenDef[] = {
{"decimeter", "decimeters", "dm", NULL, "10 Centimeters", UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
{"centimeter", "centimeters", "cm", NULL, "Centimeters", UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
{"millimeter", "millimeters", "mm", NULL, "Millimeters", UN_SC_MM, 0.0, B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
- {"micrometer", "micrometers", UM, "um", "Micrometers", UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, // micron too?
+ {"micrometer", "micrometers", "µm", "um", "Micrometers", UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
/* These get displayed because of float precision problems in the transform header,
* could work around, but for now probably people wont use these */
@@ -154,7 +149,7 @@ static struct bUnitDef buMetricAreaDef[] = {
{"square decimeter", "square decimetees", "dm²", "dm2", "Square Decimeters", UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
{"square centimeter", "square centimeters", "cm²", "cm2", "Square Centimeters", UN_SC_CM * UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
{"square millimeter", "square millimeters", "mm²", "mm2", "Square Millimeters", UN_SC_MM * UN_SC_MM, 0.0, B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
- {"square micrometer", "square micrometers", UM"²", "um2", "Square Micrometers", UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
+ {"square micrometer", "square micrometers", "µm²", "um2", "Square Micrometers", UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buMetricAreaCollection = {buMetricAreaDef, 3, 0, sizeof(buMetricAreaDef) / sizeof(bUnitDef)};
@@ -180,7 +175,7 @@ static struct bUnitDef buMetricVolDef[] = {
{"cubic decimeter", "cubic decimeters", "dm³", "dm3", "Cubic Decimeters", UN_SC_DM * UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
{"cubic centimeter", "cubic centimeters", "cm³", "cm3", "Cubic Centimeters", UN_SC_CM * UN_SC_CM * UN_SC_CM, 0.0, B_UNIT_DEF_NONE},
{"cubic millimeter", "cubic millimeters", "mm³", "mm3", "Cubic Millimeters", UN_SC_MM * UN_SC_MM * UN_SC_MM, 0.0, B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
- {"cubic micrometer", "cubic micrometers", UM"³", "um3", "Cubic Micrometers", UN_SC_UM * UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
+ {"cubic micrometer", "cubic micrometers", "µm³", "um3", "Cubic Micrometers", UN_SC_UM * UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buMetricVolCollection = {buMetricVolDef, 3, 0, sizeof(buMetricVolDef) / sizeof(bUnitDef)};
@@ -258,7 +253,7 @@ static struct bUnitDef buNaturalTimeDef[] = {
{"minute", "minutes", "min", "m", "Minutes", 60.0, 0.0, B_UNIT_DEF_NONE},
{"second", "seconds", "sec", "s", "Seconds", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"millisecond", "milliseconds", "ms", NULL, "Milliseconds", 0.001, 0.0, B_UNIT_DEF_NONE},
- {"microsecond", "microseconds", US, "us", "Microseconds", 0.000001, 0.0, B_UNIT_DEF_NONE},
+ {"microsecond", "microseconds", "µs", "us", "Microseconds", 0.000001, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buNaturalTimeCollection = {buNaturalTimeDef, 3, 0, sizeof(buNaturalTimeDef) / sizeof(bUnitDef)};
@@ -278,7 +273,7 @@ static struct bUnitDef buCameraLenDef[] = {
{"decimeter", "decimeters", "dm", NULL, "10 Centimeters", UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS},
{"centimeter", "centimeters", "cm", NULL, "Centimeters", UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},
{"millimeter", "millimeters", "mm", NULL, "Millimeters", UN_SC_M, 0.0, B_UNIT_DEF_NONE},
- {"micrometer", "micrometers", UM, "um", "Micrometers", UN_SC_MM, 0.0, B_UNIT_DEF_SUPPRESS}, // micron too?
+ {"micrometer", "micrometers", "µm", "um", "Micrometers", UN_SC_MM, 0.0, B_UNIT_DEF_SUPPRESS},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buCameraLenCollection = {buCameraLenDef, 3, 0, sizeof(buCameraLenDef) / sizeof(bUnitDef)};
@@ -614,9 +609,10 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
int i;
char *ch = str;
- for (i = 0; (i >= len_max || *ch == '\0'); i++, ch++)
+ for (i = 0; (i < len_max || *ch != '\0'); i++, ch++) {
if ((*ch >= 'A') && (*ch <= 'Z'))
*ch += ('a' - 'A');
+ }
}
for (unit = usys->units; unit->name; unit++) {
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index ebd6bc01bea..bcf5e712eff 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -295,17 +295,7 @@ static const char **get_file_extensions(int format)
}
case FFMPEG_OGG:
{
- static const char *rv[] = { ".ogg", ".ogv", NULL };
- return rv;
- }
- case FFMPEG_MP3:
- {
- static const char *rv[] = { ".mp3", NULL };
- return rv;
- }
- case FFMPEG_WAV:
- {
- static const char *rv[] = { ".wav", NULL };
+ static const char *rv[] = { ".ogv", ".ogg", NULL };
return rv;
}
default:
@@ -875,12 +865,6 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
case FFMPEG_FLV:
fmt->video_codec = CODEC_ID_FLV1;
break;
- case FFMPEG_MP3:
- fmt->audio_codec = CODEC_ID_MP3;
- /* fall-through */
- case FFMPEG_WAV:
- fmt->video_codec = CODEC_ID_NONE;
- break;
case FFMPEG_MPEG4:
default:
fmt->video_codec = CODEC_ID_MPEG4;
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index f8b9088fe3d..0fee9264191 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -74,6 +74,8 @@ bool BLI_rctf_isect_pt(const struct rctf *rect, const float x, const float y);
bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2]);
bool BLI_rcti_isect_segment(const struct rcti *rect, const int s1[2], const int s2[2]);
bool BLI_rctf_isect_segment(const struct rctf *rect, const float s1[2], const float s2[2]);
+bool BLI_rcti_isect_circle(const struct rcti *rect, const float xy[2], const float radius);
+bool BLI_rctf_isect_circle(const struct rctf *rect, const float xy[2], const float radius);
bool BLI_rcti_inside_rcti(rcti *rct_a, const rcti *rct_b);
bool BLI_rctf_inside_rctf(rctf *rct_a, const rctf *rct_b);
void BLI_rcti_union(struct rcti *rcti1, const struct rcti *rcti2);
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index c3a3c035ed3..9bf720c03ea 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -240,8 +240,13 @@
#define CLAMPIS(a, b, c) ((a) < (b) ? (b) : (a) > (c) ? (c) : (a))
-#define IS_EQ(a, b) ((fabs((double)(a) - (b)) >= (double) FLT_EPSILON) ? 0 : 1)
-#define IS_EQF(a, b) ((fabsf((float)(a) - (b)) >= (float) FLT_EPSILON) ? 0 : 1)
+#define IS_EQ(a, b) ( \
+ CHECK_TYPE_INLINE(a, double), CHECK_TYPE_INLINE(b, double), \
+ ((fabs((double)(a) - (b)) >= (double) FLT_EPSILON) ? false : true))
+
+#define IS_EQF(a, b) ( \
+ CHECK_TYPE_INLINE(a, float), CHECK_TYPE_INLINE(b, float), \
+ ((fabsf((float)(a) - (b)) >= (float) FLT_EPSILON) ? false : true))
#define IS_EQT(a, b, c) ((a > b) ? (((a - b) <= c) ? 1 : 0) : ((((b - a) <= c) ? 1 : 0)))
#define IN_RANGE(a, b, c) ((b < c) ? ((b < a && a < c) ? 1 : 0) : ((c < a && a < b) ? 1 : 0))
diff --git a/source/blender/blenlib/BLI_voronoi.h b/source/blender/blenlib/BLI_voronoi.h
index 68d7398d89b..9d32061bf97 100644
--- a/source/blender/blenlib/BLI_voronoi.h
+++ b/source/blender/blenlib/BLI_voronoi.h
@@ -52,7 +52,7 @@ typedef struct VoronoiEdge {
float f, g; /* directional coeffitients satisfying equation y = f * x + g (edge lies on this line) */
/* some edges consist of two parts, so we add the pointer to another part to connect them at the end of an algorithm */
- struct VoronoiEdge *neighbour;
+ struct VoronoiEdge *neighbor;
} VoronoiEdge;
typedef struct VoronoiTriangulationPoint {
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index fcca6cd59ba..f3ebddddc8c 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -136,7 +136,7 @@ BLI_INLINE void ghash_resize_buckets(GHash *gh, const unsigned int nbuckets)
}
/**
- * Increase initial bucket size to match a reserved ammount.
+ * Increase initial bucket size to match a reserved amount.
*/
BLI_INLINE void ghash_buckets_reserve(GHash *gh, const unsigned int nentries_reserve)
{
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index b26e007b3e6..50dcd01207d 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -137,7 +137,7 @@ BLI_INLINE void edgehash_resize_buckets(EdgeHash *eh, const unsigned int nbucket
}
/**
- * Increase initial bucket size to match a reserved ammount.
+ * Increase initial bucket size to match a reserved amount.
*/
BLI_INLINE void edgehash_buckets_reserve(EdgeHash *eh, const unsigned int nentries_reserve)
{
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 02525e25dda..d36cd3cb394 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -216,6 +216,32 @@ bool BLI_rctf_isect_segment(const rctf *rect, const float s1[2], const float s2[
}
}
+bool BLI_rcti_isect_circle(const rcti *rect, const float xy[2], const float radius)
+{
+ float dx, dy;
+
+ if (xy[0] >= rect->xmin && xy[0] <= rect->xmax) dx = 0;
+ else dx = (xy[0] < rect->xmin) ? (rect->xmin - xy[0]) : (xy[0] - rect->xmax);
+
+ if (xy[1] >= rect->ymin && xy[1] <= rect->ymax) dy = 0;
+ else dy = (xy[1] < rect->ymin) ? (rect->ymin - xy[1]) : (xy[1] - rect->ymax);
+
+ return dx * dx + dy * dy <= radius * radius;
+}
+
+bool BLI_rctf_isect_circle(const rctf *rect, const float xy[2], const float radius)
+{
+ float dx, dy;
+
+ if (xy[0] >= rect->xmin && xy[0] <= rect->xmax) dx = 0;
+ else dx = (xy[0] < rect->xmin) ? (rect->xmin - xy[0]) : (xy[0] - rect->xmax);
+
+ if (xy[1] >= rect->ymin && xy[1] <= rect->ymax) dy = 0;
+ else dy = (xy[1] < rect->ymin) ? (rect->ymin - xy[1]) : (xy[1] - rect->ymax);
+
+ return dx * dx + dy * dy <= radius * radius;
+}
+
void BLI_rctf_union(rctf *rct1, const rctf *rct2)
{
if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 4361583dafc..0b8f5dfdde5 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -166,7 +166,7 @@ TaskScheduler *BLI_task_scheduler_get(void)
if (task_scheduler == NULL) {
int tot_thread = BLI_system_thread_count();
- /* Do a lazy initialization, so it happes after
+ /* Do a lazy initialization, so it happens after
* command line arguments parsing
*/
task_scheduler = BLI_task_scheduler_create(tot_thread);
diff --git a/source/blender/blenlib/intern/voronoi.c b/source/blender/blenlib/intern/voronoi.c
index 3f6adff1eda..731536ff0df 100644
--- a/source/blender/blenlib/intern/voronoi.c
+++ b/source/blender/blenlib/intern/voronoi.c
@@ -99,7 +99,7 @@ static VoronoiEdge *voronoiEdge_new(float start[2], float left[2], float right[2
copy_v2_v2(edge->left, left);
copy_v2_v2(edge->right, right);
- edge->neighbour = NULL;
+ edge->neighbor = NULL;
edge->end[0] = 0;
edge->end[1] = 0;
@@ -395,7 +395,7 @@ static void voronoi_addParabola(VoronoiProcess *process, float site[2])
el = voronoiEdge_new(start, par->site, site);
er = voronoiEdge_new(start, site, par->site);
- el->neighbour = er;
+ el->neighbor = er;
BLI_addtail(&process->edges, el);
par->edge = er;
@@ -682,9 +682,9 @@ void BLI_voronoi_compute(const VoronoiSite *sites, int sites_total, int width, i
edge = process.edges.first;
while (edge) {
- if (edge->neighbour) {
- copy_v2_v2(edge->start, edge->neighbour->end);
- MEM_freeN(edge->neighbour);
+ if (edge->neighbor) {
+ copy_v2_v2(edge->start, edge->neighbor->end);
+ MEM_freeN(edge->neighbor);
}
edge = edge->next;
diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index f865962bac9..24b8df78258 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -66,4 +66,8 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+if(WITH_CODEC_FFMPEG)
+ add_definitions(-DWITH_FFMPEG)
+endif()
+
blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/blenloader/SConscript b/source/blender/blenloader/SConscript
index 3882cc1029a..bd002e59fa4 100644
--- a/source/blender/blenloader/SConscript
+++ b/source/blender/blenloader/SConscript
@@ -51,6 +51,9 @@ defs = []
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
+if env['WITH_BF_FFMPEG']:
+ defs.append('WITH_FFMPEG')
+
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
env.BlenderLib('bf_blenloader', sources, incs, defs, libtype=['core', 'player'], priority = [167, 30]) #, cc_compileflags=['/WX'])
else:
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c7ab60fc38b..5777d044f66 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -153,6 +153,7 @@
#include "BKE_tracking.h"
#include "BKE_treehash.h"
#include "BKE_sound.h"
+#include "BKE_writeffmpeg.h"
#include "IMB_imbuf.h" // for proxy / timecode versioning stuff
@@ -3815,6 +3816,7 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
psys->clmd->point_cache = psys->pointcache;
psys->clmd->ptcaches.first = psys->clmd->ptcaches.last= NULL;
psys->clmd->coll_parms->group = newlibadr(fd, id->lib, psys->clmd->coll_parms->group);
+ psys->clmd->modifier.error = NULL;
}
}
else {
@@ -7300,7 +7302,8 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
bfd->main->subversionfile = fg->subversion;
bfd->main->minversionfile = fg->minversion;
bfd->main->minsubversionfile = fg->minsubversion;
- bfd->main->revision = fg->revision;
+ BLI_strncpy(bfd->main->build_change, fg->build_change, sizeof(bfd->main->build_change));
+ BLI_strncpy(bfd->main->build_hash, fg->build_hash, sizeof(bfd->main->build_hash));
bfd->winpos = fg->winpos;
bfd->fileflags = fg->fileflags;
@@ -7934,8 +7937,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
- if (G.debug & G_DEBUG)
- printf("read file %s\n Version %d sub %d svn r%d\n", fd->relabase, main->versionfile, main->subversionfile, main->revision);
+ if (G.debug & G_DEBUG) {
+ printf("read file %s\n Version %d sub %d change %s hash %s\n",
+ fd->relabase, main->versionfile, main->subversionfile,
+ main->build_change, main->build_hash);
+ }
blo_do_versions_pre250(fd, lib, main);
blo_do_versions_250(fd, lib, main);
@@ -9705,7 +9711,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
-
+
if (!MAIN_VERSION_ATLEAST(main, 269, 1)) {
/* Removal of Cycles SSS Compatible falloff */
FOREACH_NODETREE(main, ntree, id) {
@@ -9722,10 +9728,38 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
} FOREACH_NODETREE_END
}
+ if (!MAIN_VERSION_ATLEAST(main, 269, 2)) {
+ /* Initialize CDL settings for Color Balance nodes */
+ FOREACH_NODETREE(main, ntree, id) {
+ if (ntree->type == NTREE_COMPOSIT) {
+ bNode *node;
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == CMP_NODE_COLORBALANCE) {
+ NodeColorBalance *n = node->storage;
+ if (node->custom1 == 0) {
+ /* LGG mode stays the same, just init CDL settings */
+ ntreeCompositColorBalanceSyncFromLGG(ntree, node);
+ }
+ else if (node->custom1 == 1) {
+ /* CDL previously used same variables as LGG, copy them over
+ * and then sync LGG for comparable results in both modes.
+ */
+ copy_v3_v3(n->offset, n->lift);
+ copy_v3_v3(n->power, n->gamma);
+ copy_v3_v3(n->slope, n->gain);
+ ntreeCompositColorBalanceSyncFromCDL(ntree, node);
+ }
+ }
+ }
+ }
+ } FOREACH_NODETREE_END
+ }
+
{
bScreen *sc;
ScrArea *sa;
SpaceLink *sl;
+ Scene *scene;
/* Update files using invalid (outdated) outlinevis Outliner values. */
for (sc = main->screen.first; sc; sc = sc->id.next) {
@@ -9765,6 +9799,47 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
+
+ if (!DNA_struct_elem_find(fd->filesdna, "TriangulateModifierData", "int", "quad_method")) {
+ Object *ob;
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ ModifierData *md;
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_Triangulate) {
+ TriangulateModifierData *tmd = (TriangulateModifierData *)md;
+ if ((tmd->flag & MOD_TRIANGULATE_BEAUTY)) {
+ tmd->quad_method = MOD_TRIANGULATE_QUAD_BEAUTY;
+ tmd->ngon_method = MOD_TRIANGULATE_NGON_BEAUTY;
+ }
+ else {
+ tmd->quad_method = MOD_TRIANGULATE_QUAD_FIXED;
+ tmd->ngon_method = MOD_TRIANGULATE_NGON_SCANFILL;
+ }
+ }
+ }
+ }
+ }
+
+ for (scene = main->scene.first; scene; scene = scene->id.next) {
+ if (scene->gm.matmode == GAME_MAT_TEXFACE) {
+ scene->gm.matmode = GAME_MAT_MULTITEX;
+ }
+ }
+
+ /* 'Increment' mode disabled for nodes, use true grid snapping instead */
+ for (scene = main->scene.first; scene; scene = scene->id.next) {
+ if (scene->toolsettings->snap_node_mode == SCE_SNAP_MODE_INCREMENT)
+ scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
+ }
+
+ /* Update for removed "sound-only" option in FFMPEG export settings. */
+#ifdef WITH_FFMPEG
+ for (scene = main->scene.first; scene; scene = scene->id.next) {
+ if (scene->r.ffcodecdata.type >= FFMPEG_INVALID) {
+ scene->r.ffcodecdata.type = FFMPEG_AVI;
+ }
+ }
+#endif
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index 80e34f0fce4..62e3955ca60 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -2323,7 +2323,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
KeyBlock *kb;
for (kb = key->block.first; kb; kb = kb->next) {
- if (IS_EQF(kb->slidermin, kb->slidermax) && IS_EQ(kb->slidermax, 0))
+ if (IS_EQF(kb->slidermin, kb->slidermax) && IS_EQF(kb->slidermax, 0.0f))
kb->slidermax = kb->slidermin + 1.0f;
}
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 0a9a8d252a7..dd2badf6622 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -3266,7 +3266,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
char subvstr[8];
/* prevent mem checkers from complaining */
- fg.pads= fg.pad= 0;
+ fg.pads= 0;
memset(fg.filename, 0, sizeof(fg.filename));
current_screen_compat(mainvar, &screen);
@@ -3290,11 +3290,14 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
fg.minsubversion= BLENDER_MINSUBVERSION;
#ifdef WITH_BUILDINFO
{
- extern char build_rev[];
- fg.revision= atoi(build_rev);
+ extern char build_change[], build_hash[];
+ /* TODO(sergey): Add branch name to file as well? */
+ BLI_strncpy(fg.build_change, build_change, sizeof(fg.build_change));
+ BLI_strncpy(fg.build_hash, build_hash, sizeof(fg.build_hash));
}
#else
- fg.revision= 0;
+ BLI_strncpy(fg.build_change, "unknown", sizeof(fg.build_change));
+ BLI_strncpy(fg.build_hash, "unknown", sizeof(fg.build_hash));
#endif
writestruct(wd, GLOB, "FileGlobal", 1, &fg);
}
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index 775cb24b8c9..ef43d73d485 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1028,7 +1028,8 @@ static BMOpDefine bmo_triangulate_def = {
"triangulate",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}},
- {"use_beauty", BMO_OP_SLOT_BOOL},
+ {"quad_method", BMO_OP_SLOT_INT},
+ {"ngon_method", BMO_OP_SLOT_INT},
{{'\0'}},
},
/* slots_out */
@@ -1556,6 +1557,7 @@ static BMOpDefine bmo_bevel_def = {
/* slots_in */
{{"geom", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input edges and vertices */
{"offset", BMO_OP_SLOT_FLT}, /* amount to offset beveled edge */
+ {"offset_type", BMO_OP_SLOT_INT}, /* how to measure offset (enum) */
{"segments", BMO_OP_SLOT_INT}, /* number of segments in bevel */
{"vertex_only", BMO_OP_SLOT_BOOL}, /* only bevel vertices, not edges */
{{'\0'}},
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index 56d63694d88..b3d97947cab 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -117,6 +117,14 @@ enum {
BMOP_POKE_BOUNDS
};
+/* Bevel offset_type slot values */
+enum {
+ BEVEL_AMT_OFFSET,
+ BEVEL_AMT_WIDTH,
+ BEVEL_AMT_DEPTH,
+ BEVEL_AMT_PERCENT
+};
+
extern const BMOpDefine *bmo_opdefines[];
extern const int bmo_opdefines_total;
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 12ec3da9b69..e88fdb8a7e8 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -29,6 +29,7 @@
*/
#include "DNA_listBase.h"
+#include "DNA_modifier_types.h"
#include "BLI_alloca.h"
#include "BLI_math.h"
@@ -817,7 +818,9 @@ bool BM_face_point_inside_test(BMFace *f, const float co[3])
void BM_face_triangulate(BMesh *bm, BMFace *f,
BMFace **r_faces_new,
MemArena *sf_arena,
- const bool use_beauty, const bool use_tag)
+ const int quad_method,
+ const int ngon_method,
+ const bool use_tag)
{
BMLoop *l_iter, *l_first, *l_new;
BMFace *f_new;
@@ -825,6 +828,7 @@ void BM_face_triangulate(BMesh *bm, BMFace *f,
int nf_i = 0;
BMEdge **edge_array;
int edge_array_len;
+ bool use_beauty = (ngon_method == MOD_TRIANGULATE_NGON_BEAUTY);
#define SF_EDGE_IS_BOUNDARY 0xff
@@ -832,9 +836,67 @@ void BM_face_triangulate(BMesh *bm, BMFace *f,
if (f->len == 4) {
+ BMVert *v1, *v2;
l_first = BM_FACE_FIRST_LOOP(f);
- f_new = BM_face_split(bm, f, l_first->v, l_first->next->next->v, &l_new, NULL, false);
+ switch (quad_method) {
+ case MOD_TRIANGULATE_QUAD_FIXED:
+ {
+ v1 = l_first->v;
+ v2 = l_first->next->next->v;
+ break;
+ }
+ case MOD_TRIANGULATE_QUAD_ALTERNATE:
+ {
+ v1 = l_first->next->v;
+ v2 = l_first->prev->v;
+ break;
+ }
+ case MOD_TRIANGULATE_QUAD_SHORTEDGE:
+ {
+ BMVert *v3, *v4;
+ float d1, d2;
+
+ v1 = l_first->v;
+ v2 = l_first->next->next->v;
+ v3 = l_first->next->v;
+ v4 = l_first->prev->v;
+
+ d1 = len_squared_v3v3(v1->co, v2->co);
+ d2 = len_squared_v3v3(v3->co, v4->co);
+
+ if (d2 < d1) {
+ v1 = v3;
+ v2 = v4;
+ }
+ break;
+ }
+ case MOD_TRIANGULATE_QUAD_BEAUTY:
+ default:
+ {
+ BMVert *v3, *v4;
+ float cost;
+
+ v1 = l_first->next->v;
+ v2 = l_first->next->next->v;
+ v3 = l_first->prev->v;
+ v4 = l_first->v;
+
+ cost = BM_verts_calc_rotate_beauty(v1, v2, v3, v4, 0, 0);
+
+ if (cost < 0.0f) {
+ v1 = v4;
+ //v2 = v2;
+ }
+ else {
+ //v1 = v1;
+ v2 = v3;
+ }
+ break;
+ }
+ }
+
+ f_new = BM_face_split(bm, f, v1, v2, &l_new, NULL, false);
copy_v3_v3(f_new->no, f->no);
if (use_tag) {
diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h
index b7117621273..4759c73cb4d 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.h
+++ b/source/blender/bmesh/intern/bmesh_polygon.h
@@ -54,7 +54,8 @@ bool BM_face_point_inside_test(BMFace *f, const float co[3]) ATTR_WARN_UNUSED_R
void BM_face_triangulate(BMesh *bm, BMFace *f, BMFace **newfaces,
struct MemArena *sf_arena,
- const bool use_beauty, const bool use_tag) ATTR_NONNULL(1, 2);
+ const int quad_method, const int ngon_method,
+ const bool use_tag) ATTR_NONNULL(1, 2);
void BM_face_legal_splits(BMFace *f, BMLoop *(*loops)[2], int len) ATTR_NONNULL();
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index eef470e0d85..4eec15d4d7e 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -35,9 +35,10 @@
void bmo_bevel_exec(BMesh *bm, BMOperator *op)
{
- const float offset = BMO_slot_float_get(op->slots_in, "offset");
- const int seg = BMO_slot_int_get(op->slots_in, "segments");
- const bool vonly = BMO_slot_bool_get(op->slots_in, "vertex_only");
+ const float offset = BMO_slot_float_get(op->slots_in, "offset");
+ const int offset_type = BMO_slot_int_get(op->slots_in, "offset_type");
+ const int seg = BMO_slot_int_get(op->slots_in, "segments");
+ const bool vonly = BMO_slot_bool_get(op->slots_in, "vertex_only");
if (offset > 0) {
BMOIter siter;
@@ -58,7 +59,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
}
}
- BM_mesh_bevel(bm, offset, seg, vonly, false, false, NULL, -1);
+ BM_mesh_bevel(bm, offset, offset_type, seg, vonly, false, false, NULL, -1);
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
}
diff --git a/source/blender/bmesh/operators/bmo_fill_grid.c b/source/blender/bmesh/operators/bmo_fill_grid.c
index 4e302a8ff63..50d25202f7e 100644
--- a/source/blender/bmesh/operators/bmo_fill_grid.c
+++ b/source/blender/bmesh/operators/bmo_fill_grid.c
@@ -633,7 +633,12 @@ void bmo_grid_fill_exec(BMesh *bm, BMOperator *op)
goto cleanup;
}
- BM_mesh_edgeloops_find_path(bm, &eloops_rail, bm_edge_test_rail_cb, (void *)bm, v_a_first, v_b_last);
+ /* We may find a first path, but not a second one! See geometry attached to bug [#37388]. */
+ if (BM_mesh_edgeloops_find_path(bm, &eloops_rail, bm_edge_test_rail_cb, bm, v_a_first, v_b_last) == false) {
+ BMO_error_raise(bm, op, BMERR_INVALID_SELECTION,
+ "Loops are not connected by wire/boundary edges");
+ goto cleanup;
+ }
/* Check flipping by comparing path length */
estore_rail_a = eloops_rail.first;
@@ -656,7 +661,7 @@ void bmo_grid_fill_exec(BMesh *bm, BMOperator *op)
BM_edgeloop_free(estore_rail_a);
estore_rail_a = estore_rail_b;
- /* reverse so these so both are sorted the same way */
+ /* reverse so both are sorted the same way */
BM_edgeloop_flip(bm, estore_b);
SWAP(BMVert *, v_b_first, v_b_last);
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index ca45289520b..a1de265bc56 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -42,13 +42,15 @@
void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
{
- const bool use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty");
+ const int quad_method = BMO_slot_int_get(op->slots_in, "quad_method");
+ const int ngon_method = BMO_slot_int_get(op->slots_in, "ngon_method");
+
BMOpSlot *slot_facemap_out = BMO_slot_get(op->slots_out, "face_map.out");
BM_mesh_elem_hflag_disable_all(bm, BM_FACE | BM_EDGE, BM_ELEM_TAG, false);
BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false);
- BM_mesh_triangulate(bm, use_beauty, true, op, slot_facemap_out);
+ BM_mesh_triangulate(bm, quad_method, ngon_method, true, op, slot_facemap_out);
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_TAG);
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
diff --git a/source/blender/bmesh/operators/bmo_wireframe.c b/source/blender/bmesh/operators/bmo_wireframe.c
index 2e5db5210c4..7f1008813ad 100644
--- a/source/blender/bmesh/operators/bmo_wireframe.c
+++ b/source/blender/bmesh/operators/bmo_wireframe.c
@@ -172,9 +172,9 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
BMIter itersub;
/* filled only with boundary verts */
- BMVert **verts_src = MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__);
- BMVert **verts_neg = MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__);
- BMVert **verts_pos = MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__);
+ BMVert **verts_src = MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__);
+ BMVert **verts_neg = MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__);
+ BMVert **verts_pos = MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__);
/* will over-alloc, but makes for easy lookups by index to keep aligned */
BMVert **verts_boundary = use_boundary ?
diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c
index af9345b903c..1a1201c015e 100644
--- a/source/blender/bmesh/tools/bmesh_beautify.c
+++ b/source/blender/bmesh/tools/bmesh_beautify.c
@@ -252,19 +252,13 @@ static float bm_edge_calc_rotate_beauty__angle(
return FLT_MAX;
}
-static float bm_edge_calc_rotate_beauty(const BMEdge *e, const short flag, const short method)
+float BM_verts_calc_rotate_beauty(
+const BMVert *v1, const BMVert *v2, const BMVert *v3, const BMVert *v4, const short flag, const short method)
{
/* not a loop (only to be able to break out) */
do {
- const float *v1, *v2, *v3, *v4;
-
- v1 = e->l->prev->v->co; /* first face co */
- v2 = e->l->v->co; /* e->v1 or e->v2*/
- v3 = e->l->radial_next->prev->v->co; /* second face co */
- v4 = e->l->next->v->co; /* e->v1 or e->v2*/
-
if (flag & VERT_RESTRICT_TAG) {
- BMVert *v_a = e->l->prev->v, *v_b = e->l->radial_next->prev->v;
+ const BMVert *v_a = v1, *v_b = v3;
if (BM_elem_flag_test(v_a, BM_ELEM_TAG) == BM_elem_flag_test(v_b, BM_ELEM_TAG)) {
break;
}
@@ -277,15 +271,26 @@ static float bm_edge_calc_rotate_beauty(const BMEdge *e, const short flag, const
switch (method) {
case 0:
- return bm_edge_calc_rotate_beauty__area(v1, v2, v3, v4);
+ return bm_edge_calc_rotate_beauty__area(v1->co, v2->co, v3->co, v4->co);
default:
- return bm_edge_calc_rotate_beauty__angle(v1, v2, v3, v4);
+ return bm_edge_calc_rotate_beauty__angle(v1->co, v2->co, v3->co, v4->co);
}
} while (false);
return FLT_MAX;
}
+static float bm_edge_calc_rotate_beauty(const BMEdge *e, const short flag, const short method)
+{
+ const BMVert *v1, *v2, *v3, *v4;
+ v1 = e->l->prev->v; /* first vert co */
+ v2 = e->l->v; /* e->v1 or e->v2*/
+ v3 = e->l->radial_next->prev->v; /* second vert co */
+ v4 = e->l->next->v; /* e->v1 or e->v2*/
+
+ return BM_verts_calc_rotate_beauty(v1, v2, v3, v4, flag, method);
+}
+
/* -------------------------------------------------------------------- */
/* Update the edge cost of rotation in the heap */
diff --git a/source/blender/bmesh/tools/bmesh_beautify.h b/source/blender/bmesh/tools/bmesh_beautify.h
index 210e265d706..7cc17008b50 100644
--- a/source/blender/bmesh/tools/bmesh_beautify.h
+++ b/source/blender/bmesh/tools/bmesh_beautify.h
@@ -35,4 +35,8 @@ void BM_mesh_beautify_fill(BMesh *bm, BMEdge **edge_array, const int edge_array_
const short flag, const short method,
const short oflag_edge, const short oflag_face);
+float BM_verts_calc_rotate_beauty(const BMVert *v1, const BMVert *v2,
+ const BMVert *v3, const BMVert *v4,
+ const short flag, const short method);
+
#endif /* __BMESH_BEAUTIFY_H__ */
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index bb3fe129e0b..7293e400951 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -73,7 +73,8 @@ typedef struct EdgeHalf {
struct BoundVert *leftv; /* left boundary vert (looking along edge to end) */
struct BoundVert *rightv; /* right boundary vert, if beveled */
int seg; /* how many segments for the bevel */
- float offset; /* offset for this edge */
+ float offset_l; /* offset for this edge, on left side */
+ float offset_r; /* offset for this edge, on right side */
bool is_bev; /* is this edge beveled? */
bool is_rev; /* is e->v2 the vertex at this end? */
bool is_seam; /* is e a seam for custom loopdata (e.g., UVs)? */
@@ -128,6 +129,7 @@ typedef struct BevelParams {
MemArena *mem_arena; /* use for all allocs while bevel runs, if we need to free we can switch to mempool */
float offset; /* blender units to offset each side of a beveled edge */
+ int offset_type; /* how offset is measured; enum defined in bmesh_operators.h */
int seg; /* number of segments in beveled edge profile */
bool vertex_only; /* bevel vertices only */
bool use_weights; /* bevel amount affected by weights on edges or verts */
@@ -469,7 +471,7 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f,
if (ang < 100.0f * BEVEL_EPSILON) {
/* special case: e1 and e2 are parallel; put offset point perp to both, from v.
* need to find a suitable plane.
- * if offsets are different, we're out of luck: just use e1->offset */
+ * if offsets are different, we're out of luck: just use e1->offset_r */
if (f)
copy_v3_v3(norm_v, f->no);
else
@@ -477,14 +479,14 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f,
cross_v3_v3v3(norm_perp1, dir1, norm_v);
normalize_v3(norm_perp1);
copy_v3_v3(off1a, v->co);
- madd_v3_v3fl(off1a, norm_perp1, e1->offset);
+ madd_v3_v3fl(off1a, norm_perp1, e1->offset_r);
copy_v3_v3(meetco, off1a);
}
else if (fabsf(ang - (float)M_PI) < 100.0f * BEVEL_EPSILON) {
/* special case e1 and e2 are antiparallel, so bevel is into
* a zero-area face. Just make the offset point on the
* common line, at offset distance from v. */
- slide_dist(e2, v, e2->offset, meetco);
+ slide_dist(e2, v, e2->offset_l, meetco);
}
else {
/* get normal to plane where meet point should be */
@@ -504,10 +506,10 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f,
/* get points that are offset distances from each line, then another point on each line */
copy_v3_v3(off1a, v->co);
- madd_v3_v3fl(off1a, norm_perp1, e1->offset);
+ madd_v3_v3fl(off1a, norm_perp1, e1->offset_r);
add_v3_v3v3(off1b, off1a, dir1);
copy_v3_v3(off2a, v->co);
- madd_v3_v3fl(off2a, norm_perp2, e2->offset);
+ madd_v3_v3fl(off2a, norm_perp2, e2->offset_l);
add_v3_v3v3(off2b, off2a, dir2);
/* intersect the lines; by construction they should be on the same plane and not parallel */
@@ -552,10 +554,10 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid,
/* get points that are offset distances from each line, then another point on each line */
copy_v3_v3(off1a, v->co);
- madd_v3_v3fl(off1a, norm_perp1, e1->offset);
+ madd_v3_v3fl(off1a, norm_perp1, e1->offset_r);
sub_v3_v3v3(off1b, off1a, dir1);
copy_v3_v3(off2a, v->co);
- madd_v3_v3fl(off2a, norm_perp2, e2->offset);
+ madd_v3_v3fl(off2a, norm_perp2, e2->offset_l);
add_v3_v3v3(off2b, off2a, dir2);
ang = angle_v3v3(dir1, dir2);
@@ -564,7 +566,7 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid,
copy_v3_v3(meetco, off1a);
}
else if (fabsf(ang - (float)M_PI) < 100.0f * BEVEL_EPSILON) {
- slide_dist(e2, v, e2->offset, meetco);
+ slide_dist(e2, v, e2->offset_l, meetco);
}
else {
iret = isect_line_line_v3(off1a, off1b, off2a, off2b, meetco, isect2);
@@ -612,7 +614,7 @@ static void offset_in_plane(EdgeHalf *e, const float plane_no[3], int left, floa
cross_v3_v3v3(fdir, no, dir);
normalize_v3(fdir);
copy_v3_v3(r, v->co);
- madd_v3_v3fl(r, fdir, e->offset);
+ madd_v3_v3fl(r, fdir, left? e->offset_l : e->offset_r);
}
/* Calculate the point on e where line (co_a, co_b) comes closest to and return it in projco */
@@ -818,7 +820,7 @@ static void build_boundary(BevelParams *bp, BevVert *bv)
v->efirst = v->elast = e;
e->rightv = v;
/* make artifical extra point along unbeveled edge, and form triangle */
- slide_dist(e->next, bv->v, e->offset, co);
+ slide_dist(e->next, bv->v, e->offset_l, co);
v = add_new_bound_vert(mem_arena, vm, co);
v->efirst = v->elast = e->next;
e->next->leftv = e->next->rightv = v;
@@ -828,7 +830,7 @@ static void build_boundary(BevelParams *bp, BevVert *bv)
return;
}
- lastd = bp->vertex_only ? bv->offset : e->offset;
+ lastd = bp->vertex_only ? bv->offset : e->offset_l;
vm->boundstart = NULL;
do {
if (e->is_bev) {
@@ -1921,6 +1923,18 @@ static void build_vmesh(BevelParams *bp, BMesh *bm, BevVert *bv)
}
}
+/* Return the angle between the two faces adjacent to e.
+ * If there are not two, return 0. */
+static float edge_face_angle(EdgeHalf *e) {
+ if (e->fprev && e->fnext) {
+ /* angle between faces is supplement of angle between face normals */
+ return (float)M_PI - angle_normalized_v3v3(e->fprev->no, e->fnext->no);
+ }
+ else {
+ return 0.0f;
+ }
+}
+
/* take care, this flag isn't cleared before use, it just so happens that its not set */
#define BM_BEVEL_EDGE_TAG_ENABLE(bme) BM_ELEM_API_FLAG_ENABLE( (bme), _FLAG_OVERLAP)
#define BM_BEVEL_EDGE_TAG_DISABLE(bme) BM_ELEM_API_FLAG_DISABLE( (bme), _FLAG_OVERLAP)
@@ -1937,7 +1951,7 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
BMFace *f;
BMIter iter, iter2;
EdgeHalf *e;
- float weight;
+ float weight, z;
int i, found_shared_face, ccw_test_sum;
int nsel = 0;
int ntot = 0;
@@ -2053,16 +2067,6 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
e->seg = 0;
}
e->is_rev = (bme->v2 == v);
- if (e->is_bev) {
- e->offset = bp->offset;
- if (bp->use_weights) {
- weight = BM_elem_float_data_get(&bm->edata, bme, CD_BWEIGHT);
- e->offset *= weight;
- }
- }
- else {
- e->offset = 0.0f;
- }
}
/* find wrap-around shared face */
BM_ITER_ELEM (f, &iter2, bme, BM_FACES_OF_EDGE) {
@@ -2098,6 +2102,50 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
for (i = 0, e = bv->edges; i < ntot; i++, e++) {
e->next = &bv->edges[(i + 1) % ntot];
e->prev = &bv->edges[(i + ntot - 1) % ntot];
+
+ /* set offsets */
+ if (e->is_bev) {
+ /* Convert distance as specified by user into offsets along
+ * faces on left side and right side of this edgehalf.
+ * Except for percent method, offset will be same on each side. */
+ switch (bp->offset_type) {
+ case BEVEL_AMT_OFFSET:
+ e->offset_l = bp->offset;
+ break;
+ case BEVEL_AMT_WIDTH:
+ z = fabs(2.0f * sinf(edge_face_angle(e) / 2.0f));
+ if (z < BEVEL_EPSILON)
+ e->offset_l = 0.01f * bp->offset; /* undefined behavior, so tiny bevel */
+ else
+ e->offset_l = bp->offset / z;
+ break;
+ case BEVEL_AMT_DEPTH:
+ z = fabs(cosf(edge_face_angle(e) / 2.0f));
+ if (z < BEVEL_EPSILON)
+ e->offset_l = 0.01f * bp->offset; /* undefined behavior, so tiny bevel */
+ else
+ e->offset_l = bp->offset / z;
+ break;
+ case BEVEL_AMT_PERCENT:
+ e->offset_l = BM_edge_calc_length(e->prev->e) * bp->offset / 100.0f;
+ e->offset_r = BM_edge_calc_length(e->next->e) * bp->offset / 100.0f;
+ break;
+ default:
+ BLI_assert(!"bad bevel offset kind");
+ e->offset_l = bp->offset;
+ }
+ if (bp->offset_type != BEVEL_AMT_PERCENT)
+ e->offset_r = e->offset_l;
+ if (bp->use_weights) {
+ weight = BM_elem_float_data_get(&bm->edata, bme, CD_BWEIGHT);
+ e->offset_l *= weight;
+ e->offset_r *= weight;
+ }
+ }
+ else {
+ e->offset_l = e->offset_r = 0.0f;
+ }
+
BM_BEVEL_EDGE_TAG_DISABLE(e->e);
if (e->fprev && e->fnext)
e->is_seam = !contig_ldata_across_edge(bm, e->e, e->fprev, e->fnext);
@@ -2370,7 +2418,7 @@ static float bevel_limit_offset(BMesh *bm, BevelParams *bp)
*
* \warning all tagged edges _must_ be manifold.
*/
-void BM_mesh_bevel(BMesh *bm, const float offset, const float segments,
+void BM_mesh_bevel(BMesh *bm, const float offset, const int offset_type, const float segments,
const bool vertex_only, const bool use_weights, const bool limit_offset,
const struct MDeformVert *dvert, const int vertex_group)
{
@@ -2380,6 +2428,7 @@ void BM_mesh_bevel(BMesh *bm, const float offset, const float segments,
BevelParams bp = {NULL};
bp.offset = offset;
+ bp.offset_type = offset_type;
bp.seg = segments;
bp.vertex_only = vertex_only;
bp.use_weights = use_weights;
diff --git a/source/blender/bmesh/tools/bmesh_bevel.h b/source/blender/bmesh/tools/bmesh_bevel.h
index bee26357aca..9897b6b070c 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.h
+++ b/source/blender/bmesh/tools/bmesh_bevel.h
@@ -29,7 +29,7 @@
struct MDeformVert;
-void BM_mesh_bevel(BMesh *bm, const float offset, const float segments,
+void BM_mesh_bevel(BMesh *bm, const float offset, const int offset_type, const float segments,
const bool vertex_only, const bool use_weights, const bool limit_offset,
const struct MDeformVert *dvert, const int vertex_group);
diff --git a/source/blender/bmesh/tools/bmesh_triangulate.c b/source/blender/bmesh/tools/bmesh_triangulate.c
index 34ff493a026..59c2aa4331d 100644
--- a/source/blender/bmesh/tools/bmesh_triangulate.c
+++ b/source/blender/bmesh/tools/bmesh_triangulate.c
@@ -42,14 +42,16 @@
/**
* a version of #BM_face_triangulate that maps to #BMOpSlot
*/
-static void bm_face_triangulate_mapping(BMesh *bm, BMFace *face, MemArena *sf_arena, const bool use_beauty, const bool use_tag,
+static void bm_face_triangulate_mapping(BMesh *bm, BMFace *face, MemArena *sf_arena,
+ const int quad_method, const int ngon_method,
+ const bool use_tag,
BMOperator *op, BMOpSlot *slot_facemap_out)
{
const int faces_array_tot = face->len - 3;
BMFace **faces_array = BLI_array_alloca(faces_array, faces_array_tot);
BLI_assert(face->len > 3);
- BM_face_triangulate(bm, face, faces_array, sf_arena, use_beauty, use_tag);
+ BM_face_triangulate(bm, face, faces_array, sf_arena, quad_method, ngon_method, use_tag);
if (faces_array) {
int i;
@@ -61,7 +63,7 @@ static void bm_face_triangulate_mapping(BMesh *bm, BMFace *face, MemArena *sf_ar
}
-void BM_mesh_triangulate(BMesh *bm, const bool use_beauty, const bool tag_only,
+void BM_mesh_triangulate(BMesh *bm, const int quad_method, const int ngon_method, const bool tag_only,
BMOperator *op, BMOpSlot *slot_facemap_out)
{
BMIter iter;
@@ -75,7 +77,7 @@ void BM_mesh_triangulate(BMesh *bm, const bool use_beauty, const bool tag_only,
BM_ITER_MESH (face, &iter, bm, BM_FACES_OF_MESH) {
if (face->len > 3) {
if (tag_only == false || BM_elem_flag_test(face, BM_ELEM_TAG)) {
- bm_face_triangulate_mapping(bm, face, sf_arena, use_beauty, tag_only,
+ bm_face_triangulate_mapping(bm, face, sf_arena, quad_method, ngon_method, tag_only,
op, slot_facemap_out);
}
}
@@ -85,7 +87,7 @@ void BM_mesh_triangulate(BMesh *bm, const bool use_beauty, const bool tag_only,
BM_ITER_MESH (face, &iter, bm, BM_FACES_OF_MESH) {
if (face->len > 3) {
if (tag_only == false || BM_elem_flag_test(face, BM_ELEM_TAG)) {
- BM_face_triangulate(bm, face, NULL, sf_arena, use_beauty, tag_only);
+ BM_face_triangulate(bm, face, NULL, sf_arena, quad_method, ngon_method, tag_only);
}
}
}
diff --git a/source/blender/bmesh/tools/bmesh_triangulate.h b/source/blender/bmesh/tools/bmesh_triangulate.h
index 141aa2f82b4..550109ffef9 100644
--- a/source/blender/bmesh/tools/bmesh_triangulate.h
+++ b/source/blender/bmesh/tools/bmesh_triangulate.h
@@ -30,7 +30,7 @@
#ifndef __BMESH_TRIANGULATE_H__
#define __BMESH_TRIANGULATE_H__
-void BM_mesh_triangulate(BMesh *bm, const bool use_beauty, const bool tag_only,
+void BM_mesh_triangulate(BMesh *bm, const int quad_method, const int ngon_method, const bool tag_only,
BMOperator *op, BMOpSlot *slot_facemap_out);
#endif /* __BMESH_TRIANGULATE_H__ */
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index ea5fd203bea..60224151308 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -53,10 +53,6 @@ extern "C"
#include "BIK_api.h"
#include "BKE_global.h"
#include "ED_object.h"
-
-#ifdef NAN_BUILDINFO
-extern char build_rev[];
-#endif
}
#include "MEM_guardedalloc.h"
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 5d47ce155c8..74db2082a00 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -701,7 +701,7 @@ void ArmatureImporter::make_shape_keys()
//insert other shape keys
for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
- //better to have a seperate map of morph objects,
+ //better to have a separate map of morph objects,
//This'll do for now since only mesh morphing is imported
Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]);
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index c03316e1fe5..9aa0f6e2831 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -101,7 +101,8 @@ extern "C"
#include "ED_keyframing.h"
#ifdef WITH_BUILDINFO
-extern char build_rev[];
+extern char build_change[];
+extern char build_hash[];
#endif
#include "MEM_guardedalloc.h"
@@ -226,7 +227,14 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
}
char version_buf[128];
#ifdef WITH_BUILDINFO
- sprintf(version_buf, "Blender %d.%02d.%d r%s", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION, build_rev);
+ /* TODO(sergey): As soon as we fully switched to GIT, no need to check build_hash. */
+ if (build_hash[0] != '\0') {
+ sprintf(version_buf, "Blender %d.%02d.%d change:%s, hash:", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION,
+ build_change, build_hash);
+ }
+ else {
+ sprintf(version_buf, "Blender %d.%02d.%d r%s", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION, build_change);
+ }
#else
sprintf(version_buf, "Blender %d.%02d.%d", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION);
#endif
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 146aff5ca5b..2e805ce18f1 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -354,12 +354,14 @@ void bc_match_scale(std::vector<Object *> *objects_done,
void bc_triangulate_mesh(Mesh *me)
{
- bool use_beauty = false;
- bool tag_only = false;
+ bool use_beauty = false;
+ bool tag_only = false;
+ int quad_method = MOD_TRIANGULATE_QUAD_SHORTEDGE; /* XXX: The triangulation method selection could be offered in the UI */
BMesh *bm = BM_mesh_create(&bm_mesh_allocsize_default);
BM_mesh_bm_from_me(bm, me, true, false, 0);
- BM_mesh_triangulate(bm, use_beauty, tag_only, NULL, NULL);
+ BM_mesh_triangulate(bm, quad_method, use_beauty, tag_only, NULL, NULL);
+
BM_mesh_bm_to_me(bm, me, FALSE);
BM_mesh_free(bm);
}
diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
index 5578fdae54e..2b396fb9861 100644
--- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
@@ -43,25 +43,23 @@ void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorCon
NodeOperation *operation;
if (node->custom1 == 0) {
ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation();
- {
- int c;
-
- for (c = 0; c < 3; c++) {
- n->lift_lgg[c] = 2.0f - n->lift[c];
- n->gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f;
- }
+
+ float lift_lgg[3], gamma_inv[3];
+ for (int c = 0; c < 3; c++) {
+ lift_lgg[c] = 2.0f - n->lift[c];
+ gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f;
}
-
+
operationLGG->setGain(n->gain);
- operationLGG->setLift(n->lift_lgg);
- operationLGG->setGammaInv(n->gamma_inv);
+ operationLGG->setLift(lift_lgg);
+ operationLGG->setGammaInv(gamma_inv);
operation = operationLGG;
}
else {
ColorBalanceASCCDLOperation *operationCDL = new ColorBalanceASCCDLOperation();
- operationCDL->setGain(n->gain);
- operationCDL->setLift(n->lift);
- operationCDL->setGamma(n->gamma);
+ operationCDL->setOffset(n->offset);
+ operationCDL->setPower(n->power);
+ operationCDL->setSlope(n->slope);
operation = operationCDL;
}
diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.cpp b/source/blender/compositor/nodes/COM_DespeckleNode.cpp
index a97714c870e..9894dc7b9ac 100644
--- a/source/blender/compositor/nodes/COM_DespeckleNode.cpp
+++ b/source/blender/compositor/nodes/COM_DespeckleNode.cpp
@@ -39,7 +39,7 @@ void DespeckleNode::convertToOperations(ExecutionSystem *graph, CompositorContex
operation->setbNode(editorNode);
operation->setThreshold(editorNode->custom3);
- operation->setThresholdNeighbour(editorNode->custom4);
+ operation->setThresholdNeighbor(editorNode->custom4);
inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph);
diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
index aa4d0932c92..1456aaf6a55 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
@@ -61,9 +61,9 @@ void ColorBalanceASCCDLOperation::executePixel(float output[4], float x, float y
fac = min(1.0f, fac);
const float mfac = 1.0f - fac;
- output[0] = mfac * inputColor[0] + fac * colorbalance_cdl(inputColor[0], this->m_lift[0], this->m_gamma[0], this->m_gain[0]);
- output[1] = mfac * inputColor[1] + fac * colorbalance_cdl(inputColor[1], this->m_lift[1], this->m_gamma[1], this->m_gain[1]);
- output[2] = mfac * inputColor[2] + fac * colorbalance_cdl(inputColor[2], this->m_lift[2], this->m_gamma[2], this->m_gain[2]);
+ output[0] = mfac * inputColor[0] + fac * colorbalance_cdl(inputColor[0], this->m_offset[0], this->m_power[0], this->m_slope[0]);
+ output[1] = mfac * inputColor[1] + fac * colorbalance_cdl(inputColor[1], this->m_offset[1], this->m_power[1], this->m_slope[1]);
+ output[2] = mfac * inputColor[2] + fac * colorbalance_cdl(inputColor[2], this->m_offset[2], this->m_power[2], this->m_slope[2]);
output[3] = inputColor[3];
}
diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h
index 17fb5f67be9..ee0b89f7f70 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h
+++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h
@@ -36,9 +36,9 @@ protected:
SocketReader *m_inputValueOperation;
SocketReader *m_inputColorOperation;
- float m_gain[3];
- float m_lift[3];
- float m_gamma[3];
+ float m_offset[3];
+ float m_power[3];
+ float m_slope[3];
public:
/**
@@ -61,8 +61,8 @@ public:
*/
void deinitExecution();
- void setGain(float gain[3]) { copy_v3_v3(this->m_gain, gain); }
- void setLift(float lift[3]) { copy_v3_v3(this->m_lift, lift); }
- void setGamma(float gamma[3]) { copy_v3_v3(this->m_gamma, gamma); }
+ void setOffset(float offset[3]) { copy_v3_v3(this->m_offset, offset); }
+ void setPower(float power[3]) { copy_v3_v3(this->m_power, power); }
+ void setSlope(float slope[3]) { copy_v3_v3(this->m_slope, slope); }
};
#endif
diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.cpp b/source/blender/compositor/operations/COM_DespeckleOperation.cpp
index 599f54720f2..186c17845f3 100644
--- a/source/blender/compositor/operations/COM_DespeckleOperation.cpp
+++ b/source/blender/compositor/operations/COM_DespeckleOperation.cpp
@@ -114,7 +114,7 @@ void DespeckleOperation::executePixel(float output[4], int x, int y, void *data)
//mul_v4_fl(color_mid, 1.0f / w);
if ((w != 0.0f) &&
- ((w / WTOT) > (this->m_threshold_neighbour)) &&
+ ((w / WTOT) > (this->m_threshold_neighbor)) &&
color_diff(color_mid, color_org, this->m_threshold))
{
mul_v4_fl(color_mid_ok, 1.0f / w);
diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.h b/source/blender/compositor/operations/COM_DespeckleOperation.h
index 99635e61544..00c5463c17a 100644
--- a/source/blender/compositor/operations/COM_DespeckleOperation.h
+++ b/source/blender/compositor/operations/COM_DespeckleOperation.h
@@ -25,7 +25,7 @@
class DespeckleOperation : public NodeOperation {
private:
float m_threshold;
- float m_threshold_neighbour;
+ float m_threshold_neighbor;
// int m_filterWidth;
// int m_filterHeight;
@@ -40,7 +40,7 @@ public:
void executePixel(float output[4], int x, int y, void *data);
void setThreshold(float threshold) { this->m_threshold = threshold; }
- void setThresholdNeighbour(float threshold) { this->m_threshold_neighbour = threshold; }
+ void setThresholdNeighbor(float threshold) { this->m_threshold_neighbor = threshold; }
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp
index ba1059c4eb5..85df691ee29 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_MaskOperation.cpp
@@ -75,7 +75,7 @@ void MaskOperation::initExecution()
masklay;
masklay = masklay->next)
{
- masklay_shape = BKE_mask_layer_shape_varify_frame(masklay, this->m_frame_number);
+ masklay_shape = BKE_mask_layer_shape_verify_frame(masklay, this->m_frame_number);
BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
}
}
@@ -84,7 +84,7 @@ void MaskOperation::initExecution()
this->m_rasterMaskHandles[i] = BKE_maskrasterize_handle_new();
/* re-eval frame info */
- BKE_mask_evaluate(mask_temp, frame_iter, TRUE);
+ BKE_mask_evaluate(mask_temp, frame_iter, true);
BKE_maskrasterize_handle_init(this->m_rasterMaskHandles[i], mask_temp,
this->m_maskWidth, this->m_maskHeight,
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 9e8800fd91e..25fcd76b513 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -33,6 +33,7 @@
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "BLI_math.h"
@@ -359,9 +360,68 @@ void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, short restore, sh
/* *************************************************** */
/* UNITS CONVERSION MAPPING (required for drawing and editing keyframes) */
+/* Get flags used for normalization in ANIM_unit_mapping_get_factor. */
+short ANIM_get_normalization_flags(bAnimContext *ac)
+{
+ if (ac->sl->spacetype == SPACE_IPO) {
+ SpaceIpo *sipo = (SpaceIpo *) ac->sl;
+ bool use_normalization = (sipo->flag & SIPO_NORMALIZE) != 0;
+ bool freeze_normalization = (sipo->flag & SIPO_NORMALIZE_FREEZE) != 0;
+ return use_normalization
+ ? (ANIM_UNITCONV_NORMALIZE | (freeze_normalization ? ANIM_UNITCONV_NORMALIZE_FREEZE : 0))
+ : 0;
+ }
+
+ return 0;
+}
+
+static float normalzation_factor_get(FCurve *fcu, short flag)
+{
+ float factor = 1.0f;
+
+ if (flag & ANIM_UNITCONV_RESTORE) {
+ return 1.0f / fcu->prev_norm_factor;
+ }
+
+ if (flag & ANIM_UNITCONV_NORMALIZE_FREEZE) {
+ return fcu->prev_norm_factor;
+ }
+
+ if (G.moving & G_TRANSFORM_FCURVES) {
+ return fcu->prev_norm_factor;
+ }
+
+ fcu->prev_norm_factor = 1.0f;
+ if (fcu->bezt) {
+ BezTriple *bezt;
+ int i;
+ float max_coord = -FLT_MAX;
+
+ if (fcu->totvert < 1) {
+ return 1.0f;
+ }
+
+ for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
+ max_coord = max_ff(max_coord, fabsf(bezt->vec[0][1]));
+ max_coord = max_ff(max_coord, fabsf(bezt->vec[1][1]));
+ max_coord = max_ff(max_coord, fabsf(bezt->vec[2][1]));
+ }
+
+ if (max_coord > FLT_EPSILON) {
+ factor = 1.0f / max_coord;
+ }
+ }
+ fcu->prev_norm_factor = factor;
+ return factor;
+}
+
/* Get unit conversion factor for given ID + F-Curve */
-float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short restore)
+float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag)
{
+ if (flag & ANIM_UNITCONV_NORMALIZE) {
+ return normalzation_factor_get(fcu, flag);
+ }
+
/* sanity checks */
if (id && fcu && fcu->rna_path) {
PointerRNA ptr, id_ptr;
@@ -374,7 +434,7 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short rest
if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION) {
/* if the radians flag is not set, default to using degrees which need conversions */
if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) {
- if (restore)
+ if (flag & ANIM_UNITCONV_RESTORE)
return DEG2RADF(1.0f); /* degrees to radians */
else
return RAD2DEGF(1.0f); /* radians to degrees */
@@ -389,76 +449,4 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short rest
return 1.0f;
}
-/* ----------------------- */
-
-/* helper function for ANIM_unit_mapping_apply_fcurve -> mapping callback for unit mapping */
-static short bezt_unit_mapping_apply(KeyframeEditData *ked, BezTriple *bezt)
-{
- /* mapping factor is stored in f1, flags are stored in i1 */
- const bool only_keys = (ked->i1 & ANIM_UNITCONV_ONLYKEYS) != 0;
- const bool sel_vs = (ked->i1 & ANIM_UNITCONV_SELVERTS) != 0;
- const bool skip_knot = (ked->i1 & ANIM_UNITCONV_SKIPKNOTS) != 0;
- float fac = ked->f1;
-
- /* adjust BezTriple handles only if allowed to */
- if (only_keys == false) {
- if ((sel_vs == false) || (bezt->f1 & SELECT))
- bezt->vec[0][1] *= fac;
- if ((sel_vs == false) || (bezt->f3 & SELECT))
- bezt->vec[2][1] *= fac;
- }
-
- if (skip_knot == false) {
- if ((sel_vs == false) || (bezt->f2 & SELECT))
- bezt->vec[1][1] *= fac;
- }
-
- return 0;
-}
-
-/* Apply/Unapply units conversions to keyframes */
-void ANIM_unit_mapping_apply_fcurve(Scene *scene, ID *id, FCurve *fcu, short flag)
-{
- KeyframeEditData ked;
- KeyframeEditFunc sel_cb;
- float fac;
-
- /* abort if rendering - we may get some race condition issues... */
- if (G.is_rendering) return;
-
- /* calculate mapping factor, and abort if nothing to change */
- fac = ANIM_unit_mapping_get_factor(scene, id, fcu, (flag & ANIM_UNITCONV_RESTORE));
- if (fac == 1.0f)
- return;
-
- /* init edit data
- * - mapping factor is stored in f1
- * - flags are stored in 'i1'
- */
- memset(&ked, 0, sizeof(KeyframeEditData));
- ked.f1 = (float)fac;
- ked.i1 = (int)flag;
-
- /* only selected? */
- if (flag & ANIM_UNITCONV_ONLYSEL)
- sel_cb = ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
- else
- sel_cb = NULL;
-
- /* apply to F-Curve */
- ANIM_fcurve_keyframes_loop(&ked, fcu, sel_cb, bezt_unit_mapping_apply, NULL);
-
- // FIXME: loop here for samples should be generalised
- // TODO: only sel?
- if (fcu->fpt) {
- FPoint *fpt;
- unsigned int i;
-
- for (i = 0, fpt = fcu->fpt; i < fcu->totvert; i++, fpt++) {
- /* apply unit mapping */
- fpt->vec[1] *= fac;
- }
- }
-}
-
/* *************************************************** */
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index b7a1614146a..ad745155286 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2624,24 +2624,50 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
/* firstly filter the data */
switch (datatype) {
+ /* Action-Editing Modes */
case ANIMCONT_ACTION: /* 'Action Editor' */
{
Object *obact = ac->obact;
SpaceAction *saction = (SpaceAction *)ac->sl;
bDopeSheet *ads = (saction) ? &saction->ads : NULL;
- /* the check for the DopeSheet summary is included here since the summary works here too */
- if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
- items += animfilter_action(ac, anim_data, ads, data, filter_mode, (ID *)obact);
+ /* specially check for AnimData filter... [#36687] */
+ if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
+ /* all channels here are within the same AnimData block, hence this special case */
+ if (LIKELY(obact->adt)) {
+ ANIMCHANNEL_NEW_CHANNEL(obact->adt, ANIMTYPE_ANIMDATA, (ID *)obact);
+ }
+ }
+ else {
+ /* the check for the DopeSheet summary is included here since the summary works here too */
+ if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
+ items += animfilter_action(ac, anim_data, ads, data, filter_mode, (ID *)obact);
+ }
+
break;
}
case ANIMCONT_SHAPEKEY: /* 'ShapeKey Editor' */
{
- /* the check for the DopeSheet summary is included here since the summary works here too */
- if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
- items = animdata_filter_shapekey(ac, anim_data, data, filter_mode);
+ Key *key = (Key *)data;
+
+ /* specially check for AnimData filter... [#36687] */
+ if (UNLIKELY(filter_mode & ANIMFILTER_ANIMDATA)) {
+ /* all channels here are within the same AnimData block, hence this special case */
+ if (LIKELY(key->adt)) {
+ ANIMCHANNEL_NEW_CHANNEL(key->adt, ANIMTYPE_ANIMDATA, (ID *)key);
+ }
+ }
+ else {
+ /* the check for the DopeSheet summary is included here since the summary works here too */
+ if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
+ items = animdata_filter_shapekey(ac, anim_data, key, filter_mode);
+ }
+
break;
}
+
+
+ /* Modes for Specialty Data Types (i.e. not keyframes) */
case ANIMCONT_GPENCIL:
{
if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
@@ -2654,6 +2680,9 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
items = animdata_filter_mask(anim_data, data, filter_mode);
break;
}
+
+
+ /* DopeSheet Based Modes */
case ANIMCONT_DOPESHEET: /* 'DopeSheet Editor' */
{
/* the DopeSheet editor is the primary place where the DopeSheet summaries are useful */
@@ -2669,6 +2698,9 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
items = animdata_filter_dopesheet(ac, anim_data, data, filter_mode);
break;
}
+
+
+ /* Special/Internal Use */
case ANIMCONT_CHANNEL: /* animation channel */
{
bDopeSheet *ads = ac->ads;
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 1e8f2bfc038..cab072675b2 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -711,13 +711,11 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op)
}
/* only for modal */
-static int ed_marker_move_cancel(bContext *C, wmOperator *op)
+static void ed_marker_move_cancel(bContext *C, wmOperator *op)
{
RNA_int_set(op->ptr, "frames", 0);
ed_marker_move_apply(C, op);
ed_marker_move_exit(C, op);
-
- return OPERATOR_CANCELLED;
}
@@ -734,7 +732,6 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even
case ESCKEY:
ed_marker_move_cancel(C, op);
return OPERATOR_CANCELLED;
-
case RIGHTMOUSE:
/* press = user manually demands transform to be canceled */
if (event->val == KM_PRESS) {
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 826e204d981..bbfa981c0c7 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -76,7 +76,7 @@ void free_anim_drivers_copybuf(void);
*
* - add: 0 - don't add anything if not found,
* 1 - add new Driver FCurve (with keyframes for visual tweaking),
- * 2 - add new Driver FCurve (with generator, for script backwards compatability)
+ * 2 - add new Driver FCurve (with generator, for script backwards compatibility)
* -1 - add new Driver FCurve without driver stuff (for pasting)
*/
FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_index, short add)
@@ -125,7 +125,7 @@ FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_inde
/* F-Modifier or Keyframes? */
// FIXME: replace these magic numbers with defines
if (add == 2) {
- /* Python API Backwards compatability hack:
+ /* Python API Backwards compatibility hack:
* Create FModifier so that old scripts won't break
* for now before 2.7 series -- (September 4, 2013)
*/
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index 1c6ba1d3562..29eebe86afa 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -484,7 +484,7 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op)
/* the number of joints determines how we fill:
* 1) between joint and cursor (joint=head, cursor=tail)
- * 2) between the two joints (order is dependent on active-bone/hierachy)
+ * 2) between the two joints (order is dependent on active-bone/hierarchy)
* 3+) error (a smarter method involving finding chains needs to be worked out
*/
count = BLI_countlist(&points);
@@ -583,8 +583,11 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op)
else
newbone->parent = ebp2->head_owner;
}
-
- newbone->flag |= BONE_CONNECTED;
+
+ /* don't set for bone connecting two head points of bones */
+ if (ebp->tail_owner || ebp2->tail_owner) {
+ newbone->flag |= BONE_CONNECTED;
+ }
}
}
else {
@@ -840,7 +843,7 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
armature_tag_select_mirrored(arm);
/* clear BONE_TRANSFORM flags
- * - used to prevent duplicate/cancelling operations from occurring [#34123]
+ * - used to prevent duplicate/canceling operations from occurring [#34123]
* - BONE_DONE cannot be used here as that's already used for mirroring
*/
armature_clear_swap_done_flags(arm);
@@ -1063,6 +1066,44 @@ void ARMATURE_OT_align(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/* ********************************* Split ******************************* */
+
+static int armature_split_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Object *ob = CTX_data_edit_object(C);
+ bArmature *arm = (bArmature *)ob->data;
+ EditBone *bone;
+
+ for (bone = arm->edbo->first; bone; bone = bone->next) {
+ if (bone->parent && (bone->flag & BONE_SELECTED) != (bone->parent->flag & BONE_SELECTED)) {
+ bone->parent = NULL;
+ bone->flag &= ~BONE_CONNECTED;
+ }
+ }
+ for (bone = arm->edbo->first; bone; bone = bone->next) {
+ ED_armature_ebone_select_set(bone, (bone->flag & BONE_SELECTED) != 0);
+ }
+
+ WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+void ARMATURE_OT_split(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Split";
+ ot->idname = "ARMATURE_OT_split";
+ ot->description = "Split off selected bones from connected unselected bones";
+
+ /* api callbacks */
+ ot->exec = armature_split_exec;
+ ot->poll = ED_operator_editarmature;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
/* ********************************* Delete ******************************* */
/* previously delete_armature */
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index e58d8fd2380..83800e598ba 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -62,7 +62,7 @@ void ARMATURE_OT_parent_set(struct wmOperatorType *ot);
void ARMATURE_OT_parent_clear(struct wmOperatorType *ot);
void ARMATURE_OT_select_all(struct wmOperatorType *ot);
-void ARMATURE_OT_select_inverse(struct wmOperatorType *ot);
+void ARMATURE_OT_select_mirror(struct wmOperatorType *ot);
void ARMATURE_OT_select_more(struct wmOperatorType *ot);
void ARMATURE_OT_select_less(struct wmOperatorType *ot);
void ARMATURE_OT_select_hierarchy(struct wmOperatorType *ot);
@@ -78,6 +78,7 @@ void ARMATURE_OT_click_extrude(struct wmOperatorType *ot);
void ARMATURE_OT_fill(struct wmOperatorType *ot);
void ARMATURE_OT_merge(struct wmOperatorType *ot);
void ARMATURE_OT_separate(struct wmOperatorType *ot);
+void ARMATURE_OT_split(struct wmOperatorType *ot);
void ARMATURE_OT_autoside_names(struct wmOperatorType *ot);
void ARMATURE_OT_flip_names(struct wmOperatorType *ot);
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index 3c41765034d..040b6f33f3b 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -58,7 +58,7 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(ARMATURE_OT_parent_clear);
WM_operatortype_append(ARMATURE_OT_select_all);
- WM_operatortype_append(ARMATURE_OT_select_inverse);
+ WM_operatortype_append(ARMATURE_OT_select_mirror);
WM_operatortype_append(ARMATURE_OT_select_more);
WM_operatortype_append(ARMATURE_OT_select_less);
WM_operatortype_append(ARMATURE_OT_select_hierarchy);
@@ -74,6 +74,7 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(ARMATURE_OT_fill);
WM_operatortype_append(ARMATURE_OT_merge);
WM_operatortype_append(ARMATURE_OT_separate);
+ WM_operatortype_append(ARMATURE_OT_split);
WM_operatortype_append(ARMATURE_OT_autoside_names);
WM_operatortype_append(ARMATURE_OT_flip_names);
@@ -239,6 +240,9 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+
+ kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
@@ -269,6 +273,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_fill", FKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_merge", MKEY, KM_PRESS, KM_ALT, 0);
+ WM_keymap_add_item(keymap, "ARMATURE_OT_split", YKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_separate", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index fe1d2fa3765..4c956ca65d4 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -54,6 +54,10 @@
#include "armature_intern.h"
+/* utility macros fro storing a temp int in the bone (selection flag) */
+#define EBONE_PREV_FLAG_GET(ebone) ((void)0, (GET_INT_FROM_POINTER((ebone)->temp)))
+#define EBONE_PREV_FLAG_SET(ebone, val) ((ebone)->temp = SET_INT_IN_POINTER(val))
+
/* **************** PoseMode & EditMode Selection Buffer Queries *************************** */
/* only for opengl selection indices */
@@ -559,39 +563,6 @@ bool mouse_armature(bContext *C, const int mval[2], bool extend, bool deselect,
/* **************** Selections ******************/
-static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
-{
- /* Set the flags */
- CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones)
- {
- /* ignore bone if selection can't change */
- if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
- /* select bone */
- ebone->flag ^= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- }
- }
- CTX_DATA_END;
-
- WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-void ARMATURE_OT_select_inverse(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Select Inverse";
- ot->idname = "ARMATURE_OT_select_inverse";
- ot->description = "Flip the selection status of bones (selected -> unselected, unselected -> selected)";
-
- /* api callbacks */
- ot->exec = armature_select_inverse_exec;
- ot->poll = ED_operator_editarmature;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
-}
static int armature_de_select_all_exec(bContext *C, wmOperator *op)
{
int action = RNA_enum_get(op->ptr, "action");
@@ -667,9 +638,6 @@ void ARMATURE_OT_select_all(wmOperatorType *ot)
/**************** Select more/less **************/
-#define EBONE_PREV_FLAG_GET(ebone) ((void)0, (GET_INT_FROM_POINTER(ebone->temp)))
-#define EBONE_PREV_FLAG_SET(ebone, val) (ebone->temp = SET_INT_IN_POINTER(val))
-
static void armature_select_more(bArmature *arm, EditBone *ebone)
{
if ((EBONE_PREV_FLAG_GET(ebone) & (BONE_ROOTSEL | BONE_TIPSEL)) != 0) {
@@ -753,9 +721,6 @@ static void armature_select_more_less(Object *ob, bool more)
ED_armature_sync_selection(arm->edbo);
}
-#undef EBONE_PREV_FLAG_GET
-#undef EBONE_PREV_FLAG_SET
-
static int armature_de_select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
@@ -1083,3 +1048,57 @@ void ARMATURE_OT_select_hierarchy(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
}
+/****************** Mirror Select ****************/
+
+static int armature_select_mirror_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ bArmature *arm = obedit->data;
+ EditBone *ebone;
+ const bool extend = RNA_boolean_get(op->ptr, "extend");
+
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ const int flag = ED_armature_ebone_selectflag_get(ebone);
+ EBONE_PREV_FLAG_SET(ebone, flag);
+ }
+
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_SELECTABLE(arm, ebone)) {
+ EditBone *ebone_mirror;
+ int flag_new = extend ? EBONE_PREV_FLAG_GET(ebone) : 0;
+
+ if ((ebone_mirror = ED_armature_bone_get_mirrored(arm->edbo, ebone)) &&
+ (EBONE_VISIBLE(arm, ebone_mirror)))
+ {
+ const int flag_mirror = EBONE_PREV_FLAG_GET(ebone_mirror);
+ flag_new |= flag_mirror;
+ }
+
+ ED_armature_ebone_selectflag_set(ebone, flag_new);
+ }
+ }
+
+ ED_armature_sync_selection(arm->edbo);
+
+ WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
+
+ return OPERATOR_FINISHED;
+}
+
+void ARMATURE_OT_select_mirror(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Mirror Select";
+ ot->idname = "ARMATURE_OT_select_mirror";
+ ot->description = "Mirror the bone selection";
+
+ /* api callbacks */
+ ot->exec = armature_select_mirror_exec;
+ ot->poll = ED_operator_editarmature;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
+}
diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c
index 76cd12f12f8..f2f51dc1bd5 100644
--- a/source/blender/editors/armature/armature_utils.c
+++ b/source/blender/editors/armature/armature_utils.c
@@ -454,7 +454,7 @@ void ED_armature_from_edit(Object *obedit)
/* armature bones */
BKE_armature_bonelist_free(&arm->bonebase);
- /* remove zero sized bones, this gives instable restposes */
+ /* remove zero sized bones, this gives unstable restposes */
for (eBone = arm->edbo->first; eBone; eBone = neBone) {
float len = len_v3v3(eBone->head, eBone->tail);
neBone = eBone->next;
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 8ae1b9557ee..36999c15665 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -2339,7 +2339,7 @@ static int sketch_convert(bContext *C, wmOperator *UNUSED(op), const wmEvent *UN
return OPERATOR_FINISHED;
}
-static int sketch_cancel(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
+static int sketch_cancel_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
if (sketch != NULL) {
@@ -2374,12 +2374,11 @@ static int sketch_select(bContext *C, wmOperator *UNUSED(op), const wmEvent *eve
return OPERATOR_FINISHED;
}
-static int sketch_draw_stroke_cancel(bContext *C, wmOperator *op)
+static void sketch_draw_stroke_cancel(bContext *C, wmOperator *op)
{
SK_Sketch *sketch = contextSketch(C, 1); /* create just to be sure */
sk_cancelStroke(sketch);
MEM_freeN(op->customdata);
- return OPERATOR_CANCELLED;
}
static int sketch_draw_stroke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -2400,12 +2399,11 @@ static int sketch_draw_stroke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int sketch_draw_gesture_cancel(bContext *C, wmOperator *op)
+static void sketch_draw_gesture_cancel(bContext *C, wmOperator *op)
{
SK_Sketch *sketch = contextSketch(C, 1); /* create just to be sure */
sk_cancelStroke(sketch);
MEM_freeN(op->customdata);
- return OPERATOR_CANCELLED;
}
static int sketch_draw_gesture(bContext *C, wmOperator *op, const wmEvent *event)
@@ -2622,7 +2620,7 @@ void SKETCH_OT_cancel_stroke(wmOperatorType *ot)
ot->description = "Cancel the current sketch stroke";
/* api callbacks */
- ot->invoke = sketch_cancel;
+ ot->invoke = sketch_cancel_invoke;
ot->poll = ED_operator_sketch_mode_active_stroke;
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 182f94b3693..69ee794e1d9 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -567,7 +567,7 @@ static int poselib_remove_exec(bContext *C, wmOperator *op)
if (fcu->bezt) {
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
/* check if remove */
- if (IS_EQ(bezt->vec[1][0], marker->frame)) {
+ if (IS_EQF(bezt->vec[1][0], (float)marker->frame)) {
delete_fcurve_key(fcu, i, 1);
break;
}
@@ -1532,10 +1532,9 @@ static int poselib_preview_exit(bContext *C, wmOperator *op)
}
/* Cancel previewing operation (called when exiting Blender) */
-static int poselib_preview_cancel(bContext *C, wmOperator *op)
+static void poselib_preview_cancel(bContext *C, wmOperator *op)
{
poselib_preview_exit(C, op);
- return OPERATOR_CANCELLED;
}
/* main modal status check */
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index d0e1b15064a..82652702fe7 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -682,11 +682,10 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
/* common code for cancel() */
-static int pose_slide_cancel(bContext *UNUSED(C), wmOperator *op)
+static void pose_slide_cancel(bContext *UNUSED(C), wmOperator *op)
{
/* cleanup and done */
pose_slide_exit(op);
- return OPERATOR_CANCELLED;
}
/* common code for exec() methods */
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index bd91740521d..f576440fe92 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1279,6 +1279,8 @@ void CU_deselect_all(Object *obedit)
if (editnurb) {
Nurb *nu;
int a;
+ ((Curve *)obedit->data)->lastsel = NULL;
+
for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->bezt) {
BezTriple *bezt;
@@ -1902,7 +1904,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb,
int a, b, c, starta, enda, diffa, cyclicu, cyclicv, newu, newv;
char *usel;
- cu->lastsel = NULL;
while (nu) {
cyclicu = cyclicv = 0;
if (nu->type == CU_BEZIER) {
@@ -1927,7 +1928,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb,
newnu = BKE_nurb_copy(nu, newu, 1);
BLI_addtail(newnurb, newnu);
- set_actNurb(obedit, newnu);
memcpy(newnu->bezt, &nu->bezt[starta], diffa * sizeof(BezTriple));
if (newu != diffa) {
memcpy(&newnu->bezt[diffa], nu->bezt, cyclicu * sizeof(BezTriple));
@@ -1976,7 +1976,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb,
newnu = BKE_nurb_copy(nu, newu, 1);
BLI_addtail(newnurb, newnu);
- set_actNurb(obedit, newnu);
memcpy(newnu->bp, &nu->bp[starta], diffa * sizeof(BPoint));
if (newu != diffa) {
memcpy(&newnu->bp[diffa], nu->bp, cyclicu * sizeof(BPoint));
@@ -1995,8 +1994,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb,
if (cyclicu != 0) {
newnu = BKE_nurb_copy(nu, cyclicu, 1);
BLI_addtail(newnurb, newnu);
- set_actNurb(obedit, newnu);
-
memcpy(newnu->bp, nu->bp, cyclicu * sizeof(BPoint));
newnu->flagu &= ~CU_NURB_CYCLIC;
@@ -2093,7 +2090,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb,
memcpy(&newnu->bp[b * newu], &nu->bp[b * nu->pntsu + a], newu * sizeof(BPoint));
}
}
- set_actNurb(obedit, newnu);
BLI_addtail(newnurb, newnu);
if (newu != nu->pntsu) newnu->flagu &= ~CU_NURB_CYCLIC;
@@ -2110,7 +2106,6 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb,
for (b = 0; b < newv; b++) {
memcpy(&newnu->bp[b * newu], &nu->bp[b * nu->pntsu], newu * sizeof(BPoint));
}
- set_actNurb(obedit, newnu);
BLI_addtail(newnurb, newnu);
if (newu != nu->pntsu) newnu->flagu &= ~CU_NURB_CYCLIC;
@@ -2127,32 +2122,35 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb,
nu = nu->prev;
}
- for (nu = newnurb->first; nu; nu = nu->next) {
- if (nu->type == CU_BEZIER) {
- if (split) {
- /* recalc first and last */
- BKE_nurb_handle_calc_simple(nu, &nu->bezt[0]);
- BKE_nurb_handle_calc_simple(nu, &nu->bezt[nu->pntsu - 1]);
- }
- }
- else {
- /* knots done after duplicate as pntsu may change */
- nu->knotsu = nu->knotsv = NULL;
- BKE_nurb_order_clamp_u(nu);
- BKE_nurb_knot_calc_u(nu);
+ if (newnurb->first != NULL) {
+ cu->lastsel = NULL;
+ cu->actnu = -1;
- if (obedit->type == OB_SURF) {
- for (a = 0, bp = nu->bp; a < nu->pntsu * nu->pntsv; a++, bp++) {
- bp->f1 &= ~SURF_SEEN;
+ for (nu = newnurb->first; nu; nu = nu->next) {
+ if (nu->type == CU_BEZIER) {
+ if (split) {
+ /* recalc first and last */
+ BKE_nurb_handle_calc_simple(nu, &nu->bezt[0]);
+ BKE_nurb_handle_calc_simple(nu, &nu->bezt[nu->pntsu - 1]);
}
+ }
+ else {
+ /* knots done after duplicate as pntsu may change */
+ nu->knotsu = nu->knotsv = NULL;
+ BKE_nurb_order_clamp_u(nu);
+ BKE_nurb_knot_calc_u(nu);
- BKE_nurb_order_clamp_v(nu);
- BKE_nurb_knot_calc_v(nu);
+ if (obedit->type == OB_SURF) {
+ for (a = 0, bp = nu->bp; a < nu->pntsu * nu->pntsv; a++, bp++) {
+ bp->f1 &= ~SURF_SEEN;
+ }
+
+ BKE_nurb_order_clamp_v(nu);
+ BKE_nurb_knot_calc_v(nu);
+ }
}
}
}
-
- /* actnu changed */
}
/**************** switch direction operator ***************/
@@ -6367,6 +6365,7 @@ static int curve_delete_segments(Object *obedit, const bool split)
static int curve_delete_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
+ Curve *cu = (Curve *)obedit->data;
eCurveElem_Types type = RNA_enum_get(op->ptr, "type");
int retval;
@@ -6375,6 +6374,9 @@ static int curve_delete_exec(bContext *C, wmOperator *op)
else BLI_assert(0);
if (retval == OPERATOR_FINISHED) {
+ cu->lastsel = NULL;
+ cu->actnu = -1;
+
if (ED_curve_updateAnimPaths(obedit->data)) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c
index 9b858a2c4e9..6804aa3584f 100644
--- a/source/blender/editors/curve/editcurve_add.c
+++ b/source/blender/editors/curve/editcurve_add.c
@@ -458,6 +458,8 @@ Nurb *add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4], int type
if (nu) { /* should always be set */
nu->flag |= CU_SMOOTH;
+ cu->actnu = BLI_countlist(editnurb);
+ cu->lastsel = NULL;
BKE_nurb_test2D(nu);
}
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index ac9c338e431..dc58e84415c 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1613,11 +1613,10 @@ static void font_ui_template_init(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
-static int font_open_cancel(bContext *UNUSED(C), wmOperator *op)
+static void font_open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata = NULL;
- return OPERATOR_CANCELLED;
}
static int font_open_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 98fff3d65ce..2cf8d9c27af 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1456,11 +1456,10 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op)
op->customdata = NULL;
}
-static int gpencil_draw_cancel(bContext *C, wmOperator *op)
+static void gpencil_draw_cancel(bContext *C, wmOperator *op)
{
/* this is just a wrapper around exit() */
gpencil_draw_exit(C, op);
- return OPERATOR_CANCELLED;
}
/* ------------------------------- */
@@ -1875,7 +1874,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
//printf("\tGP - handle modal event...\n");
/* exit painting mode (and/or end current stroke)
- * NOTE: cannot do RIGHTMOUSE (as is standard for cancelling) as that would break polyline [#32647]
+ * NOTE: cannot do RIGHTMOUSE (as is standard for canceling) as that would break polyline [#32647]
*/
if (ELEM4(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY)) {
/* exit() ends the current stroke before cleaning up */
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 61f9cec15d9..d98fa1fc32f 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -559,13 +559,19 @@ typedef enum eAnimUnitConv_Flags {
/* only touch selected vertices */
ANIM_UNITCONV_SELVERTS = (1 << 3),
ANIM_UNITCONV_SKIPKNOTS = (1 << 4),
+ /* Scale FCurve i a way it fits to -1..1 space */
+ ANIM_UNITCONV_NORMALIZE = (1 << 5),
+ /* Only whennormalization is used: use scale factor from previous run,
+ * prevents curves from jumping all over the place when tweaking them.
+ */
+ ANIM_UNITCONV_NORMALIZE_FREEZE = (1 << 6),
} eAnimUnitConv_Flags;
-/* Get unit conversion factor for given ID + F-Curve */
-float ANIM_unit_mapping_get_factor(struct Scene *scene, struct ID *id, struct FCurve *fcu, short restore);
+/* Normalizatin flags from Space Graph passing to ANIM_unit_mapping_get_factor */
+short ANIM_get_normalization_flags(bAnimContext *ac);
-/* Apply/Unapply units conversions to keyframes */
-void ANIM_unit_mapping_apply_fcurve(struct Scene *scene, struct ID *id, struct FCurve *fcu, short flag);
+/* Get unit conversion factor for given ID + F-Curve */
+float ANIM_unit_mapping_get_factor(struct Scene *scene, struct ID *id, struct FCurve *fcu, short flag);
/* ------------- Utility macros ----------------------- */
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index e7489e1bc72..bb4640949c1 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -106,7 +106,7 @@ typedef struct EditBone {
(((ebone)->flag & BONE_SELECTED) && !((ebone)->flag & BONE_EDITMODE_LOCKED)) \
)
-/* used in bone_select_hierachy() */
+/* used in armature_select_hierarchy_exec() */
#define BONE_SELECT_PARENT 0
#define BONE_SELECT_CHILD 1
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 2f16d84aed0..de83df9cc05 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -54,6 +54,8 @@ typedef enum {
NODE_RIGHT = 8
} NodeBorder;
+#define NODE_GRID_STEPS 5
+
/* space_node.c */
int ED_node_tree_path_length(struct SpaceNode *snode);
void ED_node_tree_path_get(struct SpaceNode *snode, char *value);
@@ -81,6 +83,7 @@ void ED_node_tree_update(const struct bContext *C);
void ED_node_tag_update_id(struct ID *id);
void ED_node_tag_update_nodetree(struct Main *bmain, struct bNodeTree *ntree);
void ED_node_sort(struct bNodeTree *ntree);
+float ED_node_grid_size(void);
/* node_relationships.c */
void ED_node_link_intersect_test(struct ScrArea *sa, int test);
diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h
index 518bee665ae..8f39502b2fe 100644
--- a/source/blender/editors/include/ED_render.h
+++ b/source/blender/editors/include/ED_render.h
@@ -55,6 +55,7 @@ void ED_render_scene_update(struct Main *bmain, struct Scene *scene, int updated
void ED_render_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa);
void ED_viewport_render_kill_jobs(const struct bContext *C, bool free_database);
+struct Scene *ED_render_job_get_scene(const struct bContext *C);
/* render_preview.c */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 16e92f2bc18..96638f77b10 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -78,8 +78,8 @@
#include "interface_intern.h"
-#define PRECISION_FLOAT_MAX 6
-#define PRECISION_FLOAT_MAX_POW 1000000 /* pow(10, PRECISION_FLOAT_MAX) */
+#define PRECISION_FLOAT_MAX 7
+#define PRECISION_FLOAT_MAX_POW 10000000 /* pow(10, PRECISION_FLOAT_MAX) */
/* avoid unneeded calls to ui_get_but_val */
#define UI_BUT_VALUE_UNSET DBL_MAX
@@ -443,7 +443,7 @@ void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int max
static int ui_but_float_precision(uiBut *but, double value)
{
int prec;
- const double pow10_neg[PRECISION_FLOAT_MAX + 1] = {1.0, 0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001};
+ const double pow10_neg[PRECISION_FLOAT_MAX + 1] = {1.0, 0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001, 0.0000001};
/* first check if prec is 0 and fallback to a simple default */
if ((prec = (int)but->a2) == -1) {
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index 783a777a2fe..01e53d5e721 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -122,10 +122,9 @@ static void eyedropper_exit(bContext *C, wmOperator *op)
}
}
-static int eyedropper_cancel(bContext *C, wmOperator *op)
+static void eyedropper_cancel(bContext *C, wmOperator *op)
{
eyedropper_exit(C, op);
- return OPERATOR_CANCELLED;
}
/* *** eyedropper_color_ helper functions *** */
@@ -243,7 +242,8 @@ static int eyedropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
switch (event->type) {
case ESCKEY:
case RIGHTMOUSE:
- return eyedropper_cancel(C, op);
+ eyedropper_cancel(C, op);
+ return OPERATOR_CANCELLED;
case LEFTMOUSE:
if (event->val == KM_RELEASE) {
if (eye->accum_tot == 0) {
@@ -447,10 +447,9 @@ static void datadropper_exit(bContext *C, wmOperator *op)
}
}
-static int datadropper_cancel(bContext *C, wmOperator *op)
+static void datadropper_cancel(bContext *C, wmOperator *op)
{
datadropper_exit(C, op);
- return OPERATOR_CANCELLED;
}
/* *** datadropper id helper functions *** */
@@ -552,7 +551,8 @@ static int datadropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
switch (event->type) {
case ESCKEY:
case RIGHTMOUSE:
- return datadropper_cancel(C, op);
+ datadropper_cancel(C, op);
+ return OPERATOR_CANCELLED;
case LEFTMOUSE:
if (event->val == KM_RELEASE) {
bool success;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 7e9c90d51a1..903a5e72499 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1534,7 +1534,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
char *str;
opptr = uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */
- str = WM_operator_pystring(C, but->optype, opptr, 0);
+ str = WM_operator_pystring_ex(C, NULL, false, but->optype, opptr);
WM_clipboard_text_set(str, 0);
@@ -2730,9 +2730,14 @@ static int ui_do_but_SEARCH_UNLINK(bContext *C, uiBlock *block, uiBut *but, uiHa
rect.xmin = rect.xmax - (BLI_rcti_size_y(&rect));
if (BLI_rcti_isect_pt(&rect, x, y)) {
- ui_set_but_string(C, but, "");
+ /* most likely NULL, but let's check, and give it temp zero string */
+ if (data->str == NULL)
+ data->str = MEM_callocN(1, "temp str");
+ data->str[0] = 0;
+
+ ui_apply_but_TEX(C, but, data);
button_activate_state(C, but, BUTTON_STATE_EXIT);
-
+
return WM_UI_HANDLER_BREAK;
}
}
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index b453a3b8363..e5bcc3d6863 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2423,7 +2423,10 @@ void ui_layout_list_set_labels_active(uiLayout *layout)
{
uiButtonItem *bitem;
for (bitem = layout->items.first; bitem; bitem = bitem->item.next) {
- if (bitem->item.type == ITEM_BUTTON && bitem->but->type == LISTLABEL) {
+ if (bitem->item.type != ITEM_BUTTON) {
+ ui_layout_list_set_labels_active((uiLayout *)(&bitem->item));
+ }
+ else if (bitem->but->type == LISTLABEL) {
uiButSetFlag(bitem->but, UI_SELECT);
}
}
@@ -2931,7 +2934,7 @@ static void ui_intro_button(DynStr *ds, uiButtonItem *bitem)
BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : ""); /* not exactly needed, rna has this */
if (but->optype) {
- char *opstr = WM_operator_pystring(but->block->evil_C, but->optype, but->opptr, 0);
+ char *opstr = WM_operator_pystring_ex(but->block->evil_C, NULL, false, but->optype, but->opptr);
BLI_dynstr_appendf(ds, "'operator':'''%s''', ", opstr ? opstr : "");
MEM_freeN(opstr);
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 15fbd51c6fc..3ef613f5867 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -539,7 +539,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* so the context is passed to itemf functions (some py itemf functions use it) */
WM_operator_properties_sanitize(opptr, false);
- str = WM_operator_pystring(C, but->optype, opptr, 0);
+ str = WM_operator_pystring_ex(C, NULL, false, but->optype, opptr);
/* operator info */
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index c343115be30..46cff2fb458 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -967,11 +967,11 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
if (md->type == eModifierType_ParticleSystem) {
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
- if (!(ob->mode & OB_MODE_PARTICLE_EDIT) && psys->pathcache) {
+ if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
uiItemO(row, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE,
"OBJECT_OT_duplicates_make_real");
- else if (psys->part->ren_as == PART_DRAW_PATH)
+ else if (psys->part->ren_as == PART_DRAW_PATH && psys->pathcache)
uiItemO(row, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE,
"OBJECT_OT_modifier_convert");
}
@@ -2855,6 +2855,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
items_shown = dyn_data->items_shown;
if (items_shown >= 0) {
+ bool activei_mapping_pending = true;
items_ptr = MEM_mallocN(sizeof(_uilist_item) * items_shown, AT);
//printf("%s: items shown: %d.\n", __func__, items_shown);
RNA_PROP_BEGIN (dataptr, itemptr, prop)
@@ -2875,8 +2876,10 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co
items_ptr[ii].org_idx = i;
items_ptr[ii].flt_flag = dyn_data->items_filter_flags ? dyn_data->items_filter_flags[i] : 0;
- if (activei == i) {
+ if (activei_mapping_pending && activei == i) {
activei = ii;
+ /* So that we do not map again activei! */
+ activei_mapping_pending = false;
}
# if 0 /* For now, do not alter active element, even if it will be hidden... */
else if (activei < i) {
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index ace35f0276e..55b353b1031 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1406,6 +1406,7 @@ void init_userdef_do_versions(void)
}
if (U.pad_rot_angle == 0)
U.pad_rot_angle = 15;
+
/* graph editor - unselected F-Curve visibility */
if (U.fcu_inactive_alpha == 0) {
U.fcu_inactive_alpha = 0.25f;
@@ -2224,7 +2225,14 @@ void init_userdef_do_versions(void)
rgba_char_args_test_set(btheme->tima.uv_shadow, 112, 112, 112, 255);
}
}
-
+
+ if (U.versionfile < 270) {
+ /* grease pencil - new layer color */
+ if (U.gpencil_new_layer_col[3] < 0.1f) {
+ /* defaults to black, but must at least be visible! */
+ U.gpencil_new_layer_col[3] = 0.9f;
+ }
+ }
if (U.pixelsize == 0.0f)
U.pixelsize = 1.0f;
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 00113666872..c5c9b1c8ce4 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -284,10 +284,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op)
+static void view_pan_cancel(bContext *UNUSED(C), wmOperator *op)
{
view_pan_exit(op);
- return OPERATOR_CANCELLED;
}
static void VIEW2D_OT_pan(wmOperatorType *ot)
@@ -906,11 +905,9 @@ static void view_zoomdrag_exit(bContext *C, wmOperator *op)
}
}
-static int view_zoomdrag_cancel(bContext *C, wmOperator *op)
+static void view_zoomdrag_cancel(bContext *C, wmOperator *op)
{
view_zoomdrag_exit(C, op);
-
- return OPERATOR_CANCELLED;
}
/* for 'redo' only, with no user input */
@@ -1579,11 +1576,9 @@ static void scroller_activate_exit(bContext *C, wmOperator *op)
}
}
-static int scroller_activate_cancel(bContext *C, wmOperator *op)
+static void scroller_activate_cancel(bContext *C, wmOperator *op)
{
scroller_activate_exit(C, op);
-
- return OPERATOR_CANCELLED;
}
/* apply transform to view (i.e. adjust 'cur' rect) */
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index 4cc9d3b59b1..7a78d60e11e 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -385,7 +385,7 @@ static int add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2]
setup_vertex_point(mask, spline, new_point, co, tangent, u, NULL, TRUE, 1.0f);
/* TODO - we could pass the spline! */
- BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index + 1, TRUE, TRUE);
+ BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index + 1, true, true);
masklay->act_spline = spline;
masklay->act_point = new_point;
@@ -486,7 +486,7 @@ static int add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay,
if (masklay->splines_shapes.first) {
point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point);
- BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index, TRUE, TRUE);
+ BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index, true, true);
}
if (do_recalc_src) {
@@ -548,7 +548,7 @@ static int add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, con
{
int point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point);
- BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index, TRUE, TRUE);
+ BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index, true, true);
}
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c
index d5fbdca5b0a..78dba382520 100644
--- a/source/blender/editors/mask/mask_shapekey.c
+++ b/source/blender/editors/mask/mask_shapekey.c
@@ -69,7 +69,7 @@ static int mask_shape_key_insert_exec(bContext *C, wmOperator *UNUSED(op))
continue;
}
- masklay_shape = BKE_mask_layer_shape_varify_frame(masklay, frame);
+ masklay_shape = BKE_mask_layer_shape_verify_frame(masklay, frame);
BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
change = TRUE;
}
@@ -319,8 +319,8 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
masklay_shape_tmp;
masklay_shape_tmp = masklay_shape_tmp->next)
{
- BKE_mask_layer_evaluate(masklay, masklay_shape_tmp->frame, TRUE);
- masklay_shape_tmp_rekey = BKE_mask_layer_shape_varify_frame(masklay, masklay_shape_tmp->frame);
+ BKE_mask_layer_evaluate(masklay, masklay_shape_tmp->frame, true);
+ masklay_shape_tmp_rekey = BKE_mask_layer_shape_verify_frame(masklay, masklay_shape_tmp->frame);
BKE_mask_layer_shape_from_mask(masklay, masklay_shape_tmp_rekey);
masklay_shape_tmp_rekey->flag = masklay_shape_tmp->flag & MASK_SHAPE_SELECT;
}
@@ -376,7 +376,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
}
/* re-evaluate */
- BKE_mask_layer_evaluate(masklay, frame, TRUE);
+ BKE_mask_layer_evaluate(masklay, frame, true);
}
}
@@ -417,7 +417,7 @@ void ED_mask_layer_shape_auto_key(MaskLayer *masklay, const int frame)
{
MaskLayerShape *masklay_shape;
- masklay_shape = BKE_mask_layer_shape_varify_frame(masklay, frame);
+ masklay_shape = BKE_mask_layer_shape_verify_frame(masklay, frame);
BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
}
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index 97da0047793..ddb58cd6c7b 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -131,6 +131,7 @@ static bool edbm_bevel_calc(wmOperator *op)
BMEditMesh *em = opdata->em;
BMOperator bmop;
const float offset = RNA_float_get(op->ptr, "offset");
+ const int offset_type = RNA_enum_get(op->ptr, "offset_type");
const int segments = RNA_int_get(op->ptr, "segments");
const bool vertex_only = RNA_boolean_get(op->ptr, "vertex_only");
@@ -140,8 +141,8 @@ static bool edbm_bevel_calc(wmOperator *op)
}
EDBM_op_init(em, &bmop, op,
- "bevel geom=%hev offset=%f segments=%i vertex_only=%b",
- BM_ELEM_SELECT, offset, segments, vertex_only);
+ "bevel geom=%hev offset=%f segments=%i vertex_only=%b offset_type=%i",
+ BM_ELEM_SELECT, offset, segments, vertex_only, offset_type);
BMO_op_exec(em->bm, &bmop);
@@ -185,7 +186,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op)
op->customdata = NULL;
}
-static int edbm_bevel_cancel(bContext *C, wmOperator *op)
+static void edbm_bevel_cancel(bContext *C, wmOperator *op)
{
BevelData *opdata = op->customdata;
if (opdata->is_modal) {
@@ -197,7 +198,6 @@ static int edbm_bevel_cancel(bContext *C, wmOperator *op)
/* need to force redisplay or we may still view the modified result */
ED_region_tag_redraw(CTX_wm_region(C));
- return OPERATOR_CANCELLED;
}
/* bevel! yay!!*/
@@ -257,12 +257,14 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static float edbm_bevel_mval_factor(wmOperator *op, const wmEvent *event)
{
BevelData *opdata = op->customdata;
- int use_dist = true;
+ bool use_dist = true;
+ bool is_percent = false;
float mdiff[2];
float factor;
mdiff[0] = opdata->mcenter[0] - event->mval[0];
mdiff[1] = opdata->mcenter[1] - event->mval[1];
+ is_percent = (RNA_enum_get(op->ptr, "offset_type") == BEVEL_AMT_PERCENT);
if (use_dist) {
factor = ((len_v2(mdiff) - MVAL_PIXEL_MARGIN) - opdata->initial_length) * opdata->pixel_size;
@@ -287,7 +289,13 @@ static float edbm_bevel_mval_factor(wmOperator *op, const wmEvent *event)
if (factor < 0.0f) factor = 0.0f;
}
else {
- CLAMP(factor, 0.0f, 1.0f);
+ if (is_percent) {
+ factor *= 100.0f;
+ CLAMP(factor, 0.0f, 100.0f);
+ }
+ else {
+ CLAMP(factor, 0.0f, 1.0f);
+ }
}
return factor;
@@ -362,6 +370,14 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
void MESH_OT_bevel(wmOperatorType *ot)
{
+ static EnumPropertyItem offset_type_items[] = {
+ {BEVEL_AMT_OFFSET, "OFFSET", 0, "Offset", "Amount is offset of new edges from original"},
+ {BEVEL_AMT_WIDTH, "WIDTH", 0, "Width", "Amount is width of new face"},
+ {BEVEL_AMT_DEPTH, "DEPTH", 0, "Depth", "Amount is perpendicular distance from original edge to bevel face"},
+ {BEVEL_AMT_PERCENT, "PERCENT", 0, "Percent", "Amount is percent of adjacent edge length"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
/* identifiers */
ot->name = "Bevel";
ot->description = "Edge Bevel";
@@ -377,7 +393,8 @@ void MESH_OT_bevel(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING;
- RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Offset", "", 0.0f, 1.0f);
+ RNA_def_enum(ot->srna, "offset_type", offset_type_items, 0, "Amount Type", "What distance Amount measures");
+ RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Amount", "", 0.0f, 1.0f);
RNA_def_int(ot->srna, "segments", 1, 1, 50, "Segments", "Segments for curved edge", 1, 8);
RNA_def_boolean(ot->srna, "vertex_only", false, "Vertex only", "Bevel only vertices");
}
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index eb66cf50a1e..137554459ce 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -166,7 +166,7 @@ static void edbm_inset_exit(bContext *C, wmOperator *op)
MEM_freeN(op->customdata);
}
-static int edbm_inset_cancel(bContext *C, wmOperator *op)
+static void edbm_inset_cancel(bContext *C, wmOperator *op)
{
InsetData *opdata;
@@ -180,7 +180,6 @@ static int edbm_inset_cancel(bContext *C, wmOperator *op)
/* need to force redisplay or we may still view the modified result */
ED_region_tag_redraw(CTX_wm_region(C));
- return OPERATOR_CANCELLED;
}
static bool edbm_inset_calc(wmOperator *op)
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 5d8851640e0..de57d24640f 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -76,6 +76,7 @@
#define KNIFE_FLT_EPS 0.00001f
#define KNIFE_FLT_EPS_SQUARED (KNIFE_FLT_EPS * KNIFE_FLT_EPS)
+#define KNIFE_FLT_EPSBIG 0.001f
typedef struct KnifeColors {
unsigned char line[3];
@@ -111,16 +112,20 @@ typedef struct KnifeEdge {
bool draw;
} KnifeEdge;
-typedef struct BMEdgeHit {
- KnifeEdge *kfe;
+typedef struct KnifeLineHit {
float hit[3], cagehit[3];
- float realhit[3]; /* used in midpoint mode */
float schit[2];
float l; /* lambda along cut line */
float perc; /* lambda along hit line */
- KnifeVert *v; /* set if snapped to a vert */
+ float m; /* depth front-to-back */
+
+ /* Exactly one of kfe, v, or f should be non-NULL,
+ * saying whether cut line crosses and edge,
+ * is snapped to a vert, or is in the middle of some face. */
+ KnifeEdge *kfe;
+ KnifeVert *v;
BMFace *f;
-} BMEdgeHit;
+} KnifeLineHit;
typedef struct KnifePosData {
float co[3];
@@ -152,8 +157,8 @@ typedef struct KnifeTool_OpData {
GHash *origvertmap;
GHash *origedgemap;
-
GHash *kedgefacemap;
+ GHash *facetrimap;
BMBVHTree *bmbvh;
@@ -164,7 +169,7 @@ typedef struct KnifeTool_OpData {
float ethresh;
/* used for drag-cutting */
- BMEdgeHit *linehits;
+ KnifeLineHit *linehits;
int totlinehit;
/* Data for mouse-position-derived data (cur) and previous click (prev) */
@@ -198,7 +203,7 @@ typedef struct KnifeTool_OpData {
} mode;
int prevmode;
- bool snap_midpoints, extend;
+ bool snap_midpoints;
bool ignore_edge_snapping;
bool ignore_vert_snapping;
@@ -215,13 +220,11 @@ typedef struct KnifeTool_OpData {
static ListBase *knife_get_face_kedges(KnifeTool_OpData *kcd, BMFace *f);
-#if 0
-static void knife_input_ray_cast(KnifeTool_OpData *kcd, const float mval[2],
- float r_origin[3], float r_ray[3]);
-#endif
static void knife_input_ray_segment(KnifeTool_OpData *kcd, const float mval[2], const float ofs,
float r_origin[3], float r_dest[3]);
+static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f);
+
static void knife_update_header(bContext *C, KnifeTool_OpData *kcd)
{
#define HEADER_LENGTH 256
@@ -238,13 +241,6 @@ static void knife_update_header(bContext *C, KnifeTool_OpData *kcd)
ED_area_headerprint(CTX_wm_area(C), header);
}
-#if 0
-BLI_INLINE int round_ftoi(float x)
-{
- return x > 0.0f ? (int)(x + 0.5f) : (int)(x - 0.5f);
-}
-#endif
-
static void knife_project_v2(const KnifeTool_OpData *kcd, const float co[3], float sco[2])
{
ED_view3d_project_float_v2_m4(kcd->ar, co, sco, (float (*)[4])kcd->projmat);
@@ -290,6 +286,12 @@ static Ref *find_ref(ListBase *lb, void *ref)
return NULL;
}
+static void knife_append_list_no_dup(KnifeTool_OpData *kcd, ListBase *lst, void *elem)
+{
+ if (!find_ref(lst, elem))
+ knife_append_list(kcd, lst, elem);
+}
+
static KnifeEdge *new_knife_edge(KnifeTool_OpData *kcd)
{
kcd->totkedge++;
@@ -346,12 +348,17 @@ static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, const float co[3], const
static KnifeVert *get_bm_knife_vert(KnifeTool_OpData *kcd, BMVert *v)
{
KnifeVert *kfv = BLI_ghash_lookup(kcd->origvertmap, v);
+ const float *cageco;
if (!kfv) {
BMIter bmiter;
BMFace *f;
- kfv = new_knife_vert(kcd, v->co, kcd->cagecos[BM_elem_index_get(v)]);
+ if (BM_elem_index_get(v) >= 0)
+ cageco = kcd->cagecos[BM_elem_index_get(v)];
+ else
+ cageco = v->co;
+ kfv = new_knife_vert(kcd, v->co, cageco);
kfv->v = v;
BLI_ghash_insert(kcd->origvertmap, v, kfv);
BM_ITER_ELEM (f, &bmiter, v, BM_FACES_OF_VERT) {
@@ -387,6 +394,45 @@ static KnifeEdge *get_bm_knife_edge(KnifeTool_OpData *kcd, BMEdge *e)
return kfe;
}
+/* Record the index in kcd->em->looptris of first looptri triple for a given face,
+ * given an index for some triple in that array.
+ * This assumes that all of the triangles for a given face are contiguous
+ * in that array (as they are by the current tesselation routines).
+ * Actually store index + 1 in the hash, because 0 looks like "no entry"
+ * to hash lookup routine; will reverse this in the get routine.
+ * Doing this lazily rather than all at once for all faces.
+ */
+static void set_lowest_face_tri(KnifeTool_OpData *kcd, BMFace *f, int index)
+{
+ int i;
+
+ if (BLI_ghash_lookup(kcd->facetrimap, f))
+ return;
+
+ BLI_assert(index >= 0 && index < kcd->em->tottri);
+ BLI_assert(kcd->em->looptris[index][0]->f == f);
+ for (i = index - 1; i >= 0; i--) {
+ if (kcd->em->looptris[i][0]->f != f) {
+ i++;
+ break;
+ }
+ }
+ if (i == -1)
+ i++;
+
+ BLI_ghash_insert(kcd->facetrimap, f, SET_INT_IN_POINTER(i + 1));
+}
+
+/* This should only be called for faces that have had a lowest face tri set by previous function */
+static int get_lowest_face_tri(KnifeTool_OpData *kcd, BMFace *f)
+{
+ int ans;
+
+ ans = GET_INT_FROM_POINTER(BLI_ghash_lookup(kcd->facetrimap, f));
+ BLI_assert(ans != 0);
+ return ans - 1;
+}
+
/* User has just clicked for first time or first time after a restart (E key).
* Copy the current position data into prev. */
static void knife_start_cut(KnifeTool_OpData *kcd)
@@ -430,12 +476,6 @@ static ListBase *knife_get_face_kedges(KnifeTool_OpData *kcd, BMFace *f)
return lst;
}
-/* finds the proper face to restrict face fill to */
-static void knife_find_basef(KnifeEdge *kfe)
-{
- kfe->basef = knife_find_common_face(&kfe->v1->faces, &kfe->v2->faces);
-}
-
static void knife_edge_append_face(KnifeTool_OpData *kcd, KnifeEdge *kfe, BMFace *f)
{
knife_append_list(kcd, knife_get_face_kedges(kcd, f), kfe);
@@ -493,471 +533,272 @@ static KnifeVert *knife_split_edge(KnifeTool_OpData *kcd, KnifeEdge *kfe, float
return newkfe->v2;
}
-/* Make a single KnifeEdge for cut from kcd->prev to kcd->curr.
- * and move cur data to prev. */
-static void knife_add_single_cut(KnifeTool_OpData *kcd)
+/* primary key: lambda along cut
+ * secondary key: lambda along depth
+ * tertiary key: pointer comparisons of verts if both snapped to verts
+ */
+static int linehit_compare(const void *vlh1, const void *vlh2)
{
- KnifeEdge *kfe, *kfe2 = NULL, *kfe3 = NULL;
+ const KnifeLineHit *lh1 = vlh1;
+ const KnifeLineHit *lh2 = vlh2;
- if ((kcd->prev.vert && kcd->prev.vert == kcd->curr.vert) ||
- (kcd->prev.edge && kcd->prev.edge == kcd->curr.edge))
- {
- kcd->prev = kcd->curr;
- return;
- }
-
- kfe = new_knife_edge(kcd);
- kfe->draw = true;
-
- if (kcd->prev.vert) {
- kfe->v1 = kcd->prev.vert;
- }
- else if (kcd->prev.edge) {
- kfe->v1 = knife_split_edge(kcd, kcd->prev.edge, kcd->prev.co, &kfe2);
- }
+ if (lh1->l < lh2->l) return -1;
+ else if (lh1->l > lh2->l) return 1;
else {
- kfe->v1 = new_knife_vert(kcd, kcd->prev.co, kcd->prev.co);
- kfe->v1->draw = kfe->draw = !kcd->prev.is_space;
- kfe->v1->in_space = kcd->prev.is_space;
- kfe->draw = !kcd->prev.is_space;
- kfe->v1->is_face = true;
- if (kfe->v1->draw && kcd->prev.bmface)
- knife_append_list(kcd, &kfe->v1->faces, kcd->prev.bmface);
+ if (lh1->m < lh2->m) return -1;
+ else if (lh1->m > lh2->m) return 1;
+ else {
+ if (lh1->v < lh2->v) return -1;
+ else if (lh1->v > lh2->v) return 1;
+ else return 0;
+ }
}
+}
- if (kcd->curr.vert) {
- kfe->v2 = kcd->curr.vert;
- }
- else if (kcd->curr.edge) {
- kfe->v2 = knife_split_edge(kcd, kcd->curr.edge, kcd->curr.co, &kfe3);
- kcd->curr.vert = kfe->v2;
- }
- else {
- kfe->v2 = new_knife_vert(kcd, kcd->curr.co, kcd->curr.co);
- kfe->v2->draw = !kcd->curr.is_space;
- kfe->v2->is_face = true;
- kfe->v2->in_space = kcd->curr.is_space;
- if (kfe->v2->draw && kcd->curr.bmface)
- knife_append_list(kcd, &kfe->v2->faces, kcd->curr.bmface);
+/*
+ * Sort linehits by distance along cut line, and secondarily from
+ * front to back (from eye), and tertiarily by snap vertex,
+ * and remove any duplicates.
+ */
+static void prepare_linehits_for_cut(KnifeTool_OpData *kcd)
+{
+ KnifeLineHit *linehits, *lhi, *lhj;
+ int i, j, n;
- if (kcd->curr.is_space)
- kfe->draw = false;
+ n = kcd->totlinehit;
+ linehits = kcd->linehits;
+ if (n == 0)
+ return;
- kcd->curr.vert = kfe->v2;
+ qsort(linehits, n, sizeof(KnifeLineHit), linehit_compare);
+
+ /* Remove any edge hits that are preceded or followed
+ * by a vertex hit that is very near. Mark such edge hits using
+ * l == -1 and then do another pass to actually remove.
+ * Also remove all but one of a series of vertex hits for the same vertex. */
+ for (i = 0; i < n; i++) {
+ lhi = &linehits[i];
+ if (lhi->v) {
+ for (j = i - 1; j >= 0; j--) {
+ lhj = &linehits[j];
+ if (!lhj->kfe ||
+ fabsf(lhi->l - lhj->l) > KNIFE_FLT_EPSBIG ||
+ fabsf(lhi->m - lhj->m) > KNIFE_FLT_EPSBIG)
+ {
+ break;
+ }
+ lhj->l = -1.0f;
+ }
+ for (j = i + 1; j < n; j++) {
+ lhj = &linehits[j];
+ if (fabsf(lhi->l - lhj->l) > KNIFE_FLT_EPSBIG ||
+ fabsf(lhi->m - lhj->m) > KNIFE_FLT_EPSBIG)
+ {
+ break;
+ }
+ if (lhj->kfe || lhi->v == lhj->v) {
+ lhj->l = -1.0f;
+ }
+ }
+ }
}
- knife_find_basef(kfe);
-
- knife_add_to_vert_edges(kcd, kfe);
-
- if (kfe->basef && !find_ref(&kfe->faces, kfe->basef))
- knife_edge_append_face(kcd, kfe, kfe->basef);
-
- /* sanity check to make sure we're in the right edge/face lists */
- if (kcd->curr.bmface) {
- if (!find_ref(&kfe->faces, kcd->curr.bmface)) {
- knife_edge_append_face(kcd, kfe, kcd->curr.bmface);
+ /* delete-in-place loop: copying from pos j to pos i+1 */
+ i = 0;
+ j = 1;
+ while (j < n) {
+ lhi = &linehits[i];
+ lhj = &linehits[j];
+ if (lhj->l == -1.0f) {
+ j++; /* skip copying this one */
}
-
- if (kcd->prev.bmface && kcd->prev.bmface != kcd->curr.bmface) {
- if (!find_ref(&kfe->faces, kcd->prev.bmface)) {
- knife_edge_append_face(kcd, kfe, kcd->prev.bmface);
+ else {
+ /* copy unless a no-op */
+ if (lhi->l == -1.0f) {
+ /* could happen if linehits[0] is being deleted */
+ memcpy(&linehits[i], &linehits[j], sizeof(KnifeLineHit));
}
+ else {
+ if (i + 1 != j)
+ memcpy(&linehits[i + 1], &linehits[j], sizeof(KnifeLineHit));
+ i++;
+ }
+ j++;
}
}
-
- /* set up for next cut */
- kcd->prev = kcd->curr;
+ kcd->totlinehit = i + 1;
}
-static int verge_linehit(const void *vlh1, const void *vlh2)
+/* Add hit to list of hits in facehits[f], where facehits is a map, if not already there */
+static void add_hit_to_facehits(KnifeTool_OpData *kcd, GHash *facehits, BMFace *f, KnifeLineHit *hit)
{
- const BMEdgeHit *lh1 = vlh1, *lh2 = vlh2;
+ ListBase *lst = BLI_ghash_lookup(facehits, f);
- if (lh1->l < lh2->l) return -1;
- else if (lh1->l > lh2->l) return 1;
- else if (lh1->v && lh2->v) {
- /* want like verts to sort together; just compare pointers */
- if (lh1->v < lh2->v) return -1;
- else if (lh1->v > lh2->v) return 1;
- else return 0;
+ if (!lst) {
+ lst = knife_empty_list(kcd);
+ BLI_ghash_insert(facehits, f, lst);
}
- else return 0;
+ knife_append_list_no_dup(kcd, lst, hit);
}
-/* If there's a linehit connected (same face) as testi in range [firsti, lasti], return the first such, else -1.
- * It also counts as connected if both linehits are snapped to the same vertex.
- * If testi is out of range, look for connection to f instead, if f is non-NULL */
-static int find_connected_linehit(KnifeTool_OpData *kcd, int testi, BMFace *f, int firsti, int lasti)
+static void knife_add_single_cut(KnifeTool_OpData *kcd, KnifeLineHit *lh1, KnifeLineHit *lh2, BMFace *f)
{
- int i;
- ListBase *testfaces, *ifaces;
- BMFace *testface, *iface;
- BMEdgeHit *lh;
- bool shareface;
-
- if (testi >= 0 && testi < kcd->totlinehit) {
- testface = NULL;
- testfaces = NULL;
- lh = &kcd->linehits[testi];
- if (lh->v)
- testfaces = &lh->v->faces;
- else if (lh->kfe)
- testfaces = &lh->kfe->faces;
- else if (lh->f) {
- testfaces = NULL;
- testface = lh->f;
- }
- }
- else {
- testface = f;
- testfaces = NULL;
- }
- for (i = firsti; i <= lasti; i++) {
- shareface = false;
- lh = &kcd->linehits[i];
- iface = NULL;
- ifaces = NULL;
- if (lh->v)
- ifaces = &lh->v->faces;
- else if (lh->kfe)
- ifaces = &lh->kfe->faces;
- else if (lh->f) {
- ifaces = NULL;
- iface = lh->f;
- }
- if (testfaces) {
- if (ifaces)
- shareface = (knife_find_common_face(testfaces, ifaces) != NULL);
- else if (iface)
- shareface = (find_ref(testfaces, iface) != NULL);
- }
- else if (ifaces) {
- if (testface)
- shareface = (find_ref(ifaces, testface) != NULL);
- }
- else if (testface && iface) {
- shareface = (testface == iface);
- }
- if (shareface)
- return i;
- }
- return -1;
-}
-
-/* Sort in order of distance along cut line.
- * Remove any successive linehits that are snapped to the same vertex.
- * If joinfaces, treat hits at same distance as follows: try to find
- * ordering so that preceding and succeeding hits will share a face.
- */
-static void knife_sort_linehits(KnifeTool_OpData *kcd, bool joinfaces)
-{
- int i, j, k, nexti, nsame;
+ KnifeEdge *kfe, *kfe2;
- qsort(kcd->linehits, kcd->totlinehit, sizeof(BMEdgeHit), verge_linehit);
+ if ((lh1->v && lh1->v == lh2->v) ||
+ (lh1->kfe && lh1->kfe == lh2->kfe))
+ {
+ return;
+ }
- /* Remove duplicated linehits snapped to same vertex */
- i = j = 0; /* loop copies from j to i */
- while (j < kcd->totlinehit) {
- nsame = 0;
- if (kcd->linehits[j].v) {
- for (k = j + 1; k < kcd->totlinehit; k++) {
- if (kcd->linehits[k].v != kcd->linehits[j].v)
- break;
- nsame++;
- }
+ /* Check if edge actually lies within face (might not, if this face is concave) */
+ if (lh1->v && lh2->v) {
+ if (!knife_verts_edge_in_face(lh1->v, lh2->v, f)) {
+ return;
}
- if (i != j)
- kcd->linehits[i] = kcd->linehits[j];
- i++;
- j += 1 + nsame;
}
- kcd->totlinehit = i;
- if (!joinfaces)
- return;
+ kfe = new_knife_edge(kcd);
+ kfe->draw = true;
+ kfe->basef = f;
- /* for ranges of equal "l", swap if neccesary to make predecessor and
- * successor faces connected to the linehits at either end of the range */
- for (i = 0; i < kcd->totlinehit - 1; i = nexti) {
- for (j = i + 1; j < kcd->totlinehit; j++) {
- if (fabsf(kcd->linehits[j].l - kcd->linehits[i].l) > KNIFE_FLT_EPS)
- break;
- }
- nexti = j;
- j--;
- nsame = j - i;
- if (nsame > 0) {
- /* find something connected to predecessor of equal range */
- k = find_connected_linehit(kcd, i - 1, kcd->prev.bmface, i, j);
- if (k != -1) {
- if (k != i) {
- SWAP(BMEdgeHit, kcd->linehits[i], kcd->linehits[k]);
- }
- i++;
- nsame--;
- }
- if (nsame > 0) {
- /* find something connected to successor of equal range */
- k = find_connected_linehit(kcd, j + 1, kcd->curr.bmface, i, j);
- if (k != -1 && k != j) {
- SWAP(BMEdgeHit, kcd->linehits[j], kcd->linehits[k]);
- }
- }
- /* rest of same range doesn't matter because we won't connect them */
- }
+ if (lh1->v) {
+ kfe->v1 = lh1->v;
+ }
+ else if (lh1->kfe) {
+ kfe->v1 = knife_split_edge(kcd, lh1->kfe, lh1->cagehit, &kfe2);
+ lh1->v = kfe->v1; /* record the KnifeVert for this hit */
+ }
+ else {
+ BLI_assert(lh1->f);
+ kfe->v1 = new_knife_vert(kcd, lh1->hit, lh1->cagehit);
+ kfe->v1->draw = true;
+ kfe->v1->is_face = true;
+ knife_append_list(kcd, &kfe->v1->faces, lh1->f);
+ lh1->v = kfe->v1; /* record the KnifeVert for this hit */
}
-}
-static void knife_add_single_cut_through(KnifeTool_OpData *kcd, KnifeVert *v1, KnifeVert *v2, BMFace *f)
-{
- KnifeEdge *kfenew;
+ if (lh2->v) {
+ kfe->v2 = lh2->v;
+ }
+ else if (lh2->kfe) {
+ kfe->v2 = knife_split_edge(kcd, lh2->kfe, lh2->cagehit, &kfe2);
+ lh2->v = kfe->v2; /* future uses of lh2 won't split again */
+ }
+ else {
+ BLI_assert(lh2->f);
+ kfe->v2 = new_knife_vert(kcd, lh2->hit, lh2->cagehit);
+ kfe->v2->draw = true;
+ kfe->v2->is_face = true;
+ knife_append_list(kcd, &kfe->v2->faces, lh2->f);
+ lh2->v = kfe->v2; /* record the KnifeVert for this hit */
+ }
- kfenew = new_knife_edge(kcd);
- kfenew->basef = f;
- kfenew->v1 = v1;
- kfenew->v2 = v2;
- kfenew->draw = true;
+ knife_add_to_vert_edges(kcd, kfe);
- knife_add_to_vert_edges(kcd, kfenew);
+ /* TODO: check if this is ever needed */
+ if (kfe->basef && !find_ref(&kfe->faces, kfe->basef))
+ knife_edge_append_face(kcd, kfe, kfe->basef);
- if (!find_ref(&kfenew->faces, f))
- knife_edge_append_face(kcd, kfenew, f);
}
-#if 0
-static void knife_get_vert_faces(KnifeTool_OpData *kcd, KnifeVert *kfv, BMFace *facef, ListBase *lst)
+/* Given a list of KnifeLineHits for one face, sorted by l
+ * and then by m, make the required KnifeVerts and
+ * KnifeEdges.
+ */
+static void knife_cut_face(KnifeTool_OpData *kcd, BMFace *f, ListBase *hits)
{
- BMIter bmiter;
- BMFace *f;
Ref *r;
+ KnifeLineHit *lh, *prevlh;
+ int n;
- if (kfv->is_face && facef) {
- knife_append_list(kcd, lst, facef);
- }
- else if (kfv->v) {
- BM_ITER_ELEM (f, &bmiter, kfv->v, BM_FACES_OF_VERT) {
- knife_append_list(kcd, lst, f);
- }
- }
- else {
- for (r = kfv->faces.first; r; r = r->next) {
- knife_append_list(kcd, lst, r->ref);
- }
- }
-}
+ (void) kcd;
-static void knife_get_edge_faces(KnifeTool_OpData *kcd, KnifeEdge *kfe, ListBase *lst)
-{
- BMIter bmiter;
- BMFace *f;
+ n = BLI_countlist(hits);
+ if (n < 2)
+ return;
- if (kfe->e) {
- BM_ITER_ELEM (f, &bmiter, kfe->e, BM_FACES_OF_EDGE) {
- knife_append_list(kcd, lst, f);
- }
+ prevlh = NULL;
+ for (r = hits->first; r; r = r->next) {
+ lh = (KnifeLineHit *)r->ref;
+ if (prevlh)
+ knife_add_single_cut(kcd, prevlh, lh, f);
+ prevlh = lh;
}
-}
-#endif
-static void copy_hit_from_posdata(BMEdgeHit *lh, KnifePosData *pos, float lambda)
-{
- lh->kfe = pos->edge;
- lh->v = pos->vert;
- lh->f = pos->bmface;
- copy_v3_v3(lh->hit, pos->co);
- copy_v3_v3(lh->cagehit, pos->cage);
- copy_v3_v3(lh->realhit, pos->co);
- lh->l = lambda;
- /* perc and schit not used by callers of this function */
}
-/* BMESH_TODO: add more functionality to cut-through:
- * - cutting "in face" (e.g., holes) should cut in all faces, not just visible one
- * - perhaps improve O(n^2) algorithm used here */
-static void knife_cut_through(KnifeTool_OpData *kcd)
+/* User has just left-clicked after the first time.
+ * Add all knife cuts implied by line from prev to curr.
+ * If that line crossed edges then kcd->linehits will be non-NULL.
+ * Make all of the KnifeVerts and KnifeEdges implied by this cut.
+ */
+static void knife_add_cut(KnifeTool_OpData *kcd)
{
- BMEdgeHit *lh, *lh2, *linehits;
+ int i;
+ KnifeLineHit *lh;
+ GHash *facehits;
BMFace *f;
- KnifeEdge *kfe, *kfe2;
- KnifeVert *v1, *v2, *lastv;
- ListBase *faces1, *faces2;
- KnifeEdge **splitkfe;
- bool needprev, needcurr;
- int i, j, n;
+ Ref *r;
+ GHashIterator giter;
+ ListBase *lst;
- if (!kcd->totlinehit) {
- /* if no linehits then no interesting back face stuff to do */
- knife_add_single_cut(kcd);
+ prepare_linehits_for_cut(kcd);
+ if (kcd->totlinehit == 0) {
+ kcd->prev = kcd->curr;
return;
}
- /* sort eliminates hits on same vertices */
- knife_sort_linehits(kcd, false);
-
- /* code is cleaner if make prev and curr into hits (if they are on edges or verts) */
- n = kcd->totlinehit;
- needprev = ((kcd->prev.vert && kcd->prev.vert != kcd->linehits[0].v) || kcd->prev.edge);
- needcurr = ((kcd->curr.vert && kcd->curr.vert != kcd->linehits[n - 1].v) || kcd->curr.edge);
- n += needprev + needcurr;
- linehits = MEM_callocN(n * sizeof(BMEdgeHit), "knife_cut_through");
- i = 0;
- if (needprev) {
- copy_hit_from_posdata(&linehits[0], &kcd->prev, 0.0f);
- i++;
- }
- memcpy(linehits + i, kcd->linehits, kcd->totlinehit * sizeof(BMEdgeHit));
- i += kcd->totlinehit;
- if (needcurr)
- copy_hit_from_posdata(&linehits[i], &kcd->curr, 1.0f);
-
-
- splitkfe = MEM_callocN(n * sizeof(KnifeEdge *), "knife_cut_through");
-
- lastv = NULL;
- for (i = 0, lh = linehits; i < n; i++, lh++) {
- kfe = lh->kfe;
- v1 = NULL;
-
- /* get faces incident on hit lh */
+ /* make facehits: map face -> list of linehits touching it */
+ facehits = BLI_ghash_ptr_new("knife facehits");
+ for (i = 0; i < kcd->totlinehit; i++) {
+ lh = &kcd->linehits[i];
+ if (lh->f) {
+ add_hit_to_facehits(kcd, facehits, lh->f, lh);
+ }
if (lh->v) {
- v1 = lh->v;
- faces1 = &v1->faces;
+ for (r = lh->v->faces.first; r; r = r->next) {
+ add_hit_to_facehits(kcd, facehits, r->ref, lh);
+ }
}
- else if (kfe) {
- faces1 = &kfe->faces;
+ if (lh->kfe) {
+ for (r = lh->kfe->faces.first; r; r = r->next) {
+ add_hit_to_facehits(kcd, facehits, r->ref, lh);
+ }
}
+ }
- /* For each following hit, connect if lh1 an lh2 share a face */
- for (j = i + 1, lh2 = lh + 1; j < n; j++, lh2++) {
- kfe2 = lh2->kfe;
- v2 = NULL;
- if (lh2->v) {
- v2 = lh2->v;
- faces2 = &v2->faces;
- }
- else if (kfe2) {
- faces2 = &kfe2->faces;
- }
+ /* Note: as following loop progresses, the 'v' fields of
+ * the linehits will be filled in (as edges are split or
+ * in-face verts are made), so it may be true that both
+ * the v and the kfe or f fields will be non-NULL. */
+ GHASH_ITER (giter, facehits) {
+ f = (BMFace *)BLI_ghashIterator_getKey(&giter);
+ lst = (ListBase *)BLI_ghashIterator_getValue(&giter);
+ knife_cut_face(kcd, f, lst);
+ }
- f = knife_find_common_face(faces1, faces2);
- if (f) {
- if (!v1)
- v1 = splitkfe[i] ? kfe->v1 : knife_split_edge(kcd, kfe, lh->hit, &splitkfe[i]);
- if (!v2)
- v2 = splitkfe[j] ? kfe2->v1 : knife_split_edge(kcd, kfe2, lh2->hit, &splitkfe[j]);
- knife_add_single_cut_through(kcd, v1, v2, f);
- lastv = v2;
- }
- }
+ /* set up for next cut */
+ kcd->prev = kcd->curr;
+ if (kcd->prev.bmface) {
+ /* was "in face" but now we have a KnifeVert it is snapped to */
+ kcd->prev.bmface = NULL;
+ kcd->prev.vert = kcd->linehits[kcd->totlinehit - 1].v;
}
- MEM_freeN(splitkfe);
- MEM_freeN(linehits);
+ BLI_ghash_free(facehits, NULL, NULL);
MEM_freeN(kcd->linehits);
kcd->linehits = NULL;
kcd->totlinehit = 0;
-
- /* set up for next cut */
- kcd->curr.vert = lastv;
- kcd->prev = kcd->curr;
}
-/* User has just left-clicked after the first time.
- * Add all knife cuts implied by line from prev to curr.
- * If that line crossed edges then kcd->linehits will be non-NULL. */
-static void knife_add_cut(KnifeTool_OpData *kcd)
+static void knife_finish_cut(KnifeTool_OpData *kcd)
{
- KnifePosData savcur = kcd->curr;
-
- if (kcd->cut_through) {
- knife_cut_through(kcd);
- }
- else if (kcd->linehits) {
- BMEdgeHit *lh, *lastlh, *firstlh;
- int i;
-
- knife_sort_linehits(kcd, true);
-
- lh = kcd->linehits;
- lastlh = firstlh = NULL;
- for (i = 0; i < kcd->totlinehit; i++, (lastlh = lh), lh++) {
- BMFace *f = lastlh ? lastlh->f : lh->f;
-
- if (lastlh && len_squared_v3v3(lastlh->hit, lh->hit) == 0.0f) {
- if (!firstlh)
- firstlh = lastlh;
- continue;
- }
- else if (lastlh && firstlh) {
- if (firstlh->v || lastlh->v) {
- KnifeVert *kfv = firstlh->v ? firstlh->v : lastlh->v;
-
- kcd->prev.vert = kfv;
- copy_v3_v3(kcd->prev.co, firstlh->hit);
- copy_v3_v3(kcd->prev.cage, firstlh->cagehit);
- kcd->prev.edge = NULL;
- kcd->prev.bmface = f;
- /* TODO: should we set prev.in_space = 0 ? */
- }
- lastlh = firstlh = NULL;
- }
-
- if (len_squared_v3v3(kcd->prev.cage, lh->realhit) < KNIFE_FLT_EPS_SQUARED)
- continue;
- if (len_squared_v3v3(kcd->curr.cage, lh->realhit) < KNIFE_FLT_EPS_SQUARED)
- continue;
-
- /* first linehit may be down face parallel to view */
- if (!lastlh && !lh->v && fabsf(lh->l) < KNIFE_FLT_EPS)
- continue;
-
- if (kcd->prev.is_space) {
- kcd->prev.is_space = 0;
- copy_v3_v3(kcd->prev.co, lh->hit);
- copy_v3_v3(kcd->prev.cage, lh->cagehit);
- kcd->prev.vert = lh->v;
- kcd->prev.edge = lh->kfe;
- kcd->prev.bmface = lh->f;
- continue;
- }
-
- kcd->curr.is_space = 0;
- kcd->curr.edge = lh->kfe;
- kcd->curr.bmface = lh->f;
- kcd->curr.vert = lh->v;
- copy_v3_v3(kcd->curr.co, lh->hit);
- copy_v3_v3(kcd->curr.cage, lh->cagehit);
-
- /* don't draw edges down faces parallel to view */
- if (lastlh && fabsf(lastlh->l - lh->l) < KNIFE_FLT_EPS) {
- kcd->prev = kcd->curr;
- continue;
- }
-
- knife_add_single_cut(kcd);
- }
-
- if (savcur.is_space) {
- kcd->prev = savcur;
- }
- else {
- kcd->curr = savcur;
- knife_add_single_cut(kcd);
- }
-
+ if (kcd->linehits) {
MEM_freeN(kcd->linehits);
kcd->linehits = NULL;
kcd->totlinehit = 0;
}
- else {
- knife_add_single_cut(kcd);
- }
-}
-
-static void knife_finish_cut(KnifeTool_OpData *UNUSED(kcd))
-{
-
}
static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd)
@@ -1101,6 +942,24 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
glLineWidth(1.0);
}
+ if (kcd->prev.vert) {
+ glColor3ubv(kcd->colors.point);
+ glPointSize(11);
+
+ glBegin(GL_POINTS);
+ glVertex3fv(kcd->prev.cage);
+ glEnd();
+ }
+
+ if (kcd->prev.bmface) {
+ glColor3ubv(kcd->colors.curpoint);
+ glPointSize(9);
+
+ glBegin(GL_POINTS);
+ glVertex3fv(kcd->prev.cage);
+ glEnd();
+ }
+
if (kcd->curr.edge) {
glColor3ubv(kcd->colors.edge);
glLineWidth(2.0);
@@ -1131,10 +990,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
}
if (kcd->totlinehit > 0) {
- const float vthresh4 = kcd->vthresh / 4.0f;
- const float vthresh4_sq = vthresh4 * vthresh4;
-
- BMEdgeHit *lh;
+ KnifeLineHit *lh;
int i;
glEnable(GL_BLEND);
@@ -1146,22 +1002,8 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
glBegin(GL_POINTS);
lh = kcd->linehits;
for (i = 0; i < kcd->totlinehit; i++, lh++) {
- float sv1[2], sv2[2];
-
- knife_project_v2(kcd, lh->kfe->v1->cageco, sv1);
- knife_project_v2(kcd, lh->kfe->v2->cageco, sv2);
- knife_project_v2(kcd, lh->cagehit, lh->schit);
-
- if (len_squared_v2v2(lh->schit, sv1) < vthresh4_sq) {
- copy_v3_v3(lh->cagehit, lh->kfe->v1->cageco);
- glVertex3fv(lh->cagehit);
- lh->v = lh->kfe->v1;
- }
- else if (len_squared_v2v2(lh->schit, sv2) < vthresh4_sq) {
- copy_v3_v3(lh->cagehit, lh->kfe->v2->cageco);
+ if (lh->v)
glVertex3fv(lh->cagehit);
- lh->v = lh->kfe->v2;
- }
}
glEnd();
@@ -1171,7 +1013,8 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
glBegin(GL_POINTS);
lh = kcd->linehits;
for (i = 0; i < kcd->totlinehit; i++, lh++) {
- glVertex3fv(lh->cagehit);
+ if (!lh->v)
+ glVertex3fv(lh->cagehit);
}
glEnd();
glDisable(GL_BLEND);
@@ -1224,274 +1067,72 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
-static float len_v3_tri_side_max(const float v1[3], const float v2[3], const float v3[3])
-{
- const float s1 = len_squared_v3v3(v1, v2);
- const float s2 = len_squared_v3v3(v2, v3);
- const float s3 = len_squared_v3v3(v3, v1);
-
- return sqrtf(max_fff(s1, s2, s3));
-}
-
-/**
- * given a tri, return 3 planes aligned with the tri's normal.
- *
- * If the triangle were extruded along its normal,
- * the planes calculated would be the 3 sides around the extrusion.
- */
-static void plane_from_tri_clip3_v3(
- float tri_plane_clip[3][4],
- const float v0[3], const float v1[3], const float v2[3])
-{
- float tri_norm[3];
- float tvec[3], cross[3];
-
- normal_tri_v3(tri_norm, v0, v1, v2);
-
- sub_v3_v3v3(tvec, v0, v1);
- cross_v3_v3v3(cross, tvec, tri_norm);
- plane_from_point_normal_v3(tri_plane_clip[0], v0, cross);
-
- sub_v3_v3v3(tvec, v1, v2);
- cross_v3_v3v3(cross, tvec, tri_norm);
- plane_from_point_normal_v3(tri_plane_clip[1], v1, cross);
-
- sub_v3_v3v3(tvec, v2, v0);
- cross_v3_v3v3(cross, tvec, tri_norm);
- plane_from_point_normal_v3(tri_plane_clip[2], v2, cross);
-}
-
-/**
- * Given a line that is planar with a tri, clip the segment by that tri.
- *
- * This is needed so we end up with both points in the triangle.
- */
-static bool isect_line_tri_coplanar_v3(
- const float p1[3], const float p2[3],
- const float v0[3], const float v1[3], const float v2[3],
- float r_isects[2][3],
-
- /* avoid re-calculating every time */
- float tri_plane[4], float tri_plane_clip[3][4])
-{
- float p1_tmp[3] = {UNPACK3(p1)};
- float p2_tmp[3] = {UNPACK3(p2)};
-
- (void)v0, (void)v1, (void)v2;
-
- /* first check if the points are planar with the tri */
- if ((fabsf(dist_squared_to_plane_v3(p1, tri_plane)) < KNIFE_FLT_EPS_SQUARED) &&
- (fabsf(dist_squared_to_plane_v3(p2, tri_plane)) < KNIFE_FLT_EPS_SQUARED) &&
- /* clip the segment by planes around the triangle so we can be sure the points
- * aren't outside the triangle */
- (clip_segment_v3_plane_n(p1_tmp, p2_tmp, tri_plane_clip, 3)))
- {
- copy_v3_v3(r_isects[0], p1_tmp);
- copy_v3_v3(r_isects[1], p2_tmp);
-
- return true;
- }
- else {
- return false;
- }
-}
-
-static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
- const float v1[3], const float v2[3], const float v3[3],
- SmallHash *ehash, bglMats *mats, int *count)
-{
- BVHTree *tree2 = BLI_bvhtree_new(3, FLT_EPSILON * 4, 8, 8), *tree = BKE_bmbvh_tree_get(bmtree);
- BMEdgeHit *edges = NULL;
- BLI_array_declare(edges);
- BVHTreeOverlap *results, *result;
- BMLoop **ls;
- float cos[9], tri_norm[3], tri_plane[4], isects[2][3], lambda;
- float tri_plane_clip[3][4];
- unsigned int tot = 0;
- int i, j, n_isects;
-
-
- /* for comparing distances, error of intersection depends on triangle scale.
- * need to scale down before squaring for accurate comparison */
- const float depsilon = (FLT_EPSILON / 2.0f) * len_v3_tri_side_max(v1, v2, v3);
- const float depsilon_sq = depsilon * depsilon;
-
- copy_v3_v3(cos + 0, v1);
- copy_v3_v3(cos + 3, v2);
- copy_v3_v3(cos + 6, v3);
-
- /* avoid re-calculation in #isect_line_tri_coplanar_v3 */
- normal_tri_v3(tri_norm, v1, v2, v3);
- plane_from_point_normal_v3(tri_plane, v1, tri_norm);
- plane_from_tri_clip3_v3(tri_plane_clip, v1, v2, v3);
-
- BLI_bvhtree_insert(tree2, 0, cos, 3);
- BLI_bvhtree_balance(tree2);
-
- result = results = BLI_bvhtree_overlap(tree, tree2, &tot);
-
- for (i = 0; i < tot; i++, result++) {
- BMLoop *l1;
- BMFace *f_hit;
- ListBase *lst;
- Ref *ref;
-
- ls = (BMLoop **)kcd->em->looptris[result->indexA];
-
- l1 = ls[0];
- lst = knife_get_face_kedges(kcd, l1->f);
-
- for (ref = lst->first; ref; ref = ref->next) {
- KnifeEdge *kfe = ref->ref;
-
- if (BLI_smallhash_haskey(ehash, (uintptr_t)kfe)) {
- continue; /* We already found a hit on this knife edge */
- }
+/* Find intersection of v1-v2 with face f.
+ * Only take intersections that are at least face_tol (in screen space) away
+ * from other intersection elements.
+ * If v1-v2 is coplanar with f, call that "no intersection though
+ * it really means "infinite number of intersections".
+ * In such a case we should have gotten hits on edges or verts of the face. */
+static bool knife_ray_intersect_face(KnifeTool_OpData *kcd,
+ const float s[2],
+ const float v1[2], const float v2[2],
+ BMFace *f,
+ const float face_tol,
+ float intersectp[3])
+{
+ int tottri, tri_i;
+ float lv1[3], lv2[3], lv3[3], raydir[3];
+ float tri_norm[3], tri_plane[4];
+ float se1[2], se2[2];
+ float d, lambda;
+ BMLoop **tri;
+ ListBase *lst;
+ Ref *ref;
+ KnifeEdge *kfe;
- n_isects = 0;
+ sub_v3_v3v3(raydir, v2, v1);
+ normalize_v3(raydir);
+ tri_i = get_lowest_face_tri(kcd, f);
+ tottri = kcd->em->tottri;
+ BLI_assert(tri_i >= 0 && tri_i < tottri);
- if (isect_line_tri_coplanar_v3(kfe->v1->cageco, kfe->v2->cageco, v1, v2, v3,
- isects,
- /* cached values */
- tri_plane, tri_plane_clip))
- {
- /* both kfe ends are in cutting triangle */
- n_isects = 2;
- }
- else if (isect_line_tri_epsilon_v3(kfe->v1->cageco, kfe->v2->cageco, v1, v2, v3,
- &lambda, NULL, depsilon))
+ for (; tri_i < tottri; tri_i++) {
+ tri = kcd->em->looptris[tri_i];
+ if (tri[0]->f != f)
+ break;
+ copy_v3_v3(lv1, kcd->cagecos[BM_elem_index_get(tri[0]->v)]);
+ copy_v3_v3(lv2, kcd->cagecos[BM_elem_index_get(tri[1]->v)]);
+ copy_v3_v3(lv3, kcd->cagecos[BM_elem_index_get(tri[2]->v)]);
+ /* using epsilon test in case ray is directly through an internal
+ * tesselation edge and might not hit either tesselation tri with
+ * an exact test;
+ * we will exclude hits near real edges by a later test */
+ if (isect_ray_tri_epsilon_v3(v1, raydir, lv1, lv2, lv3, &lambda, NULL, KNIFE_FLT_EPS)) {
+ /* check if line coplanar with tri */
+ normal_tri_v3(tri_norm, lv1, lv2, lv3);
+ plane_from_point_normal_v3(tri_plane, lv1, tri_norm);
+ if ((fabsf(dist_squared_to_plane_v3(v1, tri_plane)) < KNIFE_FLT_EPS) &&
+ (fabsf(dist_squared_to_plane_v3(v2, tri_plane)) < KNIFE_FLT_EPS))
{
- /* kfe intersects cutting triangle lambda of the way along kfe */
- interp_v3_v3v3(isects[0], kfe->v1->cageco, kfe->v2->cageco, lambda);
- n_isects = 1;
+ return false;
}
-
- for (j = 0; j < n_isects; j++) {
- float p[3];
-
- copy_v3_v3(p, isects[j]);
- if (kcd->curr.vert && len_squared_v3v3(kcd->curr.vert->cageco, p) < depsilon_sq) {
- continue;
- }
- if (kcd->prev.vert && len_squared_v3v3(kcd->prev.vert->cageco, p) < depsilon_sq) {
- continue;
- }
- if (len_squared_v3v3(kcd->prev.cage, p) < depsilon_sq ||
- len_squared_v3v3(kcd->curr.cage, p) < depsilon_sq)
- {
- continue;
- }
- if ((kcd->vc.rv3d->rflag & RV3D_CLIPPING) &&
- ED_view3d_clipping_test(kcd->vc.rv3d, p, true))
- {
- continue;
- }
-
- if (kcd->cut_through) {
- f_hit = NULL;
- }
- else {
- /* check if this point is visible in the viewport */
- float p1[3], no[3], view[3], sp[2];
- float lambda1;
-
- /* screen projection */
- knife_project_v2(kcd, p, sp);
- ED_view3d_unproject(mats, view, sp[0], sp[1], 0.0f);
- mul_m4_v3(kcd->ob->imat, view);
-
- /* if face isn't planer, p may be behind the current tesselated tri,
- * so move it onto that and then a little towards eye */
- if (isect_line_tri_v3(p, view, ls[0]->v->co, ls[1]->v->co, ls[2]->v->co, &lambda1, NULL)) {
- interp_v3_v3v3(p1, p, view, lambda1);
- }
- else {
- copy_v3_v3(p1, p);
- }
- sub_v3_v3(view, p1);
- normalize_v3(view);
-
- copy_v3_v3(no, view);
- mul_v3_fl(no, 0.003);
-
- /* go towards view a bit */
- add_v3_v3(p1, no);
-
- /* ray cast */
- f_hit = BKE_bmbvh_ray_cast(bmtree, p1, no, KNIFE_FLT_EPS, NULL, NULL, NULL);
- }
-
- /* ok, if visible add the new point */
- if (!f_hit && !BLI_smallhash_haskey(ehash, (uintptr_t)kfe)) {
- BMEdgeHit hit;
-
- if (len_squared_v3v3(p, kcd->curr.co) < depsilon_sq ||
- len_squared_v3v3(p, kcd->prev.co) < depsilon_sq)
- {
- continue;
- }
-
- hit.kfe = kfe;
- hit.v = NULL;
- hit.l = 0.0f;
-
- knife_find_basef(kfe);
- hit.f = kfe->basef;
- hit.perc = len_v3v3(p, kfe->v1->cageco) / len_v3v3(kfe->v1->cageco, kfe->v2->cageco);
- copy_v3_v3(hit.cagehit, p);
-
- interp_v3_v3v3(p, kfe->v1->co, kfe->v2->co, hit.perc);
- copy_v3_v3(hit.realhit, p);
-
- if (kcd->snap_midpoints) {
- float perc = hit.perc;
-
- /* select the closest from the edge endpoints or the midpoint */
- if (perc < 0.25f) {
- perc = 0.0f;
- }
- else if (perc < 0.75f) {
- perc = 0.5f;
- }
- else {
- perc = 1.0f;
- }
-
- interp_v3_v3v3(hit.hit, kfe->v1->co, kfe->v2->co, perc);
- interp_v3_v3v3(hit.cagehit, kfe->v1->cageco, kfe->v2->cageco, perc);
- }
- else if (hit.perc < KNIFE_FLT_EPS || hit.perc > 1.0f - KNIFE_FLT_EPS) {
- /* snap to vert */
- hit.v = (hit.perc < KNIFE_FLT_EPS) ? kfe->v1 : kfe->v2;
- copy_v3_v3(hit.hit, hit.v->co);
- copy_v3_v3(hit.cagehit, hit.v->co);
- }
- else {
- copy_v3_v3(hit.hit, p);
- }
- knife_project_v2(kcd, hit.cagehit, hit.schit);
-
- BLI_array_append(edges, hit);
- BLI_smallhash_insert(ehash, (uintptr_t)kfe, NULL);
+ copy_v3_v3(intersectp, v1);
+ madd_v3_v3fl(intersectp, raydir, lambda);
+ /* Now check that far enough away from verts and edges */
+ lst = knife_get_face_kedges(kcd, f);
+ for (ref = lst->first; ref; ref = ref->next) {
+ kfe = ref->ref;
+ knife_project_v2(kcd, kfe->v1->cageco, se1);
+ knife_project_v2(kcd, kfe->v2->cageco, se2);
+ d = dist_to_line_segment_v2(s, se1, se2);
+ if (d < face_tol) {
+ return false;
}
}
+ return true;
}
}
-
- if (results)
- MEM_freeN(results);
-
- BLI_bvhtree_free(tree2);
- *count = BLI_array_count(edges);
-
- return edges;
-}
-
-static void knife_bgl_get_mats(KnifeTool_OpData *UNUSED(kcd), bglMats *mats)
-{
- bgl_get_mats(mats);
- //copy_m4_m4(mats->modelview, kcd->vc.rv3d->viewmat);
- //copy_m4_m4(mats->projection, kcd->vc.rv3d->winmat);
+ return false;
}
/* Calculate maximum excursion from (0,0,0) of mesh */
@@ -1510,6 +1151,43 @@ static void calc_ortho_extent(KnifeTool_OpData *kcd)
kcd->ortho_extent = max_xyz;
}
+/* Check if p is visible (not clipped, not occluded by another face).
+ * s in screen projection of p. */
+static bool point_is_visible(KnifeTool_OpData *kcd, const float p[3], const float s[2], bglMats *mats)
+{
+ float p1[3], no[3], view[3];
+ BMFace *f_hit;
+
+ /* If not cutting through, make sure no face is in front of p */
+ if (!kcd->cut_through) {
+ /* TODO: I think there's a simpler way to get the required raycast ray */
+ ED_view3d_unproject(mats, view, s[0], s[1], 0.0f);
+ mul_m4_v3(kcd->ob->imat, view);
+
+ /* make p1 a little towards view, so ray doesn't hit p's face. */
+ copy_v3_v3(p1, p);
+ sub_v3_v3(view, p1);
+ normalize_v3(view);
+ copy_v3_v3(no, view);
+ mul_v3_fl(no, 3.0f * KNIFE_FLT_EPSBIG);
+ add_v3_v3(p1, no);
+
+ /* see if there's a face hit between p1 and the view */
+ f_hit = BKE_bmbvh_ray_cast(kcd->bmbvh, p1, no, KNIFE_FLT_EPS, NULL, NULL, NULL);
+ if (f_hit)
+ return false;
+ }
+
+ /* If box clipping on, make sure p is not clipped */
+ if (kcd->vc.rv3d->rflag & RV3D_CLIPPING &&
+ ED_view3d_clipping_test(kcd->vc.rv3d, p, true))
+ {
+ return false;
+ }
+
+ return true;
+}
+
/* Clip the line (v1, v2) to planes perpendicular to it and distances d from
* the closest point on the line to the origin */
static void clip_to_ortho_planes(float v1[3], float v2[3], float d)
@@ -1522,16 +1200,49 @@ static void clip_to_ortho_planes(float v1[3], float v2[3], float d)
dist_ensure_v3_v3fl(v2, closest, d);
}
+static void set_linehit_depth(KnifeTool_OpData *kcd, KnifeLineHit *lh)
+{
+ float vnear[3], vfar[3];
+
+ ED_view3d_win_to_segment(kcd->ar, kcd->vc.v3d, lh->schit, vnear, vfar, true);
+ mul_m4_v3(kcd->ob->imat, vnear);
+ if (kcd->is_ortho) {
+ if (kcd->ortho_extent == 0.0f)
+ calc_ortho_extent(kcd);
+ clip_to_ortho_planes(vnear, vfar, kcd->ortho_extent + 10.0f);
+ }
+ lh->m = len_v3v3(vnear, lh->cagehit);
+}
+
/* Finds visible (or all, if cutting through) edges that intersects the current screen drag line */
static void knife_find_line_hits(KnifeTool_OpData *kcd)
{
bglMats mats;
- BMEdgeHit *e1, *e2;
- SmallHash hash, *ehash = &hash;
- float v1[3], v2[3], v3[3], v4[4], s1[2], s2[2];
- int i, c1, c2;
+ SmallHash faces, kfes, kfvs;
+ float v1[3], v2[3], v3[3], v4[3], s1[2], s2[2];
+ BVHTree *planetree, *tree;
+ BVHTreeOverlap *results, *result;
+ BMLoop **ls;
+ BMFace *f;
+ KnifeEdge *kfe;
+ KnifeVert *v;
+ ListBase *lst;
+ Ref *ref;
+ KnifeLineHit *linehits = NULL;
+ BLI_array_declare(linehits);
+ SmallHashIter hiter;
+ KnifeLineHit hit;
+ void *val;
+ float plane_cos[12];
+ float s[2], se1[2], se2[2], sint[2];
+ float p[3], p2[3], r1[3], r2[3];
+ float d, d1, d2, lambda;
+ float vert_tol, vert_tol_sq, line_tol, face_tol;
+ int isect_kind;
+ unsigned int tot;
+ int i;
- knife_bgl_get_mats(kcd, &mats);
+ bgl_get_mats(&mats);
if (kcd->linehits) {
MEM_freeN(kcd->linehits);
@@ -1568,7 +1279,7 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
/* numeric error, 'v1' -> 'v2', 'v2' -> 'v4' can end up being ~2000 units apart in otho mode
* (from ED_view3d_win_to_segment_clip() above)
- * this gives precision error in 'knife_edge_tri_isect', rather then solving properly
+ * this gives precision error; rather then solving properly
* (which may involve using doubles everywhere!),
* limit the distance between these points */
if (kcd->is_ortho) {
@@ -1578,70 +1289,176 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
clip_to_ortho_planes(v2, v4, kcd->ortho_extent + 10.0f);
}
- BLI_smallhash_init(ehash);
+ /* First use bvh tree to find faces, knife edges, and knife verts that might
+ * intersect the cut plane with rays v1-v3 and v2-v4.
+ * This deduplicates the candidates before doing more expensive intersection tests. */
+ BLI_smallhash_init(&faces);
+ BLI_smallhash_init(&kfes);
+ BLI_smallhash_init(&kfvs);
+
+ tree = BKE_bmbvh_tree_get(kcd->bmbvh);
+ planetree = BLI_bvhtree_new(4, FLT_EPSILON * 4, 8, 8);
+ copy_v3_v3(plane_cos + 0, v1);
+ copy_v3_v3(plane_cos + 3, v2);
+ copy_v3_v3(plane_cos + 6, v3);
+ copy_v3_v3(plane_cos + 9, v4);
+ BLI_bvhtree_insert(planetree, 0, plane_cos, 4);
+ BLI_bvhtree_balance(planetree);
+
+ results = BLI_bvhtree_overlap(tree, planetree, &tot);
+ if (!results) {
+ BLI_smallhash_release(&faces);
+ BLI_smallhash_release(&kfes);
+ BLI_smallhash_release(&kfvs);
+ BLI_bvhtree_free(planetree);
+ return;
+ }
- /* test two triangles of sceen line's plane */
- e1 = knife_edge_tri_isect(kcd, kcd->bmbvh, v1, v2, v3, ehash, &mats, &c1);
- e2 = knife_edge_tri_isect(kcd, kcd->bmbvh, v2, v3, v4, ehash, &mats, &c2);
- if (c1 && c2) {
- e1 = MEM_reallocN(e1, sizeof(BMEdgeHit) * (c1 + c2));
- memcpy(e1 + c1, e2, sizeof(BMEdgeHit) * c2);
- MEM_freeN(e2);
+ for (i = 0, result = results; i < tot; i++, result++) {
+ ls = (BMLoop **)kcd->em->looptris[result->indexA];
+ f = ls[0]->f;
+ set_lowest_face_tri(kcd, f, result->indexA);
+ /* for faces, store index of lowest hit looptri in hash */
+ if (BLI_smallhash_haskey(&faces, (uintptr_t)f)) {
+ continue;
+ }
+ /* don't care what the value is except that it is non-NULL, for iterator */
+ BLI_smallhash_insert(&faces, (uintptr_t)f, f);
+
+ lst = knife_get_face_kedges(kcd, f);
+ for (ref = lst->first; ref; ref = ref->next) {
+ kfe = ref->ref;
+ if (BLI_smallhash_haskey(&kfes, (uintptr_t)kfe))
+ continue;
+ BLI_smallhash_insert(&kfes, (uintptr_t)kfe, kfe);
+ v = kfe->v1;
+ if (!BLI_smallhash_haskey(&kfvs, (uintptr_t)v))
+ BLI_smallhash_insert(&kfvs, (uintptr_t)v, v);
+ v = kfe->v2;
+ if (!BLI_smallhash_haskey(&kfvs, (uintptr_t)v))
+ BLI_smallhash_insert(&kfvs, (uintptr_t)v, v);
+ }
+ }
+
+ /* Now go through the candidates and find intersections */
+ /* These tolerances, in screen space, are for intermediate hits, as ends are already snapped to screen */
+ vert_tol = KNIFE_FLT_EPS * 2000.0f;
+ line_tol = KNIFE_FLT_EPS * 2000.0f;
+ vert_tol_sq = vert_tol * vert_tol;
+ face_tol = max_ff(vert_tol, line_tol);
+ /* Assume these tolerances swamp floating point rounding errors in calculations below */
+
+ /* first look for vertex hits */
+ for (val = BLI_smallhash_iternew(&kfvs, &hiter, (uintptr_t *)&v); val;
+ val = BLI_smallhash_iternext(&hiter, (uintptr_t *)&v))
+ {
+ knife_project_v2(kcd, v->cageco, s);
+ d = dist_squared_to_line_segment_v2(s, s1, s2);
+ if (d <= vert_tol_sq) {
+ if (point_is_visible(kcd, v->cageco, s, &mats)) {
+ memset(&hit, 0, sizeof(hit));
+ hit.v = v;
+ copy_v3_v3(hit.hit, v->cageco);
+ copy_v3_v3(hit.cagehit, v->cageco);
+ copy_v2_v2(hit.schit, s);
+ set_linehit_depth(kcd, &hit);
+ BLI_array_append(linehits, hit);
+ }
+ }
+ }
+ /* now edge hits; don't add if a vertex at end of edge should have hit */
+ for (val = BLI_smallhash_iternew(&kfes, &hiter, (uintptr_t *)&kfe); val;
+ val = BLI_smallhash_iternext(&hiter, (uintptr_t *)&kfe))
+ {
+ knife_project_v2(kcd, kfe->v1->cageco, se1);
+ knife_project_v2(kcd, kfe->v2->cageco, se2);
+ isect_kind = isect_seg_seg_v2_point(s1, s2, se1, se2, sint);
+ if (isect_kind == -1) {
+ /* isect_seg_seg_v2 doesn't do tolerance test around ends of s1-s2 */
+ closest_to_line_segment_v2(sint, s1, se1, se2);
+ if (len_squared_v2v2(sint, s1) <= vert_tol_sq)
+ isect_kind = 1;
+ else {
+ closest_to_line_segment_v2(sint, s2, se1, se2);
+ if (len_squared_v2v2(sint, s2) <= vert_tol_sq)
+ isect_kind = 1;
+ }
+ }
+ if (isect_kind == 1) {
+ d1 = len_v2v2(sint, se1);
+ d2 = len_v2v2(se2, se1);
+ if (!(d1 <= vert_tol || d2 <= vert_tol || fabsf(d1 - d2) <= vert_tol)) {
+ lambda = d1 / d2;
+ /* Can't just interpolate between ends of kfe because
+ * that doesn't work with perspective transformation.
+ * Need to find 3d intersection of ray through sint */
+ knife_input_ray_segment(kcd, sint, 1.0f, r1, r2);
+ isect_kind = isect_line_line_v3(kfe->v1->cageco, kfe->v2->cageco, r1, r2, p, p2);
+ if (isect_kind >= 1 && point_is_visible(kcd, p, sint, &mats)) {
+ memset(&hit, 0, sizeof(hit));
+ hit.kfe = kfe;
+ copy_v3_v3(hit.hit, p);
+ copy_v3_v3(hit.cagehit, p);
+ copy_v2_v2(hit.schit, sint);
+ hit.perc = lambda;
+ set_linehit_depth(kcd, &hit);
+ BLI_array_append(linehits, hit);
+ }
+ }
+ }
}
- else if (c2) {
- e1 = e2;
+ /* now face hits; don't add if a vertex or edge in face should have hit */
+ for (val = BLI_smallhash_iternew(&faces, &hiter, (uintptr_t *)&f); val;
+ val = BLI_smallhash_iternext(&hiter, (uintptr_t *)&f))
+ {
+ if (knife_ray_intersect_face(kcd, s1, v1, v3, f, face_tol, p)) {
+ if (point_is_visible(kcd, p, s1, &mats)) {
+ memset(&hit, 0, sizeof(hit));
+ hit.f = f;
+ copy_v3_v3(hit.hit, p);
+ copy_v3_v3(hit.cagehit, p);
+ copy_v2_v2(hit.schit, s1);
+ set_linehit_depth(kcd, &hit);
+ BLI_array_append(linehits, hit);
+ }
+ }
+ if (knife_ray_intersect_face(kcd, s2, v2, v4, f, face_tol, p)) {
+ if (point_is_visible(kcd, p, s2, &mats)) {
+ memset(&hit, 0, sizeof(hit));
+ hit.f = f;
+ copy_v3_v3(hit.hit, p);
+ copy_v3_v3(hit.cagehit, p);
+ copy_v2_v2(hit.schit, s2);
+ set_linehit_depth(kcd, &hit);
+ BLI_array_append(linehits, hit);
+ }
+ }
}
- kcd->linehits = e1;
- kcd->totlinehit = c1 + c2;
+ kcd->linehits = linehits;
+ kcd->totlinehit = BLI_array_count(linehits);
/* find position along screen line, used for sorting */
for (i = 0; i < kcd->totlinehit; i++) {
- BMEdgeHit *lh = e1 + i;
+ KnifeLineHit *lh = kcd->linehits + i;
lh->l = len_v2v2(lh->schit, s1) / len_v2v2(s2, s1);
}
- BLI_smallhash_release(ehash);
-}
-
-/* this works but gives numeric problems [#33400] */
-#if 0
-static void knife_input_ray_cast(KnifeTool_OpData *kcd, const float mval[2],
- float r_origin[3], float r_ray[3])
-{
- bglMats mats;
- float imat[3][3];
-
- knife_bgl_get_mats(kcd, &mats);
-
- /* unproject to find view ray */
- ED_view3d_unproject(&mats, r_origin, mval[0], mval[1], 0.0f);
-
- if (kcd->is_ortho) {
- negate_v3_v3(r_ray, kcd->vc.rv3d->viewinv[2]);
- }
- else {
- sub_v3_v3v3(r_ray, r_origin, kcd->vc.rv3d->viewinv[3]);
- }
- normalize_v3(r_ray);
-
- /* transform into object space */
- invert_m4_m4(kcd->ob->imat, kcd->ob->obmat);
- copy_m3_m4(imat, kcd->ob->obmat);
- invert_m3(imat);
-
- mul_m4_v3(kcd->ob->imat, r_origin);
- mul_m3_v3(imat, r_ray);
+ BLI_smallhash_release(&faces);
+ BLI_smallhash_release(&kfes);
+ BLI_smallhash_release(&kfvs);
+ BLI_bvhtree_free(planetree);
+ if (results)
+ MEM_freeN(results);
}
-#endif
static void knife_input_ray_segment(KnifeTool_OpData *kcd, const float mval[2], const float ofs,
float r_origin[3], float r_origin_ofs[3])
{
bglMats mats;
- knife_bgl_get_mats(kcd, &mats);
+ bgl_get_mats(&mats);
/* unproject to find view ray */
ED_view3d_unproject(&mats, r_origin, mval[0], mval[1], 0.0f);
@@ -1757,7 +1574,8 @@ static float knife_snap_size(KnifeTool_OpData *kcd, float maxsize)
}
/* p is closest point on edge to the mouse cursor */
-static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], float cagep[3], BMFace **fptr, bool *is_space)
+static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], float cagep[3],
+ BMFace **fptr, bool *is_space)
{
BMFace *f;
float co[3], cageco[3], sco[2];
@@ -1867,7 +1685,7 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo
/* set p to co, in case we don't find anything, means a face cut */
copy_v3_v3(p, co);
- copy_v3_v3(cagep, p);
+ copy_v3_v3(cagep, cageco);
kcd->curr.bmface = f;
if (f) {
@@ -1989,20 +1807,22 @@ static int knife_update_active(KnifeTool_OpData *kcd)
kcd->curr.vert = knife_find_closest_vert(kcd, kcd->curr.co, kcd->curr.cage, &kcd->curr.bmface, &kcd->curr.is_space);
if (!kcd->curr.vert) {
- kcd->curr.edge = knife_find_closest_edge(kcd, kcd->curr.co, kcd->curr.cage, &kcd->curr.bmface, &kcd->curr.is_space);
+ kcd->curr.edge = knife_find_closest_edge(kcd, kcd->curr.co, kcd->curr.cage,
+ &kcd->curr.bmface, &kcd->curr.is_space);
}
/* if no hits are found this would normally default to (0, 0, 0) so instead
* get a point at the mouse ray closest to the previous point.
* Note that drawing lines in `free-space` isn't properly supported
* but theres no guarantee (0, 0, 0) has any geometry either - campbell */
- if (kcd->curr.vert == NULL && kcd->curr.edge == NULL) {
+ if (kcd->curr.vert == NULL && kcd->curr.edge == NULL && kcd->curr.bmface == NULL) {
float origin[3];
float origin_ofs[3];
knife_input_ray_segment(kcd, kcd->curr.mval, 1.0f, origin, origin_ofs);
closest_to_line_v3(kcd->curr.cage, kcd->prev.cage, origin_ofs, origin);
+ copy_v3_v3(kcd->curr.co, kcd->curr.cage);
}
if (kcd->mode == MODE_DRAGGING) {
@@ -2011,380 +1831,11 @@ static int knife_update_active(KnifeTool_OpData *kcd)
return 1;
}
-#define SCANFILL_CUTS 0
-#if SCANFILL_CUTS
-
-#define MARK 4
-#define DEL 8
-#define VERT_ON_EDGE 16
-#define VERT_ORIG 32
-#define FACE_FLIP 64
-#define BOUNDARY 128
-#define FACE_NEW 256
-
-typedef struct facenet_entry {
- struct facenet_entry *next, *prev;
- KnifeEdge *kfe;
-} facenet_entry;
-
-static void rnd_offset_co(RNG *rng, float co[3], float scale)
-{
- int i;
-
- for (i = 0; i < 3; i++) {
- co[i] += (BLI_rng_get_float(rng) - 0.5) * scale;
- }
-}
-
-static void remerge_faces(KnifeTool_OpData *kcd)
-{
- BMesh *bm = kcd->em->bm;
- SmallHash svisit, *visit = &svisit;
- BMIter iter;
- BMFace *f;
- BMFace **stack = NULL;
- BLI_array_declare(stack);
- BMFace **faces = NULL;
- BLI_array_declare(faces);
- BMOperator bmop;
- int idx;
-
- BMO_op_initf(bm, &bmop, "beautify_fill faces=%ff edges=%Fe", FACE_NEW, BOUNDARY);
-
- BMO_op_exec(bm, &bmop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geom.out", BM_FACE, FACE_NEW);
-
- BMO_op_finish(bm, &bmop);
-
- BLI_smallhash_init(visit);
- BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
- BMIter eiter;
- BMEdge *e;
- BMFace *f2;
-
- if (!BMO_elem_flag_test(bm, f, FACE_NEW))
- continue;
-
- if (BLI_smallhash_haskey(visit, (uintptr_t)f))
- continue;
-
- BLI_array_empty(stack);
- BLI_array_empty(faces);
- BLI_array_append(stack, f);
- BLI_smallhash_insert(visit, (uintptr_t)f, NULL);
-
- do {
- f2 = BLI_array_pop(stack);
-
- BLI_array_append(faces, f2);
-
- BM_ITER_ELEM (e, &eiter, f2, BM_EDGES_OF_FACE) {
- BMIter fiter;
- BMFace *f3;
-
- if (BMO_elem_flag_test(bm, e, BOUNDARY))
- continue;
-
- BM_ITER_ELEM (f3, &fiter, e, BM_FACES_OF_EDGE) {
- if (!BMO_elem_flag_test(bm, f3, FACE_NEW))
- continue;
- if (BLI_smallhash_haskey(visit, (uintptr_t)f3))
- continue;
-
- BLI_smallhash_insert(visit, (uintptr_t)f3, NULL);
- BLI_array_append(stack, f3);
- }
- }
- } while (BLI_array_count(stack) > 0);
-
- if (BLI_array_count(faces) > 0) {
- idx = BM_elem_index_get(faces[0]);
-
- f2 = BM_faces_join(bm, faces, BLI_array_count(faces), true);
- if (f2) {
- BMO_elem_flag_enable(bm, f2, FACE_NEW);
- BM_elem_index_set(f2, idx); /* set_dirty! *//* BMESH_TODO, check if this is valid or not */
- }
- }
- }
- /* BMESH_TODO, check if the code above validates the indices */
- /* bm->elem_index_dirty &= ~BM_FACE; */
- bm->elem_index_dirty |= BM_FACE;
-
- BLI_smallhash_release(visit);
-
- BLI_array_free(stack);
- BLI_array_free(faces);
-}
-
-/* use edgenet to fill faces. this is a bit annoying and convoluted.*/
-static void knifenet_fill_faces(KnifeTool_OpData *kcd)
-{
- ScanFillContext sf_ctx;
- BMesh *bm = kcd->em->bm;
- BMIter bmiter;
- BLI_mempool_iter iter;
- BMFace *f;
- BMEdge *e;
- KnifeVert *kfv;
- KnifeEdge *kfe;
- facenet_entry *entry;
- ListBase *face_nets = MEM_callocN(sizeof(ListBase) * bm->totface, "face_nets");
- BMFace **faces = MEM_callocN(sizeof(BMFace *) * bm->totface, "faces knife");
- MemArena *arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 16), "knifenet_fill_faces");
- SmallHash shash;
- RNG *rng;
- int i, j, k = 0, totface = bm->totface;
-
- BMO_push(bm, NULL);
- bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH);
-
- /* BMESH_TODO this should be valid now, leaving here until we can ensure this - campbell */
- i = 0;
- BM_ITER_MESH (f, &bmiter, bm, BM_FACES_OF_MESH) {
- BM_elem_index_set(f, i); /* set_inline */
- faces[i] = f;
- i++;
- }
- bm->elem_index_dirty &= ~BM_FACE;
-
- BM_ITER_MESH (e, &bmiter, bm, BM_EDGES_OF_MESH) {
- BMO_elem_flag_enable(bm, e, BOUNDARY);
- }
-
- /* turn knife verts into real verts, as necessary */
- BLI_mempool_iternew(kcd->kverts, &iter);
- for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) {
- if (!kfv->v) {
- /* shouldn't we be at least copying the normal? - if not some comment here should explain why - campbell */
- kfv->v = BM_vert_create(bm, kfv->co, NULL, BM_CREATE_NOP);
- kfv->flag = 1;
- BMO_elem_flag_enable(bm, kfv->v, DEL);
- }
- else {
- kfv->flag = 0;
- BMO_elem_flag_enable(bm, kfv->v, VERT_ORIG);
- }
-
- BMO_elem_flag_enable(bm, kfv->v, MARK);
- }
-
- /* we want to only do changed faces. first, go over new edges and add to
- * face net lists.*/
- i = j = k = 0;
- BLI_mempool_iternew(kcd->kedges, &iter);
- for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) {
- Ref *ref;
- if (!kfe->v1 || !kfe->v2 || kfe->v1->inspace || kfe->v2->inspace)
- continue;
-
- i++;
-
- if (kfe->e && kfe->v1->v == kfe->e->v1 && kfe->v2->v == kfe->e->v2) {
- kfe->e_old = kfe->e;
- continue;
- }
-
- j++;
-
- if (kfe->e) {
- kfe->e_old = kfe->e;
-
- BMO_elem_flag_enable(bm, kfe->e, DEL);
- BMO_elem_flag_disable(bm, kfe->e, BOUNDARY);
- kfe->e = NULL;
- }
-
- kfe->e = BM_edge_create(bm, kfe->v1->v, kfe->v2->v, NULL, BM_CREATE_NO_DOUBLE);
- BMO_elem_flag_enable(bm, kfe->e, BOUNDARY);
-
- for (ref = kfe->faces.first; ref; ref = ref->next) {
- f = ref->ref;
-
- entry = BLI_memarena_alloc(arena, sizeof(*entry));
- entry->kfe = kfe;
- BLI_addtail(face_nets + BM_elem_index_get(f), entry);
- }
- }
-
- /* go over original edges, and add to faces with new geometry */
- BLI_mempool_iternew(kcd->kedges, &iter);
- for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) {
- Ref *ref;
-
- if (!kfe->v1 || !kfe->v2 || kfe->v1->inspace || kfe->v2->inspace)
- continue;
- if (!(kfe->e_old && kfe->v1->v == kfe->e_old->v1 && kfe->v2->v == kfe->e_old->v2))
- continue;
-
- k++;
-
- BMO_elem_flag_enable(bm, kfe->e, BOUNDARY);
- kfe->e_old = kfe->e;
-
- for (ref = kfe->faces.first; ref; ref = ref->next) {
- f = ref->ref;
-
- if (face_nets[BM_elem_index_get(f)].first) {
- entry = BLI_memarena_alloc(arena, sizeof(*entry));
- entry->kfe = kfe;
- BLI_addtail(face_nets + BM_elem_index_get(f), entry);
- }
- }
- }
-
- rng = BLI_rng_new(0);
-
- for (i = 0; i < totface; i++) {
- SmallHash *hash = &shash;
- ScanFillFace *sf_tri;
- ScanFillVert *sf_vert, *sf_vert_last;
- int j;
- float rndscale = (KNIFE_FLT_EPS / 4.0f);
-
- f = faces[i];
- BLI_smallhash_init(hash);
-
- if (face_nets[i].first)
- BMO_elem_flag_enable(bm, f, DEL);
-
- BLI_scanfill_begin(&sf_ctx);
-
- for (entry = face_nets[i].first; entry; entry = entry->next) {
- if (!BLI_smallhash_haskey(hash, (uintptr_t)entry->kfe->v1)) {
- sf_vert = BLI_scanfill_vert_add(&sf_ctx, entry->kfe->v1->v->co);
- sf_vert->poly_nr = 0;
- rnd_offset_co(rng, sf_vert->co, rndscale);
- sf_vert->tmp.p = entry->kfe->v1->v;
- BLI_smallhash_insert(hash, (uintptr_t)entry->kfe->v1, sf_vert);
- }
-
- if (!BLI_smallhash_haskey(hash, (uintptr_t)entry->kfe->v2)) {
- sf_vert = BLI_scanfill_vert_add(&sf_ctx, entry->kfe->v2->v->co);
- sf_vert->poly_nr = 0;
- rnd_offset_co(rng, sf_vert->co, rndscale);
- sf_vert->tmp.p = entry->kfe->v2->v;
- BLI_smallhash_insert(hash, (uintptr_t)entry->kfe->v2, sf_vert);
- }
- }
-
- for (j = 0, entry = face_nets[i].first; entry; entry = entry->next, j++) {
- sf_vert_last = BLI_smallhash_lookup(hash, (uintptr_t)entry->kfe->v1);
- sf_vert = BLI_smallhash_lookup(hash, (uintptr_t)entry->kfe->v2);
-
- sf_vert->poly_nr++;
- sf_vert_last->poly_nr++;
- }
-
- for (j = 0, entry = face_nets[i].first; entry; entry = entry->next, j++) {
- sf_vert_last = BLI_smallhash_lookup(hash, (uintptr_t)entry->kfe->v1);
- sf_vert = BLI_smallhash_lookup(hash, (uintptr_t)entry->kfe->v2);
-
- if (sf_vert->poly_nr > 1 && sf_vert_last->poly_nr > 1) {
- ScanFillEdge *sf_edge;
- sf_edge = BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert);
- if (entry->kfe->e_old)
- sf_edge->f = SF_EDGE_BOUNDARY; /* mark as original boundary edge */
-
- BMO_elem_flag_disable(bm, entry->kfe->e->v1, DEL);
- BMO_elem_flag_disable(bm, entry->kfe->e->v2, DEL);
- }
- else {
- if (sf_vert_last->poly_nr < 2)
- BLI_remlink(&sf_ctx.fillvertbase, sf_vert_last);
- if (sf_vert->poly_nr < 2)
- BLI_remlink(&sf_ctx.fillvertbase, sf_vert);
- }
- }
-
- BLI_scanfill_calc(&sf_ctx, 0);
-
- for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
- BMVert *v1 = sf_tri->v3->tmp.p, *v2 = sf_tri->v2->tmp.p, *v3 = sf_tri->v1->tmp.p;
- BMFace *f2;
- BMLoop *l_iter;
- BMVert *verts[3] = {v1, v2, v3};
-
- if (v1 == v2 || v2 == v3 || v1 == v3)
- continue;
- if (BM_face_exists(bm, verts, 3, &f2))
- continue;
-
- f2 = BM_face_create_quad_tri(bm,
- v1, v2, v3, NULL,
- NULL, false);
-
- BMO_elem_flag_enable(bm, f2, FACE_NEW);
-
- l_iter = BM_FACE_FIRST_LOOP(f2);
- do {
- BMO_elem_flag_disable(bm, l_iter->e, DEL);
- } while ((l_iter = l_iter->next) != BM_FACE_FIRST_LOOP(f2));
-
- BMO_elem_flag_disable(bm, f2, DEL);
- BM_elem_index_set(f2, i); /* set_dirty! *//* note, not 100% sure this is dirty? need to check */
-
- BM_face_normal_update(f2);
- if (dot_v3v3(f->no, f2->no) < 0.0f) {
- BM_face_normal_flip(bm, f2);
- }
- }
-
- BLI_scanfill_end(&sf_ctx);
- BLI_smallhash_release(hash);
- }
- bm->elem_index_dirty |= BM_FACE;
-
- /* interpolate customdata */
- BM_ITER_MESH (f, &bmiter, bm, BM_FACES_OF_MESH) {
- BMLoop *l1;
- BMFace *f2;
- BMIter liter1;
-
- if (!BMO_elem_flag_test(bm, f, FACE_NEW))
- continue;
-
- f2 = faces[BM_elem_index_get(f)];
- if (BM_elem_index_get(f) < 0 || BM_elem_index_get(f) >= totface) {
- fprintf(stderr, "%s: face index out of range! (bmesh internal error)\n", __func__);
- }
-
- BM_elem_attrs_copy(bm, bm, f2, f);
-
- BM_ITER_ELEM (l1, &liter1, f, BM_LOOPS_OF_FACE) {
- BM_loop_interp_from_face(bm, l1, f2, true, true);
- }
- }
-
- /* merge triangles back into faces */
- remerge_faces(kcd);
-
- /* delete left over faces */
- BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "delete geom=%ff context=%i", DEL, DEL_ONLYFACES);
- BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "delete geom=%fe context=%i", DEL, DEL_EDGES);
- BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "delete geom=%fv context=%i", DEL, DEL_VERTS);
-
- if (face_nets)
- MEM_freeN(face_nets);
- if (faces)
- MEM_freeN(faces);
- BLI_memarena_free(arena);
- BLI_rng_free(rng);
-
- BMO_error_clear(bm); /* remerge_faces sometimes raises errors, so make sure to clear them */
-
- bmesh_edit_end(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH);
- BMO_pop(bm);
-}
-
-#else /* use direct (non-scanfill) method for cuts */
-
/* sort list of kverts by fraction along edge e */
static void sort_by_frac_along(ListBase *lst, BMEdge *e)
{
/* note, since we know the point is along the edge, sort from distance to v1co */
const float *v1co = e->v1->co;
-// const float *v2co = e->v2->co;
Ref *cur = NULL, *prev = NULL, *next = NULL;
if (lst->first == lst->last)
@@ -2392,11 +1843,7 @@ static void sort_by_frac_along(ListBase *lst, BMEdge *e)
for (cur = ((Ref *)lst->first)->next; cur; cur = next) {
KnifeVert *vcur = cur->ref;
-#if 0
- const float vcur_fac = line_point_factor_v3(vcur->co, v1co, v2co);
-#else
const float vcur_fac = len_squared_v3v3(v1co, vcur->co);
-#endif
next = cur->next;
prev = cur->prev;
@@ -2405,13 +1852,8 @@ static void sort_by_frac_along(ListBase *lst, BMEdge *e)
while (prev) {
KnifeVert *vprev = prev->ref;
-#if 0
- if (line_point_factor_v3(vprev->co, v1co, v2co) <= vcur_fac)
- break;
-#else
if (len_squared_v3v3(v1co, vprev->co) <= vcur_fac)
break;
-#endif
prev = prev->prev;
}
@@ -2745,34 +2187,30 @@ static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, L
}
}
-static bool knife_edge_in_face(KnifeTool_OpData *UNUSED(kcd), KnifeEdge *kfe, BMFace *f)
+static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f)
{
- /* BMesh *bm = kcd->em->bm; */ /* UNUSED */
- BMVert *v1, *v2;
BMLoop *l1, *l2, *l;
float mid[3];
BMIter iter;
int v1inside, v2inside;
- if (!f)
+ if (!f || !v1 || !v2)
return false;
- v1 = kfe->v1->v;
- v2 = kfe->v2->v;
l1 = NULL;
l2 = NULL;
/* find out if v1 and v2, if set, are part of the face */
BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
- if (v1 && l->v == v1)
+ if (v1->v && l->v == v1->v)
l1 = l;
- if (v2 && l->v == v2)
+ if (v2->v && l->v == v2->v)
l2 = l;
}
/* BM_face_point_inside_test uses best-axis projection so this isn't most accurate test... */
- v1inside = l1 ? 0 : BM_face_point_inside_test(f, kfe->v1->co);
- v2inside = l2 ? 0 : BM_face_point_inside_test(f, kfe->v2->co);
+ v1inside = l1 ? 0 : BM_face_point_inside_test(f, v1->co);
+ v2inside = l2 ? 0 : BM_face_point_inside_test(f, v2->co);
if ((l1 && v2inside) || (l2 && v1inside) || (v1inside && v2inside))
return true;
if (l1 && l2) {
@@ -2780,12 +2218,17 @@ static bool knife_edge_in_face(KnifeTool_OpData *UNUSED(kcd), KnifeEdge *kfe, BM
* BM_face_legal_splits does visibility and self-intersection tests,
* but it is expensive and maybe a bit buggy, so use a simple
* "is the midpoint in the face" test */
- mid_v3_v3v3(mid, kfe->v1->co, kfe->v2->co);
+ mid_v3_v3v3(mid, v1->co, v2->co);
return BM_face_point_inside_test(f, mid);
}
return false;
}
+static bool knife_edge_in_face(KnifeEdge *kfe, BMFace *f)
+{
+ return knife_verts_edge_in_face(kfe->v1, kfe->v2, f);
+}
+
/* Split face f with KnifeEdges on chain. f remains as one side, the face formed is put in *newface.
* The new face will be on the left side of the chain as viewed from the normal-out side of f. */
static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *chain, BMFace **r_f_new)
@@ -2877,7 +2320,7 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe
for (ref = kfedges->first; ref; ref = refnext) {
kfe = ref->ref;
refnext = ref->next;
- if (knife_edge_in_face(kcd, kfe, fnew)) {
+ if (knife_edge_in_face(kfe, fnew)) {
BLI_remlink(kfedges, ref);
kfe->basef = fnew;
knife_append_list(kcd, fnew_kfedges, kfe);
@@ -2907,14 +2350,14 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe
return;
}
kfe = ((Ref *)sidechain->first)->ref;
- if (knife_edge_in_face(kcd, kfe, f)) {
+ if (knife_edge_in_face(kfe, f)) {
knife_make_chain_cut(kcd, f, sidechain, &fnew2);
if (fnew2 == NULL) {
return;
}
fhole = f;
}
- else if (knife_edge_in_face(kcd, kfe, fnew)) {
+ else if (knife_edge_in_face(kfe, fnew)) {
knife_make_chain_cut(kcd, fnew, sidechain, &fnew2);
if (fnew2 == NULL) {
return;
@@ -2933,12 +2376,12 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe
for (ref = kfedges->first; ref; ref = refnext) {
kfe = ref->ref;
refnext = ref->next;
- if (knife_edge_in_face(kcd, kfe, fnew)) {
+ if (knife_edge_in_face(kfe, fnew)) {
BLI_remlink(kfedges, ref);
kfe->basef = fnew;
knife_append_list(kcd, fnew_kfedges, kfe);
}
- else if (knife_edge_in_face(kcd, kfe, fnew2)) {
+ else if (knife_edge_in_face(kfe, fnew2)) {
BLI_remlink(kfedges, ref);
kfe->basef = fnew2;
knife_append_list(kcd, fnew2_kfedges, kfe);
@@ -3044,16 +2487,11 @@ static void knife_make_cuts(KnifeTool_OpData *kcd)
BLI_smallhash_release(fhash);
BLI_smallhash_release(ehash);
}
-#endif
/* called on tool confirmation */
static void knifetool_finish_ex(KnifeTool_OpData *kcd)
{
-#if SCANFILL_CUTS
- knifenet_fill_faces(kcd);
-#else
knife_make_cuts(kcd);
-#endif
EDBM_selectmode_flush(kcd->em);
EDBM_mesh_normals_update(kcd->em);
@@ -3096,6 +2534,7 @@ static void knifetool_exit_ex(bContext *C, KnifeTool_OpData *kcd)
BLI_ghash_free(kcd->origedgemap, NULL, NULL);
BLI_ghash_free(kcd->origvertmap, NULL, NULL);
BLI_ghash_free(kcd->kedgefacemap, NULL, NULL);
+ BLI_ghash_free(kcd->facetrimap, NULL, NULL);
BKE_bmbvh_free(kcd->bmbvh);
BLI_memarena_free(kcd->arena);
@@ -3155,16 +2594,14 @@ static void knifetool_init(bContext *C, KnifeTool_OpData *kcd,
kcd->cagecos = (const float (*)[3])BKE_editmesh_vertexCos_get(kcd->em, scene, NULL);
kcd->bmbvh = BKE_bmbvh_new(kcd->em,
- BMBVH_RETURN_ORIG |
- (only_select ? BMBVH_RESPECT_SELECT : BMBVH_RESPECT_HIDDEN),
- kcd->cagecos, false);
+ BMBVH_RETURN_ORIG |
+ (only_select ? BMBVH_RESPECT_SELECT : BMBVH_RESPECT_HIDDEN),
+ kcd->cagecos, false);
kcd->arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 15), "knife");
kcd->vthresh = KMAXDIST - 1;
kcd->ethresh = KMAXDIST;
- kcd->extend = true;
-
knife_recalc_projmat(kcd);
ED_region_tag_redraw(kcd->ar);
@@ -3175,7 +2612,8 @@ static void knifetool_init(bContext *C, KnifeTool_OpData *kcd,
kcd->origedgemap = BLI_ghash_ptr_new("knife origedgemap");
kcd->origvertmap = BLI_ghash_ptr_new("knife origvertmap");
- kcd->kedgefacemap = BLI_ghash_ptr_new("knife origvertmap");
+ kcd->kedgefacemap = BLI_ghash_ptr_new("knife kedgefacemap");
+ kcd->facetrimap = BLI_ghash_ptr_new("knife facetrimap");
/* cut all the way through the mesh if use_occlude_geometry button not pushed */
kcd->is_interactive = is_interactive;
@@ -3195,11 +2633,10 @@ static void knifetool_init(bContext *C, KnifeTool_OpData *kcd,
}
}
-static int knifetool_cancel(bContext *C, wmOperator *op)
+static void knifetool_cancel(bContext *C, wmOperator *op)
{
/* this is just a wrapper around exit() */
knifetool_exit(C, op);
- return OPERATOR_CANCELLED;
}
static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -3382,10 +2819,6 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (kcd->mode == MODE_DRAGGING) {
knife_add_cut(kcd);
- if (!kcd->extend) {
- knife_finish_cut(kcd);
- kcd->mode = MODE_IDLE;
- }
}
else if (kcd->mode != MODE_PANNING) {
knife_start_cut(kcd);
@@ -3476,7 +2909,7 @@ static void edvm_mesh_knife_face_point(BMFace *f, float r_cent[3])
int j;
float const *best_co[3] = {NULL};
- float best_area = -1.0f;
+ float best_area = -1.0f;
bool ok = false;
tottri = BM_face_calc_tessellation(f, loops, index);
@@ -3540,7 +2973,7 @@ static bool edbm_mesh_knife_face_isect(ARegion *ar, LinkNode *polys, BMFace *f,
/**
* \param use_tag When set, tag all faces inside the polylines.
*/
-void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag)
+void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_through)
{
KnifeTool_OpData *kcd;
@@ -3549,7 +2982,6 @@ void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag)
/* init */
{
const bool only_select = false;
- const bool cut_through = false;
const bool is_interactive = false; /* can enable for testing */
kcd = MEM_callocN(sizeof(KnifeTool_OpData), __func__);
diff --git a/source/blender/editors/mesh/editmesh_knife_project.c b/source/blender/editors/mesh/editmesh_knife_project.c
index f473939d0aa..57a85f1162d 100644
--- a/source/blender/editors/mesh/editmesh_knife_project.c
+++ b/source/blender/editors/mesh/editmesh_knife_project.c
@@ -42,6 +42,9 @@
#include "BKE_editmesh.h"
#include "BKE_report.h"
+#include "RNA_define.h"
+#include "RNA_access.h"
+
#include "MEM_guardedalloc.h"
#include "WM_types.h"
@@ -117,6 +120,7 @@ static int knifeproject_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
+ const bool cut_through = RNA_boolean_get(op->ptr, "cut_through");
LinkNode *polys = NULL;
@@ -129,7 +133,7 @@ static int knifeproject_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
if (polys) {
- EDBM_mesh_knife(C, polys, true);
+ EDBM_mesh_knife(C, polys, true, cut_through);
/* select only tagged faces */
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
@@ -166,4 +170,7 @@ void MESH_OT_knife_project(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
+
+ /* parameters */
+ RNA_def_boolean(ot->srna, "cut_through", false, "Cut through", "Cut through all faces, not just visible ones");
}
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 3066fb86bf8..9223f6d9450 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -418,11 +418,10 @@ static int ringsel_init(bContext *C, wmOperator *op, bool do_cut)
return 1;
}
-static int ringcut_cancel(bContext *C, wmOperator *op)
+static void ringcut_cancel(bContext *C, wmOperator *op)
{
/* this is just a wrapper around exit() */
ringsel_exit(C, op);
- return OPERATOR_CANCELLED;
}
static void loopcut_update_edge(RingSelOpData *lcd, BMEdge *e, const int previewlines)
@@ -549,7 +548,8 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
ringsel_exit(C, op);
}
else {
- return ringcut_cancel(C, op);
+ ringcut_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
return OPERATOR_FINISHED;
@@ -569,7 +569,8 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
ED_region_tag_redraw(lcd->ar);
ED_area_headerprint(CTX_wm_area(C), NULL);
- return ringcut_cancel(C, op);
+ ringcut_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
ED_region_tag_redraw(lcd->ar);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index e557b07dba2..203907226e3 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3204,21 +3204,12 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMOperator bmop;
- const bool use_beauty = RNA_boolean_get(op->ptr, "use_beauty");
+ const int quad_method = RNA_enum_get(op->ptr, "quad_method");
+ const int ngon_method = RNA_enum_get(op->ptr, "ngon_method");
- EDBM_op_init(em, &bmop, op, "triangulate faces=%hf use_beauty=%b", BM_ELEM_SELECT, use_beauty);
+ EDBM_op_init(em, &bmop, op, "triangulate faces=%hf quad_method=%i ngon_method=%i", BM_ELEM_SELECT, quad_method, ngon_method);
BMO_op_exec(em->bm, &bmop);
- BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
-
- /* now call beauty fill */
- if (use_beauty) {
- EDBM_op_call_and_selectf(
- em, op, "geom.out", true,
- "beautify_fill faces=%S edges=%S",
- &bmop, "faces.out", &bmop, "edges.out");
- }
-
if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
@@ -3243,7 +3234,10 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_boolean(ot->srna, "use_beauty", 1, "Beauty", "Use best triangulation division");
+ RNA_def_enum(ot->srna, "quad_method", modifier_triangulate_quad_method_items, MOD_TRIANGULATE_QUAD_BEAUTY,
+ "Quad Method", "Method for splitting the quads into triangles");
+ RNA_def_enum(ot->srna, "ngon_method", modifier_triangulate_ngon_method_items, MOD_TRIANGULATE_NGON_BEAUTY,
+ "Polygon Method", "Method for splitting the polygons into triangles");
}
static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index e8cbf0926d4..f35a46b50d3 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -417,7 +417,7 @@ int ED_mesh_color_add(Mesh *me, const char *name, const bool active_set)
}
else {
layernum = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL);
- if (layernum >= CD_MLOOPCOL) {
+ if (layernum >= MAX_MCOL) {
return -1;
}
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 287938c4002..a9cfd7de871 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -116,7 +116,8 @@ void MESH_OT_inset(struct wmOperatorType *ot);
/* *** editmesh_knife.c *** */
void MESH_OT_knife_tool(struct wmOperatorType *ot);
void MESH_OT_knife_project(struct wmOperatorType *ot);
-void EDBM_mesh_knife(struct bContext *C, struct LinkNode *polys, bool use_tag);
+void EDBM_mesh_knife(struct bContext *C, struct LinkNode *polys,
+ bool use_tag, bool cut_through);
struct wmKeyMap *knifetool_modal_keymap(struct wmKeyConfig *keyconf);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 08333b1b1e0..7b9bfa09116 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -29,6 +29,7 @@
*/
#include "DNA_scene_types.h"
+#include "DNA_modifier_types.h"
#include "BLI_math.h"
@@ -360,9 +361,11 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_beautify_fill", FKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "use_beauty", true);
+ RNA_enum_set(kmi->ptr, "quad_method", MOD_TRIANGULATE_QUAD_BEAUTY);
+ RNA_enum_set(kmi->ptr, "ngon_method", MOD_TRIANGULATE_NGON_BEAUTY);
kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "use_beauty", false);
+ RNA_enum_set(kmi->ptr, "quad_method", MOD_TRIANGULATE_QUAD_FIXED);
+ RNA_enum_set(kmi->ptr, "ngon_method", MOD_TRIANGULATE_NGON_SCANFILL);
WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 11f25da529c..1d47d4c49df 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -1231,6 +1231,29 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int
return true;
}
+static void ed_mesh_pick_face_vert__mpoly_find(
+ /* context */
+ struct ARegion *ar, const float mval[2],
+ /* mesh data */
+ DerivedMesh *dm, MPoly *mp, MLoop *mloop,
+ /* return values */
+ float *r_len_best, int *r_v_idx_best)
+{
+ const MLoop *ml;
+ int j = mp->totloop;
+ for (ml = &mloop[mp->loopstart]; j--; ml++) {
+ float co[3], sco[2], len;
+ const int v_idx = ml->v;
+ dm->getVertCo(dm, v_idx, co);
+ if (ED_view3d_project_float_object(ar, co, sco, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+ len = len_manhattan_v2v2(mval, sco);
+ if (len < *r_len_best) {
+ *r_len_best = len;
+ *r_v_idx_best = v_idx;
+ }
+ }
+ }
+}
/**
* Use when the back buffer stores face index values. but we want a vert.
* This gets the face then finds the closest vertex to mval.
@@ -1247,39 +1270,61 @@ bool ED_mesh_pick_face_vert(bContext *C, Object *ob, const int mval[2], unsigned
struct ARegion *ar = CTX_wm_region(C);
/* derived mesh to find deformed locations */
- DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
- int v_idx_best = -1;
-
- if (dm->getVertCo) {
- RegionView3D *rv3d = ar->regiondata;
-
- /* find the vert closest to 'mval' */
- const float mval_f[2] = {(float)mval[0],
- (float)mval[1]};
- MPoly *mp = &me->mpoly[poly_index];
- int fidx;
- float len_best = FLT_MAX;
-
- ED_view3d_init_mats_rv3d(ob, rv3d);
-
- fidx = mp->totloop - 1;
- do {
- float co[3], sco[2], len;
- const int v_idx = me->mloop[mp->loopstart + fidx].v;
- dm->getVertCo(dm, v_idx, co);
- if (ED_view3d_project_float_object(ar, co, sco, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
- len = len_manhattan_v2v2(mval_f, sco);
- if (len < len_best) {
- len_best = len;
- v_idx_best = v_idx;
- }
+ DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
+
+ int v_idx_best = ORIGINDEX_NONE;
+
+ /* find the vert closest to 'mval' */
+ const float mval_f[2] = {UNPACK2(mval)};
+ float len_best = FLT_MAX;
+
+ MPoly *dm_mpoly;
+ MLoop *dm_mloop;
+ unsigned int dm_mpoly_tot;
+ const int *index_mp_to_orig;
+
+ dm_mpoly = dm->getPolyArray(dm);
+ dm_mloop = dm->getLoopArray(dm);
+
+ dm_mpoly_tot = dm->getNumPolys(dm);
+
+ index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+
+ /* tag all verts using this face */
+ if (index_mp_to_orig) {
+ unsigned int i;
+
+ for (i = 0; i < dm_mpoly_tot; i++) {
+ if (index_mp_to_orig[i] == poly_index) {
+ ed_mesh_pick_face_vert__mpoly_find(
+ ar, mval_f,
+ dm, &dm_mpoly[i], dm_mloop,
+ &len_best, &v_idx_best);
}
- } while (fidx--);
+ }
+ }
+ else {
+ if (poly_index < dm_mpoly_tot) {
+ ed_mesh_pick_face_vert__mpoly_find(
+ ar, mval_f,
+ dm, &dm_mpoly[poly_index], dm_mloop,
+ &len_best, &v_idx_best);
+ }
+ }
+
+ /* map 'dm -> me' index if possible */
+ if (v_idx_best != ORIGINDEX_NONE) {
+ const int *index_mv_to_orig;
+
+ index_mv_to_orig = dm->getVertDataArray(dm, CD_ORIGINDEX);
+ if (index_mv_to_orig) {
+ v_idx_best = index_mv_to_orig[v_idx_best];
+ }
}
dm->release(dm);
- if (v_idx_best != -1) {
+ if ((v_idx_best != ORIGINDEX_NONE) && (v_idx_best < me->totvert)) {
*index = v_idx_best;
return true;
}
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 7130166ba0e..deae9f17992 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -333,6 +333,7 @@ static int mball_select_similar_exec(bContext *C, wmOperator *op)
break;
default:
BLI_assert(0);
+ break;
}
if (change) {
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 0a390da2ae4..9dd686326bb 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1617,6 +1617,9 @@ static int convert_exec(bContext *C, wmOperator *op)
for (nu = cu->nurb.first; nu; nu = nu->next)
nu->charidx = 0;
+ cu->flag &= ~CU_3D;
+ BKE_curve_curve_dimension_update(cu);
+
if (target == OB_MESH) {
curvetomesh(scene, newob);
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 060e48f39bc..55564703a87 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -156,12 +156,6 @@ static bool multiresbake_check(bContext *C, wmOperator *op)
break;
}
- if (mmd->lvl == 0) {
- BKE_report(op->reports, RPT_ERROR, "Multires data baking is not supported for preview subdivision level 0");
- ok = false;
- break;
- }
-
if (!me->mtpoly) {
BKE_report(op->reports, RPT_ERROR, "Mesh should be unwrapped before multires data baking");
@@ -214,28 +208,23 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
DerivedMesh *dm;
MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
Mesh *me = (Mesh *)ob->data;
+ MultiresModifierData tmp_mmd = *mmd;
+ DerivedMesh *cddm = CDDM_from_mesh(me, ob);
- *lvl = mmd->lvl;
-
- if (*lvl == 0) {
- DerivedMesh *tmp_dm = CDDM_from_mesh(me, ob);
-
- DM_set_only_copy(tmp_dm, CD_MASK_BAREMESH | CD_MASK_MTFACE);
-
- dm = CDDM_copy(tmp_dm);
- tmp_dm->release(tmp_dm);
+ if (mmd->lvl > 0) {
+ *lvl = mmd->lvl;
}
else {
- MultiresModifierData tmp_mmd = *mmd;
- DerivedMesh *cddm = CDDM_from_mesh(me, ob);
+ *lvl = 1;
+ tmp_mmd.simple = true;
+ }
- DM_set_only_copy(cddm, CD_MASK_BAREMESH | CD_MASK_MTFACE);
+ DM_set_only_copy(cddm, CD_MASK_BAREMESH | CD_MASK_MTFACE);
- tmp_mmd.lvl = *lvl;
- tmp_mmd.sculptlvl = *lvl;
- dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0);
- cddm->release(cddm);
- }
+ tmp_mmd.lvl = *lvl;
+ tmp_mmd.sculptlvl = *lvl;
+ dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0);
+ cddm->release(cddm);
return dm;
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 8af9401e30f..d4fac49e973 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1331,7 +1331,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
/* do updates */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob);
return OPERATOR_FINISHED;
}
@@ -1365,7 +1365,7 @@ static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
DAG_relations_tag_update(bmain);
/* do updates */
- WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, NULL);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index a79b0607421..3425aa08955 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -528,7 +528,7 @@ typedef enum eLattice_FlipAxes {
LATTICE_FLIP_W = 2
} eLattice_FlipAxes;
-/* Flip midpoint value so that relative distances between midpoint and neighbour-pair is maintained
+/* Flip midpoint value so that relative distances between midpoint and neighbor-pair is maintained
* ! Assumes that uvw <=> xyz (i.e. axis-aligned index-axes with coordinate-axes)
* - Helper for lattice_flip_exec()
*/
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 0ba84e27420..ec0423d7480 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -87,7 +87,6 @@
#include "object_intern.h"
-static void modifier_skin_customdata_ensure(struct Object *ob);
static void modifier_skin_customdata_delete(struct Object *ob);
/******************************** API ****************************/
@@ -1434,7 +1433,7 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
/************************** skin modifier ***********************/
-static void modifier_skin_customdata_ensure(Object *ob)
+void modifier_skin_customdata_ensure(Object *ob)
{
Mesh *me = ob->data;
BMesh *bm = me->edit_btmesh ? me->edit_btmesh->bm : NULL;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index b0e19d04e35..65a3e5b558e 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3880,11 +3880,9 @@ static int brush_edit_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int brush_edit_cancel(bContext *UNUSED(C), wmOperator *op)
+static void brush_edit_cancel(bContext *UNUSED(C), wmOperator *op)
{
brush_edit_exit(op);
-
- return OPERATOR_CANCELLED;
}
void PARTICLE_OT_brush_edit(wmOperatorType *ot)
diff --git a/source/blender/editors/render/SConscript b/source/blender/editors/render/SConscript
index 7406d42f416..41576f9b485 100644
--- a/source/blender/editors/render/SConscript
+++ b/source/blender/editors/render/SConscript
@@ -61,9 +61,6 @@ if env['WITH_BF_QUICKTIME']:
incs += ' ../../quicktime'
env.Append(CFLAGS=['-DWITH_QUICKTIME'])
-if env['USE_QTKIT']:
- env.Append(CFLAGS=['-DUSE_QTKIT'])
-
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index df8d5ec4e84..71bf67220fe 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -564,15 +564,13 @@ static int screen_render_modal(bContext *C, wmOperator *op, const wmEvent *event
return OPERATOR_PASS_THROUGH;
}
-static int screen_render_cancel(bContext *C, wmOperator *op)
+static void screen_render_cancel(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
Scene *scene = (Scene *) op->customdata;
/* kill on cancel, because job is using op->reports */
WM_jobs_kill_type(wm, scene, WM_JOB_TYPE_RENDER);
-
- return OPERATOR_CANCELLED;
}
/* using context, starts job */
@@ -1239,3 +1237,13 @@ void ED_viewport_render_kill_jobs(const bContext *C, bool free_database)
}
}
+Scene *ED_render_job_get_scene(const bContext *C)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ RenderJob *rj = (RenderJob *)WM_jobs_customdata_from_type(wm, WM_JOB_TYPE_RENDER);
+
+ if (rj)
+ return rj->scene;
+
+ return NULL;
+}
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 21074bdc47c..107674babdd 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -485,11 +485,9 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
MEM_freeN(oglrender);
}
-static int screen_opengl_render_cancel(bContext *C, wmOperator *op)
+static void screen_opengl_render_cancel(bContext *C, wmOperator *op)
{
screen_opengl_render_end(C, op->customdata);
-
- return OPERATOR_CANCELLED;
}
/* share between invoke and exec */
diff --git a/source/blender/editors/render/render_ops.c b/source/blender/editors/render/render_ops.c
index 7c52b7d0d39..3401577ee55 100644
--- a/source/blender/editors/render/render_ops.c
+++ b/source/blender/editors/render/render_ops.c
@@ -37,10 +37,6 @@
#include "render_intern.h" // own include
-#if (defined(WITH_QUICKTIME) && !defined(USE_QTKIT))
-#include "quicktime_export.h"
-#endif
-
/***************************** render ***********************************/
void ED_operatortypes_render(void)
@@ -81,10 +77,6 @@ void ED_operatortypes_render(void)
WM_operatortype_append(SCENE_OT_freestyle_modifier_copy);
#endif
-#if (defined(WITH_QUICKTIME) && !defined(USE_QTKIT))
- WM_operatortype_append(SCENE_OT_render_data_set_quicktime_codec);
-#endif
-
WM_operatortype_append(TEXTURE_OT_slot_copy);
WM_operatortype_append(TEXTURE_OT_slot_paste);
WM_operatortype_append(TEXTURE_OT_slot_move);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 3cecbbb767d..b226104a356 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -750,11 +750,9 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int actionzone_cancel(bContext *UNUSED(C), wmOperator *op)
+static void actionzone_cancel(bContext *UNUSED(C), wmOperator *op)
{
actionzone_exit(op);
-
- return OPERATOR_CANCELLED;
}
static void SCREEN_OT_actionzone(wmOperatorType *ot)
@@ -825,10 +823,9 @@ static void area_swap_exit(bContext *C, wmOperator *op)
op->customdata = NULL;
}
-static int area_swap_cancel(bContext *C, wmOperator *op)
+static void area_swap_cancel(bContext *C, wmOperator *op)
{
area_swap_exit(C, op);
- return OPERATOR_CANCELLED;
}
static int area_swap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -857,8 +854,8 @@ static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event)
case LEFTMOUSE: /* release LMB */
if (event->val == KM_RELEASE) {
if (!sad->sa2 || sad->sa1 == sad->sa2) {
-
- return area_swap_cancel(C, op);
+ area_swap_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
ED_area_tag_redraw(sad->sa1);
@@ -875,7 +872,8 @@ static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event)
break;
case ESCKEY:
- return area_swap_cancel(C, op);
+ area_swap_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
return OPERATOR_RUNNING_MODAL;
}
@@ -1148,14 +1146,12 @@ static int area_move_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int area_move_cancel(bContext *C, wmOperator *op)
+static void area_move_cancel(bContext *C, wmOperator *op)
{
RNA_int_set(op->ptr, "delta", 0);
area_move_apply(C, op);
area_move_exit(C, op);
-
- return OPERATOR_CANCELLED;
}
/* modal callback for while moving edges */
@@ -1186,7 +1182,8 @@ static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_FINISHED;
case KM_MODAL_CANCEL:
- return area_move_cancel(C, op);
+ area_move_cancel(C, op);
+ return OPERATOR_CANCELLED;
case KM_MODAL_STEP10:
md->step = 10;
@@ -1530,7 +1527,7 @@ static int area_split_exec(bContext *C, wmOperator *op)
}
-static int area_split_cancel(bContext *C, wmOperator *op)
+static void area_split_cancel(bContext *C, wmOperator *op)
{
sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
@@ -1546,8 +1543,6 @@ static int area_split_cancel(bContext *C, wmOperator *op)
}
}
area_split_exit(C, op);
-
- return OPERATOR_CANCELLED;
}
static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -1640,7 +1635,8 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
case RIGHTMOUSE: /* cancel operation */
case ESCKEY:
- return area_split_cancel(C, op);
+ area_split_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
return OPERATOR_RUNNING_MODAL;
@@ -1915,12 +1911,10 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int region_scale_cancel(bContext *UNUSED(C), wmOperator *op)
+static void region_scale_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata = NULL;
-
- return OPERATOR_CANCELLED;
}
static void SCREEN_OT_region_scale(wmOperatorType *ot)
@@ -2449,7 +2443,7 @@ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int area_join_cancel(bContext *C, wmOperator *op)
+static void area_join_cancel(bContext *C, wmOperator *op)
{
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
@@ -2465,8 +2459,6 @@ static int area_join_cancel(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_WINDOW, NULL);
area_join_exit(C, op);
-
- return OPERATOR_CANCELLED;
}
/* modal callback while selecting area (space) that will be removed */
@@ -2554,7 +2546,8 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
case RIGHTMOUSE:
case ESCKEY:
- return area_join_cancel(C, op);
+ area_join_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
return OPERATOR_RUNNING_MODAL;
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 06581fb3c11..0153d609adb 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -237,10 +237,9 @@ static bool screenshot_check(bContext *UNUSED(C), wmOperator *op)
return WM_operator_filesel_ensure_ext_imtype(op, &scd->im_format);
}
-static int screenshot_cancel(bContext *UNUSED(C), wmOperator *op)
+static void screenshot_cancel(bContext *UNUSED(C), wmOperator *op)
{
screenshot_data_free(op);
- return OPERATOR_CANCELLED;
}
static bool screenshot_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 9e8a8fd3ecc..003db8a9c43 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -898,10 +898,9 @@ static int grab_clone_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int grab_clone_cancel(bContext *UNUSED(C), wmOperator *op)
+static void grab_clone_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
- return OPERATOR_CANCELLED;
}
void PAINT_OT_grab_clone(wmOperatorType *ot)
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 86b223ec2a0..5fff02f016b 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -80,7 +80,7 @@ bool paint_supports_jitter(enum PaintMode mode);
struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf);
int paint_stroke_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
int paint_stroke_exec(struct bContext *C, struct wmOperator *op);
-int paint_stroke_cancel(struct bContext *C, struct wmOperator *op);
+void paint_stroke_cancel(struct bContext *C, struct wmOperator *op);
struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke);
void *paint_stroke_mode_data(struct PaintStroke *stroke);
void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data);
@@ -265,5 +265,6 @@ typedef enum {
void PAINT_OT_mask_flood_fill(struct wmOperatorType *ot);
void PAINT_OT_mask_box_fill(struct wmOperatorType *ot);
+void PAINT_OT_mask_lasso_gesture(struct wmOperatorType *ot);
#endif /* __PAINT_INTERN_H__ */
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 13f11c8a816..980223e24c0 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -41,6 +41,8 @@
#include "BLI_math_matrix.h"
#include "BLI_math_geom.h"
#include "BLI_utildefines.h"
+#include "BLI_lasso.h"
+
#include "BKE_pbvh.h"
#include "BKE_ccg.h"
#include "BKE_context.h"
@@ -163,6 +165,9 @@ static int is_effected(float planes[4][4], const float co[3])
int do_sculpt_mask_box_select(ViewContext *vc, rcti *rect, bool select, bool UNUSED(extend))
{
+#ifdef _OPENMP
+ Sculpt *sd = vc->scene->toolsettings->sculpt;
+#endif
BoundBox bb;
bglMats mats = {{0}};
float clip_planes[4][4];
@@ -180,7 +185,7 @@ int do_sculpt_mask_box_select(ViewContext *vc, rcti *rect, bool select, bool UNU
mode = PAINT_MASK_FLOOD_VALUE;
value = select ? 1.0 : 0.0;
- /* transform the */
+ /* transform the clip planes in object space */
view3d_get_transformation(vc->ar, vc->rv3d, vc->obact, &mats);
ED_view3d_clipping_calc(&bb, clip_planes, &mats, rect);
mul_m4_fl(clip_planes, -1.0f);
@@ -195,6 +200,7 @@ int do_sculpt_mask_box_select(ViewContext *vc, rcti *rect, bool select, bool UNU
sculpt_undo_push_begin("Mask box fill");
+#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
for (i = 0; i < totnode; i++) {
PBVHVertexIter vi;
@@ -219,3 +225,150 @@ int do_sculpt_mask_box_select(ViewContext *vc, rcti *rect, bool select, bool UNU
return OPERATOR_FINISHED;
}
+
+typedef struct LassoMaskData {
+ struct ViewContext *vc;
+ float projviewobjmat[4][4];
+ bool *px;
+ int width;
+ rcti rect; /* bounding box for scanfilling */
+} LassoMaskData;
+
+
+/* Lasso select. This could be defined as part of VIEW3D_OT_select_lasso, still the shortcuts conflict,
+ * so we will use a separate operator */
+
+static bool is_effected_lasso(LassoMaskData *data, float co[3])
+{
+ float scr_co_f[2];
+ short scr_co_s[2];
+
+ /* first project point to 2d space */
+ ED_view3d_project_float_v2_m4(data->vc->ar, co, scr_co_f, data->projviewobjmat);
+
+ scr_co_s[0] = scr_co_f[0];
+ scr_co_s[1] = scr_co_f[1];
+
+ /* clip against screen, because lasso is limited to screen only */
+ if (scr_co_s[0] < data->rect.xmin || scr_co_s[1] < data->rect.ymin || scr_co_s[0] >= data->rect.xmax || scr_co_s[1] >= data->rect.ymax)
+ return false;
+
+ scr_co_s[0] -= data->rect.xmin;
+ scr_co_s[1] -= data->rect.ymin;
+
+ return data->px[scr_co_s[1] * data->width + scr_co_s[0]];
+}
+
+static void mask_lasso_px_cb(int x, int y, void *user_data)
+{
+ struct LassoMaskData *data = user_data;
+ data->px[(y * data->width) + x] = true;
+}
+
+static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
+{
+ int mcords_tot;
+ int (*mcords)[2] = (int (*)[2])WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
+
+ if (mcords) {
+ float clip_planes[4][4];
+ BoundBox bb;
+ bglMats mats = {{0}};
+ Object *ob;
+ ViewContext vc;
+ LassoMaskData data;
+#ifdef _OPENMP
+ Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
+#endif
+ struct MultiresModifierData *mmd;
+ DerivedMesh *dm;
+ PBVH *pbvh;
+ PBVHNode **nodes;
+ int totnode, i;
+ PaintMaskFloodMode mode = PAINT_MASK_FLOOD_VALUE;
+ bool select = true; /* TODO: see how to implement deselection */
+ float value = select ? 1.0 : 0.0;
+
+ /* Calculations of individual vertices are done in 2D screen space to diminish the amount of
+ * calculations done. Bounding box PBVH collision is not computed against enclosing rectangle
+ * of lasso */
+ view3d_set_viewcontext(C, &vc);
+ view3d_get_transformation(vc.ar, vc.rv3d, vc.obact, &mats);
+
+ /* lasso data calculations */
+ data.vc = &vc;
+ ob = vc.obact;
+ ED_view3d_ob_project_mat_get(vc.rv3d, ob, data.projviewobjmat);
+
+ BLI_lasso_boundbox(&data.rect, (const int (*)[2])mcords, mcords_tot);
+ data.width = data.rect.xmax - data.rect.xmin;
+ data.px = MEM_callocN(sizeof(*data.px) * data.width * (data.rect.ymax - data.rect.ymin), "lasso_mask_pixel_buffer");
+
+ fill_poly_v2i_n(
+ data.rect.xmin, data.rect.ymin, data.rect.xmax, data.rect.ymax,
+ (const int (*)[2])mcords, mcords_tot,
+ mask_lasso_px_cb, &data);
+
+ ED_view3d_clipping_calc(&bb, clip_planes, &mats, &data.rect);
+ mul_m4_fl(clip_planes, -1.0f);
+
+ mmd = sculpt_multires_active(vc.scene, ob);
+ ED_sculpt_mask_layers_ensure(ob, mmd);
+ dm = mesh_get_derived_final(vc.scene, ob, CD_MASK_BAREMESH);
+ pbvh = dm->getPBVH(ob, dm);
+ ob->sculpt->pbvh = pbvh;
+
+ /* gather nodes inside lasso's enclosing rectangle (should greatly help with bigger meshes) */
+ BKE_pbvh_search_gather(pbvh, BKE_pbvh_node_planes_contain_AABB, clip_planes, &nodes, &totnode);
+
+ sculpt_undo_push_begin("Mask lasso fill");
+
+#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
+ for (i = 0; i < totnode; i++) {
+ PBVHVertexIter vi;
+
+ sculpt_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK);
+
+ BKE_pbvh_vertex_iter_begin(pbvh, nodes[i], vi, PBVH_ITER_UNIQUE) {
+ if (is_effected_lasso(&data, vi.co))
+ mask_flood_fill_set_elem(vi.mask, mode, value);
+ } BKE_pbvh_vertex_iter_end;
+
+ BKE_pbvh_node_mark_update(nodes[i]);
+ if (BKE_pbvh_type(pbvh) == PBVH_GRIDS)
+ multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
+ }
+
+ sculpt_undo_push_end();
+
+ if (nodes)
+ MEM_freeN(nodes);
+
+ ED_region_tag_redraw(vc.ar);
+ MEM_freeN((void *)mcords);
+ MEM_freeN(data.px);
+
+ return OPERATOR_FINISHED;
+ }
+ return OPERATOR_PASS_THROUGH;
+}
+
+void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ ot->name = "Mask Lasso Gesture";
+ ot->idname = "PAINT_OT_mask_lasso_gesture";
+ ot->description = "Add mask within the lasso as you move the pointer";
+
+ ot->invoke = WM_gesture_lasso_invoke;
+ ot->modal = WM_gesture_lasso_modal;
+ ot->exec = paint_mask_gesture_lasso_exec;
+
+ ot->poll = sculpt_mode_poll;
+
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
+}
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 8b038973831..809e9911e09 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -613,13 +613,12 @@ static void stencil_restore(StencilControlData *scd)
*scd->rot_target = scd->init_rot;
}
-static int stencil_control_cancel(bContext *UNUSED(C), wmOperator *op)
+static void stencil_control_cancel(bContext *UNUSED(C), wmOperator *op)
{
StencilControlData *scd = op->customdata;
stencil_restore(scd);
MEM_freeN(op->customdata);
- return OPERATOR_CANCELLED;
}
static void stencil_control_calculate(StencilControlData *scd, const int mval[2])
@@ -987,6 +986,7 @@ void ED_operatortypes_paint(void)
/* paint masking */
WM_operatortype_append(PAINT_OT_mask_flood_fill);
+ WM_operatortype_append(PAINT_OT_mask_lasso_gesture);
}
@@ -1149,6 +1149,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "PAINT_OT_mask_flood_fill", IKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "mode", PAINT_MASK_INVERT);
+ WM_keymap_add_item(keymap, "PAINT_OT_mask_lasso_gesture", LEFTMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+
/* Toggle dynamic topology */
WM_keymap_add_item(keymap, "SCULPT_OT_dynamic_topology_toggle", DKEY, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index b00b1c3ecff..397baeae4c9 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -718,10 +718,13 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* Cancel */
if (event->type == EVT_MODAL_MAP && event->val == PAINT_STROKE_MODAL_CANCEL) {
- if (op->type->cancel)
- return op->type->cancel(C, op);
- else
- return paint_stroke_cancel(C, op);
+ if (op->type->cancel) {
+ op->type->cancel(C, op);
+ }
+ else {
+ paint_stroke_cancel(C, op);
+ }
+ return OPERATOR_CANCELLED;
}
if (event->type == stroke->event_type && event->val == KM_RELEASE && !first_modal) {
@@ -787,10 +790,9 @@ int paint_stroke_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-int paint_stroke_cancel(bContext *C, wmOperator *op)
+void paint_stroke_cancel(bContext *C, wmOperator *op)
{
stroke_done(C, op);
- return OPERATOR_CANCELLED;
}
ViewContext *paint_stroke_view_context(PaintStroke *stroke)
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 1c3caf5d8bc..c8c38eebea9 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2059,7 +2059,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
BKE_mesh_flush_select_from_polys(me);
}
- /* weight paint spesific */
+ /* weight paint specific */
mesh_octree_table(NULL, NULL, NULL, 'e');
mesh_mirrtopo_table(NULL, 'e');
@@ -2075,7 +2075,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
BKE_paint_init(&wp->paint, PAINT_CURSOR_WEIGHT_PAINT);
- /* weight paint spesific */
+ /* weight paint specific */
mesh_octree_table(ob, NULL, NULL, 's');
ED_vgroup_sync_from_pose(ob);
}
@@ -2593,11 +2593,9 @@ static int wpaint_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int wpaint_cancel(bContext *C, wmOperator *op)
+static void wpaint_cancel(bContext *C, wmOperator *op)
{
paint_stroke_cancel(C, op);
-
- return OPERATOR_CANCELLED;
}
void PAINT_OT_weight_paint(wmOperatorType *ot)
@@ -3144,11 +3142,9 @@ static int vpaint_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int vpaint_cancel(bContext *C, wmOperator *op)
+static void vpaint_cancel(bContext *C, wmOperator *op)
{
paint_stroke_cancel(C, op);
-
- return OPERATOR_CANCELLED;
}
void PAINT_OT_vertex_paint(wmOperatorType *ot)
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index a7a7b6ab84a..6bd935af436 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -4567,7 +4567,7 @@ static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int sculpt_brush_stroke_cancel(bContext *C, wmOperator *op)
+static void sculpt_brush_stroke_cancel(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
@@ -4585,8 +4585,6 @@ static int sculpt_brush_stroke_cancel(bContext *C, wmOperator *op)
}
sculpt_brush_exit_tex(sd);
-
- return OPERATOR_CANCELLED;
}
static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
@@ -4660,7 +4658,7 @@ static void SCULPT_OT_set_persistent_base(wmOperatorType *ot)
static void sculpt_dynamic_topology_triangulate(BMesh *bm)
{
if (bm->totloop != bm->totface * 3) {
- BM_mesh_triangulate(bm, false, false, NULL, NULL);
+ BM_mesh_triangulate(bm, MOD_TRIANGULATE_QUAD_FIXED, MOD_TRIANGULATE_NGON_SCANFILL, false, NULL, NULL);
}
}
diff --git a/source/blender/editors/sound/SConscript b/source/blender/editors/sound/SConscript
index 016f8055da0..33feedf51cc 100644
--- a/source/blender/editors/sound/SConscript
+++ b/source/blender/editors/sound/SConscript
@@ -44,4 +44,10 @@ incs = ' '.join(incs)
defs = []
+if env['WITH_BF_FFMPEG']:
+ defs.append('WITH_FFMPEG')
+
+if env['WITH_BF_SNDFILE']:
+ defs.append('WITH_SNDFILE')
+
env.BlenderLib ( 'bf_editors_sound', sources, Split(incs), defs, libtype=['core'], priority=[35] )
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index a2189f6237c..81b0992c878 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -77,11 +77,10 @@
/******************** open sound operator ********************/
-static int sound_open_cancel(bContext *UNUSED(C), wmOperator *op)
+static void sound_open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata = NULL;
- return OPERATOR_CANCELLED;
}
static void sound_open_init(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index a89a02b7e01..fdccedd9c3c 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -541,7 +541,7 @@ void ED_spacetype_action(void)
art = MEM_callocN(sizeof(ARegionType), "spacetype action region");
art->regionid = RGN_TYPE_CHANNELS;
art->prefsizex = 200;
- art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
art->init = action_channel_area_init;
art->draw = action_channel_area_draw;
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index cf277957e70..4fbf5aa5fb7 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -158,12 +158,10 @@ static int file_browse_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int file_browse_cancel(bContext *UNUSED(C), wmOperator *op)
+static void file_browse_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata = NULL;
-
- return OPERATOR_CANCELLED;
}
static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index a76f4364492..9aa6eab7fc8 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -159,12 +159,10 @@ static void open_init(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
-static int open_cancel(bContext *UNUSED(C), wmOperator *op)
+static void open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata = NULL;
-
- return OPERATOR_CANCELLED;
}
static int open_exec(bContext *C, wmOperator *op)
@@ -444,11 +442,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int view_pan_cancel(bContext *C, wmOperator *op)
+static void view_pan_cancel(bContext *C, wmOperator *op)
{
- view_pan_exit(C, op, 1);
-
- return OPERATOR_CANCELLED;
+ view_pan_exit(C, op, true);
}
void CLIP_OT_view_pan(wmOperatorType *ot)
@@ -578,11 +574,9 @@ static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int view_zoom_cancel(bContext *C, wmOperator *op)
+static void view_zoom_cancel(bContext *C, wmOperator *op)
{
- view_zoom_exit(C, op, 1);
-
- return OPERATOR_CANCELLED;
+ view_zoom_exit(C, op, true);
}
void CLIP_OT_view_zoom(wmOperatorType *ot)
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 51d7bc3139a..5607d7dc635 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -1097,16 +1097,16 @@ static int track_markers_testbreak(void)
return G.is_break;
}
-static int track_count_markers(SpaceClip *sc, MovieClip *clip)
+static int track_count_markers(SpaceClip *sc, MovieClip *clip, int framenr)
{
int tot = 0;
ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
MovieTrackingTrack *track;
- int framenr = ED_space_clip_get_clip_frame_number(sc);
track = tracksbase->first;
while (track) {
- if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) {
+ bool selected = sc ? TRACK_VIEW_SELECTED(sc, track) : TRACK_SELECTED(track);
+ if (selected && (track->flag & TRACK_LOCKED) == 0) {
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
if (!marker || (marker->flag & MARKER_DISABLED) == 0)
@@ -1142,18 +1142,20 @@ static void clear_invisible_track_selection(SpaceClip *sc, MovieClip *clip)
}
}
-static void track_init_markers(SpaceClip *sc, MovieClip *clip, int *frames_limit_r)
+static void track_init_markers(SpaceClip *sc, MovieClip *clip, int framenr, int *frames_limit_r)
{
ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
MovieTrackingTrack *track;
- int framenr = ED_space_clip_get_clip_frame_number(sc);
int frames_limit = 0;
- clear_invisible_track_selection(sc, clip);
+ if (sc != NULL) {
+ clear_invisible_track_selection(sc, clip);
+ }
track = tracksbase->first;
while (track) {
- if (TRACK_VIEW_SELECTED(sc, track)) {
+ bool selected = sc ? TRACK_VIEW_SELECTED(sc, track) : TRACK_SELECTED(track);
+ if (selected) {
if ((track->flag & TRACK_HIDDEN) == 0 && (track->flag & TRACK_LOCKED) == 0) {
BKE_tracking_marker_ensure(track, framenr);
@@ -1193,8 +1195,9 @@ static int track_markers_initjob(bContext *C, TrackMarkersJob *tmj, int backward
Scene *scene = CTX_data_scene(C);
MovieTrackingSettings *settings = &clip->tracking.settings;
int frames_limit;
+ int framenr = ED_space_clip_get_clip_frame_number(sc);
- track_init_markers(sc, clip, &frames_limit);
+ track_init_markers(sc, clip, framenr, &frames_limit);
tmj->sfra = ED_space_clip_get_clip_frame_number(sc);
tmj->clip = clip;
@@ -1317,20 +1320,49 @@ static void track_markers_freejob(void *tmv)
static int track_markers_exec(bContext *C, wmOperator *op)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- MovieClip *clip = ED_space_clip_get_clip(sc);
+ SpaceClip *sc;
+ MovieClip *clip;
Scene *scene = CTX_data_scene(C);
struct MovieTrackingContext *context;
- int framenr = ED_space_clip_get_clip_frame_number(sc);
- int sfra = framenr, efra;
+ MovieClipUser *user, fake_user = {0};
+ int framenr, sfra, efra;
int backwards = RNA_boolean_get(op->ptr, "backwards");
int sequence = RNA_boolean_get(op->ptr, "sequence");
int frames_limit;
- if (track_count_markers(sc, clip) == 0)
+ if (RNA_struct_property_is_set(op->ptr, "clip")) {
+ Main *bmain = CTX_data_main(C);
+ char clip_name[MAX_ID_NAME - 2];
+
+ RNA_string_get(op->ptr, "clip", clip_name);
+ clip = (MovieClip *)BLI_findstring(&bmain->movieclip, clip_name, offsetof(ID, name) + 2);
+ sc = NULL;
+
+ if (clip == NULL) {
+ return OPERATOR_CANCELLED;
+ }
+ framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, CFRA);
+ fake_user.framenr = framenr;
+ user = &fake_user;
+ }
+ else {
+ sc = CTX_wm_space_clip(C);
+
+ if (sc == NULL) {
+ return OPERATOR_CANCELLED;
+ }
+
+ clip = ED_space_clip_get_clip(sc);
+ framenr = ED_space_clip_get_clip_frame_number(sc);
+ user = &sc->user;
+ }
+
+ sfra = framenr;
+
+ if (track_count_markers(sc, clip, framenr) == 0)
return OPERATOR_CANCELLED;
- track_init_markers(sc, clip, &frames_limit);
+ track_init_markers(sc, clip, framenr, &frames_limit);
if (backwards)
efra = SFRA;
@@ -1351,7 +1383,7 @@ static int track_markers_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* do not disable tracks due to threshold when tracking frame-by-frame */
- context = BKE_tracking_context_new(clip, &sc->user, backwards, sequence);
+ context = BKE_tracking_context_new(clip, user, backwards, sequence);
while (framenr != efra) {
if (!BKE_tracking_context_step(context))
@@ -1382,10 +1414,21 @@ static int track_markers_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
TrackMarkersJob *tmj;
ScrArea *sa = CTX_wm_area(C);
SpaceClip *sc = CTX_wm_space_clip(C);
- MovieClip *clip = ED_space_clip_get_clip(sc);
+ MovieClip *clip;
wmJob *wm_job;
- int backwards = RNA_boolean_get(op->ptr, "backwards");
- int sequence = RNA_boolean_get(op->ptr, "sequence");
+ bool backwards = RNA_boolean_get(op->ptr, "backwards");
+ bool sequence = RNA_boolean_get(op->ptr, "sequence");
+ int framenr;
+
+ if (sc == NULL) {
+ /* TODO(sergey): Support clip for invoke as well. */
+ BKE_report(op->reports, RPT_ERROR,
+ "Invoking this operator only supported from Clip Editor space");
+ return OPERATOR_CANCELLED;
+ }
+
+ clip = ED_space_clip_get_clip(sc);
+ framenr = ED_space_clip_get_clip_frame_number(sc);
if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY)) {
/* only one tracking is allowed at a time */
@@ -1395,7 +1438,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
if (clip->tracking_context)
return OPERATOR_CANCELLED;
- if (track_count_markers(sc, clip) == 0)
+ if (track_count_markers(sc, clip, framenr) == 0)
return OPERATOR_CANCELLED;
if (!sequence)
@@ -1453,6 +1496,8 @@ static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), const wmEven
void CLIP_OT_track_markers(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Track Markers";
ot->description = "Track selected markers";
@@ -1461,7 +1506,6 @@ void CLIP_OT_track_markers(wmOperatorType *ot)
/* api callbacks */
ot->exec = track_markers_exec;
ot->invoke = track_markers_invoke;
- ot->poll = ED_space_clip_tracking_poll;
ot->modal = track_markers_modal;
/* flags */
@@ -1470,6 +1514,8 @@ void CLIP_OT_track_markers(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "backwards", 0, "Backwards", "Do backwards tracking");
RNA_def_boolean(ot->srna, "sequence", 0, "Track Sequence", "Track marker during image sequence rather than single image");
+ prop = RNA_def_string(ot->srna, "clip", "", MAX_NAME, "Movie Clip", "Movie Clip to be tracked");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/********************** refine track position operator *********************/
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 289986d7fba..f24a204912e 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -1123,10 +1123,9 @@ static int console_modal_select(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_RUNNING_MODAL;
}
-static int console_modal_select_cancel(bContext *C, wmOperator *op)
+static void console_modal_select_cancel(bContext *C, wmOperator *op)
{
console_cursor_set_exit(C, op);
- return OPERATOR_FINISHED;
}
void CONSOLE_OT_select_set(wmOperatorType *ot)
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 43df3be45ac..c4e6ca97418 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -251,6 +251,9 @@ static int get_file_icon(struct direntry *file)
if (strcmp(file->relname, "..") == 0) {
return ICON_FILE_PARENT;
}
+ if (file->flags & APPLICATIONBUNDLE) {
+ return ICON_UGLYPACKAGE;
+ }
if (file->flags & BLENDERFILE) {
return ICON_FILE_BLEND;
}
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 19a6296993d..a2f81498dd3 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -764,56 +764,73 @@ static int file_is_blend_backup(const char *str)
return (retval);
}
-
-static int file_extension_type(const char *relname)
+static int path_extension_type(const char *path)
{
- if (BLO_has_bfile_extension(relname)) {
+ if (BLO_has_bfile_extension(path)) {
return BLENDERFILE;
}
- else if (file_is_blend_backup(relname)) {
+ else if (file_is_blend_backup(path)) {
return BLENDERFILE_BACKUP;
}
- else if (BLI_testextensie(relname, ".py")) {
+ else if (BLI_testextensie(path, ".app")) {
+ return APPLICATIONBUNDLE;
+ }
+ else if (BLI_testextensie(path, ".py")) {
return PYSCRIPTFILE;
}
- else if (BLI_testextensie(relname, ".txt") ||
- BLI_testextensie(relname, ".glsl") ||
- BLI_testextensie(relname, ".osl") ||
- BLI_testextensie(relname, ".data"))
+ else if (BLI_testextensie(path, ".txt") ||
+ BLI_testextensie(path, ".glsl") ||
+ BLI_testextensie(path, ".osl") ||
+ BLI_testextensie(path, ".data"))
{
return TEXTFILE;
}
- else if (BLI_testextensie(relname, ".ttf") ||
- BLI_testextensie(relname, ".ttc") ||
- BLI_testextensie(relname, ".pfb") ||
- BLI_testextensie(relname, ".otf") ||
- BLI_testextensie(relname, ".otc"))
+ else if (BLI_testextensie(path, ".ttf") ||
+ BLI_testextensie(path, ".ttc") ||
+ BLI_testextensie(path, ".pfb") ||
+ BLI_testextensie(path, ".otf") ||
+ BLI_testextensie(path, ".otc"))
{
return FTFONTFILE;
}
- else if (BLI_testextensie(relname, ".btx")) {
+ else if (BLI_testextensie(path, ".btx")) {
return BTXFILE;
}
- else if (BLI_testextensie(relname, ".dae")) {
+ else if (BLI_testextensie(path, ".dae")) {
return COLLADAFILE;
}
- else if (BLI_testextensie_array(relname, imb_ext_image) ||
- (G.have_quicktime && BLI_testextensie_array(relname, imb_ext_image_qt)))
+ else if (BLI_testextensie_array(path, imb_ext_image) ||
+ (G.have_quicktime && BLI_testextensie_array(path, imb_ext_image_qt)))
{
return IMAGEFILE;
}
- else if (BLI_testextensie_array(relname, imb_ext_movie)) {
+ else if (BLI_testextensie(path, ".ogg")) {
+ if (IMB_isanim(path)) {
+ return MOVIEFILE;
+ }
+ else {
+ return SOUNDFILE;
+ }
+ }
+ else if (BLI_testextensie_array(path, imb_ext_movie)) {
return MOVIEFILE;
}
- else if (BLI_testextensie_array(relname, imb_ext_audio)) {
+ else if (BLI_testextensie_array(path, imb_ext_audio)) {
return SOUNDFILE;
}
return 0;
}
-int ED_file_extension_icon(const char *relname)
+static int file_extension_type(const char *dir, const char *relname)
{
- int type = file_extension_type(relname);
+ char path[FILE_MAX];
+ BLI_join_dirfile(path, sizeof(path), dir, relname);
+ return path_extension_type(path);
+}
+
+int ED_file_extension_icon(const char *path)
+{
+ int type = path_extension_type(path);
if (type == BLENDERFILE)
return ICON_FILE_BLEND;
@@ -848,12 +865,13 @@ static void filelist_setfiletypes(struct FileList *filelist)
for (num = 0; num < filelist->numfiles; num++, file++) {
file->type = file->s.st_mode; /* restore the mess below */
-
- /* Don't check extensions for directories */
+#ifndef __APPLE__
+ /* Don't check extensions for directories, allow in OSX cause bundles have extensions*/
if (file->type & S_IFDIR) {
continue;
}
- file->flags = file_extension_type(file->relname);
+#endif
+ file->flags = file_extension_type(filelist->dir, file->relname);
if (filelist->filter_glob[0] &&
BLI_testextensie_glob(file->relname, filelist->filter_glob))
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 0227230fb68..62cf4889797 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -55,9 +55,7 @@
#endif
#ifdef __APPLE__
-/* XXX BIG WARNING: carbon.h can not be included in blender code, it conflicts with struct ID */
-# define ID ID_
-# include <CoreServices/CoreServices.h>
+#include <Carbon/Carbon.h>
#endif /* __APPLE__ */
#ifdef __linux__
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 23c39a5e99a..e7c98437b9f 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -206,7 +206,7 @@ static void draw_fcurve_handle_control(float x, float y, float xscale, float ysc
}
/* helper func - draw handle vertices only for an F-Curve (if it is not protected) */
-static void draw_fcurve_vertices_handles(FCurve *fcu, SpaceIpo *sipo, View2D *v2d, short sel, short sel_handle_only)
+static void draw_fcurve_vertices_handles(FCurve *fcu, SpaceIpo *sipo, View2D *v2d, short sel, short sel_handle_only, float units_scale)
{
BezTriple *bezt = fcu->bezt;
BezTriple *prevbezt = NULL;
@@ -216,6 +216,9 @@ static void draw_fcurve_vertices_handles(FCurve *fcu, SpaceIpo *sipo, View2D *v2
/* get view settings */
hsize = UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE) * U.pixelsize;
UI_view2d_getscale(v2d, &xscale, &yscale);
+
+ /* Compensate OGL scale sued for unit mapping, so circle will be circle, not ellipse */
+ yscale *= units_scale;
/* set handle color */
if (sel) UI_ThemeColor(TH_HANDLE_VERTEX_SELECT);
@@ -271,7 +274,7 @@ static void set_fcurve_vertex_color(FCurve *fcu, short sel)
}
-static void draw_fcurve_vertices(SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only)
+static void draw_fcurve_vertices(SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only, float units_scale)
{
View2D *v2d = &ar->v2d;
@@ -287,10 +290,10 @@ static void draw_fcurve_vertices(SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short
/* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
if (do_handles) {
set_fcurve_vertex_color(fcu, 0);
- draw_fcurve_vertices_handles(fcu, sipo, v2d, 0, sel_handle_only);
+ draw_fcurve_vertices_handles(fcu, sipo, v2d, 0, sel_handle_only, units_scale);
set_fcurve_vertex_color(fcu, 1);
- draw_fcurve_vertices_handles(fcu, sipo, v2d, 1, sel_handle_only);
+ draw_fcurve_vertices_handles(fcu, sipo, v2d, 1, sel_handle_only, units_scale);
}
/* draw keyframes over the handles */
@@ -487,6 +490,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
float stime, etime;
float unitFac;
float dx, dy;
+ short mapping_flag = ANIM_get_normalization_flags(ac);
/* when opening a blend file on a different sized screen or while dragging the toolbar this can happen
* best just bail out in this case */
@@ -500,7 +504,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
fcu->driver = NULL;
/* compute unit correction factor */
- unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, 0);
+ unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
/* Note about sampling frequency:
* Ideally, this is chosen such that we have 1-2 pixels = 1 segment
@@ -547,11 +551,15 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
FPoint *fpt = prevfpt + 1;
float fac, v[2];
int b = fcu->totvert - 1;
-
- glBegin(GL_LINE_STRIP);
-
+ float unit_scale;
+ short mapping_flag = ANIM_get_normalization_flags(ac);
+
/* apply unit mapping */
- ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 0);
+ glPushMatrix();
+ unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
+ glScalef(1.0f, unit_scale, 1.0f);
+
+ glBegin(GL_LINE_STRIP);
/* extrapolate to left? - left-side of view comes before first keyframe? */
if (prevfpt->vec[0] > v2d->cur.xmin) {
@@ -611,10 +619,8 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie
glVertex2fv(v);
}
- /* unapply unit mapping */
- ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, ANIM_UNITCONV_RESTORE);
-
glEnd();
+ glPopMatrix();
}
/* helper func - draw one repeat of an F-Curve */
@@ -627,11 +633,15 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
float fac = 0.0f;
int b = fcu->totvert - 1;
int resol;
-
- glBegin(GL_LINE_STRIP);
-
+ float unit_scale;
+ short mapping_flag = ANIM_get_normalization_flags(ac);
+
/* apply unit mapping */
- ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, 0);
+ glPushMatrix();
+ unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
+ glScalef(1.0f, unit_scale, 1.0f);
+
+ glBegin(GL_LINE_STRIP);
/* extrapolate to left? */
if (prevbezt->vec[1][0] > v2d->cur.xmin) {
@@ -766,10 +776,8 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
glVertex2fv(v1);
}
- /* unapply unit mapping */
- ANIM_unit_mapping_apply_fcurve(ac->scene, id, fcu, ANIM_UNITCONV_RESTORE);
-
glEnd();
+ glPopMatrix();
}
/* Debugging -------------------------------- */
@@ -783,7 +791,8 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
{
ChannelDriver *driver = fcu->driver;
View2D *v2d = &ac->ar->v2d;
- float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, false);
+ short mapping_flag = ANIM_get_normalization_flags(ac);
+ float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag);
/* for now, only show when debugging driver... */
//if ((driver->flag & DRIVER_FLAG_SHOWDEBUG) == 0)
@@ -1014,9 +1023,12 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
}
}
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
- /* apply unit mapping */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, fcu, 0);
-
+ short mapping_flag = ANIM_get_normalization_flags(ac);
+ float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag);
+
+ glPushMatrix();
+ glScalef(1.0f, unit_scale, 1.0f);
+
if (fcu->bezt) {
int do_handles = draw_fcurve_handles_check(sipo, fcu);
@@ -1027,15 +1039,14 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
glDisable(GL_BLEND);
}
- draw_fcurve_vertices(sipo, ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY));
+ draw_fcurve_vertices(sipo, ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY), unit_scale);
}
else {
/* samples: only draw two indicators at either end as indicators */
draw_fcurve_samples(sipo, ar, fcu);
}
-
- /* unapply unit mapping */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, fcu, ANIM_UNITCONV_RESTORE);
+
+ glPopMatrix();
}
}
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 274c06bf871..db13e2a4024 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -116,6 +116,8 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
/* get range */
if (calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax, do_sel_only, include_handles)) {
+ short mapping_flag = ANIM_get_normalization_flags(ac);
+
/* apply NLA scaling */
if (adt) {
txmin = BKE_nla_tweakedit_remap(adt, txmin, NLATIME_CONVERT_MAP);
@@ -123,7 +125,7 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
}
/* apply unit corrections */
- unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0);
+ unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag);
tymin *= unitFac;
tymax *= unitFac;
@@ -330,12 +332,14 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end)
FPoint *fpt;
float unitFac;
int cfra;
-
+ SpaceIpo *sipo = (SpaceIpo *) ac->sl;
+ short mapping_flag = ANIM_get_normalization_flags(ac);
+
/* disable driver so that it don't muck up the sampling process */
fcu->driver = NULL;
/* calculate unit-mapping factor */
- unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0);
+ unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag);
/* create samples, but store them in a new curve
* - we cannot use fcurve_store_samples() as that will only overwrite the original curve
@@ -578,6 +582,8 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
* keyframes if these will be visible after doing so...
*/
if (fcurve_is_keyframable(fcu)) {
+ short mapping_flag = ANIM_get_normalization_flags(&ac);
+
/* get frame and value from props */
frame = RNA_float_get(op->ptr, "frame");
val = RNA_float_get(op->ptr, "value");
@@ -587,7 +593,7 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
frame = BKE_nla_tweakedit_remap(adt, frame, NLATIME_CONVERT_UNMAP);
/* apply inverse unit-mapping to value to get correct value for F-Curves */
- val *= ANIM_unit_mapping_get_factor(ac.scene, ale->id, fcu, 1);
+ val *= ANIM_unit_mapping_get_factor(ac.scene, ale->id, fcu, mapping_flag | ANIM_UNITCONV_RESTORE);
/* insert keyframe on the specified frame + value */
insert_vert_fcurve(fcu, frame, val, 0);
@@ -1787,20 +1793,24 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
-
- /* apply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS);
-
+ short mapping_flag = ANIM_get_normalization_flags(&ac);
+ KeyframeEditData current_ked;
+ float unit_scale = ANIM_unit_mapping_get_factor(ac.scene, ale->id, ale->key_data, mapping_flag | ANIM_UNITCONV_ONLYKEYS);
+
+ memset(&current_ked, 0, sizeof(current_ked));
+
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
- ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_calc_average, NULL);
+ ANIM_fcurve_keyframes_loop(&current_ked, ale->key_data, NULL, bezt_calc_average, NULL);
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
}
else
- ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_calc_average, NULL);
-
- /* unapply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE | ANIM_UNITCONV_ONLYKEYS);
+ ANIM_fcurve_keyframes_loop(&current_ked, ale->key_data, NULL, bezt_calc_average, NULL);
+
+ ked.f1 += current_ked.f1;
+ ked.i1 += current_ked.i1;
+ ked.f2 += current_ked.f2 / unit_scale;
+ ked.i2 += current_ked.i2;
}
BLI_freelistN(&anim_data);
@@ -1865,6 +1875,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
KeyframeEditData ked;
KeyframeEditFunc edit_cb;
+ float cursor_value = 0.0f;
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
@@ -1881,16 +1892,17 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
}
else if (mode == GRAPHKEYS_SNAP_VALUE) {
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
- ked.f1 = (sipo) ? sipo->cursorVal : 0.0f;
+ cursor_value = (sipo) ? sipo->cursorVal : 0.0f;
}
/* snap keyframes */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
-
- /* apply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0);
-
+ short mapping_flag = ANIM_get_normalization_flags(ac);
+ float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, ale->key_data, mapping_flag);
+
+ ked.f1 = cursor_value / unit_scale;
+
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
@@ -1898,9 +1910,6 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
}
else
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
-
- /* apply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE);
}
BLI_freelistN(&anim_data);
@@ -1977,7 +1986,8 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
KeyframeEditData ked;
KeyframeEditFunc edit_cb;
-
+ float cursor_value = 0.0f;
+
/* get beztriple editing callbacks */
edit_cb = ANIM_editkeyframes_mirror(mode);
@@ -2000,7 +2010,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
}
else if (mode == GRAPHKEYS_MIRROR_VALUE) {
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
- ked.f1 = (sipo) ? sipo->cursorVal : 0.0f;
+ cursor_value = (sipo) ? sipo->cursorVal : 0.0f;
}
/* filter data */
@@ -2010,10 +2020,12 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
/* mirror keyframes */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
-
+ short mapping_flag = ANIM_get_normalization_flags(ac);
+ float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, ale->key_data, mapping_flag | ANIM_UNITCONV_ONLYKEYS);
+
/* apply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS);
-
+ ked.f1 = cursor_value * unit_scale;
+
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
@@ -2021,9 +2033,6 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
}
else
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve);
-
- /* unapply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS | ANIM_UNITCONV_RESTORE);
}
BLI_freelistN(&anim_data);
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 4bb5e1b11d4..d0dcaf91e77 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -227,7 +227,7 @@ static void borderselect_graphkeys(bAnimContext *ac, rcti rect, short mode, shor
KeyframeEditData ked;
KeyframeEditFunc ok_cb, select_cb;
View2D *v2d = &ac->ar->v2d;
- rctf rectf;
+ rctf rectf, scaled_rectf;
/* convert mouse coordinates to frame ranges and channel coordinates corrected for view pan/zoom */
UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
@@ -243,7 +243,7 @@ static void borderselect_graphkeys(bAnimContext *ac, rcti rect, short mode, shor
/* init editing data */
memset(&ked, 0, sizeof(KeyframeEditData));
- ked.data = &rectf;
+ ked.data = &scaled_rectf;
/* treat handles separately? */
if (incl_handles) {
@@ -252,21 +252,26 @@ static void borderselect_graphkeys(bAnimContext *ac, rcti rect, short mode, shor
}
else
mapping_flag = ANIM_UNITCONV_ONLYKEYS;
-
+
+ mapping_flag |= ANIM_get_normalization_flags(ac);
+
/* loop over data, doing border select */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
FCurve *fcu = (FCurve *)ale->key_data;
-
- /* apply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, mapping_flag);
-
+ float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0);
+
/* apply NLA mapping to all the keyframes, since it's easier than trying to
* guess when a callback might use something different
*/
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, incl_handles == 0);
-
+
+ scaled_rectf.xmin = rectf.xmin;
+ scaled_rectf.xmax = rectf.xmax;
+ scaled_rectf.ymin = rectf.ymin / unit_scale;
+ scaled_rectf.ymax = rectf.ymax / unit_scale;
+
/* set horizontal range (if applicable)
* NOTE: these values are only used for x-range and y-range but not region
* (which uses ked.data, i.e. rectf)
@@ -296,9 +301,6 @@ static void borderselect_graphkeys(bAnimContext *ac, rcti rect, short mode, shor
/* un-apply NLA mapping from all the keyframes */
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, incl_handles == 0);
-
- /* unapply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE | mapping_flag);
}
/* cleanup */
@@ -936,7 +938,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, const 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], float unit_scale)
{
/* Keyframes or Samples? */
if (bezt) {
@@ -947,7 +949,7 @@ static void nearest_fcurve_vert_store(ListBase *matches, View2D *v2d, FCurve *fc
* needed to access the relevant vertex coordinates in the 3x3
* 'vec' matrix
*/
- UI_view2d_view_to_region(v2d, bezt->vec[hpoint + 1][0], bezt->vec[hpoint + 1][1], &screen_co[0], &screen_co[1]);
+ UI_view2d_view_to_region(v2d, bezt->vec[hpoint + 1][0], bezt->vec[hpoint + 1][1] * unit_scale, &screen_co[0], &screen_co[1]);
/* check if distance from mouse cursor to vert in screen space is within tolerance */
// XXX: inlined distance calculation, since we cannot do this on ints using the math lib...
@@ -996,6 +998,7 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
SpaceIpo *sipo = (SpaceIpo *)ac->sl;
View2D *v2d = &ac->ar->v2d;
+ short mapping_flag = 0;
/* get curves to search through
* - if the option to only show keyframes that belong to selected F-Curves is enabled,
@@ -1004,37 +1007,36 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
if (sipo->flag & SIPO_SELCUVERTSONLY) // FIXME: this should really be check for by the filtering code...
filter |= ANIMFILTER_SEL;
+ mapping_flag |= ANIM_get_normalization_flags(ac);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
-
- /* apply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, 0);
-
+ float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag);
+
/* apply NLA mapping to all the keyframes */
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
-
+
if (fcu->bezt) {
BezTriple *bezt1 = fcu->bezt, *prevbezt = NULL;
int i;
for (i = 0; i < fcu->totvert; i++, prevbezt = bezt1, bezt1++) {
/* keyframe */
- nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_KEY, mval);
+ nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_KEY, mval, unit_scale);
/* handles - only do them if they're visible */
if (fcurve_handle_sel_check(sipo, bezt1) && (fcu->totvert > 1)) {
/* first handle only visible if previous segment had handles */
if ((!prevbezt && (bezt1->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))) {
- nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_LEFT, mval);
+ nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_LEFT, mval, unit_scale);
}
/* second handle only visible if this segment is bezier */
if (bezt1->ipo == BEZT_IPO_BEZ) {
- nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_RIGHT, mval);
+ nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_RIGHT, mval, unit_scale);
}
}
}
@@ -1047,9 +1049,6 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
/* un-apply NLA mapping from all the keyframes */
if (adt)
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
-
- /* unapply unit corrections */
- ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE);
}
/* free channels */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 710d5c8cd81..ebcc8c2ebee 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -256,7 +256,7 @@ static void image_view_pan_init(bContext *C, wmOperator *op, const wmEvent *even
WM_event_add_modal_handler(C, op);
}
-static void image_view_pan_exit(bContext *C, wmOperator *op, int cancel)
+static void image_view_pan_exit(bContext *C, wmOperator *op, bool cancel)
{
SpaceImage *sima = CTX_wm_space_image(C);
ViewPanData *vpd = op->customdata;
@@ -330,7 +330,7 @@ static int image_view_pan_modal(bContext *C, wmOperator *op, const wmEvent *even
break;
default:
if (event->type == vpd->event_type && event->val == KM_RELEASE) {
- image_view_pan_exit(C, op, 0);
+ image_view_pan_exit(C, op, false);
return OPERATOR_FINISHED;
}
break;
@@ -339,10 +339,9 @@ static int image_view_pan_modal(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_RUNNING_MODAL;
}
-static int image_view_pan_cancel(bContext *C, wmOperator *op)
+static void image_view_pan_cancel(bContext *C, wmOperator *op)
{
- image_view_pan_exit(C, op, 1);
- return OPERATOR_CANCELLED;
+ image_view_pan_exit(C, op, true);
}
void IMAGE_OT_view_pan(wmOperatorType *ot)
@@ -412,7 +411,7 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *eve
WM_event_add_modal_handler(C, op);
}
-static void image_view_zoom_exit(bContext *C, wmOperator *op, int cancel)
+static void image_view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
{
SpaceImage *sima = CTX_wm_space_image(C);
ViewZoomData *vpd = op->customdata;
@@ -547,17 +546,16 @@ static int image_view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *eve
image_zoom_apply(vpd, op, event->x, event->y, U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0);
}
else if (event_code == VIEW_CONFIRM) {
- image_view_zoom_exit(C, op, 0);
+ image_view_zoom_exit(C, op, false);
return OPERATOR_FINISHED;
}
return OPERATOR_RUNNING_MODAL;
}
-static int image_view_zoom_cancel(bContext *C, wmOperator *op)
+static void image_view_zoom_cancel(bContext *C, wmOperator *op)
{
- image_view_zoom_exit(C, op, 1);
- return OPERATOR_CANCELLED;
+ image_view_zoom_exit(C, op, true);
}
void IMAGE_OT_view_zoom(wmOperatorType *ot)
@@ -921,11 +919,10 @@ static void image_open_init(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
-static int image_open_cancel(bContext *UNUSED(C), wmOperator *op)
+static void image_open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata = NULL;
- return OPERATOR_CANCELLED;
}
static int image_open_exec(bContext *C, wmOperator *op)
@@ -1505,11 +1502,9 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
return OPERATOR_RUNNING_MODAL;
}
-static int image_save_as_cancel(bContext *UNUSED(C), wmOperator *op)
+static void image_save_as_cancel(bContext *UNUSED(C), wmOperator *op)
{
image_save_as_free(op);
-
- return OPERATOR_CANCELLED;
}
static bool image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
@@ -2358,10 +2353,9 @@ static int image_sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int image_sample_cancel(bContext *C, wmOperator *op)
+static void image_sample_cancel(bContext *C, wmOperator *op)
{
image_sample_exit(C, op);
- return OPERATOR_CANCELLED;
}
void IMAGE_OT_sample(wmOperatorType *ot)
@@ -2625,7 +2619,7 @@ static int image_record_composite_modal(bContext *C, wmOperator *op, const wmEve
return OPERATOR_RUNNING_MODAL;
}
-static int image_record_composite_cancel(bContext *C, wmOperator *op)
+static void image_record_composite_cancel(bContext *C, wmOperator *op)
{
image_record_composite_exit(C, op);
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 7b20af340ae..2ba9123b30b 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -56,6 +56,7 @@
#include "ED_mask.h"
#include "ED_mesh.h"
#include "ED_node.h"
+#include "ED_render.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "ED_uvedit.h"
@@ -653,7 +654,16 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
/* put scene context variable in iuser */
- sima->iuser.scene = scene;
+ if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) {
+ /* for render result, try to use the currently rendering scene */
+ Scene *render_scene = ED_render_job_get_scene(C);
+ if (render_scene)
+ sima->iuser.scene = render_scene;
+ else
+ sima->iuser.scene = scene;
+ }
+ else
+ sima->iuser.scene = scene;
/* we set view2d from own zoom and offset each time */
image_main_area_set_view2d(sima, ar);
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 07f4b64d187..aaa52597357 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -327,7 +327,7 @@ void ED_spacetype_info(void)
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype info region");
art->regionid = RGN_TYPE_WINDOW;
- art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
art->init = info_main_area_init;
art->draw = info_main_area_draw;
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 4d4f27cf1ad..d0ba33358e4 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -544,7 +544,7 @@ void ED_spacetype_nla(void)
art = MEM_callocN(sizeof(ARegionType), "spacetype nla region");
art->regionid = RGN_TYPE_CHANNELS;
art->prefsizex = 200;
- art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
art->init = nla_channel_area_init;
art->draw = nla_channel_area_draw;
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index ba28f502349..50a4b515490 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -384,19 +384,21 @@ static void node_draw_frame_prepare(const bContext *UNUSED(C), bNodeTree *ntree,
node->totr = rect;
}
-static void node_draw_frame_label(bNode *node, const float aspect)
+static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float aspect)
{
/* XXX font id is crap design */
const int fontid = UI_GetStyle()->widgetlabel.uifont_id;
NodeFrame *data = (NodeFrame *)node->storage;
rctf *rct = &node->totr;
int color_id = node_get_colorid(node);
- const char *label = nodeLabel(node);
+ char label[MAX_NAME];
/* XXX a bit hacky, should use separate align values for x and y */
float width, ascender;
float x, y;
const int font_size = data->label_size / aspect;
+ nodeLabel(ntree, node, label, sizeof(label));
+
BLF_enable(fontid, BLF_ASPECT);
BLF_aspect(fontid, aspect, aspect, 1.0f);
BLF_size(fontid, MIN2(24, font_size), U.dpi); /* clamp otherwise it can suck up a LOT of memory */
@@ -418,7 +420,7 @@ static void node_draw_frame_label(bNode *node, const float aspect)
}
static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode,
- bNodeTree *UNUSED(ntree), bNode *node, bNodeInstanceKey UNUSED(key))
+ bNodeTree *ntree, bNode *node, bNodeInstanceKey UNUSED(key))
{
rctf *rct = &node->totr;
int color_id = node_get_colorid(node);
@@ -467,7 +469,7 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode,
}
/* label */
- node_draw_frame_label(node, snode->aspect);
+ node_draw_frame_label(ntree, node, snode->aspect);
UI_ThemeClearColor(color_id);
@@ -1444,7 +1446,7 @@ static void node_composit_buts_despeckle(uiLayout *layout, bContext *UNUSED(C),
col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "threshold", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "threshold_neighbour", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "threshold_neighbor", 0, NULL, ICON_NONE);
}
static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 65eb75f8523..6f2f8dee105 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -72,6 +72,11 @@
/* XXX interface.h */
extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select);
+float ED_node_grid_size(void)
+{
+ return U.widget_unit;
+}
+
void ED_node_tree_update(const bContext *C)
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -863,7 +868,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
UI_ThemeColor(TH_TEXT);
#endif
- BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
+ nodeLabel(ntree, node, showname, sizeof(showname));
//if (node->flag & NODE_MUTED)
// BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */
@@ -1030,8 +1035,8 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
UI_ThemeColor(TH_TEXT);
if (node->miniwidth > 0.0f) {
- BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
-
+ nodeLabel(ntree, node, showname, sizeof(showname));
+
//if (node->flag & NODE_MUTED)
// BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */
@@ -1325,7 +1330,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
snode_setup_v2d(snode, ar, center);
/* grid, uses theme color based on node path depth */
- UI_view2d_multi_grid_draw(v2d, (depth > 0 ? TH_NODE_GROUP : TH_BACK), U.widget_unit, 5, 2);
+ UI_view2d_multi_grid_draw(v2d, (depth > 0 ? TH_NODE_GROUP : TH_BACK), ED_node_grid_size(), NODE_GRID_STEPS, 2);
/* backdrop */
draw_nodespace_back_pix(C, ar, snode, path->parent_key);
@@ -1350,7 +1355,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
}
else {
/* default grid */
- UI_view2d_multi_grid_draw(v2d, TH_BACK, U.widget_unit, 5, 2);
+ UI_view2d_multi_grid_draw(v2d, TH_BACK, ED_node_grid_size(), NODE_GRID_STEPS, 2);
/* backdrop */
draw_nodespace_back_pix(C, ar, snode, NODE_INSTANCE_KEY_NONE);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 1d93fe65c09..f58bc83e5d2 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -859,7 +859,7 @@ static void node_resize_init(bContext *C, wmOperator *op, const wmEvent *UNUSED(
WM_event_add_modal_handler(C, op);
}
-static void node_resize_exit(bContext *C, wmOperator *op, int UNUSED(cancel))
+static void node_resize_exit(bContext *C, wmOperator *op, bool UNUSED(cancel))
{
WM_cursor_modal_restore(CTX_wm_window(C));
@@ -961,7 +961,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event)
case MIDDLEMOUSE:
case RIGHTMOUSE:
- node_resize_exit(C, op, 0);
+ node_resize_exit(C, op, false);
ED_node_post_apply_transform(C, snode->edittree);
return OPERATOR_FINISHED;
@@ -990,11 +990,9 @@ static int node_resize_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
}
-static int node_resize_cancel(bContext *C, wmOperator *op)
+static void node_resize_cancel(bContext *C, wmOperator *op)
{
- node_resize_exit(C, op, 1);
-
- return OPERATOR_CANCELLED;
+ node_resize_exit(C, op, true);
}
void NODE_OT_resize(wmOperatorType *ot)
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 176b81f9503..f598a13bea9 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -116,6 +116,7 @@ void NODE_OT_select_all(struct wmOperatorType *ot);
void NODE_OT_select_linked_to(struct wmOperatorType *ot);
void NODE_OT_select_linked_from(struct wmOperatorType *ot);
void NODE_OT_select_border(struct wmOperatorType *ot);
+void NODE_OT_select_circle(struct wmOperatorType *ot);
void NODE_OT_select_lasso(struct wmOperatorType *ot);
void NODE_OT_select_same_type(struct wmOperatorType *ot);
void NODE_OT_select_same_type_step(struct wmOperatorType *ot);
@@ -169,7 +170,6 @@ void NODE_OT_join(struct wmOperatorType *ot);
void NODE_OT_attach(struct wmOperatorType *ot);
void NODE_OT_detach(struct wmOperatorType *ot);
-void NODE_OT_show_cyclic_dependencies(struct wmOperatorType *ot);
void NODE_OT_link_viewer(struct wmOperatorType *ot);
/* node_edit.c */
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index f0d3deb24df..edd422b8148 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -56,6 +56,7 @@ void node_operatortypes(void)
WM_operatortype_append(NODE_OT_select_linked_to);
WM_operatortype_append(NODE_OT_select_linked_from);
WM_operatortype_append(NODE_OT_select_border);
+ WM_operatortype_append(NODE_OT_select_circle);
WM_operatortype_append(NODE_OT_select_lasso);
WM_operatortype_append(NODE_OT_select_same_type);
WM_operatortype_append(NODE_OT_select_same_type_step);
@@ -70,7 +71,6 @@ void node_operatortypes(void)
WM_operatortype_append(NODE_OT_preview_toggle);
WM_operatortype_append(NODE_OT_options_toggle);
WM_operatortype_append(NODE_OT_hide_socket_toggle);
- WM_operatortype_append(NODE_OT_show_cyclic_dependencies);
WM_operatortype_append(NODE_OT_node_copy_color);
WM_operatortype_append(NODE_OT_duplicate);
@@ -233,6 +233,8 @@ void node_keymap(struct wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "NODE_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_SHIFT | KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "deselect", TRUE);
+ WM_keymap_add_item(keymap, "NODE_OT_select_circle", CKEY, KM_PRESS, 0, 0);
+
/* each of these falls through if not handled... */
kmi = WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "detach", FALSE);
@@ -272,8 +274,6 @@ void node_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "NODE_OT_preview_toggle", HKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "NODE_OT_hide_socket_toggle", HKEY, KM_PRESS, KM_CTRL, 0);
- WM_keymap_add_item(keymap, "NODE_OT_show_cyclic_dependencies", CKEY, KM_PRESS, 0, 0);
-
WM_keymap_add_item(keymap, "NODE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 4b5cc9e42b6..9f5e8a6f9d9 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -395,38 +395,28 @@ void NODE_OT_link_viewer(wmOperatorType *ot)
/* *************************** add link op ******************** */
-static void node_remove_extra_links(SpaceNode *snode, bNodeSocket *tsock, bNodeLink *link)
+static void node_remove_extra_links(SpaceNode *snode, bNodeLink *link)
{
+ bNodeTree *ntree = snode->edittree;
+ bNodeSocket *from = link->fromsock, *to = link->tosock;
+ int max_from = from->limit, max_to = to->limit;
+ int count_from = 1, count_to = 1; /* start at 1, link is included */
bNodeLink *tlink;
- bNodeSocket *sock;
-
- if (tsock && nodeCountSocketLinks(snode->edittree, link->tosock) > tsock->limit) {
-
- for (tlink = snode->edittree->links.first; tlink; tlink = tlink->next) {
- if (link != tlink && tlink->tosock == link->tosock)
- break;
+
+ for (tlink = ntree->links.first; tlink; tlink = tlink->next) {
+ if (tlink == link)
+ continue;
+
+ if (tlink->fromsock == from) {
+ ++count_from;
+ if (count_from > max_from)
+ nodeRemLink(ntree, tlink);
}
- if (tlink) {
- /* try to move the existing link to the next available socket */
- if (tlink->tonode) {
- /* is there a free input socket with the target type? */
- for (sock = tlink->tonode->inputs.first; sock; sock = sock->next) {
- if (sock->type == tlink->tosock->type)
- if (nodeCountSocketLinks(snode->edittree, sock) < sock->limit)
- break;
- }
- if (sock) {
- tlink->tosock = sock;
- sock->flag &= ~SOCK_HIDDEN;
- }
- else {
- nodeRemLink(snode->edittree, tlink);
- }
- }
- else
- nodeRemLink(snode->edittree, tlink);
-
- snode->edittree->update |= NTREE_UPDATE_LINKS;
+
+ if (tlink->tosock == to) {
+ ++count_to;
+ if (count_to > max_to)
+ nodeRemLink(ntree, tlink);
}
}
}
@@ -527,8 +517,7 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
link->tonode->update |= NODE_UPDATE;
/* we might need to remove a link */
- if (in_out == SOCK_OUT)
- node_remove_extra_links(snode, link->tosock, link);
+ node_remove_extra_links(snode, link);
}
else
nodeRemLink(ntree, link);
@@ -669,7 +658,7 @@ static int node_link_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
}
-static int node_link_cancel(bContext *C, wmOperator *op)
+static void node_link_cancel(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
bNodeLinkDrag *nldrag = op->customdata;
@@ -678,8 +667,6 @@ static int node_link_cancel(bContext *C, wmOperator *op)
BLI_freelistN(&nldrag->links);
MEM_freeN(nldrag);
-
- return OPERATOR_CANCELLED;
}
void NODE_OT_link(wmOperatorType *ot)
@@ -878,34 +865,6 @@ void NODE_OT_links_detach(wmOperatorType *ot)
}
-/* ****************** Show Cyclic Dependencies Operator ******************* */
-
-static int node_show_cycles_exec(bContext *C, wmOperator *UNUSED(op))
-{
- SpaceNode *snode = CTX_wm_space_node(C);
-
- /* this is just a wrapper around this call... */
- ntreeUpdateTree(CTX_data_main(C), snode->nodetree);
- snode_notify(C, snode);
-
- return OPERATOR_FINISHED;
-}
-
-void NODE_OT_show_cyclic_dependencies(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Show Cyclic Dependencies";
- ot->description = "Sort the nodes and show the cyclic dependencies between the nodes";
- ot->idname = "NODE_OT_show_cyclic_dependencies";
-
- /* callbacks */
- ot->exec = node_show_cycles_exec;
- ot->poll = ED_operator_node_active;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
/* ****************** Set Parent ******************* */
static int node_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1214,52 +1173,62 @@ void NODE_OT_detach(wmOperatorType *ot)
/* prevent duplicate testing code below */
-static SpaceNode *ed_node_link_conditions(ScrArea *sa, bNode **select)
+static bool ed_node_link_conditions(ScrArea *sa, bool test, SpaceNode **r_snode, bNode **r_select)
{
SpaceNode *snode = sa ? sa->spacedata.first : NULL;
- bNode *node;
+ bNode *node, *select = NULL;
bNodeLink *link;
+ *r_snode = snode;
+ *r_select = NULL;
+
/* no unlucky accidents */
- if (sa == NULL || sa->spacetype != SPACE_NODE) return NULL;
+ if (sa == NULL || sa->spacetype != SPACE_NODE)
+ return false;
- *select = NULL;
+ if (!test) {
+ /* no need to look for a node */
+ return true;
+ }
for (node = snode->edittree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
- if (*select)
+ if (select)
break;
else
- *select = node;
+ select = node;
}
}
/* only one selected */
- if (node || *select == NULL) return NULL;
+ if (node || select == NULL)
+ return false;
/* correct node */
- if ((*select)->inputs.first == NULL || (*select)->outputs.first == NULL) return NULL;
+ if (select->inputs.first == NULL || select->outputs.first == NULL)
+ return false;
/* test node for links */
for (link = snode->edittree->links.first; link; link = link->next) {
if (nodeLinkIsHidden(link))
continue;
- if (link->tonode == *select || link->fromnode == *select)
- return NULL;
+ if (link->tonode == select || link->fromnode == select)
+ return false;
}
- return snode;
+ *r_select = select;
+ return true;
}
/* test == 0, clear all intersect flags */
void ED_node_link_intersect_test(ScrArea *sa, int test)
{
bNode *select;
- SpaceNode *snode = ed_node_link_conditions(sa, &select);
+ SpaceNode *snode;
bNodeLink *link, *selink = NULL;
float mcoords[6][2];
- if (snode == NULL) return;
+ if (!ed_node_link_conditions(sa, test, &snode, &select)) return;
/* clear flags */
for (link = snode->edittree->links.first; link; link = link->next)
@@ -1334,11 +1303,11 @@ static bNodeSocket *socket_best_match(ListBase *sockets)
void ED_node_link_insert(ScrArea *sa)
{
bNode *node, *select;
- SpaceNode *snode = ed_node_link_conditions(sa, &select);
+ SpaceNode *snode;
bNodeLink *link;
bNodeSocket *sockto;
- if (snode == NULL) return;
+ if (!ed_node_link_conditions(sa, true, &snode, &select)) return;
/* get the link */
for (link = snode->edittree->links.first; link; link = link->next)
@@ -1355,7 +1324,7 @@ void ED_node_link_insert(ScrArea *sa)
link->tonode = select;
link->tosock = best_input;
- node_remove_extra_links(snode, link->tosock, link);
+ node_remove_extra_links(snode, link);
link->flag &= ~NODE_LINKFLAG_HILITE;
nodeAddLink(snode->edittree, select, best_output, node, sockto);
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 958a3433337..2e3e747618b 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -514,6 +514,63 @@ void NODE_OT_select_border(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "tweak", 0, "Tweak", "Only activate when mouse is not over a node - useful for tweak gesture");
}
+/* ****** Circle Select ****** */
+
+static int node_circleselect_exec(bContext *C, wmOperator *op)
+{
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
+ bNode *node;
+
+ int x, y, radius, gesture_mode;
+ float offset[2];
+
+ float zoom = (float)(BLI_rcti_size_x(&ar->winrct)) / (float)(BLI_rctf_size_x(&ar->v2d.cur));
+
+ gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
+
+ /* get operator properties */
+ x = RNA_int_get(op->ptr, "x");
+ y = RNA_int_get(op->ptr, "y");
+ radius = RNA_int_get(op->ptr, "radius");
+
+ UI_view2d_region_to_view(&ar->v2d, x, y, &offset[0], &offset[1]);
+
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
+ if (BLI_rctf_isect_circle(&node->totr, offset, radius / zoom)) {
+ nodeSetSelected(node, (gesture_mode == GESTURE_MODAL_SELECT));
+ }
+ }
+
+ WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void NODE_OT_select_circle(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Circle Select";
+ ot->idname = "NODE_OT_select_circle";
+ ot->description = "Use circle selection to select nodes";
+
+ /* api callbacks */
+ ot->invoke = WM_gesture_circle_invoke;
+ ot->exec = node_circleselect_exec;
+ ot->modal = WM_gesture_circle_modal;
+
+ ot->poll = ED_operator_node_active;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* rna */
+ RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "radius", 0, INT_MIN, INT_MAX, "Radius", "", INT_MIN, INT_MAX);
+ RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX);
+}
+
/* ****** Lasso Select ****** */
static int do_lasso_select_node(bContext *C, const int mcords[][2], short moves, short select)
diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c
index f889a8ec97b..ff441d63479 100644
--- a/source/blender/editors/space_node/node_view.c
+++ b/source/blender/editors/space_node/node_view.c
@@ -220,6 +220,7 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *e
CLAMP(snode->yof, nvm->ymin, nvm->ymax);
ED_region_tag_redraw(ar);
+ WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL);
break;
@@ -273,12 +274,10 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *
return OPERATOR_RUNNING_MODAL;
}
-static int snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op)
+static void snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata = NULL;
-
- return OPERATOR_CANCELLED;
}
void NODE_OT_backimage_move(wmOperatorType *ot)
@@ -306,6 +305,7 @@ static int backimage_zoom_exec(bContext *C, wmOperator *op)
snode->zoom *= fac;
ED_region_tag_redraw(ar);
+ WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
}
@@ -363,6 +363,7 @@ static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op))
snode->yof = 0;
ED_region_tag_redraw(ar);
+ WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
}
@@ -612,10 +613,9 @@ static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int sample_cancel(bContext *C, wmOperator *op)
+static void sample_cancel(bContext *C, wmOperator *op)
{
sample_exit(C, op);
- return OPERATOR_CANCELLED;
}
void NODE_OT_backimage_sample(wmOperatorType *ot)
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 61c3fe52468..ebaeb9ccb6a 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1626,7 +1626,7 @@ void draw_outliner(const bContext *C)
/* set matrix for 2d-view controls */
UI_view2d_view_ortho(v2d);
- /* draw outliner stuff (background, hierachy lines and names) */
+ /* draw outliner stuff (background, hierarchy lines and names) */
outliner_back(ar);
block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
outliner_draw_tree((bContext *)C, block, scene, ar, soops, &te_edit);
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index d695ffa46d5..3a7d001f432 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -476,9 +476,9 @@ void ED_spacetype_outliner(void)
st->dropboxes = outliner_dropboxes;
/* regions: main window */
- art = MEM_callocN(sizeof(ARegionType), "spacetype time region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype outliner region");
art->regionid = RGN_TYPE_WINDOW;
- art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
art->init = outliner_main_area_init;
art->draw = outliner_main_area_draw;
@@ -487,7 +487,7 @@ void ED_spacetype_outliner(void)
BLI_addhead(&st->regiontypes, art);
/* regions: header */
- art = MEM_callocN(sizeof(ARegionType), "spacetype time header region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype outliner header region");
art->regionid = RGN_TYPE_HEADER;
art->prefsizey = HEADERY;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 8b2e7067eb9..63aa92517a7 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -821,7 +821,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
/* like duplicate, but only duplicate and cut overlapping strips,
* strips to the left of the cutframe are ignored and strips to the right
* are moved to the end of slist
- * we have to work on the same slist (not using a seperate list), since
+ * we have to work on the same slist (not using a separate list), since
* otherwise dupli_seq can't check for duplicate names properly and
* may generate strips with the same name (which will mess up animdata)
*/
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index deb37f8d943..f39b30adf37 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -211,11 +211,9 @@ static int sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int sample_cancel(bContext *C, wmOperator *op)
+static void sample_cancel(bContext *C, wmOperator *op)
{
sample_exit(C, op);
-
- return OPERATOR_CANCELLED;
}
static int sample_poll(bContext *C)
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index eaba537c0a8..692cefd3ee9 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -529,10 +529,9 @@ static void text_autocomplete_free(bContext *C, wmOperator *op)
}
}
-static int text_autocomplete_cancel(bContext *C, wmOperator *op)
+static void text_autocomplete_cancel(bContext *C, wmOperator *op)
{
text_autocomplete_free(C, op);
- return OPERATOR_CANCELLED;
}
void TEXT_OT_autocomplete(wmOperatorType *ot)
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 4f53d033029..dd5e282587d 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -214,10 +214,9 @@ static void text_open_init(bContext *C, wmOperator *op)
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
-static int text_open_cancel(bContext *UNUSED(C), wmOperator *op)
+static void text_open_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
- return OPERATOR_CANCELLED;
}
static int text_open_exec(bContext *C, wmOperator *op)
@@ -2231,11 +2230,9 @@ static int text_scroll_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int text_scroll_cancel(bContext *C, wmOperator *op)
+static void text_scroll_cancel(bContext *C, wmOperator *op)
{
scroll_exit(C, op);
-
- return OPERATOR_CANCELLED;
}
static int text_scroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -2706,10 +2703,9 @@ static int text_set_selection_modal(bContext *C, wmOperator *op, const wmEvent *
return OPERATOR_RUNNING_MODAL;
}
-static int text_set_selection_cancel(bContext *C, wmOperator *op)
+static void text_set_selection_cancel(bContext *C, wmOperator *op)
{
text_cursor_set_exit(C, op);
- return OPERATOR_FINISHED;
}
void TEXT_OT_selection_set(wmOperatorType *ot)
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index ac1f4406983..3ed1d15a9ee 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1356,6 +1356,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
/* and back to viewspace */
+ glPushMatrix();
glLoadMatrixf(rv3d->viewmat);
copy_v3_v3(vec, ob->obmat[3]);
@@ -1391,6 +1392,8 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* restore for drawing extra stuff */
glColor3ubv(ob_wire_col);
}
+ /* and finally back to org object space! */
+ glPopMatrix();
}
static void draw_limit_line(float sta, float end, const short dflag, unsigned int col)
@@ -2309,7 +2312,7 @@ static DMDrawOption draw_dm_edges_seams__setDrawOptions(void *userData, int inde
static void draw_dm_edges_seams(BMEditMesh *em, DerivedMesh *dm)
{
- dm->drawMappedEdges(dm, draw_dm_edges_seams__setDrawOptions, em);
+ dm->drawMappedEdges(dm, draw_dm_edges_seams__setDrawOptions, em->bm);
}
/* Draw only sharp edges */
@@ -2325,7 +2328,7 @@ static DMDrawOption draw_dm_edges_sharp__setDrawOptions(void *userData, int inde
static void draw_dm_edges_sharp(BMEditMesh *em, DerivedMesh *dm)
{
- dm->drawMappedEdges(dm, draw_dm_edges_sharp__setDrawOptions, em);
+ dm->drawMappedEdges(dm, draw_dm_edges_sharp__setDrawOptions, em->bm);
}
#ifdef WITH_FREESTYLE
@@ -2692,7 +2695,10 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMesh *em, UnitSettings *unit)
{
- const short txt_flag = V3D_CACHE_TEXT_ASCII | V3D_CACHE_TEXT_LOCALCLIP;
+ /* Do not use ascii when using non-default unit system, some unit chars are utf8 (micro, square, etc.).
+ * See bug #36090.
+ */
+ const short txt_flag = V3D_CACHE_TEXT_LOCALCLIP | (unit->system ? 0 : V3D_CACHE_TEXT_ASCII);
Mesh *me = ob->data;
float v1[3], v2[3], v3[3], vmid[3], fvec[3];
char numstr[32]; /* Stores the measurement display text here */
@@ -2865,14 +2871,11 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe
bUnit_AsString(numstr, sizeof(numstr), \
(double)(area * unit->scale_length * unit->scale_length), \
3, unit->system, B_UNIT_AREA, do_split, false); \
- view3d_cached_text_draw_add(vmid, numstr, 0, \
- /* Metric system uses unicode "squared" sign! */ \
- txt_flag ^ V3D_CACHE_TEXT_ASCII, col); \
} \
else { \
BLI_snprintf(numstr, sizeof(numstr), conv_float, area); \
- view3d_cached_text_draw_add(vmid, numstr, 0, txt_flag, col); \
} \
+ view3d_cached_text_draw_add(vmid, numstr, 0, txt_flag, col); \
} (void)0
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
@@ -6876,7 +6879,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
case OB_LAMP:
if (!render_override) {
drawlamp(scene, v3d, rv3d, base, dt, dflag, ob_wire_col);
- if (dtx || (base->flag & SELECT)) glMultMatrixf(ob->obmat);
}
break;
case OB_CAMERA:
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index eea084b4750..c4fdacaa915 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -482,7 +482,15 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- add_v3_v3(eve->co, &median[LOC_X]);
+ if (tot == 1) {
+ /* In case we only have one element selected, copy directly the value instead of applying
+ * the diff. Avoids some glitches when going e.g. from 3 to 0.0001 (see [#37327]).
+ */
+ copy_v3_v3(eve->co, &ve_median[LOC_X]);
+ }
+ else {
+ add_v3_v3(eve->co, &median[LOC_X]);
+ }
}
}
@@ -623,10 +631,12 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
nu = nurbs->first;
while (nu) {
if (nu->type == CU_BEZIER) {
- bezt = nu->bezt;
- a = nu->pntsu;
- while (a--) {
+ for (a = nu->pntsu, bezt = nu->bezt; a--; bezt++) {
if (bezt->f2 & SELECT) {
+ /* Here we always have to use the diff... :/
+ * Cannot avoid some glitches when going e.g. from 3 to 0.0001 (see [#37327]),
+ * unless we use doubles.
+ */
add_v3_v3(bezt->vec[0], &median[LOC_X]);
add_v3_v3(bezt->vec[1], &median[LOC_X]);
add_v3_v3(bezt->vec[2], &median[LOC_X]);
@@ -647,22 +657,39 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
else {
if (bezt->f1 & SELECT) {
- add_v3_v3(bezt->vec[0], &median[LOC_X]);
+ if (tot == 1) {
+ copy_v3_v3(bezt->vec[0], &ve_median[LOC_X]);
+ }
+ else {
+ add_v3_v3(bezt->vec[0], &median[LOC_X]);
+ }
}
if (bezt->f3 & SELECT) {
- add_v3_v3(bezt->vec[2], &median[LOC_X]);
+ if (tot == 1) {
+ copy_v3_v3(bezt->vec[2], &ve_median[LOC_X]);
+ }
+ else {
+ add_v3_v3(bezt->vec[2], &median[LOC_X]);
+ }
}
}
- bezt++;
}
}
else {
- bp = nu->bp;
- a = nu->pntsu * nu->pntsv;
- while (a--) {
+ for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a--; bp++) {
if (bp->f1 & SELECT) {
- add_v3_v3(bp->vec, &median[LOC_X]);
- bp->vec[3] += median[C_BWEIGHT];
+ if (tot == 1) {
+ copy_v3_v3(bp->vec, &ve_median[LOC_X]);
+ bp->vec[3] = ve_median[C_BWEIGHT];
+ bp->radius = ve_median[C_RADIUS];
+ bp->alfa = ve_median[C_TILT];
+ }
+ else {
+ add_v3_v3(bp->vec, &median[LOC_X]);
+ bp->vec[3] += median[C_BWEIGHT];
+ bp->radius += median[C_RADIUS];
+ bp->alfa += median[C_TILT];
+ }
if (median[C_WEIGHT] != 0.0f) {
if (ELEM(scale_w, 0.0f, 1.0f)) {
@@ -674,11 +701,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
CLAMP(bp->weight, 0.0f, 1.0f);
}
}
-
- bp->radius += median[C_RADIUS];
- bp->alfa += median[C_TILT];
}
- bp++;
}
}
BKE_nurb_test2D(nu);
@@ -697,7 +720,12 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
bp = lt->editlatt->latt->def;
while (a--) {
if (bp->f1 & SELECT) {
- add_v3_v3(bp->vec, &median[LOC_X]);
+ if (tot == 1) {
+ copy_v3_v3(bp->vec, &ve_median[LOC_X]);
+ }
+ else {
+ add_v3_v3(bp->vec, &median[LOC_X]);
+ }
if (median[L_WEIGHT] != 0.0f) {
if (ELEM(scale_w, 0.0f, 1.0f)) {
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index bb41e727d90..80e5d194d45 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1062,11 +1062,9 @@ static int view3d_lock_poll(bContext *C)
return false;
}
-static int viewrotate_cancel(bContext *C, wmOperator *op)
+static void viewrotate_cancel(bContext *C, wmOperator *op)
{
viewops_data_free(C, op);
-
- return OPERATOR_CANCELLED;
}
void VIEW3D_OT_rotate(wmOperatorType *ot)
@@ -1699,11 +1697,9 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
}
-static int viewmove_cancel(bContext *C, wmOperator *op)
+static void viewmove_cancel(bContext *C, wmOperator *op)
{
viewops_data_free(C, op);
-
- return OPERATOR_CANCELLED;
}
void VIEW3D_OT_move(wmOperatorType *ot)
@@ -2091,11 +2087,9 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_FINISHED;
}
-static int viewzoom_cancel(bContext *C, wmOperator *op)
+static void viewzoom_cancel(bContext *C, wmOperator *op)
{
viewops_data_free(C, op);
-
- return OPERATOR_CANCELLED;
}
void VIEW3D_OT_zoom(wmOperatorType *ot)
@@ -2332,11 +2326,9 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_FINISHED;
}
-static int viewdolly_cancel(bContext *C, wmOperator *op)
+static void viewdolly_cancel(bContext *C, wmOperator *op)
{
viewops_data_free(C, op);
-
- return OPERATOR_CANCELLED;
}
void VIEW3D_OT_dolly(wmOperatorType *ot)
@@ -3772,11 +3764,9 @@ static int viewroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_FINISHED;
}
-static int viewroll_cancel(bContext *C, wmOperator *op)
+static void viewroll_cancel(bContext *C, wmOperator *op)
{
viewops_data_free(C, op);
-
- return OPERATOR_CANCELLED;
}
void VIEW3D_OT_view_roll(wmOperatorType *ot)
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 9341ea9d3e6..6d04b9b8826 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -1254,15 +1254,13 @@ static int fly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-static int fly_cancel(bContext *C, wmOperator *op)
+static void fly_cancel(bContext *C, wmOperator *op)
{
FlyInfo *fly = op->customdata;
fly->state = FLY_CANCEL;
flyEnd(C, fly);
op->customdata = NULL;
-
- return OPERATOR_CANCELLED;
}
static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event)
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c
index bca162d156b..288ada3f852 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -809,15 +809,13 @@ static int view3d_ruler_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
return OPERATOR_RUNNING_MODAL;
}
-static int view3d_ruler_cancel(bContext *C, wmOperator *op)
+static void view3d_ruler_cancel(bContext *C, wmOperator *op)
{
RulerInfo *ruler_info = op->customdata;
view3d_ruler_end(C, ruler_info);
view3d_ruler_free(ruler_info);
op->customdata = NULL;
-
- return OPERATOR_CANCELLED;
}
static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event)
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 9909f438734..2caf04e3143 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -82,6 +82,7 @@
#include "ED_mesh.h"
#include "ED_clip.h"
#include "ED_mask.h"
+#include "ED_node.h"
#include "WM_types.h"
#include "WM_api.h"
@@ -2778,7 +2779,7 @@ static void Warp(TransInfo *t, const int UNUSED(mval[2]))
const float radius_snap = 0.1f;
const float snap_hack = (t->snap[1] * data->warp_init_dist) / radius_snap;
values.scale *= snap_hack;
- snapGrid(t, values.vector);
+ snapGridIncrement(t, values.vector);
values.scale /= snap_hack;
}
#endif
@@ -2950,7 +2951,7 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
value = t->values[0];
- snapGrid(t, &value);
+ snapGridIncrement(t, &value);
applyNumInput(&t->num, &value);
@@ -3238,7 +3239,7 @@ static void applyResize(TransInfo *t, const int mval[2])
size[0] = size[1] = size[2] = ratio;
- snapGrid(t, size);
+ snapGridIncrement(t, size);
if (hasNumInput(&t->num)) {
applyNumInput(&t->num, size);
@@ -3340,7 +3341,7 @@ static void applySkinResize(TransInfo *t, const int UNUSED(mval[2]))
ratio = t->values[0];
size[0] = size[1] = size[2] = ratio;
- snapGrid(t, size);
+ snapGridIncrement(t, size);
if (hasNumInput(&t->num)) {
applyNumInput(&t->num, size);
@@ -3438,7 +3439,7 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
ratio = t->values[0];
- snapGrid(t, &ratio);
+ snapGridIncrement(t, &ratio);
applyNumInput(&t->num, &ratio);
@@ -3789,7 +3790,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
final = t->values[0];
- snapGrid(t, &final);
+ snapGridIncrement(t, &final);
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
t->con.applyRot(t, NULL, t->axis, NULL);
@@ -3902,7 +3903,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
phi[0] = t->values[0];
phi[1] = t->values[1];
- snapGrid(t, phi);
+ snapGridIncrement(t, phi);
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN * 2];
@@ -3981,8 +3982,8 @@ static void initTranslation(TransInfo *t)
}
else if (t->spacetype == SPACE_NODE) {
t->snap[0] = 0.0f;
- t->snap[1] = 125.0f;
- t->snap[2] = 25.0f;
+ t->snap[1] = ED_node_grid_size() * NODE_GRID_STEPS;
+ t->snap[2] = ED_node_grid_size();
}
else {
t->snap[0] = 0.0f;
@@ -4162,7 +4163,7 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
headerTranslation(t, pvec, str);
}
else {
- snapGrid(t, t->values);
+ snapGridIncrement(t, t->values);
applyNumInput(&t->num, t->values);
if (hasNumInput(&t->num)) {
removeAspectRatio(t, t->values);
@@ -4234,7 +4235,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
distance = -t->values[0];
- snapGrid(t, &distance);
+ snapGridIncrement(t, &distance);
applyNumInput(&t->num, &distance);
@@ -4262,7 +4263,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
}
}
BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_(" or Alt) Even Thickness %s"),
- WM_bool_as_string(t->flag & T_ALT_TRANSFORM));
+ WM_bool_as_string((t->flag & T_ALT_TRANSFORM) != 0));
/* done with header string */
@@ -4327,7 +4328,7 @@ static void applyTilt(TransInfo *t, const int UNUSED(mval[2]))
final = t->values[0];
- snapGrid(t, &final);
+ snapGridIncrement(t, &final);
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
@@ -4402,7 +4403,7 @@ static void applyCurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
ratio = t->values[0];
- snapGrid(t, &ratio);
+ snapGridIncrement(t, &ratio);
applyNumInput(&t->num, &ratio);
@@ -4475,7 +4476,7 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
ratio = t->values[0];
- snapGrid(t, &ratio);
+ snapGridIncrement(t, &ratio);
applyNumInput(&t->num, &ratio);
@@ -4566,7 +4567,7 @@ static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
distance = t->values[0];
- snapGrid(t, &distance);
+ snapGridIncrement(t, &distance);
applyNumInput(&t->num, &distance);
@@ -4658,7 +4659,7 @@ static void applyBevelWeight(TransInfo *t, const int UNUSED(mval[2]))
weight -= 1.0f;
if (weight > 1.0f) weight = 1.0f;
- snapGrid(t, &weight);
+ snapGridIncrement(t, &weight);
applyNumInput(&t->num, &weight);
@@ -4735,7 +4736,7 @@ static void applyCrease(TransInfo *t, const int UNUSED(mval[2]))
crease -= 1.0f;
if (crease > 1.0f) crease = 1.0f;
- snapGrid(t, &crease);
+ snapGridIncrement(t, &crease);
applyNumInput(&t->num, &crease);
@@ -4868,7 +4869,7 @@ static void applyBoneSize(TransInfo *t, const int mval[2])
size[0] = size[1] = size[2] = ratio;
- snapGrid(t, size);
+ snapGridIncrement(t, size);
if (hasNumInput(&t->num)) {
applyNumInput(&t->num, size);
@@ -4935,7 +4936,7 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
ratio = t->values[0];
- snapGrid(t, &ratio);
+ snapGridIncrement(t, &ratio);
applyNumInput(&t->num, &ratio);
@@ -6066,7 +6067,7 @@ static void applyEdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
final = t->values[0];
- snapGrid(t, &final);
+ snapGridIncrement(t, &final);
/* only do this so out of range values are not displayed */
CLAMP(final, -1.0f, 1.0f);
@@ -6574,7 +6575,7 @@ static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2]))
final = t->values[0];
- snapGrid(t, &final);
+ snapGridIncrement(t, &final);
/* only do this so out of range values are not displayed */
if (is_constrained) {
@@ -6643,7 +6644,7 @@ static void applyBoneRoll(TransInfo *t, const int UNUSED(mval[2]))
final = t->values[0];
- snapGrid(t, &final);
+ snapGridIncrement(t, &final);
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
@@ -6716,7 +6717,7 @@ static void applyBakeTime(TransInfo *t, const int mval[2])
time = (float)(t->center2d[0] - mval[0]) * fac;
}
- snapGrid(t, &time);
+ snapGridIncrement(t, &time);
applyNumInput(&t->num, &time);
@@ -6946,7 +6947,7 @@ static void headerSeqSlide(TransInfo *t, float val[2], char str[MAX_INFO_LEN])
}
}
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_(" or Alt) Expand to fit %s"),
- WM_bool_as_string(t->flag & T_ALT_TRANSFORM));
+ WM_bool_as_string((t->flag & T_ALT_TRANSFORM) != 0));
}
static void applySeqSlideValue(TransInfo *t, const float val[2])
@@ -6983,7 +6984,7 @@ static void applySeqSlide(TransInfo *t, const int UNUSED(mval[2]))
copy_v3_v3(t->values, tvec);
}
else {
- snapGrid(t, t->values);
+ snapGridIncrement(t, t->values);
applyNumInput(&t->num, t->values);
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 73b8c47eb63..ab5f034c836 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -566,14 +566,15 @@ typedef enum {
SMALL_GEARS = 2
} GearsType;
-void snapGrid(TransInfo *t, float *val);
-void snapGridAction(TransInfo *t, float *val, GearsType action);
+void snapGridIncrement(TransInfo *t, float *val);
+void snapGridIncrementAction(TransInfo *t, float *val, GearsType action);
bool activeSnap(TransInfo *t);
bool validSnap(TransInfo *t);
void initSnapping(struct TransInfo *t, struct wmOperator *op);
void applyProject(TransInfo *t);
+void applyGridAbsolute(TransInfo *t);
void applySnapping(TransInfo *t, float *vec);
void resetSnapping(TransInfo *t);
eRedrawFlag handleSnapping(TransInfo *t, const struct wmEvent *event);
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 4497723185f..8df289ff917 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -135,7 +135,7 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
mul_m3_v3(t->con.imtx, vec);
- snapGrid(t, vec);
+ snapGridIncrement(t, vec);
if (t->num.flag & T_NULL_ONE) {
if (!(t->con.mode & CON_AXIS0))
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 28d31b09ad2..06da1edbcdc 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2381,16 +2381,16 @@ void flushTransNodes(TransInfo *t)
int a;
TransData *td;
TransData2D *td2d;
-
+
+ applyGridAbsolute(t);
+
/* flush to 2d vector from internally used 3d vector */
for (a = 0, td = t->data, td2d = t->data2d; a < t->total; a++, td++, td2d++) {
bNode *node = td->extra;
- float vec[2];
/* weirdo - but the node system is a mix of free 2d elements and dpi sensitive UI */
- add_v2_v2v2(vec, td2d->loc, td2d->ih1);
- node->locx = vec[0] / UI_DPI_FAC;
- node->locy = vec[1] / UI_DPI_FAC;
+ node->locx = td2d->loc[0] / UI_DPI_FAC;
+ node->locy = td2d->loc[1] / UI_DPI_FAC;
}
/* handle intersection with noodles */
@@ -3714,12 +3714,14 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
float mtx[3][3], smtx[3][3];
const bool use_handle = !(sipo->flag & SIPO_NOHANDLES);
const bool use_local_center = checkUseLocalCenter_GraphEdit(t);
- const short anim_map_flag = ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS;
+ short anim_map_flag = ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS;
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
-
+
+ anim_map_flag |= ANIM_get_normalization_flags(&ac);
+
/* filter data */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
@@ -3835,7 +3837,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
FCurve *fcu = (FCurve *)ale->key_data;
short intvals = (fcu->flag & FCURVE_INT_VALUES);
-
+ float unit_scale;
+ float scaled_mtx[3][3], scaled_smtx[3][3];
+
/* convert current-frame to action-time (slightly less accurate, especially under
* higher scaling ratios, but is faster than converting all points)
*/
@@ -3848,8 +3852,13 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
if (fcu->bezt == NULL)
continue;
- ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, anim_map_flag);
-
+ unit_scale = ANIM_unit_mapping_get_factor(ac.scene, ale->id, ale->key_data, anim_map_flag);
+
+ copy_m3_m3(scaled_mtx, mtx);
+ copy_m3_m3(scaled_smtx, smtx);
+ mul_v3_fl(scaled_mtx[1], unit_scale);
+ mul_v3_fl(scaled_smtx[1], 1.0f / unit_scale);
+
/* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
@@ -3866,7 +3875,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
if (!ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE) || !(sel2)) {
if (sel1) {
hdata = initTransDataCurveHandles(td, bezt);
- bezt_to_transdata(td++, td2d++, adt, bezt, 0, 1, 1, intvals, mtx, smtx);
+ bezt_to_transdata(td++, td2d++, adt, bezt, 0, 1, 1, intvals, scaled_mtx, scaled_smtx);
}
else {
/* h1 = 0; */ /* UNUSED */
@@ -3875,7 +3884,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
if (sel3) {
if (hdata == NULL)
hdata = initTransDataCurveHandles(td, bezt);
- bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals, mtx, smtx);
+ bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals, scaled_mtx, scaled_smtx);
}
else {
/* h2 = 0; */ /* UNUSED */
@@ -3897,7 +3906,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
hdata = initTransDataCurveHandles(td, bezt);
}
- bezt_to_transdata(td++, td2d++, adt, bezt, 1, 1, 0, intvals, mtx, smtx);
+ bezt_to_transdata(td++, td2d++, adt, bezt, 1, 1, 0, intvals, scaled_mtx, scaled_smtx);
}
/* special hack (must be done after initTransDataCurveHandles(), as that stores handle settings to restore...):
@@ -3919,13 +3928,6 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
/* Sets handles based on the selection */
testhandles_fcurve(fcu, use_handle);
-
- /* even though transform values are written back right after during transform,
- * using individual center's with rotation means the center point wont
- * be touched again see: [#34303] */
- if (use_local_center) {
- ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, anim_map_flag | ANIM_UNITCONV_RESTORE);
- }
}
/* cleanup temp list */
@@ -4713,13 +4715,12 @@ static bool constraints_list_needinv(TransInfo *t, ListBase *list)
if ((con->flag & CONSTRAINT_DISABLE) == 0 && (con->enforce != 0.0f)) {
/* (affirmative) returns for specific constraints here... */
/* constraints that require this regardless */
- if (ELEM6(con->type,
+ if (ELEM5(con->type,
CONSTRAINT_TYPE_CHILDOF,
CONSTRAINT_TYPE_FOLLOWPATH,
CONSTRAINT_TYPE_CLAMPTO,
CONSTRAINT_TYPE_OBJECTSOLVER,
- CONSTRAINT_TYPE_FOLLOWTRACK,
- CONSTRAINT_TYPE_TRANSFORM))
+ CONSTRAINT_TYPE_FOLLOWTRACK))
{
return true;
}
@@ -4732,6 +4733,15 @@ static bool constraints_list_needinv(TransInfo *t, ListBase *list)
if ((data->flag & ROTLIKE_OFFSET) && (t->mode == TFM_ROTATION))
return true;
}
+ else if (con->type == CONSTRAINT_TYPE_TRANSFORM) {
+ /* Transform constraint needs it for rotation at least (r.57309),
+ * but doing so when translating may also mess things up [#36203]
+ */
+
+ if (t->mode == TFM_ROTATION)
+ return true;
+ /* ??? (t->mode == TFM_SCALE) ? */
+ }
}
}
}
@@ -5861,6 +5871,9 @@ int special_transform_moving(TransInfo *t)
if (t->spacetype == SPACE_SEQ) {
return G_TRANSFORM_SEQ;
}
+ else if (t->spacetype == SPACE_IPO) {
+ return G_TRANSFORM_FCURVES;
+ }
else if (t->obedit || ((t->flag & T_POSE) && (t->poseobj))) {
return G_TRANSFORM_EDIT;
}
@@ -5949,12 +5962,10 @@ static void createTransObject(bContext *C, TransInfo *t)
/* transcribe given node into TransData2D for Transforming */
static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
{
- /* hold original location */
- float locxy[2] = {BLI_rctf_cent_x(&node->totr),
- BLI_rctf_cent_y(&node->totr)};
- float nodeloc[2];
-
- copy_v2_v2(td2d->loc, locxy);
+ /* use top-left corner as the transform origin for nodes */
+ /* weirdo - but the node system is a mix of free 2d elements and dpi sensitive UI */
+ td2d->loc[0] = UI_DPI_FAC * node->locx;
+ td2d->loc[1] = UI_DPI_FAC * node->locy;
td2d->loc[2] = 0.0f;
td2d->loc2d = td2d->loc; /* current location */
@@ -5963,8 +5974,8 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
td->loc = td2d->loc;
copy_v3_v3(td->iloc, td->loc);
/* use node center instead of origin (top-left corner) */
- td->center[0] = locxy[0];
- td->center[1] = locxy[1];
+ td->center[0] = td2d->loc[0] + BLI_rctf_size_x(&node->totr);
+ td->center[1] = td2d->loc[1] + BLI_rctf_size_y(&node->totr);
td->center[2] = 0.0f;
memset(td->axismtx, 0, sizeof(td->axismtx));
@@ -5978,11 +5989,6 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
unit_m3(td->mtx);
unit_m3(td->smtx);
- /* weirdo - but the node system is a mix of free 2d elements and dpi sensitive UI */
- nodeloc[0] = UI_DPI_FAC * node->locx;
- nodeloc[1] = UI_DPI_FAC * node->locy;
- sub_v2_v2v2(td2d->ih1, nodeloc, locxy);
-
td->extra = node;
}
@@ -6819,8 +6825,11 @@ void flushTransMasking(TransInfo *t)
td->loc2d[1] = td->loc[1] * inv[1];
mul_m3_v2(tdm->parent_inverse_matrix, td->loc2d);
- if (tdm->is_handle)
- BKE_mask_point_set_handle(tdm->point, td->loc2d, t->flag & T_ALT_TRANSFORM, tdm->orig_handle, tdm->vec);
+ if (tdm->is_handle) {
+ BKE_mask_point_set_handle(tdm->point, td->loc2d,
+ (t->flag & T_ALT_TRANSFORM) != 0,
+ tdm->orig_handle, tdm->vec);
+ }
}
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 33eca0d6b89..422060c48e6 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -381,9 +381,6 @@ static void recalcData_graphedit(TransInfo *t)
bAnimListElem *ale;
int dosort = 0;
- const bool use_local_center = checkUseLocalCenter_GraphEdit(t);
-
-
/* initialize relevant anim-context 'context' data from TransInfo data */
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
scene = ac.scene = t->scene;
@@ -411,11 +408,6 @@ static void recalcData_graphedit(TransInfo *t)
if (!fcu_test_selected(fcu))
continue;
- ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data,
- ANIM_UNITCONV_ONLYSEL | ANIM_UNITCONV_SELVERTS | ANIM_UNITCONV_RESTORE |
- (use_local_center ? ANIM_UNITCONV_SKIPKNOTS : 0));
-
-
/* watch it: if the time is wrong: do not correct handles yet */
if (test_time_fcurve(fcu))
dosort++;
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 2904b37c2e5..8f31e49bfe9 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -426,15 +426,13 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event)
return exit_code;
}
-static int transform_cancel(bContext *C, wmOperator *op)
+static void transform_cancel(bContext *C, wmOperator *op)
{
TransInfo *t = op->customdata;
t->state = TRANS_CANCEL;
transformEnd(C, t);
transformops_exit(C, op);
-
- return OPERATOR_CANCELLED;
}
static int transform_exec(bContext *C, wmOperator *op)
@@ -708,7 +706,7 @@ static void TRANSFORM_OT_warp(struct wmOperatorType *ot)
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
- ot->poll = ED_operator_screenactive;
+ ot->poll = ED_operator_region_view3d_active;
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 48b92dfac7c..5ace7e3a738 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -117,7 +117,7 @@ int BIF_snappingSupported(Object *obedit)
{
int status = 0;
- if (obedit == NULL || ELEM4(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE)) /* only support object mesh, armature, curves */
+ if (obedit == NULL || ELEM5(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE, OB_MBALL)) /* only support object mesh, armature, curves */
{
status = 1;
}
@@ -344,6 +344,70 @@ void applyProject(TransInfo *t)
}
}
+void applyGridAbsolute(TransInfo *t)
+{
+ float grid_size = 0.0f;
+ GearsType grid_action;
+ TransData *td;
+ float imat[4][4];
+ int i;
+
+ if (!(activeSnap(t) && (t->tsnap.mode == SCE_SNAP_MODE_GRID)))
+ return;
+
+ grid_action = BIG_GEARS;
+ if (t->modifiers & MOD_PRECISION)
+ grid_action = SMALL_GEARS;
+
+ switch (grid_action) {
+ case NO_GEARS: grid_size = t->snap[0]; break;
+ case BIG_GEARS: grid_size = t->snap[1]; break;
+ case SMALL_GEARS: grid_size = t->snap[2]; break;
+ }
+ /* early exit on unusable grid size */
+ if (grid_size == 0.0f)
+ return;
+
+ if (t->flag & (T_EDIT | T_POSE)) {
+ Object *ob = t->obedit ? t->obedit : t->poseobj;
+ invert_m4_m4(imat, ob->obmat);
+ }
+
+ for (i = 0, td = t->data; i < t->total; i++, td++) {
+ float iloc[3], loc[3], tvec[3];
+
+ if (td->flag & TD_NOACTION)
+ break;
+
+ if (td->flag & TD_SKIP)
+ continue;
+
+ if ((t->flag & T_PROP_EDIT) && (td->factor == 0.0f))
+ continue;
+
+ copy_v3_v3(iloc, td->loc);
+ if (t->flag & (T_EDIT | T_POSE)) {
+ Object *ob = t->obedit ? t->obedit : t->poseobj;
+ mul_m4_v3(ob->obmat, iloc);
+ }
+ else if (t->flag & T_OBJECT) {
+ td->ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ BKE_object_handle_update(t->scene, td->ob);
+ copy_v3_v3(iloc, td->ob->obmat[3]);
+ }
+
+ mul_v3_v3fl(loc, iloc, 1.0f/grid_size);
+ loc[0] = floorf(loc[0]);
+ loc[1] = floorf(loc[1]);
+ loc[2] = floorf(loc[2]);
+ mul_v3_fl(loc, grid_size);
+
+ sub_v3_v3v3(tvec, loc, iloc);
+ mul_m3_v3(td->smtx, tvec);
+ add_v3_v3(td->loc, tvec);
+ }
+}
+
void applySnapping(TransInfo *t, float *vec)
{
/* project is not applied this way */
@@ -440,7 +504,7 @@ static void initSnappingMode(TransInfo *t)
/* Edit mode */
if (t->tsnap.applySnap != NULL && // A snapping function actually exist
- (obedit != NULL && ELEM4(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE)) ) // Temporary limited to edit mode meshes, armature, curves
+ (obedit != NULL && ELEM5(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE, OB_MBALL)) ) // Temporary limited to edit mode meshes, armature, curves, mballs
{
/* Exclude editmesh if using proportional edit */
if ((obedit->type == OB_MESH) && (t->flag & T_PROP_EDIT)) {
@@ -818,7 +882,7 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3])
static void UNUSED_FUNCTION(CalcSnapGrid) (TransInfo *t, float *UNUSED(vec))
{
- snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS);
+ snapGridIncrementAction(t, t->tsnap.snapPoint, BIG_GEARS);
}
static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
@@ -2169,10 +2233,10 @@ bool snapNodesContext(bContext *C, const int mval[2], float *r_dist_px, float r_
/*================================================================*/
-static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], GearsType action);
+static void applyGridIncrement(TransInfo *t, float *val, int max_index, float fac[3], GearsType action);
-void snapGridAction(TransInfo *t, float *val, GearsType action)
+void snapGridIncrementAction(TransInfo *t, float *val, GearsType action)
{
float fac[3];
@@ -2180,11 +2244,11 @@ void snapGridAction(TransInfo *t, float *val, GearsType action)
fac[BIG_GEARS] = t->snap[1];
fac[SMALL_GEARS] = t->snap[2];
- applyGrid(t, val, t->idx_max, fac, action);
+ applyGridIncrement(t, val, t->idx_max, fac, action);
}
-void snapGrid(TransInfo *t, float *val)
+void snapGridIncrement(TransInfo *t, float *val)
{
GearsType action;
@@ -2198,17 +2262,17 @@ void snapGrid(TransInfo *t, float *val)
action = SMALL_GEARS;
}
- snapGridAction(t, val, action);
+ snapGridIncrementAction(t, val, action);
}
-static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], GearsType action)
+static void applyGridIncrement(TransInfo *t, float *val, int max_index, float fac[3], GearsType action)
{
int i;
float asp[3] = {1.0f, 1.0f, 1.0f}; // TODO: Remove hard coded limit here (3)
if (max_index > 2) {
- printf("applyGrid: invalid index %d, clamping\n", max_index);
+ printf("applyGridIncrement: invalid index %d, clamping\n", max_index);
max_index = 2;
}
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 4b5d6d55aa0..c234d1769b3 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -1998,10 +1998,9 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
}
-static int stitch_cancel(bContext *C, wmOperator *op)
+static void stitch_cancel(bContext *C, wmOperator *op)
{
stitch_exit(C, op, 0);
- return OPERATOR_CANCELLED;
}
@@ -2016,7 +2015,8 @@ static int stitch_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
}
@@ -2067,8 +2067,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* Cancel */
case ESCKEY:
- return stitch_cancel(C, op);
-
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
case LEFTMOUSE:
if (event->shift && (U.flag & USER_LMOUSESELECT)) {
@@ -2076,7 +2076,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
stitch_select(C, scene, event, state);
if (!stitch_process_data(state, scene, FALSE)) {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
}
break;
@@ -2089,7 +2090,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_FINISHED;
}
else {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
}
else {
@@ -2101,7 +2103,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (event->val == KM_PRESS && event->alt) {
state->limit_dist += 0.01f;
if (!stitch_process_data(state, scene, FALSE)) {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
break;
}
@@ -2115,7 +2118,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
state->limit_dist -= 0.01f;
state->limit_dist = MAX2(0.01f, state->limit_dist);
if (!stitch_process_data(state, scene, FALSE)) {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
break;
}
@@ -2128,7 +2132,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (event->val == KM_PRESS) {
state->use_limit = !state->use_limit;
if (!stitch_process_data(state, scene, FALSE)) {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
break;
}
@@ -2140,7 +2145,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
state->static_island %= state->element_map->totalIslands;
if (!stitch_process_data(state, scene, FALSE)) {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
break;
}
@@ -2150,7 +2156,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (event->val == KM_PRESS) {
state->midpoints = !state->midpoints;
if (!stitch_process_data(state, scene, FALSE)) {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
}
break;
@@ -2158,13 +2165,15 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* Select geometry*/
case RIGHTMOUSE:
if (!event->shift) {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
if (event->val == KM_PRESS && !(U.flag & USER_LMOUSESELECT)) {
stitch_select(C, scene, event, state);
if (!stitch_process_data(state, scene, FALSE)) {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
break;
}
@@ -2175,7 +2184,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (event->val == KM_PRESS) {
state->snap_islands = !state->snap_islands;
if (!stitch_process_data(state, scene, FALSE)) {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
break;
}
@@ -2189,7 +2199,8 @@ static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
stitch_switch_selection_mode(state);
if (!stitch_process_data(state, scene, FALSE)) {
- return stitch_cancel(C, op);
+ stitch_cancel(C, op);
+ return OPERATOR_CANCELLED;
}
}
break;
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 06ffdea96bf..d6bd6f466b9 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -542,7 +542,7 @@ static bool minimize_stretch_init(bContext *C, wmOperator *op)
return true;
}
-static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interactive)
+static void minimize_stretch_iteration(bContext *C, wmOperator *op, bool interactive)
{
MinStretch *ms = op->customdata;
ScrArea *sa = CTX_wm_area(C);
@@ -570,7 +570,7 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interact
}
}
-static void minimize_stretch_exit(bContext *C, wmOperator *op, int cancel)
+static void minimize_stretch_exit(bContext *C, wmOperator *op, bool cancel)
{
MinStretch *ms = op->customdata;
ScrArea *sa = CTX_wm_area(C);
@@ -604,8 +604,8 @@ static int minimize_stretch_exec(bContext *C, wmOperator *op)
iterations = RNA_int_get(op->ptr, "iterations");
for (i = 0; i < iterations; i++)
- minimize_stretch_iteration(C, op, 0);
- minimize_stretch_exit(C, op, 0);
+ minimize_stretch_iteration(C, op, false);
+ minimize_stretch_exit(C, op, false);
return OPERATOR_FINISHED;
}
@@ -617,7 +617,7 @@ static int minimize_stretch_invoke(bContext *C, wmOperator *op, const wmEvent *U
if (!minimize_stretch_init(C, op))
return OPERATOR_CANCELLED;
- minimize_stretch_iteration(C, op, 1);
+ minimize_stretch_iteration(C, op, true);
ms = op->customdata;
WM_event_add_modal_handler(C, op);
@@ -633,12 +633,12 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev
switch (event->type) {
case ESCKEY:
case RIGHTMOUSE:
- minimize_stretch_exit(C, op, 1);
+ minimize_stretch_exit(C, op, true);
return OPERATOR_CANCELLED;
case RETKEY:
case PADENTER:
case LEFTMOUSE:
- minimize_stretch_exit(C, op, 0);
+ minimize_stretch_exit(C, op, false);
return OPERATOR_FINISHED;
case PADPLUSKEY:
case WHEELUPMOUSE:
@@ -647,7 +647,7 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev
ms->blend += 0.1f;
ms->lasttime = 0.0f;
RNA_float_set(op->ptr, "blend", ms->blend);
- minimize_stretch_iteration(C, op, 1);
+ minimize_stretch_iteration(C, op, true);
}
}
break;
@@ -658,7 +658,7 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev
ms->blend -= 0.1f;
ms->lasttime = 0.0f;
RNA_float_set(op->ptr, "blend", ms->blend);
- minimize_stretch_iteration(C, op, 1);
+ minimize_stretch_iteration(C, op, true);
}
}
break;
@@ -667,25 +667,23 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, const wmEvent *ev
double start = PIL_check_seconds_timer();
do {
- minimize_stretch_iteration(C, op, 1);
+ minimize_stretch_iteration(C, op, true);
} while (PIL_check_seconds_timer() - start < 0.01);
}
break;
}
if (ms->iterations && ms->i >= ms->iterations) {
- minimize_stretch_exit(C, op, 0);
+ minimize_stretch_exit(C, op, false);
return OPERATOR_FINISHED;
}
return OPERATOR_RUNNING_MODAL;
}
-static int minimize_stretch_cancel(bContext *C, wmOperator *op)
+static void minimize_stretch_cancel(bContext *C, wmOperator *op)
{
- minimize_stretch_exit(C, op, 1);
-
- return OPERATOR_CANCELLED;
+ minimize_stretch_exit(C, op, true);
}
void UV_OT_minimize_stretch(wmOperatorType *ot)
diff --git a/source/blender/freestyle/intern/geometry/Grid.h b/source/blender/freestyle/intern/geometry/Grid.h
index a1368f1ea21..070bee047a9 100644
--- a/source/blender/freestyle/intern/geometry/Grid.h
+++ b/source/blender/freestyle/intern/geometry/Grid.h
@@ -261,7 +261,7 @@ public:
/*! inserts a convex polygon occluder
* This method is quite coarse insofar as it adds all cells intersecting the polygon bounding box
* convex_poly
- * The list of 3D points constituing a convex polygon
+ * The list of 3D points constituting a convex polygon
*/
void insertOccluder(Polygon3r *convex_poly);
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp
index 3b1232c51af..56c096a1eae 100644
--- a/source/blender/freestyle/intern/python/BPy_Convert.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp
@@ -512,93 +512,100 @@ Nature::EdgeNature EdgeNature_from_BPy_Nature(PyObject *obj)
return static_cast<Nature::EdgeNature>(PyLong_AsLong(obj));
}
-Vec2f *Vec2f_ptr_from_PyObject(PyObject *obj)
-{
- Vec2f *v;
- if ((v = Vec2f_ptr_from_Vector(obj)))
- return v;
- if ((v = Vec2f_ptr_from_PyList(obj)))
- return v;
- if ((v = Vec2f_ptr_from_PyTuple(obj)))
- return v;
- return NULL;
+bool Vec2f_ptr_from_PyObject(PyObject *obj, Vec2f *vec)
+{
+ if (Vec2f_ptr_from_Vector(obj, vec))
+ return true;
+ if (Vec2f_ptr_from_PyList(obj, vec))
+ return true;
+ if (Vec2f_ptr_from_PyTuple(obj, vec))
+ return true;
+ return false;
}
-Vec3f *Vec3f_ptr_from_PyObject(PyObject *obj)
+bool Vec3f_ptr_from_PyObject(PyObject *obj, Vec3f *vec)
{
- Vec3f *v;
- if ((v = Vec3f_ptr_from_Vector(obj)))
- return v;
- if ((v = Vec3f_ptr_from_Color(obj)))
- return v;
- if ((v = Vec3f_ptr_from_PyList(obj)))
- return v;
- if ((v = Vec3f_ptr_from_PyTuple(obj)))
- return v;
- return NULL;
+ if (Vec3f_ptr_from_Vector(obj, vec))
+ return true;
+ if (Vec3f_ptr_from_Color(obj, vec))
+ return true;
+ if (Vec3f_ptr_from_PyList(obj, vec))
+ return true;
+ if (Vec3f_ptr_from_PyTuple(obj, vec))
+ return true;
+ return false;
}
-Vec3r *Vec3r_ptr_from_PyObject(PyObject *obj)
+bool Vec3r_ptr_from_PyObject(PyObject *obj, Vec3r *vec)
{
- Vec3r *v;
- if ((v = Vec3r_ptr_from_Vector(obj)))
- return v;
- if ((v = Vec3r_ptr_from_Color(obj)))
- return v;
- if ((v = Vec3r_ptr_from_PyList(obj)))
- return v;
- if ((v = Vec3r_ptr_from_PyTuple(obj)))
- return v;
- return NULL;
+ if (Vec3r_ptr_from_Vector(obj, vec))
+ return true;
+ if (Vec3r_ptr_from_Color(obj, vec))
+ return true;
+ if (Vec3r_ptr_from_PyList(obj, vec))
+ return true;
+ if (Vec3r_ptr_from_PyTuple(obj, vec))
+ return true;
+ return false;
}
-Vec2f *Vec2f_ptr_from_Vector(PyObject *obj)
+bool Vec2f_ptr_from_Vector(PyObject *obj, Vec2f *vec)
{
if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 2)
- return NULL;
- float x = ((VectorObject *)obj)->vec[0];
- float y = ((VectorObject *)obj)->vec[1];
- return new Vec2f(x, y);
+ return false;
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return false;
+ vec[0] = ((VectorObject *)obj)->vec[0];
+ vec[1] = ((VectorObject *)obj)->vec[1];
+ return true;
}
-Vec3f *Vec3f_ptr_from_Vector(PyObject *obj)
+bool Vec3f_ptr_from_Vector(PyObject *obj, Vec3f *vec)
{
if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3)
- return NULL;
- float x = ((VectorObject *)obj)->vec[0];
- float y = ((VectorObject *)obj)->vec[1];
- float z = ((VectorObject *)obj)->vec[2];
- return new Vec3f(x, y, z);
+ return false;
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return false;
+ vec[0] = ((VectorObject *)obj)->vec[0];
+ vec[1] = ((VectorObject *)obj)->vec[1];
+ vec[2] = ((VectorObject *)obj)->vec[2];
+ return true;
}
-Vec3r *Vec3r_ptr_from_Vector(PyObject *obj)
+bool Vec3r_ptr_from_Vector(PyObject *obj, Vec3r *vec)
{
if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3)
- return NULL;
- real x = ((VectorObject *)obj)->vec[0];
- real y = ((VectorObject *)obj)->vec[1];
- real z = ((VectorObject *)obj)->vec[2];
- return new Vec3r(x, y, z);
+ return false;
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return false;
+ vec[0] = ((VectorObject *)obj)->vec[0];
+ vec[1] = ((VectorObject *)obj)->vec[1];
+ vec[2] = ((VectorObject *)obj)->vec[2];
+ return true;
}
-Vec3f *Vec3f_ptr_from_Color(PyObject *obj)
+bool Vec3f_ptr_from_Color(PyObject *obj, Vec3f *vec)
{
if (!ColorObject_Check(obj))
- return NULL;
- float r = ((ColorObject *)obj)->col[0];
- float g = ((ColorObject *)obj)->col[1];
- float b = ((ColorObject *)obj)->col[2];
- return new Vec3f(r, g, b);
+ return false;
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return false;
+ vec[0] = ((ColorObject *)obj)->col[0];
+ vec[1] = ((ColorObject *)obj)->col[1];
+ vec[2] = ((ColorObject *)obj)->col[2];
+ return true;
}
-Vec3r *Vec3r_ptr_from_Color(PyObject *obj)
+bool Vec3r_ptr_from_Color(PyObject *obj, Vec3r *vec)
{
if (!ColorObject_Check(obj))
- return NULL;
- real r = ((ColorObject *)obj)->col[0];
- real g = ((ColorObject *)obj)->col[1];
- real b = ((ColorObject *)obj)->col[2];
- return new Vec3r(r, g, b);
+ return false;
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return false;
+ vec[0] = ((ColorObject *)obj)->col[0];
+ vec[1] = ((ColorObject *)obj)->col[1];
+ vec[2] = ((ColorObject *)obj)->col[2];
+ return true;
}
static int float_array_from_PyList(PyObject *obj, float *v, int n)
@@ -613,37 +620,45 @@ static int float_array_from_PyList(PyObject *obj, float *v, int n)
return 1;
}
-Vec2f *Vec2f_ptr_from_PyList(PyObject *obj)
+bool Vec2f_ptr_from_PyList(PyObject *obj, Vec2f *vec)
{
float v[2];
if (!PyList_Check(obj) || PyList_Size(obj) != 2)
- return NULL;
+ return false;
if (!float_array_from_PyList(obj, v, 2))
- return NULL;
- return new Vec2f(v[0], v[1]);
+ return false;
+ vec[0] = v[0];
+ vec[1] = v[1];
+ return true;
}
-Vec3f *Vec3f_ptr_from_PyList(PyObject *obj)
+bool Vec3f_ptr_from_PyList(PyObject *obj, Vec3f *vec)
{
float v[3];
if (!PyList_Check(obj) || PyList_Size(obj) != 3)
- return NULL;
+ return false;
if (!float_array_from_PyList(obj, v, 3))
- return NULL;
- return new Vec3f(v[0], v[1], v[2]);
+ return false;
+ vec[0] = v[0];
+ vec[1] = v[1];
+ vec[2] = v[2];
+ return true;
}
-Vec3r *Vec3r_ptr_from_PyList(PyObject *obj)
+bool Vec3r_ptr_from_PyList(PyObject *obj, Vec3r *vec)
{
float v[3];
if (!PyList_Check(obj) || PyList_Size(obj) != 3)
- return NULL;
+ return false;
if (!float_array_from_PyList(obj, v, 3))
- return NULL;
- return new Vec3r(v[0], v[1], v[2]);
+ return false;
+ vec[0] = v[0];
+ vec[1] = v[1];
+ vec[2] = v[2];
+ return true;
}
static int float_array_from_PyTuple(PyObject *obj, float *v, int n)
@@ -658,37 +673,45 @@ static int float_array_from_PyTuple(PyObject *obj, float *v, int n)
return 1;
}
-Vec2f *Vec2f_ptr_from_PyTuple(PyObject *obj)
+bool Vec2f_ptr_from_PyTuple(PyObject *obj, Vec2f *vec)
{
float v[2];
if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 2)
- return NULL;
+ return false;
if (!float_array_from_PyTuple(obj, v, 2))
- return NULL;
- return new Vec2f(v[0], v[1]);
+ return false;
+ vec[0] = v[0];
+ vec[1] = v[1];
+ return true;
}
-Vec3f *Vec3f_ptr_from_PyTuple(PyObject *obj)
+bool Vec3f_ptr_from_PyTuple(PyObject *obj, Vec3f *vec)
{
float v[3];
if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 3)
- return NULL;
+ return false;
if (!float_array_from_PyTuple(obj, v, 3))
- return NULL;
- return new Vec3f(v[0], v[1], v[2]);
+ return false;
+ vec[0] = v[0];
+ vec[1] = v[1];
+ vec[2] = v[2];
+ return true;
}
-Vec3r *Vec3r_ptr_from_PyTuple(PyObject *obj)
+bool Vec3r_ptr_from_PyTuple(PyObject *obj, Vec3r *vec)
{
float v[3];
if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 3)
- return NULL;
+ return false;
if (!float_array_from_PyTuple(obj, v, 3))
- return NULL;
- return new Vec3r(v[0], v[1], v[2]);
+ return false;
+ vec[0] = v[0];
+ vec[1] = v[1];
+ vec[2] = v[2];
+ return true;
}
// helper for argument parsing
@@ -696,10 +719,19 @@ Vec3r *Vec3r_ptr_from_PyTuple(PyObject *obj)
int float_array_from_PyObject(PyObject *obj, float *v, int n)
{
if (VectorObject_Check(obj) && ((VectorObject *)obj)->size == n) {
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return 0;
for (int i = 0; i < n; i++)
v[i] = ((VectorObject *)obj)->vec[i];
return 1;
}
+ else if (ColorObject_Check(obj) && n == 3) {
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return 0;
+ for (int i = 0; i < n; i++)
+ v[i] = ((ColorObject *)obj)->col[i];
+ return 1;
+ }
else if (PyList_Check(obj) && PyList_Size(obj) == n) {
return float_array_from_PyList(obj, v, n);
}
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.h b/source/blender/freestyle/intern/python/BPy_Convert.h
index 1df4901757b..a8bc7eaa306 100644
--- a/source/blender/freestyle/intern/python/BPy_Convert.h
+++ b/source/blender/freestyle/intern/python/BPy_Convert.h
@@ -150,20 +150,20 @@ bool bool_from_PyBool(PyObject *b);
IntegrationType IntegrationType_from_BPy_IntegrationType(PyObject *obj);
Stroke::MediumType MediumType_from_BPy_MediumType(PyObject *obj);
Nature::EdgeNature EdgeNature_from_BPy_Nature(PyObject *obj);
-Vec2f * Vec2f_ptr_from_PyObject(PyObject *obj);
-Vec3f * Vec3f_ptr_from_PyObject(PyObject *obj);
-Vec3r * Vec3r_ptr_from_PyObject(PyObject *obj);
-Vec2f * Vec2f_ptr_from_Vector(PyObject *obj);
-Vec3f * Vec3f_ptr_from_Vector(PyObject *obj);
-Vec3r * Vec3r_ptr_from_Vector(PyObject *obj);
-Vec3f * Vec3f_ptr_from_Color(PyObject *obj);
-Vec3r * Vec3r_ptr_from_Color(PyObject *obj);
-Vec2f * Vec2f_ptr_from_PyList(PyObject *obj);
-Vec3f * Vec3f_ptr_from_PyList(PyObject *obj);
-Vec3r * Vec3r_ptr_from_PyList(PyObject *obj);
-Vec2f * Vec2f_ptr_from_PyTuple(PyObject *obj);
-Vec3f * Vec3f_ptr_from_PyTuple(PyObject *obj);
-Vec3r * Vec3r_ptr_from_PyTuple(PyObject *obj);
+bool Vec2f_ptr_from_PyObject(PyObject *obj, Vec2f *vec);
+bool Vec3f_ptr_from_PyObject(PyObject *obj, Vec3f *vec);
+bool Vec3r_ptr_from_PyObject(PyObject *obj, Vec3r *vec);
+bool Vec2f_ptr_from_Vector(PyObject *obj, Vec2f *vec);
+bool Vec3f_ptr_from_Vector(PyObject *obj, Vec3f *vec);
+bool Vec3r_ptr_from_Vector(PyObject *obj, Vec3r *vec);
+bool Vec3f_ptr_from_Color(PyObject *obj, Vec3f *vec);
+bool Vec3r_ptr_from_Color(PyObject *obj, Vec3r *vec);
+bool Vec2f_ptr_from_PyList(PyObject *obj, Vec2f *vec);
+bool Vec3f_ptr_from_PyList(PyObject *obj, Vec3f *vec);
+bool Vec3r_ptr_from_PyList(PyObject *obj, Vec3r *vec);
+bool Vec2f_ptr_from_PyTuple(PyObject *obj, Vec2f *vec);
+bool Vec3f_ptr_from_PyTuple(PyObject *obj, Vec3f *vec);
+bool Vec3r_ptr_from_PyTuple(PyObject *obj, Vec3r *vec);
int float_array_from_PyObject(PyObject *obj, float *v, int n);
diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
index 680f399cc77..fb678d7ea66 100644
--- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
@@ -101,8 +101,8 @@ static int ramp_blend_type(const char *type)
if (!strcmp(type, "SATURATION")) return MA_RAMP_SAT;
if (!strcmp(type, "VALUE")) return MA_RAMP_VAL;
if (!strcmp(type, "COLOR")) return MA_RAMP_COLOR;
- if (!strcmp(type, "SOFT LIGHT")) return MA_RAMP_SOFT;
- if (!strcmp(type, "LINEAR LIGHT")) return MA_RAMP_LINEAR;
+ if (!strcmp(type, "SOFT_LIGHT")) return MA_RAMP_SOFT;
+ if (!strcmp(type, "LINEAR_LIGHT")) return MA_RAMP_LINEAR;
return -1;
}
@@ -129,7 +129,6 @@ static PyObject *Freestyle_blendRamp(PyObject *self, PyObject *args)
PyObject *obj1, *obj2;
char *s;
int type;
- Vec3f *v1 = NULL, *v2 = NULL;
float a[3], fac, b[3];
if (!PyArg_ParseTuple(args, "sOfO", &s, &obj1, &fac, &obj2))
@@ -137,32 +136,20 @@ static PyObject *Freestyle_blendRamp(PyObject *self, PyObject *args)
type = ramp_blend_type(s);
if (type < 0) {
PyErr_SetString(PyExc_TypeError, "argument 1 is an unknown ramp blend type");
- goto error;
+ return NULL;
}
- v1 = Vec3f_ptr_from_PyObject(obj1);
- if (!v1) {
+ if (!float_array_from_PyObject(obj1, a, 3)) {
PyErr_SetString(PyExc_TypeError,
"argument 2 must be a 3D vector (either a tuple/list of 3 elements or Vector)");
- goto error;
+ return NULL;
}
- v2 = Vec3f_ptr_from_PyObject(obj2);
- if (!v2) {
+ if (!float_array_from_PyObject(obj2, b, 3)) {
PyErr_SetString(PyExc_TypeError,
"argument 4 must be a 3D vector (either a tuple/list of 3 elements or Vector)");
- goto error;
+ return NULL;
}
- a[0] = v1->x(); b[0] = v2->x();
- a[1] = v1->y(); b[1] = v2->y();
- a[2] = v1->z(); b[2] = v2->z();
ramp_blend(type, a, fac, b);
- delete v1;
- delete v2;
return Vector_CreatePyObject(a, 3, Py_NEW, NULL);
-
-error:
- if (v1) delete v1;
- if (v2) delete v2;
- return NULL;
}
#include "BKE_texture.h" /* do_colorband() */
diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
index abdcbaff6e1..2575b16b27a 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
+++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
@@ -132,16 +132,15 @@ static PyObject *FrsNoise_turbulence2(BPy_FrsNoise *self, PyObject *args, PyObje
PyObject *obj1;
float f2, f3;
unsigned int i = 4;
+ Vec2f vec;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i))
return NULL;
- Vec2f *v = Vec2f_ptr_from_PyObject(obj1);
- if (!v) {
+ if (!Vec2f_ptr_from_PyObject(obj1, &vec)) {
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 2D vector (either a list of 2 elements or Vector)");
return NULL;
}
- float t = self->n->turbulence2(*v, f2, f3, i);
- delete v;
+ float t = self->n->turbulence2(vec, f2, f3, i);
return PyFloat_FromDouble(t);
}
@@ -167,16 +166,15 @@ static PyObject *FrsNoise_turbulence3(BPy_FrsNoise *self, PyObject *args, PyObje
PyObject *obj1;
float f2, f3;
unsigned int i = 4;
+ Vec3f vec;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i))
return NULL;
- Vec3f *v = Vec3f_ptr_from_PyObject(obj1);
- if (!v) {
+ if (!Vec3f_ptr_from_PyObject(obj1, &vec)) {
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
return NULL;
}
- float t = self->n->turbulence3(*v, f2, f3, i);
- delete v;
+ float t = self->n->turbulence3(vec, f2, f3, i);
return PyFloat_FromDouble(t);
}
@@ -214,16 +212,15 @@ static PyObject *FrsNoise_smoothNoise2(BPy_FrsNoise *self, PyObject *args, PyObj
{
static const char *kwlist[] = {"v", NULL};
PyObject *obj;
+ Vec2f vec;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
return NULL;
- Vec2f *v = Vec2f_ptr_from_PyObject(obj);
- if (!v) {
+ if (!Vec2f_ptr_from_PyObject(obj, &vec)) {
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 2D vector (either a list of 2 elements or Vector)");
return NULL;
}
- float t = self->n->smoothNoise2(*v);
- delete v;
+ float t = self->n->smoothNoise2(vec);
return PyFloat_FromDouble(t);
}
@@ -241,16 +238,15 @@ static PyObject *FrsNoise_smoothNoise3(BPy_FrsNoise *self, PyObject *args, PyObj
{
static const char *kwlist[] = {"v", NULL};
PyObject *obj;
+ Vec3f vec;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
return NULL;
- Vec3f *v = Vec3f_ptr_from_PyObject(obj);
- if (!v) {
+ if (!Vec3f_ptr_from_PyObject(obj, &vec)) {
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
return NULL;
}
- float t = self->n->smoothNoise3(*v);
- delete v;
+ float t = self->n->smoothNoise3(vec);
return PyFloat_FromDouble(t);
}
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
index e17f16a2fa7..b08fcfa8dba 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
+++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
@@ -311,16 +311,15 @@ static PyObject * StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self,
static const char *kwlist[] = {"name", "value", NULL};
char *s;
PyObject *obj = 0;
+ Vec2f vec;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj))
return NULL;
- Vec2f *v = Vec2f_ptr_from_PyObject(obj);
- if (!v) {
+ if (!Vec2f_ptr_from_PyObject(obj, &vec)) {
PyErr_SetString(PyExc_TypeError, "argument 2 must be a 2D vector (either a list of 2 elements or Vector)");
return NULL;
}
- self->sa->setAttributeVec2f(s, *v);
- delete v;
+ self->sa->setAttributeVec2f(s, vec);
Py_RETURN_NONE;
}
@@ -341,16 +340,15 @@ static PyObject * StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self,
static const char *kwlist[] = {"name", "value", NULL};
char *s;
PyObject *obj = 0;
+ Vec3f vec;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj))
return NULL;
- Vec3f *v = Vec3f_ptr_from_PyObject(obj);
- if (!v) {
+ if (!Vec3f_ptr_from_PyObject(obj, &vec)) {
PyErr_SetString(PyExc_TypeError, "argument 2 must be a 3D vector (either a list of 3 elements or Vector)");
return NULL;
}
- self->sa->setAttributeVec3f(s, *v);
- delete v;
+ self->sa->setAttributeVec3f(s, vec);
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp
index cd6f9da3e05..011609bb343 100644
--- a/source/blender/freestyle/intern/python/Director.cpp
+++ b/source/blender/freestyle/intern/python/Director.cpp
@@ -251,14 +251,16 @@ int Director_BPy_UnaryFunction0D___call__(void *uf0D, PyObject *obj, Interface0D
((UnaryFunction0D<unsigned> *)uf0D)->result = PyLong_AsLong(result);
}
else if (BPy_UnaryFunction0DVec2f_Check(obj)) {
- Vec2f *v = Vec2f_ptr_from_Vector(result);
- ((UnaryFunction0D<Vec2f> *)uf0D)->result = *v;
- delete v;
+ Vec2f vec;
+ if (!Vec2f_ptr_from_Vector(result, &vec))
+ return -1;
+ ((UnaryFunction0D<Vec2f> *)uf0D)->result = vec;
}
else if (BPy_UnaryFunction0DVec3f_Check(obj)) {
- Vec3f *v = Vec3f_ptr_from_Vector(result);
- ((UnaryFunction0D<Vec3f> *)uf0D)->result = *v;
- delete v;
+ Vec3f vec;
+ if (!Vec3f_ptr_from_Vector(result, &vec))
+ return -1;
+ ((UnaryFunction0D<Vec3f> *)uf0D)->result = vec;
}
else if (BPy_UnaryFunction0DVectorViewShape_Check(obj)) {
vector<ViewShape*> vec;
@@ -301,14 +303,16 @@ int Director_BPy_UnaryFunction1D___call__(void *uf1D, PyObject *obj, Interface1D
((UnaryFunction1D<unsigned> *)uf1D)->result = PyLong_AsLong(result);
}
else if (BPy_UnaryFunction1DVec2f_Check(obj)) {
- Vec2f *v = Vec2f_ptr_from_Vector(result);
- ((UnaryFunction1D<Vec2f> *)uf1D)->result = *v;
- delete v;
+ Vec2f vec;
+ if (!Vec2f_ptr_from_Vector(result, &vec))
+ return -1;
+ ((UnaryFunction1D<Vec2f> *)uf1D)->result = vec;
}
else if (BPy_UnaryFunction1DVec3f_Check(obj)) {
- Vec3f *v = Vec3f_ptr_from_Vector(result);
- ((UnaryFunction1D<Vec3f> *)uf1D)->result = *v;
- delete v;
+ Vec3f vec;
+ if (!Vec3f_ptr_from_Vector(result, &vec))
+ return -1;
+ ((UnaryFunction1D<Vec3f> *)uf1D)->result = vec;
}
else if (BPy_UnaryFunction1DVectorViewShape_Check(obj)) {
vector<ViewShape*> vec;
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
index 3205a3a3d7e..d2dd1657770 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
@@ -107,17 +107,15 @@ static PyObject *SVertex_add_normal(BPy_SVertex *self, PyObject *args, PyObject
{
static const char *kwlist[] = {"normal", NULL};
PyObject *py_normal;
+ Vec3r n;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &py_normal))
return NULL;
- Vec3r *n = Vec3r_ptr_from_PyObject(py_normal);
- if (!n) {
+ if (!Vec3r_ptr_from_PyObject(py_normal, &n)) {
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
return NULL;
}
- self->sv->AddNormal(*n);
- delete n;
-
+ self->sv->AddNormal(n);
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
index 50d54df2ead..9bbb0405e49 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
@@ -167,7 +167,7 @@ static PyObject *FrsCurve_is_empty_get(BPy_FrsCurve *self, void *UNUSED(closure)
}
PyDoc_STRVAR(FrsCurve_segments_size_doc,
-"The number of segments in the polyline constituing the Curve.\n"
+"The number of segments in the polyline constituting the Curve.\n"
"\n"
":type: int");
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
index 3e4e7e3aef3..80765e794fb 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
@@ -283,7 +283,7 @@ static PyObject *Stroke_stroke_vertices_end(BPy_Stroke *self)
PyDoc_STRVAR(Stroke_stroke_vertices_size_doc,
".. method:: stroke_vertices_size()\n"
"\n"
-" Returns the number of StrokeVertex constituing the Stroke.\n"
+" Returns the number of StrokeVertex constituting the Stroke.\n"
"\n"
" :return: The number of stroke vertices.\n"
" :rtype: int");
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
index 510875ebb2f..0daaa1a0476 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
@@ -115,6 +115,8 @@ PyDoc_STRVAR(AdjacencyIterator_object_doc,
static PyObject *AdjacencyIterator_object_get(BPy_AdjacencyIterator *self, void *UNUSED(closure))
{
+ if (self->a_it->isEnd())
+ Py_RETURN_NONE;
ViewEdge *ve = self->a_it->operator*();
if (ve)
return BPy_ViewEdge_from_ViewEdge(*ve);
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
index 3e2f0102dc3..91e8de118a9 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
@@ -175,6 +175,8 @@ PyDoc_STRVAR(ChainingIterator_object_doc,
static PyObject *ChainingIterator_object_get(BPy_ChainingIterator *self, void *UNUSED(closure))
{
+ if (self->c_it->isEnd())
+ Py_RETURN_NONE;
ViewEdge *ve = self->c_it->operator*();
if (ve)
return BPy_ViewEdge_from_ViewEdge(*ve);
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
index 3e45ef17c1b..1655b766a6b 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
@@ -97,6 +97,8 @@ PyDoc_STRVAR(CurvePointIterator_object_doc,
static PyObject *CurvePointIterator_object_get(BPy_CurvePointIterator *self, void *UNUSED(closure))
{
+ if (self->cp_it->isEnd())
+ Py_RETURN_NONE;
return BPy_CurvePoint_from_CurvePoint(self->cp_it->operator*());
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
index 3a537eb672a..2f6c8ff7348 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
@@ -123,6 +123,8 @@ PyDoc_STRVAR(Interface0DIterator_object_doc,
static PyObject *Interface0DIterator_object_get(BPy_Interface0DIterator *self, void *UNUSED(closure))
{
+ if (self->if0D_it->isEnd())
+ Py_RETURN_NONE;
return Any_BPy_Interface0D_from_Interface0D(self->if0D_it->operator*());
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
index f30621f01e3..c191a94f08d 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
@@ -122,6 +122,8 @@ PyDoc_STRVAR(ViewEdgeIterator_object_doc,
static PyObject *ViewEdgeIterator_object_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure))
{
+ if (!self->ve_it->isEnd())
+ Py_RETURN_NONE;
ViewEdge *ve = self->ve_it->operator*();
if (ve)
return BPy_ViewEdge_from_ViewEdge(*ve);
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
index f2b0e604c22..cbefcd3292e 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
@@ -103,6 +103,8 @@ PyDoc_STRVAR(orientedViewEdgeIterator_object_doc,
static PyObject *orientedViewEdgeIterator_object_get(BPy_orientedViewEdgeIterator *self, void *UNUSED(closure))
{
+ if (self->ove_it->isEnd())
+ Py_RETURN_NONE;
return BPy_directedViewEdge_from_directedViewEdge(self->ove_it->operator*());
}
diff --git a/source/blender/freestyle/intern/stroke/Curve.h b/source/blender/freestyle/intern/stroke/Curve.h
index 68da744d7b3..7e3b6732bff 100644
--- a/source/blender/freestyle/intern/stroke/Curve.h
+++ b/source/blender/freestyle/intern/stroke/Curve.h
@@ -491,7 +491,7 @@ public:
return _Id;
}
- /*! Returns the number of segments in the polyline constituing the Curve. */
+ /*! Returns the number of segments in the polyline constituting the Curve. */
inline unsigned int nSegments() const
{
return _nSegments;
diff --git a/source/blender/freestyle/intern/stroke/Stroke.h b/source/blender/freestyle/intern/stroke/Stroke.h
index e7a75728985..d116edc6ace 100644
--- a/source/blender/freestyle/intern/stroke/Stroke.h
+++ b/source/blender/freestyle/intern/stroke/Stroke.h
@@ -774,7 +774,7 @@ public:
const_vertex_iterator vertices_end() const;
vertex_iterator vertices_end();
- /*! Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. One can specifly a sampling
+ /*! Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. One can specify a sampling
* value to resample the Stroke on the fly if needed.
* \param t
* The resampling value with which we want our Stroke to be resampled.
@@ -785,7 +785,7 @@ public:
/*! Returns a StrokeVertexIterator pointing after the last StrokeVertex of the Stroke. */
StrokeInternal::StrokeVertexIterator strokeVerticesEnd();
- /*! Returns the number of StrokeVertex constituing the Stroke. */
+ /*! Returns the number of StrokeVertex constituting the Stroke. */
inline unsigned int strokeVerticesSize() const
{
return _Vertices.size();
diff --git a/source/blender/freestyle/intern/system/Id.h b/source/blender/freestyle/intern/system/Id.h
index 9cd45646f1c..8b028cdb3da 100644
--- a/source/blender/freestyle/intern/system/Id.h
+++ b/source/blender/freestyle/intern/system/Id.h
@@ -92,13 +92,13 @@ public:
return _second;
}
- /*! Sets the first number constituing the Id */
+ /*! Sets the first number constituting the Id */
void setFirst(id_type first)
{
_first = first;
}
- /*! Sets the second number constituing the Id */
+ /*! Sets the second number constituting the Id */
void setSecond(id_type second)
{
_second = second;
diff --git a/source/blender/freestyle/intern/system/TimeUtils.h b/source/blender/freestyle/intern/system/TimeUtils.h
index bbf4c5a1edb..6fe8b0e7431 100644
--- a/source/blender/freestyle/intern/system/TimeUtils.h
+++ b/source/blender/freestyle/intern/system/TimeUtils.h
@@ -23,7 +23,7 @@
/** \file blender/freestyle/intern/system/TimeUtils.h
* \ingroup freestyle
- * \brief Class to measure ellapsed time
+ * \brief Class to measure elapsed time
* \author Stephane Grabli
* \date 10/04/2002
*/
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.h b/source/blender/freestyle/intern/view_map/SteerableViewMap.h
index 581155fa6e8..d6af7384fb8 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.h
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.h
@@ -95,7 +95,7 @@ public:
/*! Builds _nbOrientations+1 pyramids of images from the _nbOrientations+1 base images of the steerable viewmap.
* \param steerableBases
- * The _nbOrientations+1 images constituing the basis for the steerable pyramid.
+ * The _nbOrientations+1 images constituting the basis for the steerable pyramid.
* \param copy
* If false, the data is not duplicated, and Canvas deals with the memory management of these
* _nbOrientations+1 images. If true, data is copied, and it's up to the caller to delete the images.
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h
index 0ab089b7d7a..2c9672be53b 100644
--- a/source/blender/freestyle/intern/view_map/ViewMap.h
+++ b/source/blender/freestyle/intern/view_map/ViewMap.h
@@ -1352,12 +1352,12 @@ public:
vertex_iterator vertices_end();
// Iterator access (Interface1D)
- /*! Returns an Interface0DIterator to iterate over the SVertex constituing the embedding of this ViewEdge.
+ /*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this ViewEdge.
* The returned Interface0DIterator points to the first SVertex of the ViewEdge.
*/
virtual Interface0DIterator verticesBegin();
- /*! Returns an Interface0DIterator to iterate over the SVertex constituing the embedding of this ViewEdge.
+ /*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this ViewEdge.
* The returned Interface0DIterator points after the last SVertex of the ViewEdge.
*/
virtual Interface0DIterator verticesEnd();
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 633112095a7..5e5fac3049c 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -393,11 +393,21 @@ void set_rgb_zero(out vec3 outval)
outval = vec3(0.0);
}
+void set_rgb_one(out vec3 outval)
+{
+ outval = vec3(1.0);
+}
+
void set_rgba_zero(out vec4 outval)
{
outval = vec4(0.0);
}
+void set_rgba_one(out vec4 outval)
+{
+ outval = vec4(1.0);
+}
+
void brightness_contrast(vec4 col, float brightness, float contrast, out vec4 outcol)
{
float a = 1.0 + contrast;
@@ -2131,7 +2141,7 @@ void node_add_shader(vec4 shader1, vec4 shader2, out vec4 shader)
void node_fresnel(float ior, vec3 N, vec3 I, out float result)
{
float eta = max(ior, 0.00001);
- result = fresnel_dielectric(I, N, (gl_FrontFacing)? eta: 1.0/eta);
+ result = fresnel_dielectric(normalize(I), N, (gl_FrontFacing)? eta: 1.0/eta);
}
/* gamma */
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index 1481b2aaa66..fddfa2618c2 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -277,10 +277,10 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
return NULL;
}
- if (cineon->element[i].refLowData == CINEON_UNDEFINED_U32 || isnan(cineon->element[i].refLowData))
+ if (cineon->element[i].refLowData == CINEON_UNDEFINED_U32)
cineon->element[i].refLowData = 0;
- if (cineon->element[i].refHighData == CINEON_UNDEFINED_U32 || isnan(cineon->element[i].refHighData))
+ if (cineon->element[i].refHighData == CINEON_UNDEFINED_U32)
cineon->element[i].refHighData = (unsigned int)cineon->element[i].maxValue;
if (cineon->element[i].refLowQuantity == CINEON_UNDEFINED_R32 || isnan(cineon->element[i].refLowQuantity))
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index 5a4371d84ba..e839c2fce90 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -300,10 +300,10 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
case descriptor_RGB:
case descriptor_RGBA:
case descriptor_ABGR:
- if (dpx->element[i].refLowData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refLowData))
+ if (dpx->element[i].refLowData == DPX_UNDEFINED_U32)
dpx->element[i].refLowData = 0;
- if (dpx->element[i].refHighData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refHighData))
+ if (dpx->element[i].refHighData == DPX_UNDEFINED_U32)
dpx->element[i].refHighData = (unsigned int)dpx->element[i].maxValue;
if (dpx->element[i].refLowQuantity == DPX_UNDEFINED_R32 || isnan(dpx->element[i].refLowQuantity))
@@ -324,10 +324,10 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
case descriptor_CbYCr:
case descriptor_CbYACrYA:
case descriptor_CbYCrA:
- if (dpx->element[i].refLowData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refLowData))
+ if (dpx->element[i].refLowData == DPX_UNDEFINED_U32)
dpx->element[i].refLowData = 16.0f / 255.0f * dpx->element[i].maxValue;
- if (dpx->element[i].refHighData == DPX_UNDEFINED_U32 || isnan(dpx->element[i].refHighData))
+ if (dpx->element[i].refHighData == DPX_UNDEFINED_U32)
dpx->element[i].refHighData = 235.0f / 255.0f * dpx->element[i].maxValue;
if (dpx->element[i].refLowQuantity == DPX_UNDEFINED_R32 || isnan(dpx->element[i].refLowQuantity))
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index ecf6458ac57..9d1ff79960c 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -120,6 +120,17 @@ const char *imb_ext_image_qt[] = {
NULL
};
+const char *imb_ext_movie_qt[] = {
+ ".avi",
+ ".flc",
+ ".dv",
+ ".r3d",
+ ".mov",
+ ".movie",
+ ".mv",
+ NULL
+};
+
const char *imb_ext_movie[] = {
".avi",
".flc",
@@ -131,10 +142,13 @@ const char *imb_ext_movie[] = {
".m2t",
".m2ts",
".mts",
+ ".ts",
".mv",
".avs",
".wmv",
".ogv",
+ ".ogg",
+ ".r3d",
".dv",
".mpeg",
".mpg",
@@ -145,6 +159,7 @@ const char *imb_ext_movie[] = {
".divx",
".xvid",
".mxf",
+ ".webm",
NULL
};
@@ -448,14 +463,7 @@ int IMB_isanim(const char *filename)
if (U.uiflag & USER_FILTERFILEEXTS) {
if (G.have_quicktime) {
- if (BLI_testextensie(filename, ".avi") ||
- BLI_testextensie(filename, ".flc") ||
- BLI_testextensie(filename, ".dv") ||
- BLI_testextensie(filename, ".r3d") ||
- BLI_testextensie(filename, ".mov") ||
- BLI_testextensie(filename, ".movie") ||
- BLI_testextensie(filename, ".mv"))
- {
+ if (BLI_testextensie_array(filename, imb_ext_movie_qt)) {
type = imb_get_anim_type(filename);
}
else {
@@ -463,11 +471,7 @@ int IMB_isanim(const char *filename)
}
}
else { /* no quicktime */
- if (BLI_testextensie(filename, ".avi") ||
- BLI_testextensie(filename, ".dv") ||
- BLI_testextensie(filename, ".r3d") ||
- BLI_testextensie(filename, ".mv"))
- {
+ if (BLI_testextensie_array(filename, imb_ext_movie)) {
type = imb_get_anim_type(filename);
}
else {
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index fc0dd54a8e7..7a7e08138b0 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -459,6 +459,8 @@ typedef struct FCurve {
/* curve coloring (for editor) */
int color_mode; /* coloring method to use (eFCurve_Coloring) */
float color[3]; /* the last-color this curve took */
+
+ float prev_norm_factor, pad;
} FCurve;
diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h
index 7e81041fe4a..734741fa687 100644
--- a/source/blender/makesdna/DNA_fileglobal_types.h
+++ b/source/blender/makesdna/DNA_fileglobal_types.h
@@ -48,8 +48,7 @@ typedef struct FileGlobal {
struct Scene *curscene;
int fileflags;
int globalf;
- int revision; /* svn revision from buildinfo */
- int pad;
+ char build_change[16], build_hash[16]; /* change number and hash from buildinfo */
/* file path where this was saved, for recover */
char filename[1024]; /* 1024 = FILE_MAX */
} FileGlobal;
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 13bd99eb78c..24817fa8f43 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1178,11 +1178,27 @@ typedef struct TriangulateModifierData {
ModifierData modifier;
int flag;
+ int quad_method;
+ int ngon_method;
int pad;
} TriangulateModifierData;
enum {
- MOD_TRIANGULATE_BEAUTY = (1 << 0),
+ MOD_TRIANGULATE_BEAUTY = (1 << 0), /* deprecated */
+};
+
+/* Triangulate methods - NGons */
+enum {
+ MOD_TRIANGULATE_NGON_BEAUTY = 0,
+ MOD_TRIANGULATE_NGON_SCANFILL,
+};
+
+/* Triangulate methods - Quads */
+enum {
+ MOD_TRIANGULATE_QUAD_BEAUTY = 0,
+ MOD_TRIANGULATE_QUAD_FIXED,
+ MOD_TRIANGULATE_QUAD_ALTERNATE,
+ MOD_TRIANGULATE_QUAD_SHORTEDGE
};
typedef struct LaplacianSmoothModifierData {
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 451dd20daa6..a4510dd23fd 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -677,19 +677,15 @@ typedef struct NodeLensDist {
} NodeLensDist;
typedef struct NodeColorBalance {
- /* for processing */
+ /* ASC CDL parameters */
float slope[3];
float offset[3];
float power[3];
- /* for ui representation */
+ /* LGG parameters */
float lift[3];
float gamma[3];
float gain[3];
-
- /* temp storage for inverted lift */
- float lift_lgg[3];
- float gamma_inv[3];
} NodeColorBalance;
typedef struct NodeColorspill {
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 6ebc604bc7e..ca328423072 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -725,7 +725,7 @@ typedef struct GameData {
#define GAME_PLAYER_DESKTOP_RESOLUTION (1 << 1)
/* GameData.matmode */
-#define GAME_MAT_TEXFACE 0
+#define GAME_MAT_TEXFACE 0 /* deprecated */
#define GAME_MAT_MULTITEX 1
#define GAME_MAT_GLSL 2
@@ -1457,6 +1457,7 @@ typedef struct Scene {
#define SCE_SNAP_MODE_NODE_X 5
#define SCE_SNAP_MODE_NODE_Y 6
#define SCE_SNAP_MODE_NODE_XY 7
+#define SCE_SNAP_MODE_GRID 8
/* toolsettings->selectmode */
#define SCE_SELECT_VERTEX 1 /* for mesh */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index f71516af5e6..4ebfe349a9f 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -366,6 +366,9 @@ typedef enum eGraphEdit_Flag {
SIPO_BEAUTYDRAW_OFF = (1 << 12),
/* draw grouped channels with colors set in group */
SIPO_NODRAWGCOLORS = (1 << 13),
+ /* normalize curves on display */
+ SIPO_NORMALIZE = (1 << 14),
+ SIPO_NORMALIZE_FREEZE = (1 << 15),
} eGraphEdit_Flag;
/* SpaceIpo->mode (Graph Editor Mode) */
@@ -690,6 +693,7 @@ typedef enum eFileSel_File_Types {
BTXFILE = (1 << 12),
COLLADAFILE = (1 << 13),
OPERATORFILE = (1 << 14), /* from filter_glob operator property */
+ APPLICATIONBUNDLE = (1 << 15),
} eFileSel_File_Types;
/* Selection Flags in filesel: struct direntry, unsigned char selflag */
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 1621f7c6cb6..37d5f313dfb 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -474,6 +474,7 @@ typedef struct UserDef {
struct ColorBand coba_weight; /* from texture.h */
float sculpt_paint_overlay_col[3];
+ float gpencil_new_layer_col[4]; /* default color for newly created Grease Pencil layers */
short tweak_threshold;
short pad3;
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index c3a8148431a..79eb2945e5b 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -1035,6 +1035,7 @@ void RNA_struct_property_unset(PointerRNA *ptr, const char *identifier);
/* python compatible string representation of this property, (must be freed!) */
char *RNA_property_as_string(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index, int max_prop_length);
+char *RNA_pointer_as_string_id(struct bContext *C, PointerRNA *ptr);
char *RNA_pointer_as_string(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop_ptr, PointerRNA *ptr_prop);
char *RNA_pointer_as_string_keywords_ex(struct bContext *C, PointerRNA *ptr,
const bool skip_optional_value, const bool all_args,
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index d33d3df8a5e..f1881c8beba 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -60,6 +60,9 @@ extern EnumPropertyItem constraint_type_items[];
extern EnumPropertyItem boidrule_type_items[];
extern EnumPropertyItem sequence_modifier_type_items[];
+extern EnumPropertyItem modifier_triangulate_quad_method_items[];
+extern EnumPropertyItem modifier_triangulate_ngon_method_items[];
+
extern EnumPropertyItem image_type_items[];
extern EnumPropertyItem image_color_mode_items[];
extern EnumPropertyItem image_depth_mode_items[];
@@ -68,7 +71,6 @@ extern EnumPropertyItem image_generated_type_items[];
extern EnumPropertyItem color_sets_items[];
extern EnumPropertyItem beztriple_keyframe_type_items[];
-extern EnumPropertyItem beztriple_handle_type_items[];
extern EnumPropertyItem beztriple_interpolation_mode_items[];
extern EnumPropertyItem keyframe_handle_type_items[];
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index fe457a14718..6c216936190 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -4980,7 +4980,7 @@ bool RNA_property_is_unlink(PropertyRNA *prop)
/* string representation of a property, python
* compatible but can be used for display too,
* context may be NULL */
-static char *rna_pointer_as_string__idprop(bContext *C, PointerRNA *ptr)
+char *RNA_pointer_as_string_id(bContext *C, PointerRNA *ptr)
{
DynStr *dynstr = BLI_dynstr_new();
char *cstring;
@@ -5031,7 +5031,7 @@ static char *rna_pointer_as_string__bldata(PointerRNA *ptr)
char *RNA_pointer_as_string(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *prop_ptr, PointerRNA *ptr_prop)
{
if (RNA_property_flag(prop_ptr) & PROP_IDPROPERTY) {
- return rna_pointer_as_string__idprop(C, ptr_prop);
+ return RNA_pointer_as_string_id(C, ptr_prop);
}
else {
return rna_pointer_as_string__bldata(ptr_prop);
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index bd4b8dd76b1..74fe3c145f1 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -38,6 +38,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "rna_internal.h"
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index e13ec1f09a4..2a008a44b55 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -470,7 +470,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "start_frame");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1.0, 9999.0);
+ RNA_def_property_range(prop, 1.0, MAXFRAMEF);
RNA_def_property_ui_range(prop, 1.0, 9999, 1, -1);
RNA_def_property_ui_text(prop, "Start Frame", "Simulation start frame");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
@@ -478,7 +478,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "end_frame");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1.0, 9999.0);
+ RNA_def_property_range(prop, 1.0, MAXFRAMEF);
RNA_def_property_ui_range(prop, 1.0, 9999.0, 1, -1);
RNA_def_property_ui_text(prop, "End Frame", "Simulation end frame");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 4b50127d999..2036257e5d7 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -453,28 +453,66 @@ static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, Pointe
static void rna_FModifier_active_set(PointerRNA *ptr, int UNUSED(value))
{
- FModifier *fm = (FModifier *)ptr->data;
+ FModifier *fcm = (FModifier *)ptr->data;
/* don't toggle, always switch on */
- fm->flag |= FMODIFIER_FLAG_ACTIVE;
+ fcm->flag |= FMODIFIER_FLAG_ACTIVE;
}
-static void rna_FModifier_start_frame_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_FModifier_start_frame_set(PointerRNA *ptr, float value)
{
FModifier *fcm = (FModifier *)ptr->data;
- *min = MINAFRAMEF;
- *max = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->efra : MAXFRAMEF;
+ CLAMP(value, MINAFRAMEF, MAXFRAMEF);
+ fcm->sfra = value;
+
+ /* XXX: maintain old offset? */
+ if (fcm->sfra >= fcm->efra) {
+ fcm->efra = fcm->sfra;
+ }
}
-static void rna_FModifier_end_frame_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_FModifer_end_frame_set(PointerRNA *ptr, float value)
{
FModifier *fcm = (FModifier *)ptr->data;
+
+ CLAMP(value, MINAFRAMEF, MAXFRAMEF);
+ fcm->efra = value;
+
+ /* XXX: maintain old offset? */
+ if (fcm->efra <= fcm->sfra) {
+ fcm->sfra = fcm->efra;
+ }
+}
- *min = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->sfra : MINAFRAMEF;
- *max = MAXFRAMEF;
+static void rna_FModifier_start_frame_range(PointerRNA *UNUSED(ptr), float *min, float *max,
+ float *UNUSED(softmin), float *UNUSED(softmax))
+{
+ // FModifier *fcm = (FModifier *)ptr->data;
+
+ /* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that,
+ * or else it becomes tricky to adjust the range... [#36844]
+ *
+ * NOTE: we do not set soft-limits on lower bounds, as it's too confusing when you
+ * can't easily use the slider to set things here
+ */
+ *min = MINAFRAMEF;
+ *max = MAXFRAMEF;
+}
+
+static void rna_FModifier_end_frame_range(PointerRNA *ptr, float *min, float *max,
+ float *softmin, float *softmax)
+{
+ FModifier *fcm = (FModifier *)ptr->data;
+
+ /* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that,
+ * or else it becomes tricky to adjust the range... [#36844]
+ */
+ *min = MINAFRAMEF;
+ *softmin = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->sfra : MINAFRAMEF;
+
+ *softmax = MAXFRAMEF;
+ *max = MAXFRAMEF;
}
static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max,
@@ -527,44 +565,101 @@ static void rna_FModifierGenerator_coefficients_set(PointerRNA *ptr, const float
memcpy(gen->coefficients, values, gen->arraysize * sizeof(float));
}
-static void rna_FModifierLimits_minx_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+
+static void rna_FModifierLimits_minx_set(PointerRNA *ptr, float value)
{
FModifier *fcm = (FModifier *)ptr->data;
FMod_Limits *data = fcm->data;
+
+ data->rect.xmin = value;
+
+ if (data->rect.xmin >= data->rect.xmax) {
+ data->rect.xmax = data->rect.xmin;
+ }
+}
- *min = MINAFRAMEF;
- *max = (data->flag & FCM_LIMIT_XMAX) ? data->rect.xmax : MAXFRAMEF;
+static void rna_FModifierLimits_maxx_set(PointerRNA *ptr, float value)
+{
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Limits *data = fcm->data;
+
+ data->rect.xmax = value;
+
+ if (data->rect.xmax <= data->rect.xmin) {
+ data->rect.xmin = data->rect.xmax;
+ }
}
-static void rna_FModifierLimits_maxx_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_FModifierLimits_miny_set(PointerRNA *ptr, float value)
{
FModifier *fcm = (FModifier *)ptr->data;
FMod_Limits *data = fcm->data;
+
+ data->rect.ymin = value;
+
+ if (data->rect.ymin >= data->rect.ymax) {
+ data->rect.ymax = data->rect.ymin;
+ }
+}
- *min = (data->flag & FCM_LIMIT_XMIN) ? data->rect.xmin : MINAFRAMEF;
- *max = MAXFRAMEF;
+static void rna_FModifierLimits_maxy_set(PointerRNA *ptr, float value)
+{
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Limits *data = fcm->data;
+
+ data->rect.ymax = value;
+
+ if (data->rect.ymax <= data->rect.ymin) {
+ data->rect.ymin = data->rect.ymax;
+ }
}
-static void rna_FModifierLimits_miny_range(PointerRNA *ptr, float *min, float *max,
+static void rna_FModifierLimits_minx_range(PointerRNA *UNUSED(ptr), float *min, float *max,
float *UNUSED(softmin), float *UNUSED(softmax))
{
+ // FModifier *fcm = (FModifier *)ptr->data;
+ // FMod_Limits *data = fcm->data;
+
+ /* no soft-limits on lower bound - it's too confusing when you can't easily use the slider to set things here */
+ *min = MINAFRAMEF;
+ *max = MAXFRAMEF;
+}
+
+static void rna_FModifierLimits_maxx_range(PointerRNA *ptr, float *min, float *max,
+ float *softmin, float *softmax)
+{
FModifier *fcm = (FModifier *)ptr->data;
FMod_Limits *data = fcm->data;
+
+ *min = MINAFRAMEF;
+ *softmin = (data->flag & FCM_LIMIT_XMIN) ? data->rect.xmin : MINAFRAMEF;
+
+ *softmax = MAXFRAMEF;
+ *max = MAXFRAMEF;
+}
- *min = -FLT_MAX;
- *max = (data->flag & FCM_LIMIT_YMAX) ? data->rect.ymax : FLT_MAX;
+static void rna_FModifierLimits_miny_range(PointerRNA *UNUSED(ptr), float *min, float *max,
+ float *UNUSED(softmin), float *UNUSED(softmax))
+{
+ // FModifier *fcm = (FModifier *)ptr->data;
+ // FMod_Limits *data = fcm->data;
+
+ /* no soft-limits on lower bound - it's too confusing when you can't easily use the slider to set things here */
+ *min = -FLT_MAX;
+ *max = FLT_MAX;
}
static void rna_FModifierLimits_maxy_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+ float *softmin, float *softmax)
{
FModifier *fcm = (FModifier *)ptr->data;
FMod_Limits *data = fcm->data;
-
- *min = (data->flag & FCM_LIMIT_YMIN) ? data->rect.ymin : -FLT_MAX;
- *max = FLT_MAX;
+
+ *min = -FLT_MAX;
+ *softmin = (data->flag & FCM_LIMIT_YMIN) ? data->rect.ymin : -FLT_MAX;
+
+ *softmax = FLT_MAX;
+ *max = FLT_MAX;
}
@@ -1008,25 +1103,25 @@ static void rna_def_fmodifier_limits(BlenderRNA *brna)
prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rect.xmin");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_minx_range");
+ RNA_def_property_float_funcs(prop, NULL, "rna_FModifierLimits_minx_set", "rna_FModifierLimits_minx_range");
RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rect.ymin");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_miny_range");
+ RNA_def_property_float_funcs(prop, NULL, "rna_FModifierLimits_miny_set", "rna_FModifierLimits_miny_range");
RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rect.xmax");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_maxx_range");
+ RNA_def_property_float_funcs(prop, NULL, "rna_FModifierLimits_maxx_set", "rna_FModifierLimits_maxx_range");
RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rect.ymax");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_maxy_range");
+ RNA_def_property_float_funcs(prop, NULL, "rna_FModifierLimits_maxy_set", "rna_FModifierLimits_maxy_range");
RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
@@ -1191,14 +1286,14 @@ static void rna_def_fmodifier(BlenderRNA *brna)
prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "sfra");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_start_frame_range");
+ RNA_def_property_float_funcs(prop, NULL, "rna_FModifier_start_frame_set", "rna_FModifier_start_frame_range");
RNA_def_property_ui_text(prop, "Start Frame",
"Frame that modifier's influence starts (if Restrict Frame Range is in use)");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "efra");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_end_frame_range");
+ RNA_def_property_float_funcs(prop, NULL, "rna_FModifer_end_frame_set", "rna_FModifier_end_frame_range");
RNA_def_property_ui_text(prop, "End Frame",
"Frame that modifier's influence ends (if Restrict Frame Range is in use)");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index b18c21d53f1..9007baa9dad 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -122,7 +122,7 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA
Object *ob = (Object *)ptr->id.data;
FluidsimModifierData *fluidmd;
ParticleSystemModifierData *psmd;
- ParticleSystem *psys;
+ ParticleSystem *psys, *next_psys;
ParticleSettings *part;
fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
@@ -155,7 +155,8 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA
}
}
else {
- for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+ for (psys = ob->particlesystem.first; psys; psys = next_psys) {
+ next_psys = psys->next;
if (psys->part->type == PART_FLUID) {
/* clear modifier */
psmd = psys_get_modifier(ob, psys);
diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c
index 77d593b67b6..670df017038 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -446,7 +446,7 @@ static void rna_MaskSpline_points_add(ID *id, MaskSpline *spline, int count)
BKE_mask_parent_init(&new_point->parent);
/* Not efficient, but there's no other way for now */
- BKE_mask_layer_shape_changed_add(layer, spline_shape_index + point_index, TRUE, TRUE);
+ BKE_mask_layer_shape_changed_add(layer, spline_shape_index + point_index, true, true);
}
WM_main_add_notifier(NC_MASK | ND_DATA, mask);
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index ee32b01549d..08c8c79cb54 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -110,6 +110,22 @@ EnumPropertyItem modifier_type_items[] = {
{0, NULL, 0, NULL, NULL}
};
+EnumPropertyItem modifier_triangulate_quad_method_items[] = {
+ {MOD_TRIANGULATE_QUAD_BEAUTY, "BEAUTY", 0, "Beauty ", "Split the quads in nice triangles, slower method"},
+ {MOD_TRIANGULATE_QUAD_FIXED, "FIXED", 0, "Fixed", "Split the quads on the first and third vertices"},
+ {MOD_TRIANGULATE_QUAD_ALTERNATE, "FIXED_ALTERNATE", 0, "Fixed Alternate",
+ "Split the quads on the 2nd and 4th vertices"},
+ {MOD_TRIANGULATE_QUAD_SHORTEDGE, "SHORTEST_DIAGONAL", 0, "Shortest Diagonal",
+ "Split the quads based on the distance between the vertices"},
+ {0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem modifier_triangulate_ngon_method_items[] = {
+ {MOD_TRIANGULATE_NGON_SCANFILL, "SCANFILL", 0, "Scanfill", "Split the polygons using a scanfill algorithm"},
+ {MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY", 0, "Beauty", "Arrange the new triangles nicely, slower method"},
+ {0, NULL, 0, NULL, NULL}
+};
+
#ifdef RNA_RUNTIME
#include "DNA_particle_types.h"
@@ -3509,9 +3525,16 @@ static void rna_def_modifier_triangulate(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "TriangulateModifierData");
RNA_def_struct_ui_icon(srna, ICON_MOD_TRIANGULATE);
- prop = RNA_def_property(srna, "use_beauty", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_TRIANGULATE_BEAUTY);
- RNA_def_property_ui_text(prop, "Beauty Subdivide", "Subdivide across shortest diagonal");
+ prop = RNA_def_property(srna, "quad_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "quad_method");
+ RNA_def_property_enum_items(prop, modifier_triangulate_quad_method_items);
+ RNA_def_property_ui_text(prop, "Quad Method", "Method for splitting the quads into triangles");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "ngon_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ngon_method");
+ RNA_def_property_enum_items(prop, modifier_triangulate_ngon_method_items);
+ RNA_def_property_ui_text(prop, "Polygon Method", "Method for splitting the polygons into triangles");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 7fc53395e61..6b5bced75bd 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1280,6 +1280,29 @@ static void rna_Node_draw_buttons_ext(struct uiLayout *layout, bContext *C, Poin
RNA_parameter_list_free(&list);
}
+static void rna_Node_draw_label(bNodeTree *ntree, bNode *node, char *label, int maxlen)
+{
+ extern FunctionRNA rna_Node_draw_label_func;
+
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ char *rlabel;
+
+ func = &rna_Node_draw_label_func; /* RNA_struct_find_function(&ptr, "draw_label"); */
+
+ RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
+ RNA_parameter_list_create(&list, &ptr, func);
+ node->typeinfo->ext.call(NULL, &ptr, func, &list);
+
+ RNA_parameter_get_lookup(&list, "label", &ret);
+ rlabel = *(char **)ret;
+ BLI_strncpy(label, rlabel != NULL ? rlabel : "", maxlen);
+
+ RNA_parameter_list_free(&list);
+}
+
static int rna_Node_is_registered_node_type(StructRNA *type)
{
return (RNA_struct_blender_type_get(type) != NULL);
@@ -1321,7 +1344,7 @@ static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, Struc
PointerRNA dummyptr;
FunctionRNA *func;
PropertyRNA *parm;
- int have_function[8];
+ int have_function[9];
/* setup dummy node & node type to store static properties in */
memset(&dummynt, 0, sizeof(bNodeType));
@@ -1379,6 +1402,7 @@ static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, Struc
nt->freefunc_api = (have_function[5]) ? rna_Node_free : NULL;
nt->draw_buttons = (have_function[6]) ? rna_Node_draw_buttons : NULL;
nt->draw_buttons_ex = (have_function[7]) ? rna_Node_draw_buttons_ext : NULL;
+ nt->labelfunc = (have_function[8]) ? rna_Node_draw_label : NULL;
/* sanitize size values in case not all have been registered */
if (nt->maxwidth < nt->minwidth)
@@ -2693,6 +2717,18 @@ static PointerRNA rna_NodeOutputFile_slot_file_get(CollectionPropertyIterator *i
return ptr;
}
+static void rna_NodeColorBalance_update_lgg(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ ntreeCompositColorBalanceSyncFromLGG(ptr->id.data, ptr->data);
+ rna_Node_update(bmain, scene, ptr);
+}
+
+static void rna_NodeColorBalance_update_cdl(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ ntreeCompositColorBalanceSyncFromCDL(ptr->id.data, ptr->data);
+ rna_Node_update(bmain, scene, ptr);
+}
+
/* ******** Node Socket Types ******** */
static PointerRNA rna_NodeOutputFile_slot_layer_get(CollectionPropertyIterator *iter)
@@ -4346,7 +4382,7 @@ static void def_cmp_despeckle(StructRNA *srna)
RNA_def_property_ui_text(prop, "Threshold", "Threshold for detecting pixels to despeckle");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "threshold_neighbour", PROP_FLOAT, PROP_NONE);
+ prop = RNA_def_property(srna, "threshold_neighbor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "custom4");
RNA_def_property_range(prop, 0.0, 1.0f);
RNA_def_property_ui_text(prop, "Neighbor", "Threshold for the number of neighbor pixels that must match");
@@ -5236,7 +5272,7 @@ static void def_cmp_colorbalance(StructRNA *srna)
RNA_def_property_float_array_default(prop, default_1);
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_ui_text(prop, "Lift", "Correction for Shadows");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "gamma");
@@ -5244,7 +5280,7 @@ static void def_cmp_colorbalance(StructRNA *srna)
RNA_def_property_float_array_default(prop, default_1);
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_ui_text(prop, "Gamma", "Correction for Midtones");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "gain");
@@ -5252,33 +5288,33 @@ static void def_cmp_colorbalance(StructRNA *srna)
RNA_def_property_float_array_default(prop, default_1);
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_ui_text(prop, "Gain", "Correction for Highlights");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "lift");
+ RNA_def_property_float_sdna(prop, NULL, "offset");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
RNA_def_property_ui_text(prop, "Offset", "Correction for Shadows");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gamma");
+ RNA_def_property_float_sdna(prop, NULL, "power");
RNA_def_property_array(prop, 3);
RNA_def_property_float_array_default(prop, default_1);
RNA_def_property_range(prop, 0.f, FLT_MAX);
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_ui_text(prop, "Power", "Correction for Midtones");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gain");
+ RNA_def_property_float_sdna(prop, NULL, "slope");
RNA_def_property_array(prop, 3);
RNA_def_property_float_array_default(prop, default_1);
RNA_def_property_range(prop, 0.f, FLT_MAX);
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_ui_text(prop, "Slope", "Correction for Highlights");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
}
static void def_cmp_huecorrect(StructRNA *srna)
@@ -7137,6 +7173,14 @@ static void rna_def_node(BlenderRNA *brna)
RNA_def_property_struct_type(parm, "UILayout");
RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+
+ /* dynamic label */
+ func = RNA_def_function(srna, "draw_label", NULL);
+ RNA_def_function_ui_description(func, "Returns a dynamic label string");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_string(func, "label", "", MAX_NAME, "Label", "");
+ RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */
+ RNA_def_function_output(func, parm);
}
static void rna_def_node_link(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 476f92b77da..2a68f0afc35 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -145,7 +145,7 @@ EnumPropertyItem snap_element_items[] = {
};
EnumPropertyItem snap_node_element_items[] = {
- {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
+ {SCE_SNAP_MODE_GRID, "GRID", ICON_SNAP_INCREMENT, "Grid", "Snap to grid"},
{SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_SNAP_EDGE, "Node X", "Snap to left/right node border"},
{SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_SNAP_EDGE, "Node Y", "Snap to top/bottom node border"},
{SCE_SNAP_MODE_NODE_XY, "NODE_XY", ICON_SNAP_EDGE, "Node X / Y", "Snap to any node border"},
@@ -159,7 +159,7 @@ EnumPropertyItem snap_uv_element_items[] = {
};
/* workaround for duplicate enums,
- * have each enum line as a defne then conditionally set it or not
+ * have each enum line as a define then conditionally set it or not
*/
#define R_IMF_ENUM_BMP {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
@@ -261,11 +261,7 @@ EnumPropertyItem image_type_items[] = {
{R_IMF_IMTYPE_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", "Output video in Ogg format"},
#endif
#ifdef WITH_QUICKTIME
-# ifdef USE_QTKIT
- {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME_QTKIT", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
-# else
- {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME_CARBON", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
-# endif
+ {R_IMF_IMTYPE_QUICKTIME, "QUICKTIME", ICON_FILE_MOVIE, "QuickTime", "Output video in Quicktime format"},
#endif
#ifdef WITH_FFMPEG
{R_IMF_IMTYPE_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", "Output video in Xvid format"},
@@ -955,7 +951,6 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bCon
return item;
}
-#ifdef USE_QTKIT
static int rna_RenderSettings_qtcodecsettings_audiocodecType_get(PointerRNA *ptr)
{
QuicktimeCodecSettings *settings = (QuicktimeCodecSettings *)ptr->data;
@@ -994,7 +989,6 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf
return item;
}
#endif
-#endif
#ifdef WITH_FFMPEG
static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, int value)
@@ -3143,7 +3137,6 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
};
static EnumPropertyItem material_items[] = {
- {GAME_MAT_TEXFACE, "SINGLETEXTURE", 0, "Singletexture", "Singletexture face materials"},
{GAME_MAT_MULTITEX, "MULTITEXTURE", 0, "Multitexture", "Multitexture materials"},
{GAME_MAT_GLSL, "GLSL", 0, "GLSL", "OpenGL shading language shaders"},
{0, NULL, 0, NULL, NULL}
@@ -3783,8 +3776,6 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
{FFMPEG_OGG, "OGG", 0, "Ogg", ""},
{FFMPEG_MKV, "MKV", 0, "Matroska", ""},
{FFMPEG_FLV, "FLASH", 0, "Flash", ""},
- {FFMPEG_WAV, "WAV", 0, "Wav", ""},
- {FFMPEG_MP3, "MP3", 0, "Mp3", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -3955,7 +3946,6 @@ static void rna_def_scene_quicktime_settings(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
-#ifdef USE_QTKIT
static EnumPropertyItem quicktime_audio_samplerate_items[] = {
{22050, "22050", 0, "22kHz", ""},
{44100, "44100", 0, "44.1kHz", ""},
@@ -3985,7 +3975,6 @@ static void rna_def_scene_quicktime_settings(BlenderRNA *brna)
{320000, "320000", 0, "320kbps", ""},
{0, NULL, 0, NULL, NULL}
};
-#endif
/* QuickTime */
srna = RNA_def_struct(brna, "QuickTimeSettings", NULL);
@@ -4007,7 +3996,6 @@ static void rna_def_scene_quicktime_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Spatial quality", "Intra-frame spatial quality level");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-#ifdef USE_QTKIT
prop = RNA_def_property(srna, "audiocodec_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "audiocodecType");
RNA_def_property_enum_items(prop, quicktime_codec_type_items);
@@ -4044,7 +4032,6 @@ static void rna_def_scene_quicktime_settings(BlenderRNA *brna)
RNA_def_property_enum_items(prop, quicktime_audio_bitrate_items);
RNA_def_property_ui_text(prop, "Bitrate", "Compressed audio bitrate");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-#endif
}
#endif
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 89714e49ebf..a9f84f1dcc7 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -340,36 +340,44 @@ static void rna_def_sculpt(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X);
RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Y);
RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Z);
RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X);
RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y);
RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z);
RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMMETRY_FEATHER);
RNA_def_property_ui_text(prop, "Symmetry Feathering",
"Reduce the strength of the brush where it overlaps symmetrical daubs");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP);
RNA_def_property_ui_text(prop, "Use OpenMP",
"Take advantage of multiple CPU cores to improve sculpting performance");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM);
@@ -400,6 +408,7 @@ static void rna_def_sculpt(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Collapse Short Edges",
"In dynamic-topology mode, collapse short edges "
"in addition to subdividing long ones");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "symmetrize_direction", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, symmetrize_direction_items);
@@ -432,19 +441,23 @@ static void rna_def_vertex_paint(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_all_faces", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_AREA);
RNA_def_property_ui_text(prop, "All Faces", "Paint on all faces inside brush");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS);
RNA_def_property_ui_text(prop, "Normals", "Apply the vertex normal before painting");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_spray", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY);
RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
/* weight paint only */
prop = RNA_def_property(srna, "use_group_restrict", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_ONLYVGROUP);
RNA_def_property_ui_text(prop, "Restrict", "Restrict painting to vertices in the group");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
}
static void rna_def_image_paint(BlenderRNA *brna)
@@ -461,27 +474,33 @@ static void rna_def_image_paint(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY);
RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE);
RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT);
RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL);
RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV map buttons");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV);
RNA_def_property_ui_text(prop, "Invert", "Invert the stencil layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE);
RNA_def_property_ui_text(prop, "Clone Map",
"Use another UV map as clone source, otherwise use the 3D cursor as the source");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
/* integers */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 5daeb4ae612..6545661cdf1 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1212,7 +1212,8 @@ static int rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type)
else
return TRUE;
}
-static EnumPropertyItem *rna_SpaceNodeEditor_tree_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_SpaceNodeEditor_tree_type_itemf(bContext *C, PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), int *free)
{
return rna_node_tree_type_itemf(C, rna_SpaceNodeEditor_tree_type_poll, free);
}
@@ -1785,8 +1786,8 @@ static void rna_def_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_render_border", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_BORDER);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Render Border",
- "Use a region within the frame size for rendered viewport (when not viewing through the camera)");
+ RNA_def_property_ui_text(prop, "Render Border", "Use a region within the frame size for rendered viewport "
+ "(when not viewing through the camera)");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "render_border_min_x", PROP_FLOAT, PROP_NONE);
@@ -1832,7 +1833,8 @@ static void rna_def_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "viewport_shade", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "drawtype");
RNA_def_property_enum_items(prop, viewport_shade_items);
- RNA_def_property_enum_funcs(prop, "rna_SpaceView3D_viewport_shade_get", NULL, "rna_SpaceView3D_viewport_shade_itemf");
+ RNA_def_property_enum_funcs(prop, "rna_SpaceView3D_viewport_shade_get", NULL,
+ "rna_SpaceView3D_viewport_shade_itemf");
RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_viewport_shade_update");
@@ -2069,6 +2071,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
prop = RNA_def_property(srna, "tracks_draw_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 5, 1, 3);
RNA_def_property_float_sdna(prop, NULL, "bundle_size");
RNA_def_property_ui_text(prop, "Tracks Size", "Display size of tracks from reconstructed data");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
@@ -2880,6 +2883,19 @@ static void rna_def_space_graph(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_SpaceGraphEditor_has_ghost_curves_get", NULL);
RNA_def_property_ui_text(prop, "Has Ghost Curves", "Graph Editor instance has some ghost curves stored");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ /* nromalize curves */
+ prop = RNA_def_property(srna, "use_normalization", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_NORMALIZE);
+ RNA_def_property_ui_text(prop, "Use Normalization", "Display curves in normalized to -1..1 range, "
+ "for easier editing of multiple curves with different ranges");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "use_auto_normalization", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NORMALIZE_FREEZE);
+ RNA_def_property_ui_text(prop, "Auto Normalization",
+ "Automatically recalculate curve normalization on every curve edit");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
}
static void rna_def_space_nla(BlenderRNA *brna)
@@ -3373,7 +3389,8 @@ static void rna_def_space_node(BlenderRNA *brna)
prop = RNA_def_property(srna, "tree_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, dummy_items);
- RNA_def_property_enum_funcs(prop, "rna_SpaceNodeEditor_tree_type_get", "rna_SpaceNodeEditor_tree_type_set", "rna_SpaceNodeEditor_tree_type_itemf");
+ RNA_def_property_enum_funcs(prop, "rna_SpaceNodeEditor_tree_type_get", "rna_SpaceNodeEditor_tree_type_set",
+ "rna_SpaceNodeEditor_tree_type_itemf");
RNA_def_property_ui_text(prop, "Tree Type", "Node tree type to display and edit");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
@@ -3405,7 +3422,8 @@ static void rna_def_space_node(BlenderRNA *brna)
rna_def_space_node_path_api(brna, prop);
prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceNodeEditor_node_tree_set", NULL, "rna_SpaceNodeEditor_node_tree_poll");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceNodeEditor_node_tree_set", NULL,
+ "rna_SpaceNodeEditor_node_tree_poll");
RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
RNA_def_property_ui_text(prop, "Node Tree", "Base node tree from context");
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index f62778a5c1e..92d12a3a92c 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -570,7 +570,8 @@ static MovieTrackingTrack *rna_trackingTracks_new(ID *id, MovieTracking *trackin
return track;
}
-static MovieTrackingTrack *rna_trackingObject_tracks_new(ID *id, MovieTrackingObject *object, const char *name, int frame)
+static MovieTrackingTrack *rna_trackingObject_tracks_new(ID *id, MovieTrackingObject *object, const char *name,
+ int frame)
{
MovieClip *clip = (MovieClip *) id;
ListBase *tracksbase = &object->tracks;
@@ -649,7 +650,8 @@ static void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int fram
WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
}
-static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_find_frame(MovieTrackingPlaneTrack *plane_track, int framenr, int exact)
+static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_find_frame(MovieTrackingPlaneTrack *plane_track,
+ int framenr, int exact)
{
if (exact)
return BKE_tracking_plane_marker_get_exact(plane_track, framenr);
@@ -657,7 +659,8 @@ static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_find_frame(MovieTracki
return BKE_tracking_plane_marker_get(plane_track, framenr);
}
-static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_insert_frame(MovieTrackingPlaneTrack *plane_track, int framenr)
+static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_insert_frame(MovieTrackingPlaneTrack *plane_track,
+ int framenr)
{
MovieTrackingPlaneMarker plane_marker, *new_plane_marker;
@@ -1089,6 +1092,12 @@ static void rna_def_trackingMarker(BlenderRNA *brna)
"Right-bottom corner of search area in normalized coordinates relative "
"to marker position");
RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_markerSearch_update");
+
+ /* is marker keyframed */
+ prop = RNA_def_property(srna, "is_keyed", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MARKER_TRACKED);
+ RNA_def_property_ui_text(prop, "Keyframed", "Whether the position of the marker is keyframed or tracked");
}
static void rna_def_trackingMarkers(BlenderRNA *brna, PropertyRNA *cprop)
@@ -1344,7 +1353,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "weight");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Weight", "How much this track affects on a final solution");
+ RNA_def_property_ui_text(prop, "Weight", "Influence of this track on a final solution");
}
static void rna_def_trackingPlaneMarker(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 2a12194dfa1..0e45d6d4aea 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -367,7 +367,7 @@ static void rna_userdef_pathcompare_remove(ReportList *reports, PointerRNA *path
{
bPathCompare *path_cmp = path_cmp_ptr->data;
if (BLI_findindex(&U.autoexec_paths, path_cmp) == -1) {
- BKE_report(reports, RPT_ERROR, "Addon is no longer valid");
+ BKE_report(reports, RPT_ERROR, "Excluded path is no longer valid");
return;
}
@@ -3266,7 +3266,13 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "gp_eraser");
RNA_def_property_range(prop, 0, 100);
RNA_def_property_ui_text(prop, "Grease Pencil Eraser Radius", "Radius of eraser 'brush'");
-
+
+
+ prop = RNA_def_property(srna, "grease_pencil_default_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "gpencil_new_layer_col");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Grease Pencil Default Color", "Color of new Grease Pencil layers");
+
/* sculpt and paint */
prop = RNA_def_property(srna, "sculpt_paint_overlay_color", PROP_FLOAT, PROP_COLOR_GAMMA);
@@ -4091,7 +4097,7 @@ static void rna_def_userdef_autoexec_path_collection(BlenderRNA *brna, PropertyR
func = RNA_def_function(srna, "new", "rna_userdef_pathcompare_new");
RNA_def_function_flag(func, FUNC_NO_SELF);
- RNA_def_function_ui_description(func, "Add a new addon");
+ RNA_def_function_ui_description(func, "Add a new path");
/* return type */
parm = RNA_def_pointer(func, "pathcmp", "PathCompare", "", "");
RNA_def_function_return(func, parm);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index dd338713d3e..09451599ce5 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -1042,15 +1042,13 @@ static void operator_draw(bContext *C, wmOperator *op)
}
/* same as exec(), but call cancel */
-static int operator_cancel(bContext *C, wmOperator *op)
+static void operator_cancel(bContext *C, wmOperator *op)
{
extern FunctionRNA rna_Operator_cancel_func;
PointerRNA opr;
ParameterList list;
FunctionRNA *func;
- void *ret;
- int result;
RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
func = &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */
@@ -1059,12 +1057,7 @@ static int operator_cancel(bContext *C, wmOperator *op)
RNA_parameter_set_lookup(&list, "context", &C);
op->type->ext.call(C, &opr, func, &list);
- RNA_parameter_get_lookup(&list, "result", &ret);
- result = *(int *)ret;
-
RNA_parameter_list_free(&list);
-
- return result;
}
void operator_wrapper(wmOperatorType *ot, void *userdata);
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index eb84bb61e1f..91cddd28be0 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -539,10 +539,6 @@ void RNA_api_operator(StructRNA *srna)
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
parm = RNA_def_pointer(func, "context", "Context", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
-
- /* better name? */
- parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
- RNA_def_function_return(func, parm);
}
void RNA_api_macro(StructRNA *srna)
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 326ffba3e2e..6a1de92f9b2 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -158,7 +158,8 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
}
}
- BM_mesh_bevel(bm, bmd->value, bmd->res,
+ /* TODO: add offset_kind to modifier properties to, and pass in as 3rd arg here */
+ BM_mesh_bevel(bm, bmd->value, 0, bmd->res,
vertex_only, bmd->lim_flags & MOD_BEVEL_WEIGHT, do_clamp,
dvert, vgroup);
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index 0d302fed3e6..2822cf6925b 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -62,6 +62,8 @@ static void copyData(ModifierData *md, ModifierData *target)
BLI_strncpy(tmmd->vgroup, mmd->vgroup, sizeof(tmmd->vgroup));
tmmd->flag = mmd->flag;
+ tmmd->mode = mmd->mode;
+ tmmd->ob_arm = mmd->ob_arm;
}
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index 8386f0ff9af..e540d5c1b2c 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -199,10 +199,10 @@ static void meshdeformModifier_do(
if (!mmd->object || (!mmd->bindcagecos && !mmd->bindfunc))
return;
-
+
/* get cage derivedmesh */
if (em) {
- tmpdm = editbmesh_get_derived_cage_and_final(md->scene, ob, em, &cagedm, 0);
+ tmpdm = editbmesh_get_derived_cage_and_final(md->scene, mmd->object, em, &cagedm, 0);
if (tmpdm)
tmpdm->release(tmpdm);
}
@@ -346,7 +346,7 @@ static void deformVerts(ModifierData *md, Object *ob,
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
-
+
meshdeformModifier_do(md, ob, dm, vertexCos, numVerts);
if (dm && dm != derivedData)
diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c
index ffc813068b8..d519c981a23 100644
--- a/source/blender/modifiers/intern/MOD_triangulate.c
+++ b/source/blender/modifiers/intern/MOD_triangulate.c
@@ -36,7 +36,7 @@
#include "bmesh.h"
#include "bmesh_tools.h"
-static DerivedMesh *triangulate_dm(DerivedMesh *dm, const int flag)
+static DerivedMesh *triangulate_dm(DerivedMesh *dm, const int quad_method, const int ngon_method)
{
DerivedMesh *result;
BMesh *bm;
@@ -45,7 +45,7 @@ static DerivedMesh *triangulate_dm(DerivedMesh *dm, const int flag)
bm = DM_to_bmesh(dm, true);
- BM_mesh_triangulate(bm, (flag & MOD_TRIANGULATE_BEAUTY), false, NULL, NULL);
+ BM_mesh_triangulate(bm, quad_method, ngon_method, false, NULL, NULL);
result = CDDM_from_bmesh(bm, FALSE);
BM_mesh_free(bm);
@@ -69,7 +69,8 @@ static void initData(ModifierData *md)
/* Enable in editmode by default */
md->mode |= eModifierMode_Editmode;
- tmd->flag = MOD_TRIANGULATE_BEAUTY;
+ tmd->quad_method = MOD_TRIANGULATE_QUAD_SHORTEDGE;
+ tmd->ngon_method = MOD_TRIANGULATE_NGON_BEAUTY;
}
@@ -88,7 +89,7 @@ static DerivedMesh *applyModifier(ModifierData *md,
{
TriangulateModifierData *tmd = (TriangulateModifierData *)md;
DerivedMesh *result;
- if (!(result = triangulate_dm(dm, tmd->flag))) {
+ if (!(result = triangulate_dm(dm, tmd->quad_method, tmd->ngon_method))) {
return dm;
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
index 9ae744439bc..81ebc7c4c3b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
@@ -46,6 +46,36 @@ static bNodeSocketTemplate cmp_node_colorbalance_out[] = {
{-1, 0, ""}
};
+/* Sync functions update formula parameters for other modes, such that the result is comparable.
+ * Note that the results are not exactly the same due to differences in color handling (sRGB conversion happens for LGG),
+ * but this keeps settings comparable.
+ */
+
+void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *UNUSED(ntree), bNode *node)
+{
+ NodeColorBalance *n = node->storage;
+ int c;
+
+ for (c = 0; c < 3; ++c) {
+ n->slope[c] = (2.0f - n->lift[c]) * n->gain[c];
+ n->offset[c] = (n->lift[c] - 1.0f) * n->gain[c];
+ n->power[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f;
+ }
+}
+
+void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *UNUSED(ntree), bNode *node)
+{
+ NodeColorBalance *n = node->storage;
+ int c;
+
+ for (c = 0; c < 3; ++c) {
+ float d = n->slope[c] + n->offset[c];
+ n->lift[c] = (d != 0.0f ? n->slope[c] + 2.0f*n->offset[c] / d : 0.0f);
+ n->gain[c] = d;
+ n->gamma[c] = (n->power[c] != 0.0f) ? 1.0f / n->power[c] : 1000000.0f;
+ }
+}
+
static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode *node)
{
NodeColorBalance *n = node->storage = MEM_callocN(sizeof(NodeColorBalance), "node colorbalance");
@@ -53,6 +83,10 @@ static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode *nod
n->lift[0] = n->lift[1] = n->lift[2] = 1.0f;
n->gamma[0] = n->gamma[1] = n->gamma[2] = 1.0f;
n->gain[0] = n->gain[1] = n->gain[2] = 1.0f;
+
+ n->slope[0] = n->slope[1] = n->slope[2] = 1.0f;
+ n->offset[0] = n->offset[1] = n->offset[2] = 0.0f;
+ n->power[0] = n->power[1] = n->power[2] = 1.0f;
}
void register_node_type_cmp_colorbalance(void)
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index d073abf112a..04a56a9f505 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -201,7 +201,7 @@ static void cmp_node_image_create_outputs(bNodeTree *ntree, bNode *node)
* fail and sockets detection will go wrong.
*
* So we manually construct image user to be sure first
- * image from sequence (that one which is set as fileanme
+ * image from sequence (that one which is set as filename
* for image datablock) is used for sockets detection
*/
load_iuser.ok = 1;
diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
index b110cffd080..1d411aafe68 100644
--- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
+++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
@@ -48,12 +48,12 @@ static bNodeSocketTemplate cmp_node_moviedistortion_out[] = {
{ -1, 0, "" }
};
-static const char *label(bNode *node)
+static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
{
if (node->custom1 == 0)
- return IFACE_("Undistortion");
+ BLI_strncpy(label, IFACE_("Undistortion"), maxlen);
else
- return IFACE_("Distortion");
+ BLI_strncpy(label, IFACE_("Distortion"), maxlen);
}
static void init(const bContext *C, PointerRNA *ptr)
diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c
index 3384f31bfd1..d7de26730d0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_switch.c
+++ b/source/blender/nodes/composite/nodes/node_composite_switch.c
@@ -1,6 +1,4 @@
/*
- * $Id$
- *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index a8133460628..a3298de5d59 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -82,9 +82,9 @@ bNodeSocket *node_group_find_output_socket(bNode *groupnode, const char *identif
}
/* groups display their internal tree name as label */
-const char *node_group_label(bNode *node)
+void node_group_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
{
- return (node->id) ? node->id->name + 2 : IFACE_("Missing Datablock");
+ BLI_strncpy(label, (node->id) ? node->id->name + 2 : IFACE_("Missing Datablock"), maxlen);
}
int node_group_poll_instance(bNode *node, bNodeTree *nodetree)
diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h
index 498da607b91..df3937f5a3e 100644
--- a/source/blender/nodes/intern/node_common.h
+++ b/source/blender/nodes/intern/node_common.h
@@ -37,7 +37,7 @@
struct bNodeTree;
-const char *node_group_label(struct bNode *node);
+void node_group_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
int node_group_poll_instance(struct bNode *node, struct bNodeTree *nodetree);
void ntree_update_reroute_nodes(struct bNodeTree *ntree);
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index 812fe5b4ae7..37018b3a98d 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -207,6 +207,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context, bNodeTree *ntree, bNo
/* prepare all nodes for execution */
for (n = 0, nodeexec = exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
node = nodeexec->node = nodelist[n];
+ nodeexec->freeexecfunc = node->typeinfo->freeexecfunc;
/* tag inputs */
for (sock = node->inputs.first; sock; sock = sock->next) {
@@ -245,9 +246,8 @@ void ntree_exec_end(bNodeTreeExec *exec)
MEM_freeN(exec->stack);
for (n = 0, nodeexec = exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
- if (nodeexec->node->typeinfo)
- if (nodeexec->node->typeinfo->freeexecfunc)
- nodeexec->node->typeinfo->freeexecfunc(nodeexec->node, nodeexec->data.data);
+ if (nodeexec->freeexecfunc)
+ nodeexec->freeexecfunc(nodeexec->data.data);
}
if (exec->nodeexec)
diff --git a/source/blender/nodes/intern/node_exec.h b/source/blender/nodes/intern/node_exec.h
index 7d76ef34934..4101c6c4c4d 100644
--- a/source/blender/nodes/intern/node_exec.h
+++ b/source/blender/nodes/intern/node_exec.h
@@ -51,6 +51,8 @@ struct bNodeStack;
typedef struct bNodeExec {
struct bNode *node; /* backpointer to node */
bNodeExecData data;
+
+ NodeFreeExecFunction freeexecfunc; /* free function, stored in exec itself to avoid dangling node pointer access */
} bNodeExec;
/* Execution Data for each instance of node tree execution */
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
index e77f0a08331..3997d9cbcac 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -36,6 +36,7 @@
#include "DNA_node_types.h"
#include "BLI_listbase.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLF_translation.h"
@@ -82,32 +83,32 @@ void *node_initexec_curves(bNodeExecContext *UNUSED(context), bNode *node, bNode
/**** Labels ****/
-const char *node_blend_label(bNode *node)
+void node_blend_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
{
const char *name;
RNA_enum_name(ramp_blend_items, node->custom1, &name);
- return IFACE_(name);
+ BLI_strncpy(label, IFACE_(name), maxlen);
}
-const char *node_math_label(bNode *node)
+void node_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
{
const char *name;
RNA_enum_name(node_math_items, node->custom1, &name);
- return IFACE_(name);
+ BLI_strncpy(label, IFACE_(name), maxlen);
}
-const char *node_vect_math_label(bNode *node)
+void node_vect_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
{
const char *name;
RNA_enum_name(node_vec_math_items, node->custom1, &name);
- return IFACE_(name);
+ BLI_strncpy(label, IFACE_(name), maxlen);
}
-const char *node_filter_label(bNode *node)
+void node_filter_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
{
const char *name;
RNA_enum_name(node_filter_items, node->custom1, &name);
- return IFACE_(name);
+ BLI_strncpy(label, IFACE_(name), maxlen);
}
void node_update_internal_links_default(bNodeTree *ntree, bNode *node)
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
index 2b3f84420f9..64b2028874b 100644
--- a/source/blender/nodes/intern/node_util.h
+++ b/source/blender/nodes/intern/node_util.h
@@ -71,10 +71,10 @@ extern void *node_initexec_curves(struct bNodeExecContext *context, struct bNode
/**** Labels ****/
-const char *node_blend_label(struct bNode *node);
-const char *node_math_label(struct bNode *node);
-const char *node_vect_math_label(struct bNode *node);
-const char *node_filter_label(struct bNode *node);
+void node_blend_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
+void node_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
+void node_vect_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
+void node_filter_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
void node_update_internal_links_default(struct bNodeTree *ntree, struct bNode *node);
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c
index 72178018de4..e229fc75686 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.c
+++ b/source/blender/nodes/shader/nodes/node_shader_common.c
@@ -85,7 +85,7 @@ static void *group_initexec(bNodeExecContext *context, bNode *node, bNodeInstanc
return exec;
}
-static void group_freeexec(bNode *UNUSED(node), void *nodedata)
+static void group_freeexec(void *nodedata)
{
bNodeTreeExec *gexec = (bNodeTreeExec *)nodedata;
diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.c b/source/blender/nodes/shader/nodes/node_shader_fresnel.c
index 1e5c10968a5..c22b0f41695 100644
--- a/source/blender/nodes/shader/nodes/node_shader_fresnel.c
+++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.c
@@ -30,6 +30,7 @@
/* **************** Fresnel ******************** */
static bNodeSocketTemplate sh_node_fresnel_in[] = {
{ SOCK_FLOAT, 1, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 1.0f, 1000.0f},
+ { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ -1, 0, "" }
};
@@ -40,8 +41,10 @@ static bNodeSocketTemplate sh_node_fresnel_out[] = {
static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
{
- /* todo: is incoming vector normalized? */
- return GPU_stack_link(mat, "node_fresnel", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION));
+ if (!in[1].link)
+ in[1].link = GPU_builtin(GPU_VIEW_NORMAL);
+
+ return GPU_stack_link(mat, "node_fresnel", in, out, GPU_builtin(GPU_VIEW_POSITION));
}
/* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c
index 4200f515a80..820e0f479be 100644
--- a/source/blender/nodes/shader/nodes/node_shader_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_material.c
@@ -299,6 +299,7 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, bNodeExecData *UNU
if (node->type == SH_NODE_MATERIAL_EXT) {
out[MAT_OUT_DIFFUSE].link = shr.diff;
out[MAT_OUT_SPEC].link = shr.spec;
+ GPU_link(mat, "set_rgb_one", &out[MAT_OUT_AO].link);
}
return 1;
diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c
index fec6abbf062..7e65c472eef 100644
--- a/source/blender/nodes/texture/nodes/node_texture_common.c
+++ b/source/blender/nodes/texture/nodes/node_texture_common.c
@@ -72,7 +72,7 @@ static void *group_initexec(bNodeExecContext *context, bNode *node, bNodeInstanc
return exec;
}
-static void group_freeexec(bNode *UNUSED(node), void *nodedata)
+static void group_freeexec(void *nodedata)
{
bNodeTreeExec *gexec = (bNodeTreeExec *)nodedata;
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index d554f33a77e..80b07a926f4 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -319,7 +319,7 @@ static PyGetSetDef bpy_bmvertskin_getseters[] = {
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
-PyTypeObject BPy_BMVertSkin_Type = {{{0}}}; /* bm.loops.layers.uv.active */
+static PyTypeObject BPy_BMVertSkin_Type = {{{0}}}; /* bm.loops.layers.uv.active */
static void bm_init_types_bmvertskin(void)
{
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 88a56fac93b..da136675e1d 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -525,7 +525,17 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
}
if (val == NULL) { /* del idprop[key] */
- IDProperty *pkey = IDP_GetPropertyFromGroup(prop, _PyUnicode_AsString(key));
+ IDProperty *pkey;
+ const char *name = _PyUnicode_AsString(key);
+
+ if (name == NULL) {
+ PyErr_Format(PyExc_KeyError,
+ "expected a string, not %.200s",
+ Py_TYPE(key)->tp_name);
+ return -1;
+ }
+
+ pkey = IDP_GetPropertyFromGroup(prop, name);
if (pkey) {
IDP_FreeFromGroup(prop, pkey);
return 0;
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 2edb0aee783..3a529496f02 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -53,7 +53,9 @@
#ifdef BUILD_DATE
extern char build_date[];
extern char build_time[];
-extern char build_rev[];
+extern char build_change[];
+extern char build_hash[];
+extern char build_branch[];
extern char build_platform[];
extern char build_type[];
extern char build_cflags[];
@@ -75,7 +77,9 @@ static PyStructSequence_Field app_info_fields[] = {
/* buildinfo */
{(char *)"build_date", (char *)"The date this blender instance was built"},
{(char *)"build_time", (char *)"The time this blender instance was built"},
- {(char *)"build_revision", (char *)"The subversion revision this blender instance was built with"},
+ {(char *)"build_change", (char *)"The change number this blender instance was built with"},
+ {(char *)"build_hash", (char *)"The commit hash this blender instance was built with"},
+ {(char *)"build_branch", (char *)"The branch this blender instance was built from"},
{(char *)"build_platform", (char *)"The platform this blender instance was built for"},
{(char *)"build_type", (char *)"The type of build (Release, Debug)"},
{(char *)"build_cflags", (char *)"C compiler flags"},
@@ -133,7 +137,9 @@ static PyObject *make_app_info(void)
#ifdef BUILD_DATE
SetBytesItem(build_date);
SetBytesItem(build_time);
- SetBytesItem(build_rev);
+ SetBytesItem(build_change);
+ SetBytesItem(build_hash);
+ SetBytesItem(build_branch);
SetBytesItem(build_platform);
SetBytesItem(build_type);
SetBytesItem(build_cflags);
@@ -150,6 +156,8 @@ static PyObject *make_app_info(void)
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
+ SetBytesItem("Unknown");
+ SetBytesItem("Unknown");
#endif
SetObjItem(BPY_app_ffmpeg_struct());
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index 959e4a788dd..f8725d61167 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -50,7 +50,7 @@ static PyStructSequence_Field app_cb_info_fields[] = {
{(char *)"render_post", (char *)"Callback list - on render (after)"},
{(char *)"render_stats", (char *)"Callback list - on printing render statistics"},
{(char *)"render_complete", (char *)"Callback list - on completion of render job"},
- {(char *)"render_cancel", (char *)"Callback list - on cancelling a render job"},
+ {(char *)"render_cancel", (char *)"Callback list - on canceling a render job"},
{(char *)"load_pre", (char *)"Callback list - on loading a new blend file (before)"},
{(char *)"load_post", (char *)"Callback list - on loading a new blend file (after)"},
{(char *)"save_pre", (char *)"Callback list - on saving a blend file (before)"},
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index d13ec3c461a..754952cd65f 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -345,7 +345,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
error_val = pyrna_pydict_to_props(&ptr, kw, 0, "Converting py args to operator properties: ");
if (error_val == 0)
- buf = WM_operator_pystring(C, ot, &ptr, all_args);
+ buf = WM_operator_pystring_ex(C, NULL, all_args, ot, &ptr);
WM_operator_properties_free(&ptr);
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index 1043f68dbdb..9aefe5a733f 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -203,7 +203,7 @@ PyObject *pyrna_callback_classmethod_add(PyObject *UNUSED(self), PyObject *args)
return NULL;
}
- /* class spesific callbacks */
+ /* class specific callbacks */
if (RNA_struct_is_a(srna, &RNA_Space)) {
if (!PyArg_ParseTuple(args, "OOO!ss:Space.draw_handler_add",
&cls, &cb_func, /* already assigned, no matter */
diff --git a/source/blender/quicktime/CMakeLists.txt b/source/blender/quicktime/CMakeLists.txt
index 0c5c4d8a9f1..b0a8c92e559 100644
--- a/source/blender/quicktime/CMakeLists.txt
+++ b/source/blender/quicktime/CMakeLists.txt
@@ -41,23 +41,13 @@ set(INC_SYS
${QUICKTIME_INCLUDE_DIRS}
)
-if(USE_QTKIT)
- set(SRC
- apple/qtkit_import.m
- apple/qtkit_export.m
+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()
+ quicktime_export.h
+ quicktime_import.h
+)
add_definitions(-DWITH_QUICKTIME)
diff --git a/source/blender/quicktime/SConscript b/source/blender/quicktime/SConscript
index a6debf06226..1fc2bc96b21 100644
--- a/source/blender/quicktime/SConscript
+++ b/source/blender/quicktime/SConscript
@@ -28,12 +28,8 @@
Import ('env')
-if env['USE_QTKIT']:
- source_files = ['apple/qtkit_import.m',
+source_files = ['apple/qtkit_import.m',
'apple/qtkit_export.m']
-else:
- source_files = ['apple/quicktime_import.c',
- 'apple/quicktime_export.c']
incs = ['.',
@@ -58,8 +54,5 @@ priorities = [200,235]
defs=['WITH_QUICKTIME']
-if env['WITH_GHOST_COCOA']:
- defs.append('GHOST_COCOA')
- env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities, cc_compilerchange='/usr/bin/gcc', cxx_compilerchange='/usr/bin/g++') # always use default-Apple-gcc for objC language, gnu-compilers do not support it fully yet
-else:
- env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities)
+env.BlenderLib ('bf_quicktime', sources=source_files, includes=incs, defines=defs, libtype=types, priority=priorities, cc_compilerchange='/usr/bin/gcc', cxx_compilerchange='/usr/bin/g++') # always use default-Apple-gcc for objC language, gnu-compilers do not support it fully yet
+
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c
deleted file mode 100644
index 52ef21e4f39..00000000000
--- a/source/blender/quicktime/apple/quicktime_export.c
+++ /dev/null
@@ -1,927 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * The Original Code is written by Rob Haarsma (phase)
- *
- * Contributor(s): Stefan Gartner (sgefant)
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/quicktime/apple/quicktime_export.c
- * \ingroup quicktime
- *
- * Code to create QuickTime Movies with Blender
- */
-
-
-#ifdef WITH_QUICKTIME
-#if defined(_WIN32) || defined(__APPLE__)
-#ifndef USE_QTKIT
-
-#include "DNA_scene_types.h"
-#include "DNA_windowmanager_types.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "BKE_context.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_report.h"
-#include "BKE_scene.h"
-
-#include "BLI_blenlib.h"
-
-#include "BLI_sys_types.h"
-
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "quicktime_import.h"
-#include "quicktime_export.h"
-
-#ifdef _WIN32
-#include <QTML.h>
-#include <Movies.h>
-#include <QuickTimeComponents.h>
-#include <TextUtils.h>
-#include <string.h>
-#include <memory.h>
-
-#endif /* _WIN32 */
-
-#ifdef __APPLE__
-/* evil */
-#ifndef __AIFF__
-#define __AIFF__
-#endif
-#include <QuickTime/Movies.h>
-#include <QuickTime/QuickTimeComponents.h>
-#include <fcntl.h> /* open() */
-#include <unistd.h> /* close() */
-#include <sys/stat.h> /* file permissions */
-#endif /* __APPLE__ */
-
-#define kMyCreatorType FOUR_CHAR_CODE('TVOD')
-#define kTrackStart 0
-#define kMediaStart 0
-
-static void QT_StartAddVideoSamplesToMedia(const Rect *trackFrame, int rectx, int recty, struct ReportList *reports);
-static void QT_DoAddVideoSamplesToMedia(int frame, int *pixels, int rectx, int recty, struct ReportList *reports);
-static void QT_EndAddVideoSamplesToMedia(void);
-static void QT_CreateMyVideoTrack(int rectx, int recty, struct ReportList *reports);
-static void QT_EndCreateMyVideoTrack(struct ReportList *reports);
-static void check_renderbutton_framerate(struct RenderData *rd, struct ReportList *reports);
-static int get_qtcodec_settings(struct RenderData *rd, struct ReportList *reports);
-
-typedef struct QuicktimeExport {
-
- FSSpec theSpec;
- short resRefNum;
- Str255 qtfilename;
-
- Media theMedia;
- Movie theMovie;
- Track theTrack;
-
- GWorldPtr theGWorld;
- PixMapHandle thePixMap;
- ImageDescription **anImageDescription;
-
- ImBuf *ibuf; /* imagedata for Quicktime's Gworld */
- ImBuf *ibuf2; /* copy of renderdata, to be Y-flipped */
-
-} QuicktimeExport;
-
-typedef struct QuicktimeComponentData {
-
- ComponentInstance theComponent;
- SCTemporalSettings gTemporalSettings;
- SCSpatialSettings gSpatialSettings;
- SCDataRateSettings aDataRateSetting;
- TimeValue duration;
- long kVideoTimeScale;
-
-} QuicktimeComponentData;
-
-static struct QuicktimeExport *qtexport;
-static struct QuicktimeComponentData *qtdata;
-
-static int sframe;
-
-/* RNA functions */
-
-static QuicktimeCodecTypeDesc qtVideoCodecList[] = {
- {kRawCodecType, 1, "Uncompressed"},
- {kJPEGCodecType, 2, "JPEG"},
- {kMotionJPEGACodecType, 3, "M-JPEG A"},
- {kMotionJPEGBCodecType, 4, "M-JPEG B"},
- {kDVCPALCodecType, 5, "DV PAL"},
- {kDVCNTSCCodecType, 6, "DV/DVCPRO NTSC"},
- {kDVCPROHD720pCodecType, 7, "DVCPRO HD 720p"},
- {kDVCPROHD1080i50CodecType, 8, "DVCPRO HD 1080i50"},
- {kDVCPROHD1080i60CodecType, 9, "DVCPRO HD 1080i60"},
- {kMPEG4VisualCodecType, 10, "MPEG4"},
- {kH263CodecType, 11, "H.263"},
- {kH264CodecType, 12, "H.264"},
- {0, 0, NULL}
-};
-
-static int qtVideoCodecCount = 12;
-
-int quicktime_get_num_videocodecs()
-{
- return qtVideoCodecCount;
-}
-
-QuicktimeCodecTypeDesc *quicktime_get_videocodecType_desc(int indexValue)
-{
- if ((indexValue >= 0) && (indexValue < qtVideoCodecCount))
- return &qtVideoCodecList[indexValue];
- else
- return NULL;
-}
-
-int quicktime_rnatmpvalue_from_videocodectype(int codecType)
-{
- int i;
- for (i = 0; i < qtVideoCodecCount; i++) {
- if (qtVideoCodecList[i].codecType == codecType)
- return qtVideoCodecList[i].rnatmpvalue;
- }
-
- return 0;
-}
-
-int quicktime_videocodecType_from_rnatmpvalue(int rnatmpvalue)
-{
- int i;
- for (i = 0; i < qtVideoCodecCount; i++) {
- if (qtVideoCodecList[i].rnatmpvalue == rnatmpvalue)
- return qtVideoCodecList[i].codecType;
- }
-
- return 0;
-}
-
-
-
-static void CheckError(OSErr err, char *msg, ReportList *reports)
-{
- if (err != noErr) {
- BKE_reportf(reports, RPT_ERROR, "%s: %d", msg, err);
- }
-}
-
-
-static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports)
-{
- QTAtomContainer myContainer = NULL;
- ComponentResult myErr = noErr;
- Ptr myPtr;
- long mySize = 0;
-
- CodecInfo ci;
-
- QuicktimeCodecData *qcd = rd->qtcodecdata;
-
- /* check if current scene already has qtcodec settings, and clear them */
- if (qcd) {
- free_qtcodecdata(qcd);
- }
- else {
- qcd = rd->qtcodecdata = MEM_callocN(sizeof(QuicktimeCodecData), "QuicktimeCodecData");
- }
-
- /* obtain all current codec settings */
- SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
- SCSetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
- SCSetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
-
- /* retreive codecdata from quicktime in a atomcontainer */
- myErr = SCGetSettingsAsAtomContainer(qtdata->theComponent, &myContainer);
- if (myErr != noErr) {
- BKE_report(reports, RPT_ERROR, "Quicktime: SCGetSettingsAsAtomContainer failed");
- goto bail;
- }
-
- /* get the size of the atomcontainer */
- mySize = GetHandleSize((Handle)myContainer);
-
- /* lock and convert the atomcontainer to a *valid* pointer */
- QTLockContainer(myContainer);
- myPtr = *(Handle)myContainer;
-
- /* copy the Quicktime data into the blender qtcodecdata struct */
- if (myPtr) {
- qcd->cdParms = MEM_mallocN(mySize, "qt.cdParms");
- memcpy(qcd->cdParms, myPtr, mySize);
- qcd->cdSize = mySize;
-
- GetCodecInfo(&ci, qtdata->gSpatialSettings.codecType, 0);
- }
- else {
- BKE_report(reports, RPT_ERROR, "Quicktime: QT_SaveCodecSettingsToScene failed");
- }
-
- QTUnlockContainer(myContainer);
-
-bail:
- if (myContainer != NULL)
- QTDisposeAtomContainer(myContainer);
-
- return((OSErr)myErr);
-}
-
-
-static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
-{
- Handle myHandle = NULL;
- ComponentResult myErr = noErr;
-
- QuicktimeCodecData *qcd = rd->qtcodecdata;
-
- /* if there is codecdata in the blendfile, convert it to a Quicktime handle */
- if (qcd) {
- myHandle = NewHandle(qcd->cdSize);
- PtrToHand(qcd->cdParms, &myHandle, qcd->cdSize);
- }
-
- /* restore codecsettings to the quicktime component */
- if (qcd->cdParms && qcd->cdSize) {
- myErr = SCSetSettingsFromAtomContainer((GraphicsExportComponent)qtdata->theComponent, (QTAtomContainer)myHandle);
- if (myErr != noErr) {
- BKE_report(reports, RPT_ERROR, "Quicktime: SCSetSettingsFromAtomContainer failed");
- goto bail;
- }
-
- /* update runtime codecsettings for use with the codec dialog */
- SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
- SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
- SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
-
-
- /* Fill the render QuicktimeCodecSettigns struct */
- rd->qtcodecsettings.codecTemporalQuality = (qtdata->gTemporalSettings.temporalQuality * 100) / codecLosslessQuality;
- /* Do not override scene frame rate (qtdata->gTemporalSettings.framerate) */
- rd->qtcodecsettings.keyFrameRate = qtdata->gTemporalSettings.keyFrameRate;
-
- rd->qtcodecsettings.codecType = qtdata->gSpatialSettings.codecType;
- rd->qtcodecsettings.codec = (int)qtdata->gSpatialSettings.codec;
- rd->qtcodecsettings.colorDepth = qtdata->gSpatialSettings.depth;
- rd->qtcodecsettings.codecSpatialQuality = (qtdata->gSpatialSettings.spatialQuality * 100) / codecLosslessQuality;
-
- rd->qtcodecsettings.bitRate = qtdata->aDataRateSetting.dataRate;
- rd->qtcodecsettings.minSpatialQuality = (qtdata->aDataRateSetting.minSpatialQuality * 100) / codecLosslessQuality;
- rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality;
- /* Frame duration is already known (qtdata->aDataRateSetting.frameDuration) */
-
- }
- else {
- BKE_report(reports, RPT_ERROR, "Quicktime: QT_GetCodecSettingsFromScene failed");
- }
-bail:
- if (myHandle != NULL)
- DisposeHandle(myHandle);
-
- return((OSErr)myErr);
-}
-
-
-static OSErr QT_AddUserDataTextToMovie(Movie theMovie, char *theText, OSType theType)
-{
- UserData myUserData = NULL;
- Handle myHandle = NULL;
- long myLength = strlen(theText);
- OSErr myErr = noErr;
-
- /* get the movie's user data list */
- myUserData = GetMovieUserData(theMovie);
- if (myUserData == NULL)
- return(paramErr);
-
- /* copy the specified text into a new handle */
- myHandle = NewHandleClear(myLength);
- if (myHandle == NULL)
- return(MemError());
-
- BlockMoveData(theText, *myHandle, myLength);
-
- /* add the data to the movie's user data */
- myErr = AddUserDataText(myUserData, myHandle, theType, 1, (short)GetScriptManagerVariable(smRegionCode));
-
- /* clean up */
- DisposeHandle(myHandle);
- return(myErr);
-}
-
-
-static void QT_CreateMyVideoTrack(int rectx, int recty, ReportList *reports)
-{
- OSErr err = noErr;
- Rect trackFrame;
-// MatrixRecord myMatrix;
-
- trackFrame.top = 0;
- trackFrame.left = 0;
- trackFrame.bottom = recty;
- trackFrame.right = rectx;
-
- qtexport->theTrack = NewMovieTrack(qtexport->theMovie,
- FixRatio(trackFrame.right, 1),
- FixRatio(trackFrame.bottom, 1),
- 0);
- CheckError(GetMoviesError(), "NewMovieTrack error", reports);
-
- // SetIdentityMatrix(&myMatrix);
- // ScaleMatrix(&myMatrix, fixed1, Long2Fix(-1), 0, 0);
- // TranslateMatrix(&myMatrix, 0, Long2Fix(trackFrame.bottom));
- // SetMovieMatrix(qtexport->theMovie, &myMatrix);
-
- qtexport->theMedia = NewTrackMedia(qtexport->theTrack,
- VideoMediaType,
- qtdata->kVideoTimeScale,
- nil,
- 0);
- CheckError(GetMoviesError(), "NewTrackMedia error", reports);
-
- err = BeginMediaEdits(qtexport->theMedia);
- CheckError(err, "BeginMediaEdits error", reports);
-
- QT_StartAddVideoSamplesToMedia(&trackFrame, rectx, recty, reports);
-}
-
-
-static void QT_EndCreateMyVideoTrack(ReportList *reports)
-{
- OSErr err = noErr;
-
- QT_EndAddVideoSamplesToMedia();
-
- err = EndMediaEdits(qtexport->theMedia);
- CheckError(err, "EndMediaEdits error", reports);
-
- err = InsertMediaIntoTrack(qtexport->theTrack,
- kTrackStart, /* track start time */
- kMediaStart, /* media start time */
- GetMediaDuration(qtexport->theMedia),
- fixed1);
- CheckError(err, "InsertMediaIntoTrack error", reports);
-}
-
-
-static void QT_StartAddVideoSamplesToMedia(const Rect *trackFrame, int rectx, int recty, ReportList *reports)
-{
- SCTemporalSettings gTemporalSettings;
- OSErr err = noErr;
-
- qtexport->ibuf = IMB_allocImBuf(rectx, recty, 32, IB_rect);
- qtexport->ibuf2 = IMB_allocImBuf(rectx, recty, 32, IB_rect);
-
- err = NewGWorldFromPtr(&qtexport->theGWorld,
- k32ARGBPixelFormat,
- trackFrame,
- NULL, NULL, 0,
- (Ptr)qtexport->ibuf->rect,
- rectx * 4);
- CheckError(err, "NewGWorldFromPtr error", reports);
-
- qtexport->thePixMap = GetGWorldPixMap(qtexport->theGWorld);
- LockPixels(qtexport->thePixMap);
-
- SCDefaultPixMapSettings(qtdata->theComponent, qtexport->thePixMap, true);
-
- /* workaround for crash with H.264, which requires an upgrade to
- * the new callback based api for proper encoding, but that's not
- * really compatible with rendering out frames sequentially */
- gTemporalSettings = qtdata->gTemporalSettings;
- if (qtdata->gSpatialSettings.codecType == kH264CodecType) {
- if (gTemporalSettings.temporalQuality != codecMinQuality) {
- BKE_report(reports, RPT_WARNING, "Only minimum quality compression supported for Quicktime H.264");
- gTemporalSettings.temporalQuality = codecMinQuality;
- }
- }
-
- SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &gTemporalSettings);
- SCSetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
- SCSetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
-
- err = SCCompressSequenceBegin(qtdata->theComponent, qtexport->thePixMap, NULL, &qtexport->anImageDescription);
- CheckError(err, "SCCompressSequenceBegin error", reports);
-}
-
-
-static void QT_DoAddVideoSamplesToMedia(int frame, int *pixels, int rectx, int recty, ReportList *reports)
-{
- OSErr err = noErr;
- Rect imageRect;
-
- int index;
- int boxsize;
- unsigned char *from, *to;
-
- short syncFlag;
- long dataSize;
- Handle compressedData;
- Ptr myPtr;
-
-
- /* copy and flip renderdata */
- memcpy(qtexport->ibuf2->rect, pixels, 4 * rectx * recty);
- IMB_flipy(qtexport->ibuf2);
-
- /* get pointers to parse bitmapdata */
- myPtr = GetPixBaseAddr(qtexport->thePixMap);
- imageRect = (**qtexport->thePixMap).bounds;
-
- from = (unsigned char *) qtexport->ibuf2->rect;
- to = (unsigned char *) myPtr;
-
- /* parse RGBA bitmap into Quicktime's ARGB GWorld */
- boxsize = rectx * recty;
- for (index = 0; index < boxsize; index++) {
- to[0] = from[3];
- to[1] = from[0];
- to[2] = from[1];
- to[3] = from[2];
- to += 4, from += 4;
- }
-
- err = SCCompressSequenceFrame(qtdata->theComponent,
- qtexport->thePixMap,
- &imageRect,
- &compressedData,
- &dataSize,
- &syncFlag);
- CheckError(err, "SCCompressSequenceFrame error", reports);
-
- err = AddMediaSample(qtexport->theMedia,
- compressedData,
- 0,
- dataSize,
- qtdata->duration,
- (SampleDescriptionHandle)qtexport->anImageDescription,
- 1,
- syncFlag,
- NULL);
- CheckError(err, "AddMediaSample error", reports);
-}
-
-
-static void QT_EndAddVideoSamplesToMedia(void)
-{
- SCCompressSequenceEnd(qtdata->theComponent);
-
- UnlockPixels(qtexport->thePixMap);
- if (qtexport->theGWorld)
- DisposeGWorld(qtexport->theGWorld);
-
- if (qtexport->ibuf)
- IMB_freeImBuf(qtexport->ibuf);
-
- if (qtexport->ibuf2)
- IMB_freeImBuf(qtexport->ibuf2);
-}
-
-
-void filepath_qt(char *string, RenderData *rd)
-{
- char txt[64];
-
- if (string == 0) return;
-
- strcpy(string, rd->pic);
- BLI_path_abs(string, G.main->name);
-
- BLI_make_existing_file(string);
-
- if (BLI_strcasecmp(string + strlen(string) - 4, ".mov")) {
- sprintf(txt, "%04d-%04d.mov", (rd->sfra), (rd->efra));
- strcat(string, txt);
- }
-}
-
-
-int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, ReportList *reports)
-{
- OSErr err = noErr;
-
- char name[2048];
- char theFullPath[255];
-
-#ifdef __APPLE__
- int myFile;
- FSRef myRef;
-#else
- char *qtname;
-#endif
- int success = 1;
-
- if (qtexport == NULL) qtexport = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport");
-
- if (qtdata) {
- if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
- free_qtcomponentdata();
- }
-
- qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeCodecDataExt");
-
- if (rd->qtcodecdata == NULL || rd->qtcodecdata->cdParms == NULL) {
- get_qtcodec_settings(rd, reports);
- }
- else {
- qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
-
- QT_GetCodecSettingsFromScene(rd, reports);
- check_renderbutton_framerate(rd, reports);
- }
-
- sframe = (rd->sfra);
-
- filepath_qt(name, rd);
-
-#ifdef __APPLE__
- EnterMoviesOnThread(0);
- strcpy(theFullPath, name);
-
- /* hack: create an empty file to make FSPathMakeRef() happy */
- myFile = open(theFullPath, O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRUSR | S_IWUSR);
- if (myFile < 0) {
- BKE_report(reports, RPT_ERROR, "Error while creating movie file!");
- /* do something? */
- }
- close(myFile);
- err = FSPathMakeRef((const UInt8 *)theFullPath, &myRef, 0);
- CheckError(err, "FsPathMakeRef error", reports);
- err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &qtexport->theSpec, NULL);
- CheckError(err, "FsGetCatalogInfoRef error", reports);
-#endif
-#ifdef _WIN32
- qtname = get_valid_qtname(name);
- strcpy(theFullPath, qtname);
- strcpy(name, qtname);
- MEM_freeN(qtname);
-
- CopyCStringToPascal(theFullPath, qtexport->qtfilename);
- err = FSMakeFSSpec(0, 0L, qtexport->qtfilename, &qtexport->theSpec);
-#endif
-
- err = CreateMovieFile(&qtexport->theSpec,
- kMyCreatorType,
- smCurrentScript,
- createMovieFileDeleteCurFile | createMovieFileDontCreateResFile,
- &qtexport->resRefNum,
- &qtexport->theMovie);
- CheckError(err, "CreateMovieFile error", reports);
-
- if (err != noErr) {
- BKE_reportf(reports, RPT_ERROR, "Unable to create Quicktime movie: %s", name);
- success = 0;
-#ifdef __APPLE__
- ExitMoviesOnThread();
-#endif
- }
- else {
- /* printf("Created QuickTime movie: %s\n", name); */
-
- QT_CreateMyVideoTrack(rectx, recty, reports);
- }
-
- return success;
-}
-
-
-int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, int rectx, int recty, ReportList *reports)
-{
- QT_DoAddVideoSamplesToMedia(frame, pixels, rectx, recty, reports);
- return 1;
-}
-
-
-void end_qt(void)
-{
- OSErr err = noErr;
- short resId = movieInDataForkResID;
-
- if (qtexport->theMovie) {
- QT_EndCreateMyVideoTrack(NULL);
-
- err = AddMovieResource(qtexport->theMovie, qtexport->resRefNum, &resId, qtexport->qtfilename);
- CheckError(err, "AddMovieResource error", NULL);
-
- err = QT_AddUserDataTextToMovie(qtexport->theMovie, "Made with Blender", kUserDataTextInformation);
- CheckError(err, "AddUserDataTextToMovie error", NULL);
-
- err = UpdateMovieResource(qtexport->theMovie, qtexport->resRefNum, resId, qtexport->qtfilename);
- CheckError(err, "UpdateMovieResource error", NULL);
-
- if (qtexport->resRefNum) CloseMovieFile(qtexport->resRefNum);
-
- DisposeMovie(qtexport->theMovie);
-
- /* printf("Finished QuickTime movie.\n"); */
- }
-
-#ifdef __APPLE__
- ExitMoviesOnThread();
-#endif
-
- if (qtexport) {
- MEM_freeN(qtexport);
- qtexport = NULL;
- }
-}
-
-
-void free_qtcomponentdata(void)
-{
- if (qtdata) {
- if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
- MEM_freeN(qtdata);
- qtdata = NULL;
- }
-}
-
-
-static void check_renderbutton_framerate(RenderData *rd, ReportList *reports)
-{
- /* to keep float framerates consistent between the codec dialog and frs/sec button. */
- OSErr err;
-
- err = SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
- CheckError(err, "SCGetInfo fr error", reports);
-
- if ( (rd->frs_sec == 24 || rd->frs_sec == 30 || rd->frs_sec == 60) &&
- (qtdata->gTemporalSettings.frameRate == 1571553 ||
- qtdata->gTemporalSettings.frameRate == 1964113 ||
- qtdata->gTemporalSettings.frameRate == 3928227))
- {
- /* do nothing */
- }
- else {
- if (rd->frs_sec_base > 0)
- qtdata->gTemporalSettings.frameRate =
- ((float)(rd->frs_sec << 16) / rd->frs_sec_base);
- }
-
- err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
- CheckError(err, "SCSetInfo error", reports);
-
- if (qtdata->gTemporalSettings.frameRate == 1571553) { /* 23.98 fps */
- qtdata->kVideoTimeScale = 24000;
- qtdata->duration = 1001;
- }
- else if (qtdata->gTemporalSettings.frameRate == 1964113) { /* 29.97 fps */
- qtdata->kVideoTimeScale = 30000;
- qtdata->duration = 1001;
- }
- else if (qtdata->gTemporalSettings.frameRate == 3928227) { /* 59.94 fps */
- qtdata->kVideoTimeScale = 60000;
- qtdata->duration = 1001;
- }
- else {
- qtdata->kVideoTimeScale = (qtdata->gTemporalSettings.frameRate >> 16) * 100;
- qtdata->duration = 100;
- }
-}
-
-void quicktime_verify_image_type(RenderData *rd, ImageFormatData *imf)
-{
- if (imf->imtype == R_IMF_IMTYPE_QUICKTIME) {
- if ((rd->qtcodecsettings.codecType == 0) ||
- (rd->qtcodecsettings.codecSpatialQuality < 0) ||
- (rd->qtcodecsettings.codecSpatialQuality > 100))
- {
- rd->qtcodecsettings.codecType = kJPEGCodecType;
- rd->qtcodecsettings.codec = (int)anyCodec;
- rd->qtcodecsettings.codecSpatialQuality = (codecHighQuality * 100) / codecLosslessQuality;
- rd->qtcodecsettings.codecTemporalQuality = (codecHighQuality * 100) / codecLosslessQuality;
- rd->qtcodecsettings.keyFrameRate = 25;
- rd->qtcodecsettings.bitRate = 5000000; /* 5 Mbps */
- }
- }
-}
-
-int get_qtcodec_settings(RenderData *rd, ReportList *reports)
-{
- OSErr err = noErr;
- /* erase any existing codecsetting */
- if (qtdata) {
- if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
- free_qtcomponentdata();
- }
-
- /* allocate new */
- qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeComponentData");
- qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
-
- /* get previous selected codecsetting, from qtatom or detailed settings */
- if (rd->qtcodecdata && rd->qtcodecdata->cdParms) {
- QT_GetCodecSettingsFromScene(rd, reports);
- }
- else {
- SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
- SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
- SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
-
- qtdata->gSpatialSettings.codecType = rd->qtcodecsettings.codecType;
- qtdata->gSpatialSettings.codec = (CodecComponent)rd->qtcodecsettings.codec;
- qtdata->gSpatialSettings.spatialQuality = (rd->qtcodecsettings.codecSpatialQuality * codecLosslessQuality) / 100;
- qtdata->gTemporalSettings.temporalQuality = (rd->qtcodecsettings.codecTemporalQuality * codecLosslessQuality) / 100;
- qtdata->gTemporalSettings.keyFrameRate = rd->qtcodecsettings.keyFrameRate;
- qtdata->aDataRateSetting.dataRate = rd->qtcodecsettings.bitRate;
- qtdata->gSpatialSettings.depth = rd->qtcodecsettings.colorDepth;
- qtdata->aDataRateSetting.minSpatialQuality = (rd->qtcodecsettings.minSpatialQuality * codecLosslessQuality) / 100;
- qtdata->aDataRateSetting.minTemporalQuality = (rd->qtcodecsettings.minTemporalQuality * codecLosslessQuality) / 100;
-
- qtdata->aDataRateSetting.frameDuration = rd->frs_sec;
- SetMovieTimeScale(qtexport->theMovie, rd->frs_sec_base * 1000);
-
-
- err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
- CheckError(err, "SCSetInfo1 error", reports);
- err = SCSetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
- CheckError(err, "SCSetInfo2 error", reports);
- err = SCSetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
- CheckError(err, "SCSetInfo3 error", reports);
- }
-
- check_renderbutton_framerate(rd, reports);
-
- return err;
-}
-
-static int request_qtcodec_settings_exec(bContext *C, wmOperator *op)
-{
- OSErr err = noErr;
- Scene *scene = CTX_data_scene(C);
- RenderData *rd = &scene->r;
-
- /* erase any existing codecsetting */
- if (qtdata) {
- if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
- free_qtcomponentdata();
- }
-
- /* allocate new */
- qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeComponentData");
- qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
-
- /* get previous selected codecsetting, from qtatom or detailed settings */
- if (rd->qtcodecdata && rd->qtcodecdata->cdParms) {
- QT_GetCodecSettingsFromScene(rd, op->reports);
- }
- else {
- SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
- SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
- SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
-
- qtdata->gSpatialSettings.codecType = rd->qtcodecsettings.codecType;
- qtdata->gSpatialSettings.codec = (CodecComponent)rd->qtcodecsettings.codec;
- qtdata->gSpatialSettings.spatialQuality = (rd->qtcodecsettings.codecSpatialQuality * codecLosslessQuality) / 100;
- qtdata->gTemporalSettings.temporalQuality = (rd->qtcodecsettings.codecTemporalQuality * codecLosslessQuality) / 100;
- qtdata->gTemporalSettings.keyFrameRate = rd->qtcodecsettings.keyFrameRate;
- qtdata->gTemporalSettings.frameRate = ((float)(rd->frs_sec << 16) / rd->frs_sec_base);
- qtdata->aDataRateSetting.dataRate = rd->qtcodecsettings.bitRate;
- qtdata->gSpatialSettings.depth = rd->qtcodecsettings.colorDepth;
- qtdata->aDataRateSetting.minSpatialQuality = (rd->qtcodecsettings.minSpatialQuality * codecLosslessQuality) / 100;
- qtdata->aDataRateSetting.minTemporalQuality = (rd->qtcodecsettings.minTemporalQuality * codecLosslessQuality) / 100;
-
- qtdata->aDataRateSetting.frameDuration = rd->frs_sec;
-
- err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
- CheckError(err, "SCSetInfo1 error", op->reports);
- err = SCSetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
- CheckError(err, "SCSetInfo2 error", op->reports);
- err = SCSetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
- CheckError(err, "SCSetInfo3 error", op->reports);
- }
- /* put up the dialog box - it needs to be called from the main thread */
- err = SCRequestSequenceSettings(qtdata->theComponent);
-
- if (err == scUserCancelled) {
- return OPERATOR_FINISHED;
- }
-
- /* update runtime codecsettings for use with the codec dialog */
- SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
- SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
- SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
-
-
- /* Fill the render QuicktimeCodecSettings struct */
- rd->qtcodecsettings.codecTemporalQuality = (qtdata->gTemporalSettings.temporalQuality * 100) / codecLosslessQuality;
- /* Do not override scene frame rate (qtdata->gTemporalSettings.framerate) */
- rd->qtcodecsettings.keyFrameRate = qtdata->gTemporalSettings.keyFrameRate;
-
- rd->qtcodecsettings.codecType = qtdata->gSpatialSettings.codecType;
- rd->qtcodecsettings.codec = (int)qtdata->gSpatialSettings.codec;
- rd->qtcodecsettings.colorDepth = qtdata->gSpatialSettings.depth;
- rd->qtcodecsettings.codecSpatialQuality = (qtdata->gSpatialSettings.spatialQuality * 100) / codecLosslessQuality;
-
- rd->qtcodecsettings.bitRate = qtdata->aDataRateSetting.dataRate;
- rd->qtcodecsettings.minSpatialQuality = (qtdata->aDataRateSetting.minSpatialQuality * 100) / codecLosslessQuality;
- rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality;
- /* Frame duration is already known (qtdata->aDataRateSetting.frameDuration) */
-
- QT_SaveCodecSettingsToScene(rd, op->reports);
-
- /* framerate jugglin' */
- if (qtdata->gTemporalSettings.frameRate == 1571553) { /* 23.98 fps */
- qtdata->kVideoTimeScale = 24000;
- qtdata->duration = 1001;
-
- rd->frs_sec = 24;
- rd->frs_sec_base = 1.001;
- }
- else if (qtdata->gTemporalSettings.frameRate == 1964113) { /* 29.97 fps */
- qtdata->kVideoTimeScale = 30000;
- qtdata->duration = 1001;
-
- rd->frs_sec = 30;
- rd->frs_sec_base = 1.001;
- }
- else if (qtdata->gTemporalSettings.frameRate == 3928227) { /* 59.94 fps */
- qtdata->kVideoTimeScale = 60000;
- qtdata->duration = 1001;
-
- rd->frs_sec = 60;
- rd->frs_sec_base = 1.001;
- }
- else {
- double fps = qtdata->gTemporalSettings.frameRate;
-
- qtdata->kVideoTimeScale = 60000;
- qtdata->duration = qtdata->kVideoTimeScale / (qtdata->gTemporalSettings.frameRate / 65536);
-
- if ((qtdata->gTemporalSettings.frameRate & 0xffff) == 0) {
- rd->frs_sec = fps / 65536;
- rd->frs_sec_base = 1.0;
- }
- else {
- /* we do our very best... */
- rd->frs_sec = fps / 65536;
- rd->frs_sec_base = 1.0;
- }
- }
-
- return OPERATOR_FINISHED;
-}
-
-static int ED_operator_setqtcodec(bContext *C)
-{
- return G.have_quicktime != FALSE;
-}
-
-#if defined(__APPLE__) && defined(GHOST_COCOA)
-/* Need to set up a Cocoa NSAutoReleasePool to avoid memory leak
- * And it must be done in an objC file, so use a GHOST_SystemCocoa.mm function for that */
-extern int cocoa_request_qtcodec_settings_exec(bContext *C, wmOperator *op);
-
-int fromcocoa_request_qtcodec_settings(bContext *C, wmOperator *op)
-{
- return request_qtcodec_settings_exec(C, op);
-}
-#endif
-
-
-void SCENE_OT_render_data_set_quicktime_codec(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Change Codec";
- ot->description = "Change Quicktime codec Settings";
- ot->idname = "SCENE_OT_render_data_set_quicktime_codec";
-
- /* api callbacks */
-#if defined(__APPLE__) && defined(GHOST_COCOA)
- ot->exec = cocoa_request_qtcodec_settings_exec;
-#else
- ot->exec = request_qtcodec_settings_exec;
-#endif
- ot->poll = ED_operator_setqtcodec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-#endif /* USE_QTKIT */
-#endif /* _WIN32 || __APPLE__ */
-#endif /* WITH_QUICKTIME */
-
diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c
deleted file mode 100644
index 511b62d856a..00000000000
--- a/source/blender/quicktime/apple/quicktime_import.c
+++ /dev/null
@@ -1,833 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- *
- * The Original Code is written by Rob Haarsma (phase)
- *
- * Contributor(s): Stefan Gartner (sgefant)
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/quicktime/apple/quicktime_import.c
- * \ingroup quicktime
- *
- * Code to use Quicktime to load images/movies as texture.
- */
-
-#ifdef WITH_QUICKTIME
-
-#if defined(_WIN32) || defined(__APPLE__)
-#ifndef USE_QTKIT
-
-#include "MEM_guardedalloc.h"
-#include "IMB_anim.h"
-#include "BLI_sys_types.h"
-#include "BKE_global.h"
-#include "BLI_dynstr.h"
-#include "BLI_path_util.h"
-
-#ifdef __APPLE__
-#include <QuickTime/Movies.h>
-#include <QuickTime/QuickTimeComponents.h>
-#endif
-
-#ifdef _WIN32
-#include <Movies.h>
-#include <QTML.h>
-#include <TextUtils.h>
-#include <QuickTimeComponents.h>
-#include <QTLoadLibraryUtils.h>
-#endif /* _WIN32 */
-
-
-#include "quicktime_import.h"
-#include "quicktime_export.h"
-
-#define RECT_WIDTH(r) (r.right - r.left)
-#define RECT_HEIGHT(r) (r.bottom - r.top)
-
-#define QTIME_DEBUG 0
-
-typedef struct _QuicktimeMovie {
-
- GWorldPtr offscreenGWorld;
- PixMapHandle offscreenPixMap;
- Movie movie;
- Rect movieBounds;
- short movieRefNum;
- short movieResId;
- int movWidth, movHeight;
-
-
- int framecount;
-
-
- ImBuf *ibuf;
-
-
- TimeValue *frameIndex;
- Media theMedia;
- Track theTrack;
- long trackIndex;
- short depth;
-
- int have_gw; /* ugly */
-} QuicktimeMovie;
-
-
-
-void quicktime_init(void)
-{
- OSErr nerr;
-#ifdef _WIN32
- QTLoadLibrary("QTCF.dll");
- nerr = InitializeQTML(0);
- if (nerr != noErr) {
- G.have_quicktime = FALSE;
- }
- else
- G.have_quicktime = TRUE;
-#endif /* _WIN32 */
-
- /* Initialize QuickTime */
-#if defined(_WIN32) || defined(__APPLE__)
- nerr = EnterMovies();
- if (nerr != noErr)
- G.have_quicktime = FALSE;
- else
-#endif /* _WIN32 || __APPLE__ */
-#ifdef __linux__
- /* inititalize quicktime codec registry */
- lqt_registry_init();
-#endif
- G.have_quicktime = TRUE;
-}
-
-
-void quicktime_exit(void)
-{
-#if defined(_WIN32) || defined(__APPLE__)
-#ifdef WITH_QUICKTIME
- if (G.have_quicktime) {
- free_qtcomponentdata();
- ExitMovies();
-#ifdef _WIN32
- TerminateQTML();
-#endif /* _WIN32 */
- }
-#endif /* WITH_QUICKTIME */
-#endif /* _WIN32 || __APPLE__ */
-}
-
-
-#ifdef _WIN32
-char *get_valid_qtname(char *name)
-{
- TCHAR Buffer[MAX_PATH];
- DWORD dwRet;
- char *qtname;
- DynStr *ds = BLI_dynstr_new();
-
- dwRet = GetCurrentDirectory(MAX_PATH, Buffer);
-
- if (name[1] != ':') {
- char drive[2];
-
- if (name[0] == '/' || name[0] == '\\') {
- drive[0] = Buffer[0];
- drive[1] = '\0';
-
- BLI_dynstr_append(ds, drive);
- BLI_dynstr_append(ds, ":");
- BLI_dynstr_append(ds, name);
- }
- else {
- BLI_dynstr_append(ds, Buffer);
- BLI_dynstr_append(ds, "/");
- BLI_dynstr_append(ds, name);
- }
- }
- else {
- BLI_dynstr_append(ds, name);
- }
-
- qtname = BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
-
- return qtname;
-}
-#endif /* _WIN32 */
-
-
-int anim_is_quicktime(const char *name)
-{
- FSSpec theFSSpec;
- char theFullPath[255];
-
- Boolean isMovieFile = false;
- AliasHandle myAlias = NULL;
- Component myImporter = NULL;
-#ifdef __APPLE__
- FInfo myFinderInfo;
- FSRef myRef;
-#else
- char *qtname;
- Str255 dst;
-#endif
- OSErr err = noErr;
-
- // don't let quicktime movie import handle these
- if (BLI_testextensie(name, ".swf") ||
- BLI_testextensie(name, ".txt") ||
- BLI_testextensie(name, ".mpg") ||
- BLI_testextensie(name, ".avi") || /* wouldn't be appropriate ;) */
- BLI_testextensie(name, ".tga") ||
- BLI_testextensie(name, ".png") ||
- BLI_testextensie(name, ".bmp") ||
- BLI_testextensie(name, ".jpg") ||
- BLI_testextensie(name, ".tif") ||
- BLI_testextensie(name, ".exr") ||
- BLI_testextensie(name, ".wav") ||
- BLI_testextensie(name, ".zip") ||
- BLI_testextensie(name, ".mp3"))
- {
- return 0;
- }
-
- if (QTIME_DEBUG) printf("qt: checking as movie: %s\n", name);
-
-#ifdef __APPLE__
- strcpy(theFullPath, name);
-
- err = FSPathMakeRef(theFullPath, &myRef, 0);
- err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &theFSSpec, NULL);
-#else
- qtname = get_valid_qtname(name);
- strcpy(theFullPath, qtname);
- MEM_freeN(qtname);
-
- CopyCStringToPascal(theFullPath, dst);
- err = FSMakeFSSpec(0, 0L, dst, &theFSSpec);
-#endif
-
-#ifdef __APPLE__
- // see whether the file type is MovieFileType; to do this, get the Finder information
- err = FSpGetFInfo(&theFSSpec, &myFinderInfo);
- if (err == noErr) {
- if (myFinderInfo.fdType == kQTFileTypeMovie) {
- return(true);
- }
- }
-#endif
-
-/* on mac os x this results in using quicktime for other formats as well
- * not sure whether this is intended
- */
- // if it isn't a movie file, see whether the file can be imported as a movie
- err = QTNewAlias(&theFSSpec, &myAlias, true);
- if (err == noErr) {
- if (myAlias != NULL) {
- err = GetMovieImporterForDataRef(rAliasType, (Handle)myAlias, kGetMovieImporterDontConsiderGraphicsImporters, &myImporter);
- DisposeHandle((Handle)myAlias);
- }
- }
-
- if ((err == noErr) && (myImporter != NULL)) { /* this file is a movie file */
- isMovieFile = true;
- }
-
- return(isMovieFile);
-}
-
-
-void free_anim_quicktime(struct anim *anim)
-{
- if (anim == NULL) return;
- if (anim->qtime == NULL) return;
-
- UnlockPixels(anim->qtime->offscreenPixMap);
-
- if (anim->qtime->have_gw)
- DisposeGWorld(anim->qtime->offscreenGWorld);
- if (anim->qtime->ibuf)
- IMB_freeImBuf(anim->qtime->ibuf);
-
- DisposeMovie(anim->qtime->movie);
- CloseMovieFile(anim->qtime->movieRefNum);
-
- if (anim->qtime->frameIndex) MEM_freeN(anim->qtime->frameIndex);
- if (anim->qtime) MEM_freeN(anim->qtime);
-
- anim->qtime = NULL;
-
- anim->duration = 0;
-}
-
-
-static OSErr QT_get_frameIndexes(struct anim *anim)
-{
- int i;
- OSErr anErr = noErr;
- OSType media = VideoMediaType;
- TimeValue nextTime = 0;
- TimeValue startPoint;
- TimeValue tmpstartPoint;
- long sampleCount = 0;
-
- startPoint = -1;
-
- GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample + nextTimeEdgeOK, (TimeValue)1, &media, 0,
- 1, &startPoint, NULL);
-
- tmpstartPoint = startPoint;
-
- anim->qtime->framecount = 0;
-
- sampleCount = GetMediaSampleCount(anim->qtime->theMedia);
- anErr = GetMoviesError();
- if (anErr != noErr) return anErr;
-
- anim->qtime->framecount = sampleCount;
-
- anim->qtime->frameIndex = (TimeValue *) MEM_callocN(sizeof(TimeValue) * anim->qtime->framecount, "qtframeindex");
-
- //rewind
- GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample, 1, &media, (TimeValue)1, 0, &tmpstartPoint, NULL);
-
- anim->qtime->frameIndex[0] = startPoint;
- for (i = 1; i < anim->qtime->framecount; i++) {
- nextTime = 0;
- GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample, 1, &media, startPoint, 0, &nextTime, NULL);
- startPoint = nextTime;
- anim->qtime->frameIndex[i] = nextTime;
- }
-
- anErr = GetMoviesError();
- return anErr;
-}
-
-
-ImBuf *qtime_fetchibuf(struct anim *anim, int position)
-{
- PixMapHandle myPixMap = NULL;
- Ptr myPtr;
-
- register int index;
- register int boxsize;
-
- register uint32_t *readPos;
- register uint32_t *changePos;
-
- ImBuf *ibuf = NULL;
- unsigned int *rect;
-#ifdef __APPLE__
- unsigned char *from, *to;
-#endif
-#ifdef _WIN32
- unsigned char *crect;
-#endif
-
- if (anim == NULL) {
- return (NULL);
- }
-
- ibuf = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect);
- rect = ibuf->rect;
-
- SetMovieTimeValue(anim->qtime->movie, anim->qtime->frameIndex[position]);
- UpdateMovie(anim->qtime->movie);
- MoviesTask(anim->qtime->movie, 0);
-
-
- myPixMap = GetGWorldPixMap(anim->qtime->offscreenGWorld);
- myPtr = GetPixBaseAddr(myPixMap);
-
- if (myPtr == NULL) {
- printf("Error reading frame from Quicktime");
- IMB_freeImBuf(ibuf);
- return NULL;
- }
-
- boxsize = anim->x * anim->y;
- readPos = (uint32_t *) myPtr;
- changePos = (uint32_t *) rect; //textureIMBuf *THE* data pointerrr
-
-#ifdef __APPLE__
- // Swap alpha byte to the end, so ARGB become RGBA;
- from = (unsigned char *)readPos;
- to = (unsigned char *)changePos;
-
- for (index = 0; index < boxsize; index++, from += 4, to += 4) {
- to[3] = from[0];
- to[0] = from[1];
- to[1] = from[2];
- to[2] = from[3];
- }
-#endif
-
-#ifdef _WIN32
- for (index = 0; index < boxsize; index++, changePos++, readPos++)
- *(changePos) = *(readPos);
-
- if (anim->qtime->depth < 32) {
- //add alpha to ibuf
- boxsize = anim->x * anim->y * 4;
- crect = (unsigned char *) rect;
- for (index = 0; index < boxsize; index += 4, crect += 4) {
- crect[3] = 0xFF;
- }
- }
-#endif
-
- IMB_flipy(ibuf);
- return ibuf;
-}
-
-
-// following two functions only here to get movie pixeldepth
-
-static int GetFirstVideoMedia(struct anim *anim)
-{
- long numTracks;
- OSType mediaType;
-
- numTracks = GetMovieTrackCount(anim->qtime->movie);
-
- for (anim->qtime->trackIndex = 1; anim->qtime->trackIndex <= numTracks; (anim->qtime->trackIndex)++) {
- anim->qtime->theTrack = GetMovieIndTrack(anim->qtime->movie, anim->qtime->trackIndex);
-
- if (anim->qtime->theTrack)
- anim->qtime->theMedia = GetTrackMedia(anim->qtime->theTrack);
-
- if (anim->qtime->theMedia)
- GetMediaHandlerDescription(anim->qtime->theMedia, &mediaType, nil, nil);
- if (mediaType == VideoMediaType) return 1;
- }
-
- anim->qtime->trackIndex = 0; // trackIndex can't be 0
- return 0; // went through all tracks and no video
-}
-
-static short GetFirstVideoTrackPixelDepth(struct anim *anim)
-{
- SampleDescriptionHandle imageDescH = (SampleDescriptionHandle)NewHandle(sizeof(Handle));
-// long trackIndex = 0; /*unused*/
-
- if (!GetFirstVideoMedia(anim))
- return -1;
-
- if (!anim->qtime->trackIndex || !anim->qtime->theMedia) return -1; // we need both
- GetMediaSampleDescription(anim->qtime->theMedia, anim->qtime->trackIndex, imageDescH);
-
- return (*(ImageDescriptionHandle)imageDescH)->depth;
-}
-
-
-int startquicktime(struct anim *anim)
-{
- FSSpec theFSSpec;
-
- OSErr err = noErr;
- char theFullPath[255];
-#ifdef __APPLE__
- FSRef myRef;
-#else
- char *qtname;
- Str255 dst;
-#endif
- short depth = 0;
-
- anim->qtime = MEM_callocN(sizeof(QuicktimeMovie), "animqt");
- anim->qtime->have_gw = FALSE;
-
- if (anim->qtime == NULL) {
- if (QTIME_DEBUG) printf("Can't alloc qtime: %s\n", anim->name);
- return -1;
- }
-
- if (QTIME_DEBUG) printf("qt: attempting to load as movie %s\n", anim->name);
-
-#ifdef __APPLE__
- strcpy(theFullPath, anim->name);
-
- err = FSPathMakeRef(theFullPath, &myRef, 0);
- err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &theFSSpec, NULL);
-#else
- qtname = get_valid_qtname(anim->name);
- strcpy(theFullPath, qtname);
- MEM_freeN(qtname);
-
- CopyCStringToPascal(theFullPath, dst);
- FSMakeFSSpec(0, 0L, dst, &theFSSpec);
-#endif
-
- err = OpenMovieFile(&theFSSpec, &anim->qtime->movieRefNum, fsRdPerm);
-
- if (err == noErr) {
- if (QTIME_DEBUG) printf("qt: movie opened\n");
- err = NewMovieFromFile(&anim->qtime->movie,
- anim->qtime->movieRefNum,
- &anim->qtime->movieResId, NULL, newMovieActive, NULL);
- }
-
- if (err) {
- if (QTIME_DEBUG) printf("qt: bad movie %s\n", anim->name);
- if (anim->qtime->movie) {
- DisposeMovie(anim->qtime->movie);
- MEM_freeN(anim->qtime);
- if (QTIME_DEBUG) printf("qt: can't load %s\n", anim->name);
- return -1;
- }
- }
-
- GetMovieBox(anim->qtime->movie, &anim->qtime->movieBounds);
- anim->x = anim->qtime->movWidth = RECT_WIDTH(anim->qtime->movieBounds);
- anim->y = anim->qtime->movHeight = RECT_HEIGHT(anim->qtime->movieBounds);
- if (QTIME_DEBUG) printf("qt: got bounds %s\n", anim->name);
-
- if (anim->x == 0 && anim->y == 0) {
- if (QTIME_DEBUG) printf("qt: error, no dimensions\n");
- free_anim_quicktime(anim);
- return -1;
- }
-
- anim->qtime->ibuf = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect);
-
-#ifdef _WIN32
- err = NewGWorldFromPtr(&anim->qtime->offscreenGWorld,
- k32RGBAPixelFormat,
- &anim->qtime->movieBounds,
- NULL, NULL, 0,
- (unsigned char *)anim->qtime->ibuf->rect,
- anim->x * 4);
-#else
- err = NewGWorldFromPtr(&anim->qtime->offscreenGWorld,
- k32ARGBPixelFormat,
- &anim->qtime->movieBounds,
- NULL, NULL, 0,
- (unsigned char *)anim->qtime->ibuf->rect,
- anim->x * 4);
-#endif /* _WIN32 */
-
- if (err == noErr) {
- anim->qtime->have_gw = TRUE;
-
- SetMovieGWorld(anim->qtime->movie,
- anim->qtime->offscreenGWorld,
- GetGWorldDevice(anim->qtime->offscreenGWorld));
- SetMoviePlayHints(anim->qtime->movie, hintsHighQuality, hintsHighQuality);
-
- // sets Media and Track!
- depth = GetFirstVideoTrackPixelDepth(anim);
-
- QT_get_frameIndexes(anim);
- }
-
- anim->qtime->offscreenPixMap = GetGWorldPixMap(anim->qtime->offscreenGWorld);
- LockPixels(anim->qtime->offscreenPixMap);
-
- //fill blender's anim struct
- anim->qtime->depth = depth;
-
- anim->duration = anim->qtime->framecount;
- anim->params = 0;
-
- anim->interlacing = 0;
- anim->orientation = 0;
- anim->framesize = anim->x * anim->y * 4;
-
- anim->curposition = 0;
-
- if (QTIME_DEBUG) printf("qt: load %s %dx%dx%d frames %d\n", anim->name, anim->qtime->movWidth,
- anim->qtime->movHeight, anim->qtime->depth, anim->qtime->framecount);
-
- return 0;
-}
-
-int imb_is_a_quicktime(char *name)
-{
- GraphicsImportComponent theImporter = NULL;
-
- FSSpec theFSSpec;
-#ifdef _WIN32
- Str255 dst; /*unused*/
-#endif
- char theFullPath[255];
-
-// Boolean isMovieFile = false; /*unused*/
-// AliasHandle myAlias = NULL; /*unused*/
-// Component myImporter = NULL; /*unused*/
-#ifdef __APPLE__
-// FInfo myFinderInfo; /*unused*/
- FSRef myRef;
-#endif
- OSErr err = noErr;
-
- if (!G.have_quicktime) return 0;
-
- if (QTIME_DEBUG) printf("qt: checking as image %s\n", name);
-
- // don't let quicktime image import handle these
- if (BLI_testextensie(name, ".swf") ||
- BLI_testextensie(name, ".txt") ||
- BLI_testextensie(name, ".mpg") ||
- BLI_testextensie(name, ".wav") ||
- BLI_testextensie(name, ".mov") || // not as image, doesn't work
- BLI_testextensie(name, ".avi") ||
- BLI_testextensie(name, ".mp3"))
- {
- return 0;
- }
-
- strcpy(theFullPath, name);
-#ifdef __APPLE__
- err = FSPathMakeRef(theFullPath, &myRef, 0);
- err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &theFSSpec, NULL);
-#else
- CopyCStringToPascal(theFullPath, dst);
- err = FSMakeFSSpec(0, 0L, dst, &theFSSpec);
-#endif
-
- GetGraphicsImporterForFile(&theFSSpec, &theImporter);
-
- if (theImporter != NULL) {
- if (QTIME_DEBUG) printf("qt: %s valid\n", name);
- CloseComponent(theImporter);
- return 1;
- }
-
- return 0;
-}
-
-ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
-{
- Rect myRect;
- OSErr err = noErr;
- GraphicsImportComponent gImporter = NULL;
-
- ImageDescriptionHandle desc;
-
- ComponentInstance dataHandler;
- PointerDataRef dataref;
-
- int x, y, depth;
- int have_gw = FALSE;
- ImBuf *ibuf = NULL;
-// ImBuf *imbuf = NULL; /*unused*/
- GWorldPtr offGWorld;
- PixMapHandle myPixMap = NULL;
-
-#ifdef __APPLE__
- Ptr myPtr;
-
- register int index;
- register int boxsize;
-
- register uint32_t *readPos;
- register uint32_t *changePos;
-
- ImBuf *wbuf = NULL;
- unsigned int *rect;
- unsigned char *from, *to;
-#endif
-
- if (mem == NULL || !G.have_quicktime)
- goto bail;
-
- if (QTIME_DEBUG) printf("qt: attempt to load mem as image\n");
-
- dataref = (PointerDataRef)NewHandle(sizeof(PointerDataRefRecord));
- (**dataref).data = mem;
- (**dataref).dataLength = size;
-
- err = OpenADataHandler((Handle)dataref,
- PointerDataHandlerSubType,
- nil,
- (OSType)0,
- nil,
- kDataHCanRead,
- &dataHandler);
- if (err != noErr) {
- if (QTIME_DEBUG) printf("no datahandler\n");
- goto bail;
- }
-
- err = GetGraphicsImporterForDataRef((Handle)dataref, PointerDataHandlerSubType, &gImporter);
- if (err != noErr) {
- if (QTIME_DEBUG) printf("no graphimport\n");
- goto bail;
- }
-
- err = GraphicsImportGetNaturalBounds(gImporter, &myRect);
- if (err != noErr) {
- if (QTIME_DEBUG) printf("no bounds\n");
- goto bail;
- }
-
- err = GraphicsImportGetImageDescription(gImporter, &desc);
- if (err != noErr) {
- if (QTIME_DEBUG) printf("no imagedescription\n");
- goto bail;
- }
-
- x = RECT_WIDTH(myRect);
- y = RECT_HEIGHT(myRect);
- depth = (**desc).depth;
-
- if (flags & IB_test) {
- ibuf = IMB_allocImBuf(x, y, depth, 0);
- ibuf->ftype = QUICKTIME;
- DisposeHandle((Handle)dataref);
- if (gImporter != NULL) CloseComponent(gImporter);
- return ibuf;
- }
-
-#ifdef __APPLE__
- ibuf = IMB_allocImBuf(x, y, 32, IB_rect);
- wbuf = IMB_allocImBuf(x, y, 32, IB_rect);
-
- err = NewGWorldFromPtr(&offGWorld,
- k32ARGBPixelFormat,
- &myRect, NULL, NULL, 0,
- (unsigned char *)wbuf->rect, x * 4);
-#else
-
- ibuf = IMB_allocImBuf(x, y, 32, IB_rect);
-
- err = NewGWorldFromPtr(&offGWorld,
- k32RGBAPixelFormat,
- &myRect, NULL, NULL, 0,
- (unsigned char *)ibuf->rect, x * 4);
-#endif
-
- if (err != noErr) {
- if (QTIME_DEBUG) printf("no newgworld\n");
- goto bail;
- }
- else {
- have_gw = TRUE;
- }
-
- GraphicsImportSetGWorld(gImporter, offGWorld, NULL);
- GraphicsImportDraw(gImporter);
-
-#ifdef __APPLE__
- rect = ibuf->rect;
-
- myPixMap = GetGWorldPixMap(offGWorld);
- LockPixels(myPixMap);
- myPtr = GetPixBaseAddr(myPixMap);
-
- if (myPtr == NULL) {
- printf("Error reading frame from Quicktime");
- IMB_freeImBuf(ibuf);
- return NULL;
- }
-
- boxsize = x * y;
- readPos = (uint32_t *) myPtr;
- changePos = (uint32_t *) rect;
-
- // Swap alpha byte to the end, so ARGB become RGBA;
- from = (unsigned char *)readPos;
- to = (unsigned char *)changePos;
-
- for (index = 0; index < boxsize; index++, from += 4, to += 4) {
- to[3] = from[0];
- to[0] = from[1];
- to[1] = from[2];
- to[2] = from[3];
- }
-#endif
-
-bail:
-
- DisposeHandle((Handle)dataref);
- UnlockPixels(myPixMap);
- if (have_gw) DisposeGWorld(offGWorld);
-
-#ifdef __APPLE__
- if (wbuf) {
- IMB_freeImBuf(wbuf);
- wbuf = NULL;
- }
-#endif
-
- if (gImporter != NULL) CloseComponent(gImporter);
-
- if (err != noErr) {
- if (QTIME_DEBUG) printf("quicktime import unsuccesfull\n");
- if (ibuf) {
- IMB_freeImBuf(ibuf);
- ibuf = NULL;
- }
- }
-
- if (ibuf) {
-
-#ifdef _WIN32
-// add non transparent alpha layer, so images without alpha show up in the sequence editor
-// exception for GIF images since these can be transparent without being 32 bit
-// (might also be nescessary for OSX)
- int i;
- int box = x * y;
- unsigned char *arect = (unsigned char *) ibuf->rect;
-
- if (depth < 32 && (**desc).cType != kGIFCodecType) {
- for (i = 0; i < box; i++, arect += 4)
- arect[3] = 0xFF;
- }
-#endif
-
- IMB_flipy(ibuf);
- ibuf->ftype = QUICKTIME;
- }
- return ibuf;
-}
-
-#endif /* USE_QTKIT */
-#endif /* _WIN32 || __APPLE__ */
-
-#endif /* WITH_QUICKTIME */
-
-
-#if 0
-
-struct ImageDescription {
- long idSize;
- CodecType cType;
- long resvd1;
- short resvd2;
- short dataRefIndex;
- short version;
- short revisionLevel;
- long vendor;
- CodecQ temporalQuality;
- CodecQ spatialQuality;
- short width;
- short height;
- Fixed hRes;
- Fixed vRes;
- long dataSize;
- short frameCount;
- Str31 name;
- short depth;
- short clutID;
-};
-
-#endif // 0
diff --git a/source/blender/quicktime/quicktime_export.h b/source/blender/quicktime/quicktime_export.h
index 55323c05278..35e424b9081 100644
--- a/source/blender/quicktime/quicktime_export.h
+++ b/source/blender/quicktime/quicktime_export.h
@@ -69,25 +69,18 @@ QuicktimeCodecTypeDesc *quicktime_get_videocodecType_desc(int indexValue);
int quicktime_rnatmpvalue_from_videocodectype(int codecType);
int quicktime_videocodecType_from_rnatmpvalue(int rnatmpvalue);
-#ifdef USE_QTKIT
/*Audio codec type*/
int quicktime_get_num_audiocodecs(void);
QuicktimeCodecTypeDesc *quicktime_get_audiocodecType_desc(int indexValue);
int quicktime_rnatmpvalue_from_audiocodectype(int codecType);
int quicktime_audiocodecType_from_rnatmpvalue(int rnatmpvalue);
-#endif
-
-#ifndef USE_QTKIT
-void SCENE_OT_render_data_set_quicktime_codec(struct wmOperatorType *ot); //Operator to raise quicktime standard dialog to request codec settings
-#endif
-
void free_qtcomponentdata(void);
void makeqtstring(struct RenderData *rd, char *string); //for playanim.c
-#if (defined(USE_QTKIT) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 && __LP64__)
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 && __LP64__)
//Include the quicktime codec types constants that are missing in QTKitDefines.h
enum {
kRawCodecType = 'raw ',
diff --git a/source/blender/quicktime/quicktime_import.h b/source/blender/quicktime/quicktime_import.h
index 4ec435db982..e45720496cc 100644
--- a/source/blender/quicktime/quicktime_import.h
+++ b/source/blender/quicktime/quicktime_import.h
@@ -42,18 +42,6 @@
#include "../imbuf/IMB_imbuf.h"
#include "../imbuf/IMB_imbuf_types.h"
-#ifndef USE_QTKIT
-# ifndef __MOVIES__
-# ifdef _WIN32
-# include <Movies.h>
-# elif defined(__APPLE__)
-# define __CARBONSOUND__
-# import <Carbon/Carbon.h>
-# include <QuickTime/Movies.h>
-# endif
-# endif /* __MOVIES__ */
-#endif /* USE_QTKIT */
-
#ifdef _WIN32
# ifndef __FIXMATH__
# include <FixMath.h>
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 6cac2fa3fa6..2fb723faa12 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -555,7 +555,7 @@ void RE_parts_init(Render *re, int do_crop)
/* this is render info for caller, is not reset when parts are freed! */
re->i.totpart = 0;
re->i.curpart = 0;
- re->i.partsdone = FALSE;
+ re->i.partsdone = 0;
/* just for readable code.. */
xminb = re->disprect.xmin;
diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c
index 3ae075b4936..a920306732d 100644
--- a/source/blender/render/intern/source/multires_bake.c
+++ b/source/blender/render/intern/source/multires_bake.c
@@ -611,6 +611,9 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm,
float crn_x, crn_y;
int grid_size, S, face_side;
int *grid_offset, g_index;
+ int side, grid_index, loc_offs, cell_index, cell_side, row, col;
+
+ BLI_assert(lvl > 0);
lodm->getTessFace(lodm, face_index, &mface);
@@ -621,25 +624,19 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm,
face_side = (grid_size << 1) - 1;
- if (lvl == 0) {
- g_index = grid_offset[face_index];
- S = mdisp_rot_face_to_crn(mface.v4 ? 4 : 3, face_side, u * (face_side - 1), v * (face_side - 1), &crn_x, &crn_y);
- }
- else {
- int side = (1 << (lvl - 1)) + 1;
- int grid_index = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, face_index);
- int loc_offs = face_index % (1 << (2 * lvl));
- int cell_index = loc_offs % ((side - 1) * (side - 1));
- int cell_side = (grid_size - 1) / (side - 1);
- int row = cell_index / (side - 1);
- int col = cell_index % (side - 1);
-
- S = face_index / (1 << (2 * (lvl - 1))) - grid_offset[grid_index];
- g_index = grid_offset[grid_index];
-
- crn_y = (row * cell_side) + u * cell_side;
- crn_x = (col * cell_side) + v * cell_side;
- }
+ side = (1 << (lvl - 1)) + 1;
+ grid_index = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, face_index);
+ loc_offs = face_index % (1 << (2 * lvl));
+ cell_index = loc_offs % ((side - 1) * (side - 1));
+ cell_side = (grid_size - 1) / (side - 1);
+ row = cell_index / (side - 1);
+ col = cell_index % (side - 1);
+
+ S = face_index / (1 << (2 * (lvl - 1))) - grid_offset[grid_index];
+ g_index = grid_offset[grid_index];
+
+ crn_y = (row * cell_side) + u * cell_side;
+ crn_x = (col * cell_side) + v * cell_side;
CLAMP(crn_x, 0.0f, grid_size);
CLAMP(crn_y, 0.0f, grid_size);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 9930a8f7f61..8128dd25fdc 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1684,7 +1684,7 @@ static void add_freestyle(Render *re, int render)
* real bmain uses. This is needed because freestyle's
* bmain could be used to tag scenes for update, which
* implies call of ED_render_scene_update in some cases
- * and that function requires proper windoew manager
+ * and that function requires proper window manager
* to present (sergey)
*/
re->freestyle_bmain.wm = re->main->wm;
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 114961394c4..dbc9c47446f 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -1789,18 +1789,20 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
}
/* AO pass */
- if (R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) {
- if (((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) ||
- (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
- {
- if (R.r.mode & R_SHADOW) {
- /* AO was calculated for scanline already */
- if (shi->depth || shi->volume_depth)
- ambient_occlusion(shi);
- copy_v3_v3(shr->ao, shi->ao);
- copy_v3_v3(shr->env, shi->env); /* XXX multiply */
- copy_v3_v3(shr->indirect, shi->indirect); /* XXX multiply */
- }
+ if (((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) ||
+ (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) {
+ if ((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && (R.r.mode & R_SHADOW)) {
+ /* AO was calculated for scanline already */
+ if (shi->depth || shi->volume_depth)
+ ambient_occlusion(shi);
+ copy_v3_v3(shr->ao, shi->ao);
+ copy_v3_v3(shr->env, shi->env); /* XXX multiply */
+ copy_v3_v3(shr->indirect, shi->indirect); /* XXX multiply */
+ }
+ else {
+ shr->ao[0]= shr->ao[1]= shr->ao[2]= 1.0f;
+ zero_v3(shr->env);
+ zero_v3(shr->indirect);
}
}
diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c
index 732892ed357..3ec487f63dc 100644
--- a/source/blender/render/intern/source/sss.c
+++ b/source/blender/render/intern/source/sss.c
@@ -878,7 +878,7 @@ static void sss_create_tree_mat(Render *re, Material *mat)
re->r.mode &= ~R_OSA;
re->sss_points= &points;
re->sss_mat= mat;
- re->i.partsdone = FALSE;
+ re->i.partsdone = 0;
if (!(re->r.scemode & (R_BUTS_PREVIEW|R_VIEWPORT_PREVIEW)))
re->result= NULL;
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index b9a5b5ffaae..5f993297840 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -124,14 +124,6 @@ if(WITH_GAMEENGINE)
add_definitions(-DWITH_GAMEENGINE)
endif()
-if(APPLE)
- if(NOT WITH_COCOA)
- list(APPEND SRC
- intern/wm_apple.c
- )
- endif()
-endif()
-
if(WITH_BUILDINFO)
add_definitions(-DWITH_BUILDINFO)
endif()
diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript
index 0a2f48f0488..00d363e1539 100644
--- a/source/blender/windowmanager/SConscript
+++ b/source/blender/windowmanager/SConscript
@@ -66,9 +66,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
incs += ' ' + env['BF_PTHREADS_INC']
incs += ' ../../intern/utfconv'
-if env['OURPLATFORM'] != 'darwin' or env['WITH_GHOST_COCOA']:
- sources.remove('intern' + os.sep + 'wm_apple.c')
-
if env['BF_BUILDINFO']:
defs.append('WITH_BUILDINFO')
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index c338d49fe17..1f38368399a 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -272,7 +272,9 @@ bool WM_operator_last_properties_store(struct wmOperator *op);
/* operator as a python command (resultuing string must be freed) */
-char *WM_operator_pystring(struct bContext *C, struct wmOperatorType *ot, struct PointerRNA *opptr, int all_args);
+char *WM_operator_pystring_ex(struct bContext *C, struct wmOperator *op, const bool all_args,
+ struct wmOperatorType *ot, struct PointerRNA *opptr);
+char *WM_operator_pystring(struct bContext *C, struct wmOperator *op, const bool all_args);
char *WM_prop_pystring_assign(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int index);
void WM_operator_bl_idname(char *to, const char *from);
void WM_operator_py_idname(char *to, const char *from);
@@ -294,20 +296,20 @@ void WM_menutype_free(void);
/* default operator callbacks for border/circle/lasso */
int WM_border_select_invoke (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
int WM_border_select_modal (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
-int WM_border_select_cancel(struct bContext *C, struct wmOperator *op);
+void WM_border_select_cancel(struct bContext *C, struct wmOperator *op);
int WM_gesture_circle_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
int WM_gesture_circle_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
-int WM_gesture_circle_cancel(struct bContext *C, struct wmOperator *op);
+void WM_gesture_circle_cancel(struct bContext *C, struct wmOperator *op);
int WM_gesture_lines_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
int WM_gesture_lines_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
-int WM_gesture_lines_cancel(struct bContext *C, struct wmOperator *op);
+void WM_gesture_lines_cancel(struct bContext *C, struct wmOperator *op);
int WM_gesture_lasso_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
int WM_gesture_lasso_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
-int WM_gesture_lasso_cancel(struct bContext *C, struct wmOperator *op);
+void WM_gesture_lasso_cancel(struct bContext *C, struct wmOperator *op);
const int (*WM_gesture_lasso_path_to_array(struct bContext *C, struct wmOperator *op, int *mcords_tot))[2];
int WM_gesture_straightline_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
int WM_gesture_straightline_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
-int WM_gesture_straightline_cancel(struct bContext *C, struct wmOperator *op);
+void WM_gesture_straightline_cancel(struct bContext *C, struct wmOperator *op);
/* Gesture manager API */
struct wmGesture *WM_gesture_new(struct bContext *C, const struct wmEvent *event, int type);
@@ -378,6 +380,7 @@ int WM_jobs_test(struct wmWindowManager *wm, void *owner, int job_type);
float WM_jobs_progress(struct wmWindowManager *wm, void *owner);
char *WM_jobs_name(struct wmWindowManager *wm, void *owner);
void *WM_jobs_customdata(struct wmWindowManager *wm, void *owner);
+void *WM_jobs_customdata_from_type(struct wmWindowManager *wm, int job_type);
int WM_jobs_is_running(struct wmJob *);
void *WM_jobs_customdata_get(struct wmJob *);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index ac9af832671..6538272a43c 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -535,7 +535,7 @@ typedef struct wmOperatorType {
* canceled due to some external reason, cancel is called
* - see defines below for return values */
int (*invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT;
- int (*cancel)(struct bContext *, struct wmOperator *);
+ void (*cancel)(struct bContext *, struct wmOperator *);
int (*modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT;
/* verify if the operator can be executed in the current context, note
diff --git a/source/blender/windowmanager/intern/wm_apple.c b/source/blender/windowmanager/intern/wm_apple.c
deleted file mode 100644
index 842fc353699..00000000000
--- a/source/blender/windowmanager/intern/wm_apple.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2007 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/windowmanager/intern/wm_apple.c
- * \ingroup wm
- */
-
-/* note, this file builds on apple-carbon only! */
-
-#include "BKE_context.h"
-#include "BKE_global.h"
-#include "WM_api.h"
-
-#include <OpenGL/OpenGL.h>
-#define __CARBONSOUND__
-/* XXX BIG WARNING: carbon.h can not be included in blender code, it conflicts with struct ID */
-#define ID ID_
-#include <Carbon/Carbon.h>
-
-/* To avoid killing small end comps, we want to allow
- * blender to start maximized if all the followings are true :
- * - Renderer is OpenGL capable
- * - Hardware acceleration
- * - VRAM > 16 Mo
- *
- * We will bail out if VRAM is less than 8Mo
- */
-
-/* bad global, used in wm_window.c to open windows */
-int macPrefState = 0;
-
-static int checkAppleVideoCard(void)
-{
- CGLRendererInfoObj rend;
- long theErr;
- unsigned long display_mask;
- long nrend;
- int j;
- long value;
- long maxvram = 0; /* we get always more than 1 renderer, check one, at least, has 8 Mo */
-
- display_mask = CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID() );
-
- theErr = CGLQueryRendererInfo(display_mask, &rend, &nrend);
- if (theErr == 0) {
- theErr = CGLDescribeRenderer(rend, 0, kCGLRPRendererCount, &nrend);
- if (theErr == 0) {
- for (j = 0; j < nrend; j++) {
- theErr = CGLDescribeRenderer(rend, j, kCGLRPVideoMemory, &value);
- if (value > maxvram)
- maxvram = value;
- if ((theErr == 0) && (value >= 20000000)) {
- theErr = CGLDescribeRenderer(rend, j, kCGLRPAccelerated, &value);
- if ((theErr == 0) && (value != 0)) {
- theErr = CGLDescribeRenderer(rend, j, kCGLRPCompliant, &value);
- if ((theErr == 0) && (value != 0)) {
- /*fprintf(stderr, "make it big\n");*/
- CGLDestroyRendererInfo(rend);
- macPrefState = 8;
- return 1;
- }
- }
- }
- }
- }
- }
- if (maxvram < 7500000) { /* put a standard alert and quit*/
- SInt16 junkHit;
- char inError[] = "* Not enough VRAM ";
- char inText[] = "* blender needs at least 8Mb ";
- inError[0] = 16;
- inText[0] = 28;
-
- fprintf(stderr, " vram is %li . not enough, aborting\n", maxvram);
- StandardAlert(kAlertStopAlert, (ConstStr255Param) & inError, (ConstStr255Param) & inText, NULL, &junkHit);
- abort();
- }
- CGLDestroyRendererInfo(rend);
- return 0;
-}
-
-static void getMacAvailableBounds(short *top, short *left, short *bottom, short *right)
-{
- Rect outAvailableRect;
-
- GetAvailableWindowPositioningBounds(GetMainDevice(), &outAvailableRect);
-
- *top = outAvailableRect.top;
- *left = outAvailableRect.left;
- *bottom = outAvailableRect.bottom;
- *right = outAvailableRect.right;
-}
-
-
-void wm_set_apple_prefsize(int scr_x, int scr_y)
-{
-
- /* first let us check if we are hardware accelerated and with VRAM > 16 Mo */
-
- if (checkAppleVideoCard()) {
- short top, left, bottom, right;
-
- getMacAvailableBounds(&top, &left, &bottom, &right);
- WM_init_state_size_set(left + 10, scr_y - bottom + 10, right - left - 20, bottom - 64);
- G.windowstate = 0;
-
- }
- else {
-
- /* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */
- WM_init_state_size_set(120, 40, 850, 684);
- G.windowstate = 0;
- }
-}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 825c1ca9252..d60901f1325 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -491,7 +491,7 @@ int WM_operator_poll_context(bContext *C, wmOperatorType *ot, short context)
static void wm_operator_print(bContext *C, wmOperator *op)
{
/* context is needed for enum function */
- char *buf = WM_operator_pystring(C, op->type, op->ptr, false);
+ char *buf = WM_operator_pystring(C, op, false);
printf("%s\n", buf);
MEM_freeN(buf);
}
@@ -626,7 +626,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int cal
if (op->type->flag & OPTYPE_REGISTER) {
if (G.background == 0) { /* ends up printing these in the terminal, gets annoying */
/* Report the python string representation of the operator */
- char *buf = WM_operator_pystring(C, op->type, op->ptr, false);
+ char *buf = WM_operator_pystring(C, op, false);
BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf);
MEM_freeN(buf);
}
@@ -660,7 +660,7 @@ static void wm_operator_finished(bContext *C, wmOperator *op, int repeat)
if (repeat == 0) {
if (G.debug & G_DEBUG_WM) {
- char *buf = WM_operator_pystring(C, op->type, op->ptr, false);
+ char *buf = WM_operator_pystring(C, op, false);
BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf);
MEM_freeN(buf);
}
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 05ee23e2361..4d4d46d063a 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -293,13 +293,15 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
}
-static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt)
+static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
{
short *lasso = (short *)gt->customdata;
int i;
- draw_filled_lasso(win, gt);
-
+ if (filled) {
+ draw_filled_lasso(win, gt);
+ }
+
glEnable(GL_LINE_STIPPLE);
glColor3ub(96, 96, 96);
glLineStipple(1, 0xAAAA);
@@ -365,9 +367,9 @@ void wm_gesture_draw(wmWindow *win)
wm_gesture_draw_cross(win, gt);
}
else if (gt->type == WM_GESTURE_LINES)
- wm_gesture_draw_lasso(win, gt);
+ wm_gesture_draw_lasso(win, gt, false);
else if (gt->type == WM_GESTURE_LASSO)
- wm_gesture_draw_lasso(win, gt);
+ wm_gesture_draw_lasso(win, gt, true);
else if (gt->type == WM_GESTURE_STRAIGHTLINE)
wm_gesture_draw_line(gt);
}
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index c9c3d2df788..6908588ebd7 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -166,22 +166,27 @@ static void wm_job_main_thread_yield(wmJob *wm_job, bool ending)
}
/* finds:
- * if type, compare for it, otherwise any matching job
+ * if type or owner, compare for it, otherwise any matching job
*/
static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type)
{
wmJob *wm_job;
- for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
- if (wm_job->owner == owner) {
-
- if (job_type) {
- if ( wm_job->job_type == job_type)
- return wm_job;
- }
- else
+ if (owner && job_type) {
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
+ if (wm_job->owner == owner && wm_job->job_type == job_type)
return wm_job;
- }
+ }
+ else if (owner) {
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
+ if (wm_job->owner == owner)
+ return wm_job;
+ }
+ else if (job_type) {
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
+ if (wm_job->job_type == job_type)
+ return wm_job;
+ }
return NULL;
}
@@ -263,7 +268,16 @@ void *WM_jobs_customdata(wmWindowManager *wm, void *owner)
return WM_jobs_customdata_get(wm_job);
return NULL;
+}
+void *WM_jobs_customdata_from_type(wmWindowManager *wm, int job_type)
+{
+ wmJob *wm_job = wm_job_find(wm, NULL, job_type);
+
+ if (wm_job)
+ return WM_jobs_customdata_get(wm_job);
+
+ return NULL;
}
int WM_jobs_is_running(wmJob *wm_job)
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 6091ec4a371..ab8dac396c5 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -341,14 +341,14 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event)
return wm_macro_end(op, retval);
}
-static int wm_macro_cancel(bContext *C, wmOperator *op)
+static void wm_macro_cancel(bContext *C, wmOperator *op)
{
/* call cancel on the current modal operator, if any */
if (op->opm && op->opm->type->cancel) {
op->opm->type->cancel(C, op->opm);
}
- return wm_macro_end(op, OPERATOR_CANCELLED);
+ wm_macro_end(op, OPERATOR_CANCELLED);
}
/* Names have to be static for now */
@@ -521,13 +521,14 @@ void WM_operator_bl_idname(char *to, const char *from)
to[0] = 0;
}
-/* print a string representation of the operator, with the args that it runs
- * so python can run it again,
+/* Print a string representation of the operator, with the args that it runs so python can run it again.
*
- * When calling from an existing wmOperator do.
- * WM_operator_pystring(op->type, op->ptr);
+ * When calling from an existing wmOperator, better to use simple version:
+ * WM_operator_pystring(C, op);
+ *
+ * Note: both op and opptr may be NULL (op is only used for macro operators).
*/
-char *WM_operator_pystring(bContext *C, wmOperatorType *ot, PointerRNA *opptr, int all_args)
+char *WM_operator_pystring_ex(bContext *C, wmOperator *op, const bool all_args, wmOperatorType *ot, PointerRNA *opptr)
{
char idname_py[OP_MAX_TYPENAME];
@@ -539,24 +540,53 @@ char *WM_operator_pystring(bContext *C, wmOperatorType *ot, PointerRNA *opptr, i
/* arbitrary, but can get huge string with stroke painting otherwise */
int max_prop_length = 10;
- /* only to get the orginal props for comparisons */
- PointerRNA opptr_default;
+ WM_operator_py_idname(idname_py, ot->idname);
+ BLI_dynstr_appendf(dynstr, "bpy.ops.%s(", idname_py);
+
+ if (op && op->macro.first) {
+ /* Special handling for macros, else we only get default values in this case... */
+ wmOperator *opm;
+ bool first_op = true;
+ for (opm = op->macro.first; opm; opm = opm->next) {
+ PointerRNA *opmptr = opm->ptr;
+ PointerRNA opmptr_default;
+ if (opmptr == NULL) {
+ WM_operator_properties_create_ptr(&opmptr_default, opm->type);
+ opmptr = &opmptr_default;
+ }
+
+ cstring_args = RNA_pointer_as_string_id(C, opmptr);
+ if (first_op) {
+ BLI_dynstr_appendf(dynstr, "%s=%s", opm->type->idname, cstring_args);
+ first_op = false;
+ }
+ else {
+ BLI_dynstr_appendf(dynstr, ", %s=%s", opm->type->idname, cstring_args);
+ }
+ MEM_freeN(cstring_args);
- if (opptr == NULL) {
- WM_operator_properties_create_ptr(&opptr_default, ot);
- opptr = &opptr_default;
+ if (opmptr == &opmptr_default) {
+ WM_operator_properties_free(&opmptr_default);
+ }
+ }
}
+ else {
+ /* only to get the orginal props for comparisons */
+ PointerRNA opptr_default;
- WM_operator_py_idname(idname_py, ot->idname);
- BLI_dynstr_appendf(dynstr, "bpy.ops.%s(", idname_py);
+ if (opptr == NULL) {
+ WM_operator_properties_create_ptr(&opptr_default, ot);
+ opptr = &opptr_default;
+ }
- cstring_args = RNA_pointer_as_string_keywords(C, opptr, false,
- all_args, max_prop_length);
- BLI_dynstr_append(dynstr, cstring_args);
- MEM_freeN(cstring_args);
+ cstring_args = RNA_pointer_as_string_keywords(C, opptr, false, all_args, max_prop_length);
+ BLI_dynstr_append(dynstr, cstring_args);
+ MEM_freeN(cstring_args);
- if (opptr == &opptr_default)
- WM_operator_properties_free(&opptr_default);
+ if (opptr == &opptr_default) {
+ WM_operator_properties_free(&opptr_default);
+ }
+ }
BLI_dynstr_append(dynstr, ")");
@@ -565,6 +595,11 @@ char *WM_operator_pystring(bContext *C, wmOperatorType *ot, PointerRNA *opptr, i
return cstring;
}
+char *WM_operator_pystring(bContext *C, wmOperator *op, const bool all_args)
+{
+ return WM_operator_pystring_ex(C, op, all_args, op->type, op->ptr);
+}
+
/* return NULL if no match is found */
#if 0
static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index)
@@ -1396,12 +1431,19 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
return block;
}
-static void wm_operator_ui_popup_cancel(struct bContext *UNUSED(C), void *userData)
+static void wm_operator_ui_popup_cancel(struct bContext *C, void *userData)
{
wmOpPopUp *data = userData;
- if (data->free_op && data->op) {
- wmOperator *op = data->op;
- WM_operator_free(op);
+ wmOperator *op = data->op;
+
+ if (op) {
+ if (op->type->cancel) {
+ op->type->cancel(C, op);
+ }
+
+ if (data->free_op) {
+ WM_operator_free(op);
+ }
}
MEM_freeN(data);
@@ -1634,18 +1676,25 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
#ifdef WITH_BUILDINFO
- int ver_width, rev_width;
- char version_buf[128];
- char revision_buf[128];
- extern char build_rev[];
-
- BLI_snprintf(version_buf, sizeof(version_buf),
- "%d.%02d.%d", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION);
- BLI_snprintf(revision_buf, sizeof(revision_buf), "r%s", build_rev);
+ int label_delta = 0;
+ int hash_width, change_width;
+ char change_buf[128] = "\0";
+ char hash_buf[128] = "\0";
+ extern char build_hash[], build_change[], build_branch[];
+
+ /* TODO(sergey): As soon as we fully switched to GIT, no need to check build_hash. */
+ if (build_hash[0] != '\0') {
+ /* Builds made from tag only shows tag sha */
+ BLI_snprintf(hash_buf, sizeof(hash_buf), "Hash: %s", build_hash);
+ BLI_snprintf(change_buf, sizeof(change_buf), "Change: %s", build_change);
+ }
+ else {
+ BLI_snprintf(change_buf, sizeof(change_buf), "r%s", build_change);
+ }
BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.pixelsize * U.dpi);
- ver_width = (int)BLF_width(style->widgetlabel.uifont_id, version_buf) + 0.5f * U.widget_unit;
- rev_width = (int)BLF_width(style->widgetlabel.uifont_id, revision_buf) + 0.5f * U.widget_unit;
+ hash_width = (int)BLF_width(style->widgetlabel.uifont_id, hash_buf) + 0.5f * U.widget_unit;
+ change_width = (int)BLF_width(style->widgetlabel.uifont_id, change_buf) + 0.5f * U.widget_unit;
#endif /* WITH_BUILDINFO */
block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
@@ -1660,9 +1709,23 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiButSetFunc(but, wm_block_splash_close, block, NULL);
uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL);
-#ifdef WITH_BUILDINFO
- uiDefBut(block, LABEL, 0, version_buf, U.pixelsize * 494 - ver_width, U.pixelsize * 258, ver_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
- uiDefBut(block, LABEL, 0, revision_buf, U.pixelsize * 494 - rev_width, U.pixelsize * 246, rev_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+#ifdef WITH_BUILDINFO
+ if (!STREQ(build_change, "0")) {
+ uiDefBut(block, LABEL, 0, change_buf, U.pixelsize * 494 - change_width, U.pixelsize * 270, change_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+ label_delta = 12;
+ }
+ uiDefBut(block, LABEL, 0, hash_buf, U.pixelsize * 494 - hash_width, U.pixelsize * (270 - label_delta), hash_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+
+ /* TODO(sergey): As soon as we fully switched to GIT, no need to check
+ * whether branch is empty or not.
+ */
+ if (build_branch[0] != '\0' && !STREQ(build_branch, "master")) {
+ char branch_buf[128] = "\0";
+ int branch_width;
+ BLI_snprintf(branch_buf, sizeof(branch_buf), "Branch: %s", build_branch);
+ branch_width = (int)BLF_width(style->widgetlabel.uifont_id, branch_buf) + 0.5f * U.widget_unit;
+ uiDefBut(block, LABEL, 0, branch_buf, U.pixelsize * 494 - branch_width, U.pixelsize * (258 - label_delta), branch_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+ }
#endif /* WITH_BUILDINFO */
layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.pixelsize * 480, U.pixelsize * 110, style);
@@ -2844,11 +2907,9 @@ int WM_border_select_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-int WM_border_select_cancel(bContext *C, wmOperator *op)
+void WM_border_select_cancel(bContext *C, wmOperator *op)
{
wm_gesture_end(C, op);
-
- return OPERATOR_CANCELLED;
}
/* **************** circle gesture *************** */
@@ -2961,11 +3022,9 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-int WM_gesture_circle_cancel(bContext *C, wmOperator *op)
+void WM_gesture_circle_cancel(bContext *C, wmOperator *op)
{
wm_gesture_end(C, op);
-
- return OPERATOR_CANCELLED;
}
#if 0
@@ -3188,18 +3247,14 @@ int WM_gesture_lines_modal(bContext *C, wmOperator *op, const wmEvent *event)
return WM_gesture_lasso_modal(C, op, event);
}
-int WM_gesture_lasso_cancel(bContext *C, wmOperator *op)
+void WM_gesture_lasso_cancel(bContext *C, wmOperator *op)
{
wm_gesture_end(C, op);
-
- return OPERATOR_CANCELLED;
}
-int WM_gesture_lines_cancel(bContext *C, wmOperator *op)
+void WM_gesture_lines_cancel(bContext *C, wmOperator *op)
{
wm_gesture_end(C, op);
-
- return OPERATOR_CANCELLED;
}
/**
@@ -3365,11 +3420,9 @@ int WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *ev
return OPERATOR_RUNNING_MODAL;
}
-int WM_gesture_straightline_cancel(bContext *C, wmOperator *op)
+void WM_gesture_straightline_cancel(bContext *C, wmOperator *op)
{
wm_gesture_end(C, op);
-
- return OPERATOR_CANCELLED;
}
#if 0
@@ -3803,7 +3856,7 @@ static void radial_control_set_value(RadialControl *rc, float val)
}
}
-static int radial_control_cancel(bContext *C, wmOperator *op)
+static void radial_control_cancel(bContext *C, wmOperator *op)
{
RadialControl *rc = op->customdata;
wmWindowManager *wm = CTX_wm_manager(C);
@@ -3821,8 +3874,6 @@ static int radial_control_cancel(bContext *C, wmOperator *op)
glDeleteTextures(1, &rc->gltex);
MEM_freeN(rc);
-
- return OPERATOR_CANCELLED;
}
static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -4255,6 +4306,7 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_assign(keymap, "UV_OT_circle_select");
WM_modalkeymap_assign(keymap, "CLIP_OT_select_circle");
WM_modalkeymap_assign(keymap, "MASK_OT_select_circle");
+ WM_modalkeymap_assign(keymap, "NODE_OT_select_circle");
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 9e89c17e024..5f344340643 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -133,10 +133,6 @@ static void wm_window_check_position(rcti *rect)
wm_get_screensize(&width, &height);
-#if defined(__APPLE__) && !defined(GHOST_COCOA)
- height -= 70;
-#endif
-
if (rect->xmin < 0) {
rect->xmax -= rect->xmin;
rect->xmin = 0;
@@ -338,12 +334,6 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
* in case of OS application terminate request (e.g. OS Shortcut Alt+F4, Cmd+Q, (...), or session end) */
GHOST_SetWindowModifiedState(win->ghostwin, (GHOST_TUns8) !wm->file_saved);
-#if defined(__APPLE__) && !defined(GHOST_COCOA)
- if (wm->file_saved)
- GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateUnModified);
- else
- GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateModified);
-#endif
}
}
@@ -428,20 +418,12 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
if (wm_init_state.size_x == 0) {
wm_get_screensize(&wm_init_state.size_x, &wm_init_state.size_y);
-#if defined(__APPLE__) && !defined(GHOST_COCOA)
- /* Cocoa provides functions to get correct max window size */
- {
- extern void wm_set_apple_prefsize(int, int); /* wm_apple.c */
-
- wm_set_apple_prefsize(wm_init_state.size_x, wm_init_state.size_y);
- }
-#else
- /* note!, this isnt quite correct, active screen maybe offset 1000s if PX,
- * we'd need a wm_get_screensize like function that gives offset,
- * in practice the window manager will likely move to the correct monitor */
- wm_init_state.start_x = 0;
- wm_init_state.start_y = 0;
-#endif
+ /* note!, this isnt quite correct, active screen maybe offset 1000s if PX,
+ * we'd need a wm_get_screensize like function that gives offset,
+ * in practice the window manager will likely move to the correct monitor */
+ wm_init_state.start_x = 0;
+ wm_init_state.start_y = 0;
+
#if !defined(__APPLE__) && !defined(WIN32) /* X11 */
/* X11, start maximized but use default sane size */
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index 67009bf2c8b..4c345a0e782 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -92,6 +92,7 @@ endif()
ge_player_common
bf_intern_string
bf_intern_ghost
+ bf_intern_ghostndof3dconnexion
bf_rna
bf_blenkernel
bf_intern_rigidbody
diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
index e8e7ee6ea0a..f8fe401cb1c 100644
--- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
+++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
@@ -1,3 +1,4 @@
+
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
@@ -51,8 +52,10 @@ if(WITH_BUILDINFO)
)
add_definitions(-DBUILD_DATE="\"\""
-DBUILD_TIME="\"\""
- -DBUILD_REV="\"\""
+ -DBUILD_CHANGE="\"\""
+ -DBUILD_HASH="\"\""
-DBUILD_PLATFORM="\"\""
+ -DBUILD_BRANCH="\"\""
-DBUILD_TYPE="\"\""
)
endif()
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 2af65c763b5..80f3a617bac 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -167,6 +167,9 @@ void RE_free_sample_material(struct Material *mat) {STUB_ASSERT(0);}
void RE_sample_material_color(struct Material *mat, float color[3], float *alpha, const float volume_co[3], const float surface_co[3],
int face_index, short hit_quad, struct DerivedMesh *orcoDm, struct Object *ob) {STUB_ASSERT(0);}
+/* skin modifier*/
+void modifier_skin_customdata_ensure(struct Object *ob) {STUB_ASSERT(0);}
+
/* nodes */
struct RenderResult *RE_GetResult(struct Render *re) {STUB_ASSERT(0); return (struct RenderResult *) NULL;}
struct Render *RE_GetRender(const char *name) {STUB_ASSERT(0); return (struct Render *) NULL;}
@@ -538,7 +541,8 @@ void WM_operator_py_idname(char *to, const char *from) {STUB_ASSERT(0);}
void WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width, int height) {STUB_ASSERT(0);}
short insert_keyframe(struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag) {STUB_ASSERT(0); return 0;}
short delete_keyframe(struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag) {STUB_ASSERT(0); return 0;}
-char *WM_operator_pystring(struct bContext *C, struct wmOperatorType *ot, struct PointerRNA *opptr, int all_args) {STUB_ASSERT(0); return (char *)NULL;}
+char *WM_operator_pystring_ex(struct bContext *C, struct wmOperator *op, const bool all_args, struct wmOperatorType *ot, struct PointerRNA *opptr) {STUB_ASSERT(0); return (char *)NULL;}
+char *WM_operator_pystring(struct bContext *C, struct wmOperator *op, const bool all_args) {STUB_ASSERT(0); return (char *)NULL;}
struct wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value) {STUB_ASSERT(0); return (struct wmKeyMapItem *)NULL;}
struct wmKeyMapItem *WM_modalkeymap_add_item_str(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value) {STUB_ASSERT(0); return (struct wmKeyMapItem *)NULL;}
struct wmKeyMap *WM_modalkeymap_add(struct wmKeyConfig *keyconf, char *idname, EnumPropertyItem *items) {STUB_ASSERT(0); return (struct wmKeyMap *) NULL;}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 8e0ba6684ab..b386312bb55 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -131,7 +131,9 @@ if(WITH_BUILDINFO)
# # define in header now, else these get out of date on rebuilds.
# -DBUILD_DATE="${BUILD_DATE}"
# -DBUILD_TIME="${BUILD_TIME}"
- # -DBUILD_REV="${BUILD_REV}"
+ # -DBUILD_CHANGE="${BUILD_CHANGE}"
+ # -DBUILD_HASH="${BUILD_HASH}"
+ # -DBUILD_BRANCH="${BUILD_BRANCH}"
-DWITH_BUILDINFO_HEADER # alternative to lines above
-DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}"
-DBUILD_TYPE="${CMAKE_BUILD_TYPE}"
@@ -316,11 +318,59 @@ endif()
if(WITH_INTERNATIONAL)
install(
DIRECTORY
- ${CMAKE_SOURCE_DIR}/release/datafiles/locale
${CMAKE_SOURCE_DIR}/release/datafiles/fonts
DESTINATION ${TARGETDIR_VER}/datafiles
PATTERN ".svn" EXCLUDE
)
+
+ set(_locale_dir "${CMAKE_SOURCE_DIR}/release/datafiles/locale")
+
+ if(EXISTS "${_locale_dir}/po")
+ set(_locale_target_dir ${TARGETDIR_VER}/datafiles/locale)
+
+ file(GLOB _po_files "${_locale_dir}/po/*.po")
+ foreach(_po_file ${_po_files})
+ msgfmt_simple(${_po_file} _all_mo_files)
+ endforeach()
+
+ # Create a custom target which will compile all po to mo
+ add_custom_target(
+ locales
+ DEPENDS ${_all_mo_files})
+
+ add_dependencies(blender locales)
+
+ # Generate INSTALL rules
+ install(
+ FILES ${_locale_dir}/languages
+ DESTINATION ${_locale_target_dir}
+ )
+
+ foreach(_mo_file ${_all_mo_files})
+ get_filename_component(_locale_name ${_mo_file} NAME_WE)
+ install(
+ FILES ${_mo_file}
+ DESTINATION ${_locale_target_dir}/${_locale_name}/LC_MESSAGES
+ RENAME blender.mo
+ )
+ unset(_locale_name)
+ endforeach()
+
+ unset(_all_mo_files)
+ unset(_po_files)
+ unset(_po_file)
+ unset(_mo_file)
+ unset(_locale_target_dir)
+ else()
+ install(
+ DIRECTORY
+ ${_locale_dir}
+ DESTINATION ${TARGETDIR_VER}/datafiles
+ PATTERN ".svn" EXCLUDE
+ )
+ endif()
+
+ unset(_locale_dir)
endif()
# color management
diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c
index d747fe8e1ff..d51249980a8 100644
--- a/source/creator/buildinfo.c
+++ b/source/creator/buildinfo.c
@@ -39,7 +39,9 @@
/* currently only these are defined in the header */
char build_date[] = BUILD_DATE;
char build_time[] = BUILD_TIME;
-char build_rev[] = BUILD_REV;
+char build_hash[] = BUILD_HASH;
+char build_change[] = BUILD_CHANGE;
+char build_branch[] = BUILD_BRANCH;
char build_platform[] = BUILD_PLATFORM;
char build_type[] = BUILD_TYPE;
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 1596fe5359c..8221552a1d7 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -153,7 +153,9 @@
#ifdef BUILD_DATE
extern char build_date[];
extern char build_time[];
-extern char build_rev[];
+extern char build_hash[];
+extern char build_change[];
+extern char build_branch[];
extern char build_platform[];
extern char build_type[];
extern char build_cflags[];
@@ -219,7 +221,14 @@ static int print_version(int UNUSED(argc), const char **UNUSED(argv), void *UNUS
#ifdef BUILD_DATE
printf("\tbuild date: %s\n", build_date);
printf("\tbuild time: %s\n", build_time);
- printf("\tbuild revision: %s\n", build_rev);
+ /* TODO(sergey): As soon as we fully switched to GIT, no need to check build_hash. */
+ if (build_hash[0] != '\0') {
+ printf("\tbuild revision: %s\n", build_change);
+ }
+ else {
+ printf("\tbuild change: %s\n", build_change);
+ printf("\tbuild hash: %s\n", build_hash);
+ }
printf("\tbuild platform: %s\n", build_platform);
printf("\tbuild type: %s\n", build_type);
printf("\tbuild c flags: %s\n", build_cflags);
@@ -590,13 +599,17 @@ static void blender_crash_handler(int signum)
printf("Writing: %s\n", fname);
fflush(stdout);
- BLI_snprintf(header, sizeof(header), "# " BLEND_VERSION_FMT ", Revision: %s\n", BLEND_VERSION_ARG,
-#ifdef BUILD_DATE
- build_rev
+#ifndef BUILD_DATE
+ BLI_snprintf(header, sizeof(header), "# " BLEND_VERSION_FMT ", Unknown revision\n", BLEND_VERSION_ARG);
#else
- "Unknown"
+ /* TODO(sergey): As soon as we fully switched to GIT, no need to check build_hash. */
+ if (build_hash[0] != '\0') {
+ BLI_snprintf(header, sizeof(header), "# " BLEND_VERSION_FMT ", Change: %s, Hash %s\n", BLEND_VERSION_ARG, build_change, build_hash);
+ }
+ else {
+ BLI_snprintf(header, sizeof(header), "# " BLEND_VERSION_FMT ", Revision: %s\n", BLEND_VERSION_ARG, build_change);
+ }
#endif
- );
/* open the crash log */
errno = 0;
@@ -1470,7 +1483,7 @@ int main(int argc, const char **argv)
#endif
#ifdef WIN32 /* Win32 Unicode Args */
- /* NOTE: cannot use guardedalloc malloc here, as it's not yet initialised
+ /* NOTE: cannot use guardedalloc malloc here, as it's not yet initialized
* (it depends on the args passed in, which is what we're getting here!)
*/
wchar_t **argv_16 = CommandLineToArgvW(GetCommandLineW(), &argc);
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 484e51c4ed1..2b1c8a10cce 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -42,11 +42,9 @@
#include "GL/glew.h"
-#include "KX_BlenderGL.h"
#include "KX_BlenderCanvas.h"
#include "KX_BlenderKeyboardDevice.h"
#include "KX_BlenderMouseDevice.h"
-#include "KX_BlenderRenderTools.h"
#include "KX_BlenderSystem.h"
#include "BL_Material.h"
@@ -276,7 +274,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
if (animation_record) usefixed= false; /* override since you don't want to run full-speed for sim recording */
- // create the canvas, rasterizer and rendertools
+ // create the canvas and rasterizer
RAS_ICanvas* canvas = new KX_BlenderCanvas(wm, win, area_rect, ar);
// default mouse state set on render panel
@@ -292,7 +290,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
else
canvas->SetSwapInterval((startscene->gm.vsync == VSYNC_ON) ? 1 : 0);
- RAS_IRenderTools* rendertools = new KX_BlenderRenderTools();
RAS_IRasterizer* rasterizer = NULL;
//Don't use displaylists with VBOs
//If auto starts using VBOs, make sure to check for that here
@@ -324,7 +321,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
ketsjiengine->SetMouseDevice(mousedevice);
ketsjiengine->SetNetworkDevice(networkdevice);
ketsjiengine->SetCanvas(canvas);
- ketsjiengine->SetRenderTools(rendertools);
ketsjiengine->SetRasterizer(rasterizer);
ketsjiengine->SetUseFixedTime(usefixed);
ketsjiengine->SetTimingDisplay(frameRate, profile, properties);
@@ -474,7 +470,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
else if (gs.matmode == GAME_MAT_GLSL)
usemat = false;
- if (usemat && (gs.matmode != GAME_MAT_TEXFACE))
+ if (usemat)
sceneconverter->SetMaterials(true);
if (useglslmat && (gs.matmode == GAME_MAT_GLSL))
sceneconverter->SetGLSLMaterials(true);
@@ -518,7 +514,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
// convert and add scene
sceneconverter->ConvertScene(
startscene,
- rendertools,
+ rasterizer,
canvas);
ketsjiengine->AddScene(startscene);
@@ -664,11 +660,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
delete rasterizer;
rasterizer = NULL;
}
- if (rendertools)
- {
- delete rendertools;
- rendertools = NULL;
- }
if (canvas)
{
canvas->SetSwapInterval(previous_vsync); // Set the swap interval back
diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt
index 67739706e3c..73dbe005518 100644
--- a/source/gameengine/BlenderRoutines/CMakeLists.txt
+++ b/source/gameengine/BlenderRoutines/CMakeLists.txt
@@ -39,20 +39,16 @@ set(SRC
BL_KetsjiEmbedStart.cpp
BL_System.cpp
KX_BlenderCanvas.cpp
- KX_BlenderGL.cpp
KX_BlenderInputDevice.cpp
KX_BlenderKeyboardDevice.cpp
KX_BlenderMouseDevice.cpp
- KX_BlenderRenderTools.cpp
KX_BlenderSystem.cpp
BL_System.h
KX_BlenderCanvas.h
- KX_BlenderGL.h
KX_BlenderInputDevice.h
KX_BlenderKeyboardDevice.h
KX_BlenderMouseDevice.h
- KX_BlenderRenderTools.h
KX_BlenderSystem.h
)
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
index 3089b3fd44d..b3e0b4c3ea6 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
@@ -29,13 +29,33 @@
* \ingroup blroutines
*/
+#include <GL/glew.h>
+
+#include "MEM_guardedalloc.h"
#include "KX_BlenderCanvas.h"
+
+#include "DNA_image_types.h"
+#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
-#include <stdio.h>
+
+#include "BKE_image.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
+
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+
#include <assert.h>
+extern "C" {
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+#include "WM_api.h"
+#include "wm_cursors.h"
+#include "wm_window.h"
+}
KX_BlenderCanvas::KX_BlenderCanvas(wmWindowManager *wm, wmWindow *win, RAS_Rect &rect, struct ARegion *ar) :
m_wm(wm),
@@ -63,17 +83,17 @@ void KX_BlenderCanvas::Init()
void KX_BlenderCanvas::SwapBuffers()
{
- BL_SwapBuffers(m_win);
+ wm_window_swap_buffers(m_win);
}
void KX_BlenderCanvas::SetSwapInterval(int interval)
{
- BL_SetSwapInterval(m_win, interval);
+ wm_window_set_swap_interval(m_win, interval);
}
int KX_BlenderCanvas::GetSwapInterval()
{
- return BL_GetSwapInterval(m_win);
+ return wm_window_get_swap_interval(m_win);
}
void KX_BlenderCanvas::ResizeWindow(int width, int height)
@@ -96,7 +116,7 @@ bool KX_BlenderCanvas::BeginDraw()
{
// in case of multi-window we need to ensure we are drawing to the correct
// window always, because it may change in window event handling
- BL_MakeDrawable(m_wm, m_win);
+ wm_window_make_drawable(m_wm, m_win);
return true;
}
@@ -247,17 +267,17 @@ void KX_BlenderCanvas::SetMouseState(RAS_MouseState mousestate)
{
case MOUSE_INVISIBLE:
{
- BL_HideMouse(m_win);
+ WM_cursor_set(m_win, CURSOR_NONE);
break;
}
case MOUSE_WAIT:
{
- BL_WaitMouse(m_win);
+ WM_cursor_set(m_win, CURSOR_WAIT);
break;
}
case MOUSE_NORMAL:
{
- BL_NormalMouse(m_win);
+ WM_cursor_set(m_win, CURSOR_STD);
break;
}
default:
@@ -275,18 +295,71 @@ void KX_BlenderCanvas::SetMousePosition(int x,int y)
int winY = m_frame_rect.GetBottom();
int winH = m_frame_rect.GetHeight();
- BL_warp_pointer(m_win, winX + x, winY + (winH-y));
+ WM_cursor_warp(m_win, winX + x, winY + (winH-y));
}
+/* get shot from frontbuffer sort of a copy from screendump.c */
+static unsigned int *screenshot(ScrArea *curarea, int *dumpsx, int *dumpsy)
+{
+ int x=0, y=0;
+ unsigned int *dumprect= NULL;
+
+ x= curarea->totrct.xmin;
+ y= curarea->totrct.ymin;
+ *dumpsx= curarea->totrct.xmax-x;
+ *dumpsy= curarea->totrct.ymax-y;
+
+ if (*dumpsx && *dumpsy) {
+
+ dumprect= (unsigned int *)MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect");
+ glReadBuffer(GL_FRONT);
+ glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
+ glFinish();
+ glReadBuffer(GL_BACK);
+ }
+
+ return dumprect;
+}
void KX_BlenderCanvas::MakeScreenShot(const char *filename)
{
ScrArea area_dummy= {0};
+ bScreen *screen = m_win->screen;
+ unsigned int *dumprect;
+ int dumpsx, dumpsy;
+
area_dummy.totrct.xmin = m_frame_rect.GetLeft();
area_dummy.totrct.xmax = m_frame_rect.GetRight();
area_dummy.totrct.ymin = m_frame_rect.GetBottom();
area_dummy.totrct.ymax = m_frame_rect.GetTop();
- BL_MakeScreenShot(m_win->screen, &area_dummy, filename);
+ dumprect = screenshot(&area_dummy, &dumpsx, &dumpsy);
+
+ if (dumprect) {
+ /* initialize image file format data */
+ Scene *scene = (screen)? screen->scene: NULL;
+ ImageFormatData im_format;
+
+ if (scene)
+ im_format = scene->r.im_format;
+ else
+ BKE_imformat_defaults(&im_format);
+
+ /* create file path */
+ char path[FILE_MAX];
+ BLI_strncpy(path, filename, sizeof(path));
+ BLI_path_abs(path, G.main->name);
+ BKE_add_image_extension_from_type(path, im_format.imtype);
+
+ /* create and save imbuf */
+ ImBuf *ibuf = IMB_allocImBuf(dumpsx, dumpsy, 24, 0);
+ ibuf->rect = dumprect;
+
+ BKE_imbuf_write_as(ibuf, path, &im_format, false);
+
+ ibuf->rect = NULL;
+ IMB_freeImBuf(ibuf);
+ MEM_freeN(dumprect);
+ }
}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
index c5318b882fa..9ad80cb1737 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
@@ -34,15 +34,11 @@
#ifdef WIN32
#include <windows.h>
-#endif
-
-#include "GL/glew.h"
+#endif
#include "RAS_ICanvas.h"
#include "RAS_Rect.h"
-#include "KX_BlenderGL.h"
-
#ifdef WITH_CXX_GUARDEDALLOC
#include "MEM_guardedalloc.h"
#endif
@@ -70,7 +66,7 @@ public:
*
* \param area The Blender ARegion to run the game within.
*/
- KX_BlenderCanvas(struct wmWindowManager *wm, struct wmWindow* win, class RAS_Rect &rect, struct ARegion* ar);
+ KX_BlenderCanvas(struct wmWindowManager *wm, struct wmWindow* win, RAS_Rect &rect, struct ARegion* ar);
~KX_BlenderCanvas();
void
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
deleted file mode 100644
index 6ed4866579c..00000000000
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/BlenderRoutines/KX_BlenderGL.cpp
- * \ingroup blroutines
- */
-
-
-#include "KX_BlenderGL.h"
-
-/*
- * This little block needed for linking to Blender...
- */
-#ifdef WIN32
-#include <vector>
-#include "BLI_winstuff.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "GL/glew.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BL_Material.h" // MAXTEX
-
-/* Data types encoding the game world: */
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_world_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_image_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_material_types.h"
-#include "DNA_space_types.h"
-#include "DNA_windowmanager_types.h"
-
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_bmfont.h"
-#include "BKE_image.h"
-
-#include "BLI_path_util.h"
-#include "BLI_string.h"
-
-extern "C" {
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-#include "WM_api.h"
-#include "WM_types.h"
-#include "wm_event_system.h"
-#include "wm_cursors.h"
-#include "wm_window.h"
-#include "BLF_api.h"
-}
-
-/* end of blender block */
-void BL_warp_pointer(wmWindow *win, int x,int y)
-{
- WM_cursor_warp(win, x, y);
-}
-
-void BL_SwapBuffers(wmWindow *win)
-{
- wm_window_swap_buffers(win);
-}
-
-void BL_MakeDrawable(wmWindowManager *wm, wmWindow *win)
-{
- wm_window_make_drawable(wm, win);
-}
-
-void BL_SetSwapInterval(struct wmWindow *win, int interval)
-{
- wm_window_set_swap_interval(win, interval);
-}
-
-int BL_GetSwapInterval(struct wmWindow *win)
-{
- return wm_window_get_swap_interval(win);
-}
-
-static void DisableForText()
-{
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */
-
- glDisable(GL_BLEND);
- glDisable(GL_ALPHA_TEST);
-
- glDisable(GL_LIGHTING);
- glDisable(GL_COLOR_MATERIAL);
-
- if (GLEW_ARB_multitexture) {
- for (int i=0; i<MAXTEX; i++) {
- glActiveTextureARB(GL_TEXTURE0_ARB+i);
-
- if (GLEW_ARB_texture_cube_map)
- glDisable(GL_TEXTURE_CUBE_MAP_ARB);
-
- glDisable(GL_TEXTURE_2D);
- }
-
- glActiveTextureARB(GL_TEXTURE0_ARB);
- }
- else {
- if (GLEW_ARB_texture_cube_map)
- glDisable(GL_TEXTURE_CUBE_MAP_ARB);
-
- glDisable(GL_TEXTURE_2D);
- }
-}
-
-void BL_draw_gamedebug_box(int xco, int yco, int width, int height, float percentage)
-{
- /* This is a rather important line :( The gl-mode hasn't been left
- * behind quite as neatly as we'd have wanted to. I don't know
- * what cause it, though :/ .*/
- glDisable(GL_DEPTH_TEST);
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
-
- glOrtho(0, width, 0, height, -100, 100);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- yco = height - yco;
- int barsize = 50;
-
- /* draw in black first*/
- glColor3ub(0, 0, 0);
- glBegin(GL_QUADS);
- glVertex2f(xco + 1 + 1 + barsize * percentage, yco - 1 + 10);
- glVertex2f(xco + 1, yco - 1 + 10);
- glVertex2f(xco + 1, yco - 1);
- glVertex2f(xco + 1 + 1 + barsize * percentage, yco - 1);
- glEnd();
-
- glColor3ub(255, 255, 255);
- glBegin(GL_QUADS);
- glVertex2f(xco + 1 + barsize * percentage, yco + 10);
- glVertex2f(xco, yco + 10);
- glVertex2f(xco, yco);
- glVertex2f(xco + 1 + barsize * percentage, yco);
- glEnd();
-
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glEnable(GL_DEPTH_TEST);
-}
-
-/* Print 3D text */
-void BL_print_game_line(int fontid, const char *text, int size, int dpi, float *color, double *mat, float aspect)
-{
- /* gl prepping */
- DisableForText();
-
- /* the actual drawing */
- glColor4fv(color);
-
- /* multiply the text matrix by the object matrix */
- BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT);
- BLF_matrix(fontid, mat);
-
- /* aspect is the inverse scale that allows you to increase */
- /* your resolution without sizing the final text size */
- /* the bigger the size, the smaller the aspect */
- BLF_aspect(fontid, aspect, aspect, aspect);
-
- BLF_size(fontid, size, dpi);
- BLF_position(fontid, 0, 0, 0);
- BLF_draw(fontid, (char *)text, 65535);
-
- BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT);
-}
-
-void BL_print_gamedebug_line(const char *text, int xco, int yco, int width, int height)
-{
- /* gl prepping */
- DisableForText();
- glDisable(GL_DEPTH_TEST);
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
-
- glOrtho(0, width, 0, height, -100, 100);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- /* the actual drawing */
- glColor3ub(255, 255, 255);
- BLF_size(blf_mono_font, 11, 72);
- BLF_position(blf_mono_font, (float)xco, (float)(height-yco), 0.0f);
- BLF_draw(blf_mono_font, (char *)text, 65535); /* XXX, use real len */
-
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glEnable(GL_DEPTH_TEST);
-}
-
-void BL_print_gamedebug_line_padded(const char *text, int xco, int yco, int width, int height)
-{
- /* This is a rather important line :( The gl-mode hasn't been left
- * behind quite as neatly as we'd have wanted to. I don't know
- * what cause it, though :/ .*/
- DisableForText();
- glDisable(GL_DEPTH_TEST);
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
-
- glOrtho(0, width, 0, height, -100, 100);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- /* draw in black first*/
- glColor3ub(0, 0, 0);
- BLF_size(blf_mono_font, 11, 72);
- BLF_position(blf_mono_font, (float)xco+1, (float)(height-yco-1), 0.0f);
- BLF_draw(blf_mono_font, (char *)text, 65535);/* XXX, use real len */
-
- glColor3ub(255, 255, 255);
- BLF_position(blf_mono_font, (float)xco, (float)(height-yco), 0.0f);
- BLF_draw(blf_mono_font, (char *)text, 65535);
-
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glEnable(GL_DEPTH_TEST);
-}
-
-void BL_HideMouse(wmWindow *win)
-{
- WM_cursor_set(win, CURSOR_NONE);
-}
-
-
-void BL_WaitMouse(wmWindow *win)
-{
- WM_cursor_set(win, CURSOR_WAIT);
-}
-
-
-void BL_NormalMouse(wmWindow *win)
-{
- WM_cursor_set(win, CURSOR_STD);
-}
-/* get shot from frontbuffer sort of a copy from screendump.c */
-static unsigned int *screenshot(ScrArea *curarea, int *dumpsx, int *dumpsy)
-{
- int x=0, y=0;
- unsigned int *dumprect= NULL;
-
- x= curarea->totrct.xmin;
- y= curarea->totrct.ymin;
- *dumpsx= curarea->totrct.xmax-x;
- *dumpsy= curarea->totrct.ymax-y;
-
- if (*dumpsx && *dumpsy) {
-
- dumprect= (unsigned int *)MEM_mallocN(sizeof(int) * (*dumpsx) * (*dumpsy), "dumprect");
- glReadBuffer(GL_FRONT);
- glReadPixels(x, y, *dumpsx, *dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
- glFinish();
- glReadBuffer(GL_BACK);
- }
-
- return dumprect;
-}
-
-/* based on screendump.c::screenshot_exec */
-void BL_MakeScreenShot(bScreen *screen, ScrArea *curarea, const char *filename)
-{
- unsigned int *dumprect;
- int dumpsx, dumpsy;
-
- dumprect = screenshot(curarea, &dumpsx, &dumpsy);
-
- if (dumprect) {
- /* initialize image file format data */
- Scene *scene = (screen)? screen->scene: NULL;
- ImageFormatData im_format;
-
- if (scene)
- im_format = scene->r.im_format;
- else
- BKE_imformat_defaults(&im_format);
-
- /* create file path */
- char path[FILE_MAX];
- BLI_strncpy(path, filename, sizeof(path));
- BLI_path_abs(path, G.main->name);
- BKE_add_image_extension_from_type(path, im_format.imtype);
-
- /* create and save imbuf */
- ImBuf *ibuf = IMB_allocImBuf(dumpsx, dumpsy, 24, 0);
- ibuf->rect = dumprect;
-
- BKE_imbuf_write_as(ibuf, path, &im_format, false);
-
- ibuf->rect = NULL;
- IMB_freeImBuf(ibuf);
- MEM_freeN(dumprect);
- }
-}
-
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.h b/source/gameengine/BlenderRoutines/KX_BlenderGL.h
deleted file mode 100644
index 8032d9a594a..00000000000
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file KX_BlenderGL.h
- * \ingroup blroutines
- */
-
-#ifndef __KX_BLENDERGL_H__
-#define __KX_BLENDERGL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-struct ARegion;
-struct bScreen;
-struct wmWindow;
-struct wmWindowManager;
-
-// special swapbuffers, that takes care of which area (viewport) needs to be swapped
-void BL_SwapBuffers(struct wmWindow *win);
-void BL_SetSwapInterval(struct wmWindow *win, int interval);
-int BL_GetSwapInterval(struct wmWindow *win);
-
-void BL_MakeDrawable(struct wmWindowManager *wm, struct wmWindow *win);
-
-void BL_warp_pointer(struct wmWindow *win,int x,int y);
-
-void BL_MakeScreenShot(struct bScreen *screen, struct ScrArea *curarea, const char *filename);
-
-void BL_HideMouse(struct wmWindow *win);
-void BL_NormalMouse(struct wmWindow *win);
-void BL_WaitMouse(struct wmWindow *win);
-
-void BL_draw_gamedebug_box(int xco, int yco, int width, int height, float percentage);
-void BL_print_game_line(int fontid, const char* text, int size, int dpi, float* color, double* mat, float aspect);
-void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height);
-void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int width, int height);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __KX_BLENDERGL_H__ */
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
deleted file mode 100644
index bcc62a341f8..00000000000
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
- * \ingroup blroutines
- */
-
-
-#include "GL/glew.h"
-
-#include "RAS_IRenderTools.h"
-#include "RAS_IRasterizer.h"
-#include "RAS_LightObject.h"
-#include "RAS_ICanvas.h"
-#include "RAS_GLExtensionManager.h"
-#include "RAS_MeshObject.h"
-
-#include "KX_GameObject.h"
-#include "KX_PolygonMaterial.h"
-#include "KX_BlenderMaterial.h"
-#include "KX_RayCast.h"
-#include "KX_IPhysicsController.h"
-#include "KX_Light.h"
-
-#include "PHY_IPhysicsEnvironment.h"
-
-#include "STR_String.h"
-
-#include "GPU_draw.h"
-
-#include "KX_BlenderGL.h" // for text printing
-#include "KX_BlenderRenderTools.h"
-
-unsigned int KX_BlenderRenderTools::m_numgllights;
-
-KX_BlenderRenderTools::KX_BlenderRenderTools()
-{
- glGetIntegerv(GL_MAX_LIGHTS, (GLint *) &m_numgllights);
- if (m_numgllights < 8)
- m_numgllights = 8;
-}
-
-KX_BlenderRenderTools::~KX_BlenderRenderTools()
-{
-}
-
-void KX_BlenderRenderTools::BeginFrame(RAS_IRasterizer* rasty)
-{
- m_clientobject = NULL;
- m_lastlightlayer = -1;
- m_lastauxinfo = NULL;
- m_lastlighting = true; /* force disable in DisableOpenGLLights() */
- DisableOpenGLLights();
-}
-
-void KX_BlenderRenderTools::EndFrame(RAS_IRasterizer* rasty)
-{
-}
-
-/* ProcessLighting performs lighting on objects. the layer is a bitfield that
- * contains layer information. There are 20 'official' layers in blender. A
- * light is applied on an object only when they are in the same layer. OpenGL
- * has a maximum of 8 lights (simultaneous), so 20 * 8 lights are possible in
- * a scene. */
-
-void KX_BlenderRenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat)
-{
- bool enable = false;
- int layer= -1;
-
- /* find the layer */
- if (uselights) {
- if (m_clientobject)
- layer = static_cast<KX_GameObject*>(m_clientobject)->GetLayer();
- }
-
- /* avoid state switching */
- if (m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo)
- return;
-
- m_lastlightlayer = layer;
- m_lastauxinfo = m_auxilaryClientInfo;
-
- /* enable/disable lights as needed */
- if (layer >= 0)
- enable = applyLights(layer, viewmat);
-
- if (enable)
- EnableOpenGLLights(rasty);
- else
- DisableOpenGLLights();
-}
-
-void KX_BlenderRenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty)
-{
- if (m_lastlighting == true)
- return;
-
- glEnable(GL_LIGHTING);
- glEnable(GL_COLOR_MATERIAL);
-
- glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
- glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (rasty->GetCameraOrtho())? GL_FALSE: GL_TRUE);
- if (GLEW_EXT_separate_specular_color || GLEW_VERSION_1_2)
- glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
-
- m_lastlighting = true;
-}
-
-void KX_BlenderRenderTools::DisableOpenGLLights()
-{
- if (m_lastlighting == false)
- return;
-
- glDisable(GL_LIGHTING);
- glDisable(GL_COLOR_MATERIAL);
-
- m_lastlighting = false;
-}
-
-
-void KX_BlenderRenderTools::SetClientObject(RAS_IRasterizer *rasty, void* obj)
-{
- if (m_clientobject != obj)
- {
- bool ccw = (obj == NULL || !((KX_GameObject*)obj)->IsNegativeScaling());
- rasty->SetFrontFace(ccw);
-
- m_clientobject = obj;
- }
-}
-
-bool KX_BlenderRenderTools::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void * const data)
-{
- double* const oglmatrix = (double* const) data;
-
- RAS_Polygon* poly = result->m_hitMesh->GetPolygon(result->m_hitPolygon);
- if (!poly->IsVisible())
- return false;
-
- MT_Point3 resultpoint(result->m_hitPoint);
- MT_Vector3 resultnormal(result->m_hitNormal);
- MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]);
- MT_Vector3 dir = -(left.cross(resultnormal)).safe_normalized();
- left = (dir.cross(resultnormal)).safe_normalized();
- // for the up vector, we take the 'resultnormal' returned by the physics
-
- double maat[16] = {left[0], left[1], left[2], 0,
- dir[0], dir[1], dir[2], 0,
- resultnormal[0], resultnormal[1], resultnormal[2], 0,
- 0, 0, 0, 1};
-
- glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]);
- //glMultMatrixd(oglmatrix);
- glMultMatrixd(maat);
- return true;
-}
-
-void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,int objectdrawmode )
-{
- /* FIXME:
- blender: intern/moto/include/MT_Vector3.inl:42: MT_Vector3 operator/(const
- MT_Vector3&, double): Assertion `!MT_fuzzyZero(s)' failed.
-
- Program received signal SIGABRT, Aborted.
- [Switching to Thread 16384 (LWP 1519)]
- 0x40477571 in kill () from /lib/libc.so.6
- (gdb) bt
- #7 0x08334368 in MT_Vector3::normalized() const ()
- #8 0x0833e6ec in KX_BlenderRenderTools::applyTransform(RAS_IRasterizer*, double*, int) ()
- */
-
- if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED ||
- objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED)
- {
- // rotate the billboard/halo
- //page 360/361 3D Game Engine Design, David Eberly for a discussion
- // on screen aligned and axis aligned billboards
- // assumed is that the preprocessor transformed all billboard polygons
- // so that their normal points into the positive x direction (1.0, 0.0, 0.0)
- // when new parenting for objects is done, this rotation
- // will be moved into the object
-
- MT_Point3 objpos (oglmatrix[12],oglmatrix[13],oglmatrix[14]);
- MT_Point3 campos = rasty->GetCameraPosition();
- MT_Vector3 dir = (campos - objpos).safe_normalized();
- MT_Vector3 up(0,0,1.0);
-
- KX_GameObject* gameobj = (KX_GameObject *)this->m_clientobject;
- // get scaling of halo object
- MT_Vector3 size = gameobj->GetSGNode()->GetWorldScaling();
-
- bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned
- if (screenaligned)
- {
- up = (up - up.dot(dir) * dir).safe_normalized();
- } else
- {
- dir = (dir - up.dot(dir)*up).safe_normalized();
- }
-
- MT_Vector3 left = dir.normalized();
- dir = (left.cross(up)).normalized();
-
- // we have calculated the row vectors, now we keep
- // local scaling into account:
-
- left *= size[0];
- dir *= size[1];
- up *= size[2];
-
- double maat[16] = {left[0], left[1], left[2], 0,
- dir[0], dir[1], dir[2], 0,
- up[0], up[1], up[2], 0,
- 0, 0, 0, 1};
-
- glTranslated(objpos[0],objpos[1],objpos[2]);
- glMultMatrixd(maat);
- }
- else {
- if (objectdrawmode & RAS_IPolyMaterial::SHADOW)
- {
- // shadow must be cast to the ground, physics system needed here!
- MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]);
- KX_GameObject *gameobj = (KX_GameObject *)this->m_clientobject;
- MT_Vector3 direction = MT_Vector3(0,0,-1);
-
- direction.normalize();
- direction *= 100000;
-
- MT_Point3 topoint = frompoint + direction;
-
- KX_Scene* kxscene = (KX_Scene*) m_auxilaryClientInfo;
- PHY_IPhysicsEnvironment* physics_environment = kxscene->GetPhysicsEnvironment();
- KX_IPhysicsController* physics_controller = gameobj->GetPhysicsController();
-
- KX_GameObject *parent = gameobj->GetParent();
- if (!physics_controller && parent)
- physics_controller = parent->GetPhysicsController();
- if (parent)
- parent->Release();
-
- KX_RayCast::Callback<KX_BlenderRenderTools> callback(this, physics_controller, oglmatrix);
- if (!KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback))
- {
- // couldn't find something to cast the shadow on...
- glMultMatrixd(oglmatrix);
- }
- else
- { // we found the "ground", but the cast matrix doesn't take
- // scaling in consideration, so we must apply the object scale
- MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale();
- glScalef(size[0], size[1], size[2]);
- }
- } else
- {
-
- // 'normal' object
- glMultMatrixd(oglmatrix);
- }
- }
-}
-
-void KX_BlenderRenderTools::RenderBox2D(int xco,
- int yco,
- int width,
- int height,
- float percentage)
-{
- BL_draw_gamedebug_box(xco, yco, width, height, percentage);
-}
-
-void KX_BlenderRenderTools::RenderText3D(int fontid,
- const char* text,
- int size,
- int dpi,
- float* color,
- double* mat,
- float aspect)
-{
- BL_print_game_line(fontid, text, size, dpi, color, mat, aspect);
-}
-
-void KX_BlenderRenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode,
- const char* text,
- int xco,
- int yco,
- int width,
- int height)
-{
- if (mode == RAS_IRenderTools::RAS_TEXT_PADDED)
- BL_print_gamedebug_line_padded(text, xco, yco, width, height);
- else
- BL_print_gamedebug_line(text, xco, yco, width, height);
-}
-
-/* Render Text renders text into a (series of) polygon, using a texture font,
- * Each character consists of one polygon (one quad or two triangles) */
-
-void KX_BlenderRenderTools::RenderText(
- int mode,
- RAS_IPolyMaterial* polymat,
- float v1[3], float v2[3], float v3[3], float v4[3], int glattrib)
-{
- const STR_String &mytext = ((CValue *)m_clientobject)->GetPropertyText("Text");
-
- const unsigned int flag = polymat->GetFlag();
- struct MTFace* tface = 0;
- unsigned int *col = 0;
-
- if (flag & RAS_BLENDERMAT) {
- KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat);
- tface = bl_mat->GetMTFace();
- col = bl_mat->GetMCol();
- } else {
- KX_PolygonMaterial* blenderpoly = static_cast<KX_PolygonMaterial*>(polymat);
- tface = blenderpoly->GetMTFace();
- col = blenderpoly->GetMCol();
- }
-
- GPU_render_text(tface, mode, mytext, mytext.Length(), col, v1, v2, v3, v4, glattrib);
-}
-
-
-void KX_BlenderRenderTools::PushMatrix()
-{
- glPushMatrix();
-}
-
-void KX_BlenderRenderTools::PopMatrix()
-{
- glPopMatrix();
-}
-
-
-int KX_BlenderRenderTools::applyLights(int objectlayer, const MT_Transform& viewmat)
-{
- // taken from blender source, incompatibility between Blender Object / GameObject
- KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo;
- float glviewmat[16];
- unsigned int count;
- std::vector<struct RAS_LightObject*>::iterator lit = m_lights.begin();
-
- for (count=0; count<m_numgllights; count++)
- glDisable((GLenum)(GL_LIGHT0+count));
-
- viewmat.getValue(glviewmat);
-
- glPushMatrix();
- glLoadMatrixf(glviewmat);
- for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end()) && count < m_numgllights; ++lit)
- {
- RAS_LightObject* lightdata = (*lit);
- KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light;
-
- if (kxlight->ApplyLight(kxscene, objectlayer, count))
- count++;
- }
- glPopMatrix();
-
- return count;
-}
-
-void KX_BlenderRenderTools::MotionBlur(RAS_IRasterizer* rasterizer)
-{
- int state = rasterizer->GetMotionBlurState();
- float motionblurvalue;
- if (state)
- {
- motionblurvalue = rasterizer->GetMotionBlurValue();
- if (state==1)
- {
- //bugfix:load color buffer into accum buffer for the first time(state=1)
- glAccum(GL_LOAD, 1.0);
- rasterizer->SetMotionBlurState(2);
- }
- else if (motionblurvalue >= 0.0f && motionblurvalue <= 1.0f) {
- glAccum(GL_MULT, motionblurvalue);
- glAccum(GL_ACCUM, 1-motionblurvalue);
- glAccum(GL_RETURN, 1.0);
- glFlush();
- }
- }
-}
-
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
deleted file mode 100644
index 228763e7d2d..00000000000
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file KX_BlenderRenderTools.h
- * \ingroup blroutines
- */
-
-#ifndef __KX_BLENDERRENDERTOOLS_H__
-#define __KX_BLENDERRENDERTOOLS_H__
-
-#ifdef _MSC_VER
- /* don't show stl-warnings */
-# pragma warning (disable:4786)
-#endif
-
-#include "RAS_IRenderTools.h"
-
-#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
-#endif
-
-struct KX_ClientObjectInfo;
-class KX_RayCast;
-
-/* BlenderRenderTools are a set of tools to apply 2D/3D graphics effects, which
- * are not part of the (polygon) Rasterizer. Effects like 2D text, 3D (polygon)
- * text, lighting.
- *
- * Most of this code is duplicated in GPC_RenderTools, so this should be
- * moved to some common location to avoid duplication. */
-
-class KX_BlenderRenderTools : public RAS_IRenderTools
-{
- int m_lastlightlayer;
- bool m_lastlighting;
- void *m_lastauxinfo;
- static unsigned int m_numgllights;
-
-public:
- KX_BlenderRenderTools();
- virtual ~KX_BlenderRenderTools();
-
- void EndFrame(RAS_IRasterizer* rasty);
- void BeginFrame(RAS_IRasterizer* rasty);
-
- void EnableOpenGLLights(RAS_IRasterizer *rasty);
- void DisableOpenGLLights();
- void ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat);
-
- void RenderBox2D(int xco,
- int yco,
- int width,
- int height,
- float percentage);
-
-
- void RenderText3D(int fontid,
- const char* text,
- int size,
- int dpi,
- float* color,
- double* mat,
- float aspect);
-
- void RenderText2D(RAS_TEXT_RENDER_MODE mode,
- const char* text,
- int xco,
- int yco,
- int width,
- int height);
- void RenderText(int mode,
- class RAS_IPolyMaterial* polymat,
- float v1[3],
- float v2[3],
- float v3[3],
- float v4[3],
- int glattrib);
-
- void applyTransform(RAS_IRasterizer* rasty, double* oglmatrix, int objectdrawmode);
- int applyLights(int objectlayer, const MT_Transform& viewmat);
-
- void PushMatrix();
- void PopMatrix();
-
- bool RayHit(KX_ClientObjectInfo* client, class KX_RayCast* result, void * const data);
- bool NeedRayCast(KX_ClientObjectInfo*) { return true; }
-
- virtual void MotionBlur(RAS_IRasterizer* rasterizer);
-
- virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj);
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BlenderRenderTools")
-#endif
-};
-
-#endif /* __KX_BLENDERRENDERTOOLS_H__ */
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index b0555abbea4..1b27fde4fa4 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -39,11 +39,9 @@
#include <algorithm>
#include "BL_BlenderDataConversion.h"
-#include "KX_BlenderGL.h"
#include "KX_BlenderScalarInterpolator.h"
#include "RAS_IPolygonMaterial.h"
-#include "KX_PolygonMaterial.h"
// Expressions
#include "ListValue.h"
@@ -80,7 +78,6 @@
#include "RAS_Polygon.h"
#include "RAS_TexVert.h"
#include "RAS_BucketManager.h"
-#include "RAS_IRenderTools.h"
#include "BL_Material.h"
#include "KX_BlenderMaterial.h"
#include "BL_Texture.h"
@@ -893,167 +890,33 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
RAS_IPolyMaterial* polymat = converter->FindCachedPolyMaterial(scene, ma);
BL_Material* bl_mat = converter->FindCachedBlenderMaterial(scene, ma);
KX_BlenderMaterial* kx_blmat = NULL;
- KX_PolygonMaterial* kx_polymat = NULL;
-
- if (converter->GetMaterials()) {
- /* do Blender Multitexture and Blender GLSL materials */
-
- /* first is the BL_Material */
- if (!bl_mat)
- {
- bl_mat = new BL_Material();
-
- ConvertMaterial(bl_mat, ma, tface, tfaceName, mface, mcol,
- converter->GetGLSLMaterials());
- if (ma && (ma->mode & MA_FACETEXTURE) == 0)
- converter->CacheBlenderMaterial(scene, ma, bl_mat);
- }
-
- const bool use_vcol = GetMaterialUseVColor(ma, bl_mat->glslmat);
- GetRGB(use_vcol, mface, mcol, ma, rgb);
+ /* first is the BL_Material */
+ if (!bl_mat)
+ {
+ bl_mat = new BL_Material();
- GetUVs(bl_mat, layers, mface, tface, uvs);
-
- /* then the KX_BlenderMaterial */
- if (polymat == NULL)
- {
- kx_blmat = new KX_BlenderMaterial();
+ ConvertMaterial(bl_mat, ma, tface, tfaceName, mface, mcol,
+ converter->GetGLSLMaterials());
- kx_blmat->Initialize(scene, bl_mat, (ma?&ma->game:NULL), lightlayer);
- polymat = static_cast<RAS_IPolyMaterial*>(kx_blmat);
- if (ma && (ma->mode & MA_FACETEXTURE) == 0)
- converter->CachePolyMaterial(scene, ma, polymat);
- }
+ if (ma && (ma->mode & MA_FACETEXTURE) == 0)
+ converter->CacheBlenderMaterial(scene, ma, bl_mat);
}
- else {
- /* do Texture Face materials */
- Image* bima = (tface)? (Image*)tface->tpage: NULL;
- STR_String imastr = (tface)? (bima? (bima)->id.name : "" ) : "";
-
- char alpha_blend=0;
- short tile=0;
- int tilexrep=4,tileyrep = 4;
-
- /* set material properties - old TexFace */
- if (ma) {
- alpha_blend = ma->game.alpha_blend;
- /* Commented out for now. If we ever get rid of
- * "Texture Face/Singletexture" we can then think about it */
-
- /* Texture Face mode ignores texture but requires "Face Textures to be True "*/
- #if 0
- if ((ma->mode &MA_FACETEXTURE)==0 && (ma->game.flag &GEMAT_TEXT)==0) {
- bima = NULL;
- imastr = "";
- alpha_blend = GEMAT_SOLID;
- }
- else {
- alpha_blend = ma->game.alpha_blend;
- }
- #endif
- }
- /* check for tface tex to fallback on */
- else {
- if (bima) {
- /* see if depth of the image is 32 */
- if (BKE_image_has_alpha(bima))
- alpha_blend = GEMAT_ALPHA;
- else
- alpha_blend = GEMAT_SOLID;
- }
- else {
- alpha_blend = GEMAT_SOLID;
- }
- }
-
- if (bima) {
- tilexrep = bima->xrep;
- tileyrep = bima->yrep;
- }
- /* set UV properties */
- if (tface) {
- uvs[0][0].setValue(tface->uv[0]);
- uvs[1][0].setValue(tface->uv[1]);
- uvs[2][0].setValue(tface->uv[2]);
-
- if (mface->v4)
- uvs[3][0].setValue(tface->uv[3]);
+ const bool use_vcol = GetMaterialUseVColor(ma, bl_mat->glslmat);
+ GetRGB(use_vcol, mface, mcol, ma, rgb);
- tile = tface->tile;
- }
- else {
- /* no texfaces */
- tile = 0;
- }
+ GetUVs(bl_mat, layers, mface, tface, uvs);
- /* get vertex colors */
- if (mcol) {
- /* we have vertex colors */
- rgb[0] = KX_Mcol2uint_new(mcol[0]);
- rgb[1] = KX_Mcol2uint_new(mcol[1]);
- rgb[2] = KX_Mcol2uint_new(mcol[2]);
-
- if (mface->v4)
- rgb[3] = KX_Mcol2uint_new(mcol[3]);
- }
- else {
- /* no vertex colors, take from material, otherwise white */
- unsigned int color = 0xFFFFFFFFL;
-
- if (ma)
- {
- union
- {
- unsigned char cp[4];
- unsigned int integer;
- } col_converter;
-
- col_converter.cp[3] = (unsigned char) (ma->r*255.0);
- col_converter.cp[2] = (unsigned char) (ma->g*255.0);
- col_converter.cp[1] = (unsigned char) (ma->b*255.0);
- col_converter.cp[0] = (unsigned char) (ma->alpha*255.0);
-
- color = col_converter.integer;
- }
-
- rgb[0] = KX_rgbaint2uint_new(color);
- rgb[1] = KX_rgbaint2uint_new(color);
- rgb[2] = KX_rgbaint2uint_new(color);
-
- if (mface->v4)
- rgb[3] = KX_rgbaint2uint_new(color);
- }
-
- // only zsort alpha + add
- const bool alpha = ELEM3(alpha_blend, GEMAT_ALPHA, GEMAT_ADD, GEMAT_ALPHA_SORT);
- const bool zsort = (alpha_blend == GEMAT_ALPHA_SORT);
- const bool light = (ma)?(ma->mode & MA_SHLESS)==0:default_light_mode;
-
- // don't need zort anymore, deal as if it it's alpha blend
- if (alpha_blend == GEMAT_ALPHA_SORT) alpha_blend = GEMAT_ALPHA;
-
- if (polymat == NULL)
- {
- kx_polymat = new KX_PolygonMaterial();
- kx_polymat->Initialize(imastr, ma, (int)mface->mat_nr,
- tile, tilexrep, tileyrep,
- alpha_blend, alpha, zsort, light, lightlayer, tface, (unsigned int*)mcol);
- polymat = static_cast<RAS_IPolyMaterial*>(kx_polymat);
-
- if (ma) {
- polymat->m_specular = MT_Vector3(ma->specr, ma->specg, ma->specb)*ma->spec;
- polymat->m_shininess = (float)ma->har/4.0f; // 0 < ma->har <= 512
- polymat->m_diffuse = MT_Vector3(ma->r, ma->g, ma->b)*(ma->emit + ma->ref);
- }
- else {
- polymat->m_specular.setValue(0.0f,0.0f,0.0f);
- polymat->m_shininess = 35.0;
- }
+ /* then the KX_BlenderMaterial */
+ if (polymat == NULL)
+ {
+ kx_blmat = new KX_BlenderMaterial();
+ kx_blmat->Initialize(scene, bl_mat, (ma?&ma->game:NULL), lightlayer);
+ polymat = static_cast<RAS_IPolyMaterial*>(kx_blmat);
+ if (ma && (ma->mode & MA_FACETEXTURE) == 0)
converter->CachePolyMaterial(scene, ma, polymat);
- }
}
// see if a bucket was reused or a new one was created
@@ -1063,8 +926,7 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
if (bucketCreated) {
// this is needed to free up memory afterwards
converter->RegisterPolyMaterial(polymat);
- if (converter->GetMaterials())
- converter->RegisterBlenderMaterial(bl_mat);
+ converter->RegisterBlenderMaterial(bl_mat);
}
return bucket;
@@ -1557,12 +1419,12 @@ static void BL_CreateGraphicObjectNew(KX_GameObject* gameobj,
PHY_IMotionState* motionstate = new KX_MotionState(gameobj->GetSGNode());
CcdGraphicController* ctrl = new CcdGraphicController(env, motionstate);
gameobj->SetGraphicController(ctrl);
- ctrl->setNewClientInfo(gameobj->getClientInfo());
- ctrl->setLocalAabb(localAabbMin, localAabbMax);
+ ctrl->SetNewClientInfo(gameobj->getClientInfo());
+ ctrl->SetLocalAabb(localAabbMin, localAabbMax);
if (isActive) {
// add first, this will create the proxy handle, only if the object is visible
if (gameobj->GetVisible())
- env->addCcdGraphicController(ctrl);
+ env->AddCcdGraphicController(ctrl);
// update the mesh if there is a deformer, this will also update the bounding box for modifiers
RAS_Deformer* deformer = gameobj->GetDeformer();
if (deformer)
@@ -1874,7 +1736,7 @@ static void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
-static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int layerflag, KX_Scene *kxscene, RAS_IRenderTools *rendertools, KX_BlenderSceneConverter *converter)
+static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int layerflag, KX_Scene *kxscene, RAS_IRasterizer *rasterizer, KX_BlenderSceneConverter *converter)
{
RAS_LightObject lightobj;
KX_LightObject *gamelight;
@@ -1913,7 +1775,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l
lightobj.m_type = RAS_LightObject::LIGHT_NORMAL;
}
- gamelight = new KX_LightObject(kxscene, KX_Scene::m_callbacks, rendertools,
+ gamelight = new KX_LightObject(kxscene, KX_Scene::m_callbacks, rasterizer,
lightobj, glslmat);
return gamelight;
@@ -1934,7 +1796,7 @@ static KX_Camera *gamecamera_from_bcamera(Object *ob, KX_Scene *kxscene, KX_Blen
static KX_GameObject *gameobject_from_blenderobject(
Object *ob,
KX_Scene *kxscene,
- RAS_IRenderTools *rendertools,
+ RAS_IRasterizer *rendertools,
KX_BlenderSceneConverter *converter,
bool libloading)
{
@@ -2165,22 +2027,8 @@ static void UNUSED_FUNCTION(RBJconstraints)(Object *ob)//not used
}
#include "PHY_IPhysicsEnvironment.h"
-#include "KX_IPhysicsController.h"
#include "PHY_DynamicTypes.h"
-#if 0 /* UNUSED */
-static KX_IPhysicsController* getPhId(CListValue* sumolist,STR_String busc) {//not used
-
- for (int j=0;j<sumolist->GetCount();j++)
- {
- KX_GameObject* gameobje = (KX_GameObject*) sumolist->GetValue(j);
- if (gameobje->GetName()==busc)
- return gameobje->GetPhysicsController();
- }
-
- return 0;
-}
-#endif
static KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist)
{
@@ -2359,7 +2207,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
KX_Scene* kxscene,
KX_KetsjiEngine* ketsjiEngine,
e_PhysicsEngine physics_engine,
- RAS_IRenderTools* rendertools,
+ RAS_IRasterizer* rendertools,
RAS_ICanvas* canvas,
KX_BlenderSceneConverter* converter,
bool alwaysUseExpandFraming,
@@ -2723,7 +2571,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
kxscene->SetDbvtOcclusionRes(blenderscene->gm.occlusionRes);
}
if (blenderscene->world)
- kxscene->GetPhysicsEnvironment()->setNumTimeSubSteps(blenderscene->gm.physubstep);
+ kxscene->GetPhysicsEnvironment()->SetNumTimeSubSteps(blenderscene->gm.physubstep);
// now that the scenegraph is complete, let's instantiate the deformers.
// We need that to create reusable derived mesh and physic shapes
@@ -2814,12 +2662,12 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
{
KX_GameObject *gotar=getGameOb(dat->tar->id.name+2,sumolist);
if (gotar && ((gotar->GetLayer()&activeLayerBitInfo)!=0) && gotar->GetPhysicsController())
- physctr2 = (PHY_IPhysicsController*) gotar->GetPhysicsController()->GetUserData();
+ physctr2 = gotar->GetPhysicsController();
}
if (gameobj->GetPhysicsController())
{
- PHY_IPhysicsController* physctrl = (PHY_IPhysicsController*) gameobj->GetPhysicsController()->GetUserData();
+ PHY_IPhysicsController* physctrl = gameobj->GetPhysicsController();
//we need to pass a full constraint frame, not just axis
//localConstraintFrameBasis
@@ -2828,7 +2676,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
MT_Vector3 axis1 = localCFrame.getColumn(1);
MT_Vector3 axis2 = localCFrame.getColumn(2);
- int constraintId = kxscene->GetPhysicsEnvironment()->createConstraint(physctrl,physctr2,(PHY_ConstraintType)dat->type,(float)dat->pivX,
+ int constraintId = kxscene->GetPhysicsEnvironment()->CreateConstraint(physctrl,physctr2,(PHY_ConstraintType)dat->type,(float)dat->pivX,
(float)dat->pivY,(float)dat->pivZ,
(float)axis0.x(),(float)axis0.y(),(float)axis0.z(),
(float)axis1.x(),(float)axis1.y(),(float)axis1.z(),
@@ -2844,11 +2692,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
{
if (dat->flag & dofbit)
{
- kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]);
+ kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]);
} else
{
//minLimit > maxLimit means free(disabled limit) for this degree of freedom
- kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,1,-1);
+ kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,1,-1);
}
dofbit<<=1;
}
@@ -2862,12 +2710,12 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
{
if (dat->flag & dofbit)
{
- kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]);
+ kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]);
}
else
{
//maxLimit < 0 means free(disabled limit) for this degree of freedom
- kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,1,-1);
+ kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,1,-1);
}
dofbit<<=1;
}
@@ -2879,12 +2727,12 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
if (dat->flag & dofbit)
{
- kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,
+ kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,
dat->minLimit[dof],dat->maxLimit[dof]);
} else
{
//minLimit > maxLimit means free(disabled limit) for this degree of freedom
- kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,1,-1);
+ kxscene->GetPhysicsEnvironment()->SetConstraintParam(constraintId,dof,1,-1);
}
}
}
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.h b/source/gameengine/Converter/BL_BlenderDataConversion.h
index f3a680929fb..6bd77954b88 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.h
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.h
@@ -44,7 +44,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
class KX_Scene* kxscene,
class KX_KetsjiEngine* ketsjiEngine,
e_PhysicsEngine physics_engine,
- class RAS_IRenderTools* rendertools,
+ class RAS_IRasterizer* rendertools,
class RAS_ICanvas* canvas,
class KX_BlenderSceneConverter* sceneconverter,
bool alwaysUseExpandFraming,
diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp
index ec52eaac637..82f49ad5227 100644
--- a/source/gameengine/Converter/BL_ModifierDeformer.cpp
+++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp
@@ -192,7 +192,7 @@ bool BL_ModifierDeformer::Update(void)
float min_r[3], max_r[3];
INIT_MINMAX(min_r, max_r);
m_dm->getMinMax(m_dm, min_r, max_r);
- ctrl->setLocalAabb(min_r, max_r);
+ ctrl->SetLocalAabb(min_r, max_r);
}
}
m_lastModifierUpdate=m_gameobj->GetLastFrame();
diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp
index 25da8155867..f1f264b3367 100644
--- a/source/gameengine/Converter/BlenderWorldInfo.cpp
+++ b/source/gameengine/Converter/BlenderWorldInfo.cpp
@@ -33,7 +33,6 @@
#include <stdio.h> // printf()
#include "BlenderWorldInfo.h"
-#include "KX_BlenderGL.h"
/* This little block needed for linking to Blender... */
#ifdef WIN32
diff --git a/source/gameengine/Converter/BlenderWorldInfo.h b/source/gameengine/Converter/BlenderWorldInfo.h
index 30de5e89269..af535d65d62 100644
--- a/source/gameengine/Converter/BlenderWorldInfo.h
+++ b/source/gameengine/Converter/BlenderWorldInfo.h
@@ -33,7 +33,6 @@
#define __BLENDERWORLDINFO_H__
#include "MT_CmMatrix4x4.h"
#include "KX_WorldInfo.h"
-#include "KX_BlenderGL.h"
class BlenderWorldInfo : public KX_WorldInfo
{
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 98af99825e1..e682f335608 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -42,11 +42,9 @@
#include "PHY_IPhysicsEnvironment.h"
#include "KX_KetsjiEngine.h"
#include "KX_PythonInit.h" // So we can handle adding new text datablocks for Python to import
-#include "KX_IPhysicsController.h"
#include "BL_Material.h"
#include "BL_ActionActuator.h"
#include "KX_BlenderMaterial.h"
-#include "KX_PolygonMaterial.h"
#include "BL_System.h"
@@ -313,7 +311,7 @@ struct BlenderDebugDraw : public btIDebugDraw
#endif
void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
- class RAS_IRenderTools* rendertools,
+ class RAS_IRasterizer* rendertools,
class RAS_ICanvas* canvas,
bool libloading)
{
@@ -356,15 +354,15 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
case UseBullet:
{
CcdPhysicsEnvironment* ccdPhysEnv = new CcdPhysicsEnvironment(useDbvtCulling);
- ccdPhysEnv->setDebugDrawer(new BlenderDebugDraw());
- ccdPhysEnv->setDeactivationLinearTreshold(blenderscene->gm.lineardeactthreshold);
- ccdPhysEnv->setDeactivationAngularTreshold(blenderscene->gm.angulardeactthreshold);
- ccdPhysEnv->setDeactivationTime(blenderscene->gm.deactivationtime);
+ ccdPhysEnv->SetDebugDrawer(new BlenderDebugDraw());
+ ccdPhysEnv->SetDeactivationLinearTreshold(blenderscene->gm.lineardeactthreshold);
+ ccdPhysEnv->SetDeactivationAngularTreshold(blenderscene->gm.angulardeactthreshold);
+ ccdPhysEnv->SetDeactivationTime(blenderscene->gm.deactivationtime);
SYS_SystemHandle syshandle = SYS_GetSystem(); /*unused*/
int visualizePhysics = SYS_GetCommandLineInt(syshandle,"show_physics",0);
if (visualizePhysics)
- ccdPhysEnv->setDebugMode(btIDebugDraw::DBG_DrawWireframe|btIDebugDraw::DBG_DrawAabb|btIDebugDraw::DBG_DrawContactPoints|btIDebugDraw::DBG_DrawText|btIDebugDraw::DBG_DrawConstraintLimits|btIDebugDraw::DBG_DrawConstraints);
+ ccdPhysEnv->SetDebugMode(btIDebugDraw::DBG_DrawWireframe|btIDebugDraw::DBG_DrawAabb|btIDebugDraw::DBG_DrawContactPoints|btIDebugDraw::DBG_DrawText|btIDebugDraw::DBG_DrawConstraintLimits|btIDebugDraw::DBG_DrawConstraints);
//todo: get a button in blender ?
//disable / enable debug drawing (contact points, aabb's etc)
@@ -710,7 +708,6 @@ void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo)
KX_GameObject* gameObj = (KX_GameObject*)parentList->GetValue(g);
if (gameObj->IsDynamic())
{
- //KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController();
Object* blenderObject = gameObj->GetBlenderObject();
if (blenderObject)
@@ -826,7 +823,6 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
Object* blenderObject = gameObj->GetBlenderObject();
if (blenderObject && blenderObject->parent==NULL && gameObj->IsDynamic())
{
- //KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController();
if (blenderObject->adt==NULL)
BKE_id_add_animdata(&blenderObject->id);
@@ -945,7 +941,6 @@ void KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo()
KX_GameObject* gameObj = (KX_GameObject*)parentList->GetValue(g);
if (gameObj->IsDynamic())
{
- //KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController();
#if 0
Object* blenderObject = gameObj->GetBlenderObject();
@@ -1419,15 +1414,8 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
RAS_IPolyMaterial *mat= (*polymit).second;
Material *bmat= NULL;
- /* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject *)? - Campbell */
- if (mat->GetFlag() & RAS_BLENDERMAT) {
- KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(mat);
- bmat= bl_mat->GetBlenderMaterial();
-
- } else {
- KX_PolygonMaterial *kx_mat = static_cast<KX_PolygonMaterial*>(mat);
- bmat= kx_mat->GetBlenderMaterial();
- }
+ KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(mat);
+ bmat= bl_mat->GetBlenderMaterial();
if (IS_TAGGED(bmat)) {
/* only remove from bucket */
@@ -1444,15 +1432,8 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
RAS_IPolyMaterial *mat= (*polymit).second;
Material *bmat= NULL;
- /* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject *)? - Campbell */
- if (mat->GetFlag() & RAS_BLENDERMAT) {
- KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(mat);
- bmat= bl_mat->GetBlenderMaterial();
-
- } else {
- KX_PolygonMaterial *kx_mat = static_cast<KX_PolygonMaterial*>(mat);
- bmat= kx_mat->GetBlenderMaterial();
- }
+ KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(mat);
+ bmat= bl_mat->GetBlenderMaterial();
if (bmat) {
//printf("FOUND MAT '%s' !!! ", ((ID*)bmat)->name+2);
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h
index 7ed75ad7614..3ae90301553 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.h
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h
@@ -111,7 +111,7 @@ public:
*/
virtual void ConvertScene(
class KX_Scene* destinationscene,
- class RAS_IRenderTools* rendertools,
+ class RAS_IRasterizer* rendertools,
class RAS_ICanvas* canvas,
bool libloading=false
);
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp
index 3bb12c12cd1..b9bd9aabc54 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.cpp
+++ b/source/gameengine/Converter/KX_ConvertSensors.cpp
@@ -80,7 +80,6 @@
#include "KX_Scene.h"
#include "IntValue.h"
#include "KX_BlenderKeyboardDevice.h"
-#include "KX_BlenderGL.h"
#include "RAS_ICanvas.h"
#include "PHY_IPhysicsEnvironment.h"
diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
index d860b2ee694..fcdaaaa761a 100644
--- a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
+++ b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
@@ -48,7 +48,6 @@
#include "CcdPhysicsController.h"
#include "BulletSoftBody/btSoftBody.h"
-#include "KX_BulletPhysicsController.h"
#include "btBulletDynamicsCommon.h"
void KX_SoftBodyDeformer::Relink(CTR_Map<class CTR_HashedPtr, void*>*map)
@@ -66,7 +65,7 @@ void KX_SoftBodyDeformer::Relink(CTR_Map<class CTR_HashedPtr, void*>*map)
bool KX_SoftBodyDeformer::Apply(class RAS_IPolyMaterial *polymat)
{
- KX_BulletPhysicsController* ctrl = (KX_BulletPhysicsController*) m_gameobj->GetPhysicsController();
+ CcdPhysicsController* ctrl = (CcdPhysicsController*) m_gameobj->GetPhysicsController();
if (!ctrl)
return false;
diff --git a/source/gameengine/GameLogic/SCA_ExpressionController.cpp b/source/gameengine/GameLogic/SCA_ExpressionController.cpp
index 41a0fa7d095..d1c7b58a52c 100644
--- a/source/gameengine/GameLogic/SCA_ExpressionController.cpp
+++ b/source/gameengine/GameLogic/SCA_ExpressionController.cpp
@@ -141,6 +141,7 @@ CValue* SCA_ExpressionController::FindIdentifier(const STR_String& identifiernam
{
identifierval = new CBoolValue(sensor->GetState());
//identifierval = sensor->AddRef();
+ break;
}
//if (!sensor->IsPositiveTrigger())
diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt
index 4f2531cec2a..2fc4df86332 100644
--- a/source/gameengine/GamePlayer/common/CMakeLists.txt
+++ b/source/gameengine/GamePlayer/common/CMakeLists.txt
@@ -63,12 +63,10 @@ set(SRC
GPC_Canvas.cpp
GPC_KeyboardDevice.cpp
GPC_MouseDevice.cpp
- GPC_RenderTools.cpp
GPC_Canvas.h
GPC_KeyboardDevice.h
GPC_MouseDevice.h
- GPC_RenderTools.h
)
add_definitions(-DGLEW_STATIC)
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
deleted file mode 100644
index 0d851c4f10d..00000000000
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/GamePlayer/common/GPC_RenderTools.cpp
- * \ingroup player
- */
-
-
-#include "GL/glew.h"
-
-#include "RAS_IRenderTools.h"
-#include "RAS_IRasterizer.h"
-#include "RAS_LightObject.h"
-#include "RAS_ICanvas.h"
-#include "RAS_GLExtensionManager.h"
-#include "RAS_MeshObject.h"
-
-#include "KX_GameObject.h"
-#include "KX_PolygonMaterial.h"
-#include "KX_BlenderMaterial.h"
-#include "KX_RayCast.h"
-#include "KX_IPhysicsController.h"
-#include "KX_Light.h"
-
-#include "PHY_IPhysicsEnvironment.h"
-
-#include "STR_String.h"
-
-#include "GPU_draw.h"
-
-#include "BKE_bmfont.h" // for text printing
-#include "BKE_bmfont_types.h"
-
-#include "GPC_RenderTools.h"
-
-extern "C" {
-#include "BLF_api.h"
-}
-
-
-unsigned int GPC_RenderTools::m_numgllights;
-
-GPC_RenderTools::GPC_RenderTools()
-{
- glGetIntegerv(GL_MAX_LIGHTS, (GLint *) &m_numgllights);
- if (m_numgllights < 8)
- m_numgllights = 8;
-}
-
-GPC_RenderTools::~GPC_RenderTools()
-{
-}
-
-void GPC_RenderTools::BeginFrame(RAS_IRasterizer* rasty)
-{
- m_clientobject = NULL;
- m_lastlightlayer = -1;
- m_lastauxinfo = NULL;
- m_lastlighting = true; /* force disable in DisableOpenGLLights() */
- DisableOpenGLLights();
-}
-
-void GPC_RenderTools::EndFrame(RAS_IRasterizer* rasty)
-{
-}
-
-/* ProcessLighting performs lighting on objects. the layer is a bitfield that
- * contains layer information. There are 20 'official' layers in blender. A
- * light is applied on an object only when they are in the same layer. OpenGL
- * has a maximum of 8 lights (simultaneous), so 20 * 8 lights are possible in
- * a scene. */
-
-void GPC_RenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat)
-{
- bool enable = false;
- int layer= -1;
-
- /* find the layer */
- if (uselights) {
- if (m_clientobject)
- layer = static_cast<KX_GameObject*>(m_clientobject)->GetLayer();
- }
-
- /* avoid state switching */
- if (m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo)
- return;
-
- m_lastlightlayer = layer;
- m_lastauxinfo = m_auxilaryClientInfo;
-
- /* enable/disable lights as needed */
- if (layer >= 0)
- enable = applyLights(layer, viewmat);
-
- if (enable)
- EnableOpenGLLights(rasty);
- else
- DisableOpenGLLights();
-}
-
-void GPC_RenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty)
-{
- if (m_lastlighting == true)
- return;
-
- glEnable(GL_LIGHTING);
- glEnable(GL_COLOR_MATERIAL);
-
- glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
- glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (rasty->GetCameraOrtho())? GL_FALSE: GL_TRUE);
- if (GLEW_EXT_separate_specular_color || GLEW_VERSION_1_2)
- glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
-
- m_lastlighting = true;
-}
-
-void GPC_RenderTools::DisableOpenGLLights()
-{
- if (m_lastlighting == false)
- return;
-
- glDisable(GL_LIGHTING);
- glDisable(GL_COLOR_MATERIAL);
-
- m_lastlighting = false;
-}
-
-
-void GPC_RenderTools::SetClientObject(RAS_IRasterizer *rasty, void* obj)
-{
- if (m_clientobject != obj)
- {
- bool ccw = (obj == NULL || !((KX_GameObject*)obj)->IsNegativeScaling());
- rasty->SetFrontFace(ccw);
-
- m_clientobject = obj;
- }
-}
-
-bool GPC_RenderTools::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void * const data)
-{
- double* const oglmatrix = (double* const) data;
-
- RAS_Polygon* poly = result->m_hitMesh->GetPolygon(result->m_hitPolygon);
- if (!poly->IsVisible())
- return false;
-
- MT_Point3 resultpoint(result->m_hitPoint);
- MT_Vector3 resultnormal(result->m_hitNormal);
- MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]);
- MT_Vector3 dir = -(left.cross(resultnormal)).safe_normalized();
- left = (dir.cross(resultnormal)).safe_normalized();
- // for the up vector, we take the 'resultnormal' returned by the physics
-
- double maat[16] = {left[0], left[1], left[2], 0,
- dir[0], dir[1], dir[2], 0,
- resultnormal[0], resultnormal[1], resultnormal[2], 0,
- 0, 0, 0, 1};
-
- glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]);
- //glMultMatrixd(oglmatrix);
- glMultMatrixd(maat);
- return true;
-}
-
-void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,int objectdrawmode )
-{
- /* FIXME:
- blender: intern/moto/include/MT_Vector3.inl:42: MT_Vector3 operator/(const
- MT_Vector3&, double): Assertion `!MT_fuzzyZero(s)' failed.
-
- Program received signal SIGABRT, Aborted.
- [Switching to Thread 16384 (LWP 1519)]
- 0x40477571 in kill () from /lib/libc.so.6
- (gdb) bt
- #7 0x08334368 in MT_Vector3::normalized() const ()
- #8 0x0833e6ec in GPC_RenderTools::applyTransform(RAS_IRasterizer*, double*, int) ()
- */
-
- if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED ||
- objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED)
- {
- // rotate the billboard/halo
- //page 360/361 3D Game Engine Design, David Eberly for a discussion
- // on screen aligned and axis aligned billboards
- // assumed is that the preprocessor transformed all billboard polygons
- // so that their normal points into the positive x direction (1.0, 0.0, 0.0)
- // when new parenting for objects is done, this rotation
- // will be moved into the object
-
- MT_Point3 objpos (oglmatrix[12],oglmatrix[13],oglmatrix[14]);
- MT_Point3 campos = rasty->GetCameraPosition();
- MT_Vector3 dir = (campos - objpos).safe_normalized();
- MT_Vector3 up(0,0,1.0);
-
- KX_GameObject* gameobj = (KX_GameObject *)this->m_clientobject;
- // get scaling of halo object
- MT_Vector3 size = gameobj->GetSGNode()->GetWorldScaling();
-
- bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned
- if (screenaligned)
- {
- up = (up - up.dot(dir) * dir).safe_normalized();
- } else
- {
- dir = (dir - up.dot(dir)*up).safe_normalized();
- }
-
- MT_Vector3 left = dir.normalized();
- dir = (left.cross(up)).normalized();
-
- // we have calculated the row vectors, now we keep
- // local scaling into account:
-
- left *= size[0];
- dir *= size[1];
- up *= size[2];
-
- double maat[16] = {left[0], left[1], left[2], 0,
- dir[0], dir[1], dir[2], 0,
- up[0], up[1], up[2], 0,
- 0, 0, 0, 1};
-
- glTranslated(objpos[0],objpos[1],objpos[2]);
- glMultMatrixd(maat);
- }
- else {
- if (objectdrawmode & RAS_IPolyMaterial::SHADOW)
- {
- // shadow must be cast to the ground, physics system needed here!
- MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]);
- KX_GameObject *gameobj = (KX_GameObject *)this->m_clientobject;
- MT_Vector3 direction = MT_Vector3(0,0,-1);
-
- direction.normalize();
- direction *= 100000;
-
- MT_Point3 topoint = frompoint + direction;
-
- KX_Scene* kxscene = (KX_Scene*) m_auxilaryClientInfo;
- PHY_IPhysicsEnvironment* physics_environment = kxscene->GetPhysicsEnvironment();
- KX_IPhysicsController* physics_controller = gameobj->GetPhysicsController();
-
- KX_GameObject *parent = gameobj->GetParent();
- if (!physics_controller && parent)
- physics_controller = parent->GetPhysicsController();
- if (parent)
- parent->Release();
-
- KX_RayCast::Callback<GPC_RenderTools> callback(this, physics_controller, oglmatrix);
- if (!KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback))
- {
- // couldn't find something to cast the shadow on...
- glMultMatrixd(oglmatrix);
- }
- else
- { // we found the "ground", but the cast matrix doesn't take
- // scaling in consideration, so we must apply the object scale
- MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale();
- glScalef(size[0], size[1], size[2]);
- }
- } else
- {
-
- // 'normal' object
- glMultMatrixd(oglmatrix);
- }
- }
-}
-
-void GPC_RenderTools::RenderBox2D(int xco,
- int yco,
- int width,
- int height,
- float percentage)
-{
- // Save and change OpenGL settings
- int texture2D;
- glGetIntegerv(GL_TEXTURE_2D, (GLint*)&texture2D);
- glDisable(GL_TEXTURE_2D);
- int fog;
- glGetIntegerv(GL_FOG, (GLint*)&fog);
- glDisable(GL_FOG);
-
- int light;
- glGetIntegerv(GL_LIGHTING, (GLint*)&light);
- glDisable(GL_LIGHTING);
-
- glDisable(GL_DEPTH_TEST);
-
- // Set up viewing settings
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, width, 0, height, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- yco = height - yco;
- int barsize = 50;
-
- // draw in black first
- glColor3ub(0, 0, 0);
- glBegin(GL_QUADS);
- glVertex2f(xco + 1 + 1 + barsize * percentage, yco - 1 + 10);
- glVertex2f(xco + 1, yco - 1 + 10);
- glVertex2f(xco + 1, yco - 1);
- glVertex2f(xco + 1 + 1 + barsize * percentage, yco - 1);
- glEnd();
-
- glColor3ub(255, 255, 255);
- glBegin(GL_QUADS);
- glVertex2f(xco + 1 + barsize * percentage, yco + 10);
- glVertex2f(xco, yco + 10);
- glVertex2f(xco, yco);
- glVertex2f(xco + 1 + barsize * percentage, yco);
- glEnd();
-
- // Restore view settings
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-
- // Restore OpenGL Settings
- if (fog)
- glEnable(GL_FOG);
- else
- glDisable(GL_FOG);
-
- if (texture2D)
- glEnable(GL_TEXTURE_2D);
- else
- glDisable(GL_TEXTURE_2D);
- if (light)
- glEnable(GL_LIGHTING);
- else
- glDisable(GL_LIGHTING);
-}
-
-
-void GPC_RenderTools::RenderText3D( int fontid,
- const char* text,
- int size,
- int dpi,
- float* color,
- double* mat,
- float aspect)
-{
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */
-
- if (GLEW_ARB_multitexture) {
- for (int i=0; i<MAXTEX; i++) {
- glActiveTextureARB(GL_TEXTURE0_ARB+i);
-
- if (GLEW_ARB_texture_cube_map)
- if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
- glDisable(GL_TEXTURE_CUBE_MAP_ARB);
-
- if (glIsEnabled(GL_TEXTURE_2D))
- glDisable(GL_TEXTURE_2D);
- }
-
- glActiveTextureARB(GL_TEXTURE0_ARB);
- }
- else {
- if (GLEW_ARB_texture_cube_map)
- if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
- glDisable(GL_TEXTURE_CUBE_MAP_ARB);
-
- if (glIsEnabled(GL_TEXTURE_2D))
- glDisable(GL_TEXTURE_2D);
- }
-
- /* the actual drawing */
- glColor4fv(color);
-
- /* multiply the text matrix by the object matrix */
- BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT);
- BLF_matrix(fontid, mat);
-
- /* aspect is the inverse scale that allows you to increase */
- /* your resolution without sizing the final text size */
- /* the bigger the size, the smaller the aspect */
- BLF_aspect(fontid, aspect, aspect, aspect);
-
- BLF_size(fontid, size, dpi);
- BLF_position(fontid, 0, 0, 0);
- BLF_draw(fontid, text, 65535);
-
- BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT);
- glEnable(GL_DEPTH_TEST);
-}
-
-
-
-void GPC_RenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode,
- const char* text,
- int xco,
- int yco,
- int width,
- int height)
-{
- /*
- STR_String tmpstr(text);
- char* s = tmpstr.Ptr(); */
-
- // Save and change OpenGL settings
- int texture2D;
- glGetIntegerv(GL_TEXTURE_2D, (GLint*)&texture2D);
- glDisable(GL_TEXTURE_2D);
- int fog;
- glGetIntegerv(GL_FOG, (GLint*)&fog);
- glDisable(GL_FOG);
-
- int light;
- glGetIntegerv(GL_LIGHTING, (GLint*)&light);
- glDisable(GL_LIGHTING);
-
- glDisable(GL_DEPTH_TEST);
-
- // Set up viewing settings
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, width, 0, height, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- // Actual drawing (draw black first if padded)
- if (mode == RAS_IRenderTools::RAS_TEXT_PADDED)
- {
- glColor3ub(0, 0, 0);
- BLF_draw_default(xco+1, height-yco-1, 0.f, text, 65536);
- }
-
- glColor3ub(255, 255, 255);
- BLF_draw_default(xco, height-yco, 0.f, text, 65536);
-
- // Restore view settings
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-
- // Restore OpenGL Settings
- if (fog)
- glEnable(GL_FOG);
- else
- glDisable(GL_FOG);
-
- if (texture2D)
- glEnable(GL_TEXTURE_2D);
- else
- glDisable(GL_TEXTURE_2D);
- if (light)
- glEnable(GL_LIGHTING);
- else
- glDisable(GL_LIGHTING);
-}
-
-/* Render Text renders text into a (series of) polygon, using a texture font,
- * Each character consists of one polygon (one quad or two triangles) */
-
-void GPC_RenderTools::RenderText(
- int mode,
- RAS_IPolyMaterial* polymat,
- float v1[3], float v2[3], float v3[3], float v4[3], int glattrib)
-{
- const STR_String &mytext = ((CValue *)m_clientobject)->GetPropertyText("Text");
-
- const unsigned int flag = polymat->GetFlag();
- struct MTFace* tface = 0;
- unsigned int *col = 0;
-
- if (flag & RAS_BLENDERMAT) {
- KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat);
- tface = bl_mat->GetMTFace();
- col = bl_mat->GetMCol();
- } else {
- KX_PolygonMaterial* blenderpoly = static_cast<KX_PolygonMaterial*>(polymat);
- tface = blenderpoly->GetMTFace();
- col = blenderpoly->GetMCol();
- }
-
- GPU_render_text(tface, mode, mytext, mytext.Length(), col, v1, v2, v3, v4, glattrib);
-}
-
-
-void GPC_RenderTools::PushMatrix()
-{
- glPushMatrix();
-}
-
-void GPC_RenderTools::PopMatrix()
-{
- glPopMatrix();
-}
-
-
-int GPC_RenderTools::applyLights(int objectlayer, const MT_Transform& viewmat)
-{
- // taken from blender source, incompatibility between Blender Object / GameObject
- KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo;
- float glviewmat[16];
- unsigned int count;
- std::vector<struct RAS_LightObject*>::iterator lit = m_lights.begin();
-
- for (count=0; count<m_numgllights; count++)
- glDisable((GLenum)(GL_LIGHT0+count));
-
- viewmat.getValue(glviewmat);
-
- glPushMatrix();
- glLoadMatrixf(glviewmat);
- for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end()) && count < m_numgllights; ++lit)
- {
- RAS_LightObject* lightdata = (*lit);
- KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light;
-
- if (kxlight->ApplyLight(kxscene, objectlayer, count))
- count++;
- }
- glPopMatrix();
-
- return count;
-}
-
-void GPC_RenderTools::MotionBlur(RAS_IRasterizer* rasterizer)
-{
- int state = rasterizer->GetMotionBlurState();
- float motionblurvalue;
- if (state)
- {
- motionblurvalue = rasterizer->GetMotionBlurValue();
- if (state==1)
- {
- //bugfix:load color buffer into accum buffer for the first time(state=1)
- glAccum(GL_LOAD, 1.0);
- rasterizer->SetMotionBlurState(2);
- }
- else if (motionblurvalue >= 0.0f && motionblurvalue <= 1.0f) {
- glAccum(GL_MULT, motionblurvalue);
- glAccum(GL_ACCUM, 1-motionblurvalue);
- glAccum(GL_RETURN, 1.0);
- glFlush();
- }
- }
-}
-
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.h b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
deleted file mode 100644
index f4dcddd3250..00000000000
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file GPC_RenderTools.h
- * \ingroup player
- */
-
-#ifndef __GPC_RENDERTOOLS_H__
-#define __GPC_RENDERTOOLS_H__
-
-#ifdef WIN32
-// don't show stl-warnings
-#pragma warning (disable:4786)
-#include <windows.h>
-#endif /* WIN32 */
-
-#include "RAS_IRenderTools.h"
-
-struct KX_ClientObjectInfo;
-class KX_RayCast;
-
-/* BlenderRenderTools are a set of tools to apply 2D/3D graphics effects, which
- * are not part of the (polygon) Rasterizer. Effects like 2D text, 3D (polygon)
- * text, lighting.
- *
- * Most of this code is duplicated in KX_BlenderRenderTools, so this should be
- * moved to some common location to avoid duplication. */
-
-class GPC_RenderTools : public RAS_IRenderTools
-{
- int m_lastlightlayer;
- bool m_lastlighting;
- void *m_lastauxinfo;
- static unsigned int m_numgllights;
-
-// XXX BMF_Font* m_font;
-
-public:
- GPC_RenderTools();
- virtual ~GPC_RenderTools();
-
- void EndFrame(RAS_IRasterizer* rasty);
- void BeginFrame(RAS_IRasterizer* rasty);
-
- void EnableOpenGLLights(RAS_IRasterizer *rasty);
- void DisableOpenGLLights();
- void ProcessLighting(RAS_IRasterizer *rasty, bool uselights, const MT_Transform& viewmat);
-
- void RenderBox2D(int xco,
- int yco,
- int width,
- int height,
- float percentage);
-
- void RenderText3D(int fontid,
- const char* text,
- int size,
- int dpi,
- float* color,
- double* mat,
- float aspect);
- /* \attention mode is ignored here */
- void RenderText2D(RAS_TEXT_RENDER_MODE mode,
- const char* text,
- int xco,
- int yco,
- int width,
- int height);
- void RenderText(int mode,
- class RAS_IPolyMaterial* polymat,
- float v1[3],
- float v2[3],
- float v3[3],
- float v4[3],
- int glattrib);
-
- void applyTransform(RAS_IRasterizer* rasty, double* oglmatrix, int objectdrawmode);
- int applyLights(int objectlayer, const MT_Transform& viewmat);
-
- void PushMatrix();
- void PopMatrix();
-
- bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data);
- bool NeedRayCast(KX_ClientObjectInfo* client) { return true; }
-
- virtual void MotionBlur(RAS_IRasterizer* rasterizer);
-
- virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj);
-};
-
-#endif /* __GPC_RENDERTOOLS_H__ */
diff --git a/source/gameengine/GamePlayer/common/SConscript b/source/gameengine/GamePlayer/common/SConscript
index 85c4b091718..e30c2eb5859 100644
--- a/source/gameengine/GamePlayer/common/SConscript
+++ b/source/gameengine/GamePlayer/common/SConscript
@@ -33,7 +33,6 @@ source_files = [
'GPC_Canvas.cpp',
'GPC_KeyboardDevice.cpp',
'GPC_MouseDevice.cpp',
- 'GPC_RenderTools.cpp',
]
incs = [
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index c74e3daf7b2..d51d0bf5c10 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -86,7 +86,6 @@ extern "C"
#include "NG_LoopBackNetworkDeviceInterface.h"
#include "GPC_MouseDevice.h"
-#include "GPC_RenderTools.h"
#include "GPG_Canvas.h"
#include "GPG_KeyboardDevice.h"
#include "GPG_System.h"
@@ -126,8 +125,7 @@ GPG_Application::GPG_Application(GHOST_ISystem* system)
m_kxsystem(0),
m_keyboard(0),
m_mouse(0),
- m_canvas(0),
- m_rendertools(0),
+ m_canvas(0),
m_rasterizer(0),
m_sceneconverter(0),
m_networkdevice(0),
@@ -591,10 +589,6 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
m_canvas->Init();
if (gm->flag & GAME_SHOW_MOUSE)
m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
-
- m_rendertools = new GPC_RenderTools();
- if (!m_rendertools)
- goto initFailed;
//Don't use displaylists with VBOs
//If auto starts using VBOs, make sure to check for that here
@@ -639,7 +633,6 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
m_ketsjiengine->SetMouseDevice(m_mouse);
m_ketsjiengine->SetNetworkDevice(m_networkdevice);
m_ketsjiengine->SetCanvas(m_canvas);
- m_ketsjiengine->SetRenderTools(m_rendertools);
m_ketsjiengine->SetRasterizer(m_rasterizer);
KX_KetsjiEngine::SetExitKey(ConvertKeyCode(gm->exitkey));
@@ -667,10 +660,8 @@ initFailed:
delete m_mouse;
delete m_keyboard;
delete m_rasterizer;
- delete m_rendertools;
delete m_canvas;
m_canvas = NULL;
- m_rendertools = NULL;
m_rasterizer = NULL;
m_keyboard = NULL;
m_mouse = NULL;
@@ -712,7 +703,7 @@ bool GPG_Application::startEngine(void)
// if (always_use_expand_framing)
// sceneconverter->SetAlwaysUseExpandFraming(true);
- if (m_blendermat && (m_globalSettings->matmode != GAME_MAT_TEXFACE))
+ if (m_blendermat)
m_sceneconverter->SetMaterials(true);
if (m_blenderglslmat && (m_globalSettings->matmode == GAME_MAT_GLSL))
m_sceneconverter->SetGLSLMaterials(true);
@@ -752,7 +743,7 @@ bool GPG_Application::startEngine(void)
#endif
m_sceneconverter->ConvertScene(
startscene,
- m_rendertools,
+ m_rasterizer,
m_canvas);
m_ketsjiengine->AddScene(startscene);
@@ -870,11 +861,6 @@ void GPG_Application::exitEngine()
delete m_rasterizer;
m_rasterizer = 0;
}
- if (m_rendertools)
- {
- delete m_rendertools;
- m_rendertools = 0;
- }
if (m_canvas)
{
delete m_canvas;
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h
index f141443e738..2d21b50e664 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h
@@ -48,7 +48,6 @@ class GHOST_ISystem;
class GHOST_ITimerTask;
class GHOST_IWindow;
class GPC_MouseDevice;
-class GPC_RenderTools;
class GPG_Canvas;
class GPG_KeyboardDevice;
class GPG_System;
@@ -151,8 +150,6 @@ protected:
GPC_MouseDevice* m_mouse;
/** The game engine's canvas abstraction. */
GPG_Canvas* m_canvas;
- /** The game engine's platform dependent render tools. */
- GPC_RenderTools* m_rendertools;
/** the rasterizer */
RAS_IRasterizer* m_rasterizer;
/** Converts Blender data files. */
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 5bed4fa40b6..14b5bca1101 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -40,11 +40,6 @@
#endif /* __alpha__ */
#endif /* __linux__ */
-#ifdef __APPLE__
-// Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh)
-//#include <Carbon/Carbon.h>
-//#include <CFBundle.h>
-#endif // __APPLE__
#include "KX_KetsjiEngine.h"
#include "KX_PythonInit.h"
#include "KX_PythonMain.h"
@@ -88,6 +83,8 @@ extern "C"
#include "BLF_translation.h"
extern int datatoc_bfont_ttf_size;
extern char datatoc_bfont_ttf[];
+extern int datatoc_bmonofont_ttf_size;
+extern char datatoc_bmonofont_ttf[];
#ifdef __cplusplus
}
@@ -424,27 +421,6 @@ int main(int argc, char** argv)
#endif /* __linux__ */
BLI_init_program_path(argv[0]);
BLI_init_temporary_dir(NULL);
-#ifdef __APPLE__
- // Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh)
- /*
- IBNibRef nibRef;
- WindowRef window;
- OSStatus err;
-
- // Create a Nib reference passing the name of the nib file (without the .nib extension)
- // CreateNibReference only searches into the application bundle.
- err = ::CreateNibReference(CFSTR("main"), &nibRef);
- if (err) return -1;
-
- // Once the nib reference is created, set the menu bar. "MainMenu" is the name of the menu bar
- // object. This name is set in InterfaceBuilder when the nib is created.
- err = ::SetMenuBarFromNib(nibRef, CFSTR("MenuBar"));
- if (err) return -1;
-
- // We don't need the nib reference anymore.
- ::DisposeNibReference(nibRef);
- */
-#endif // __APPLE__
// We don't use threads directly in the BGE, but we need to call this so things like
// freeing up GPU_Textures works correctly.
@@ -475,6 +451,8 @@ int main(int argc, char** argv)
BLF_lang_set("");
BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+ if (blf_mono_font == -1)
+ blf_mono_font = BLF_load_mem_unique("monospace", (unsigned char*)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
// Parse command line options
#if defined(DEBUG)
@@ -771,11 +749,6 @@ int main(int argc, char** argv)
if (scr_saver_mode != SCREEN_SAVER_MODE_CONFIGURATION)
#endif
{
-#ifdef __APPLE__
- //SYS_WriteCommandLineInt(syshandle, "show_framerate", 1);
- //SYS_WriteCommandLineInt(syshandle, "nomipmap", 1);
- //fullScreen = false; // Can't use full screen
-#endif
if (SYS_GetCommandLineInt(syshandle, "nomipmap", 0)) {
GPU_set_mipmap(0);
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp
index 6d9b22eed91..a974ffbf672 100644
--- a/source/gameengine/Ketsji/BL_Action.cpp
+++ b/source/gameengine/Ketsji/BL_Action.cpp
@@ -34,6 +34,8 @@
#include "KX_IpoConvert.h"
#include "KX_GameObject.h"
+#include "SG_Controller.h"
+
// These three are for getting the action from the logic manager
#include "KX_Scene.h"
#include "SCA_LogicManager.h"
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt
index 7da63dcc6f4..141dd5e25f3 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -71,7 +71,6 @@ set(SRC
BL_Texture.cpp
KX_ArmatureSensor.cpp
KX_BlenderMaterial.cpp
- KX_BulletPhysicsController.cpp
KX_Camera.cpp
KX_CameraActuator.cpp
KX_CameraIpoSGController.cpp
@@ -86,7 +85,6 @@ set(SRC
KX_GameObject.cpp
KX_IpoConvert.cpp
KX_IPO_SGController.cpp
- KX_IPhysicsController.cpp
KX_IpoActuator.cpp
KX_KetsjiEngine.cpp
KX_Light.cpp
@@ -103,7 +101,6 @@ set(SRC
KX_OrientationInterpolator.cpp
KX_ParentActuator.cpp
KX_PolyProxy.cpp
- KX_PolygonMaterial.cpp
KX_PositionInterpolator.cpp
KX_PyConstraintBinding.cpp
KX_PyMath.cpp
@@ -147,7 +144,6 @@ set(SRC
BL_Texture.h
KX_ArmatureSensor.h
KX_BlenderMaterial.h
- KX_BulletPhysicsController.h
KX_Camera.h
KX_CameraActuator.h
KX_CameraIpoSGController.h
@@ -165,7 +161,6 @@ set(SRC
KX_IpoConvert.h
KX_IPOTransform.h
KX_IPO_SGController.h
- KX_IPhysicsController.h
KX_IScalarInterpolator.h
KX_ISceneConverter.h
KX_ISystem.h
@@ -186,7 +181,6 @@ set(SRC
KX_ParentActuator.h
KX_PhysicsEngineEnums.h
KX_PolyProxy.h
- KX_PolygonMaterial.h
KX_PositionInterpolator.h
KX_PyConstraintBinding.h
KX_PyMath.h
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index e5b8159753b..efaaed7b567 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -129,13 +129,13 @@ KX_BlenderMaterial::~KX_BlenderMaterial()
OnExit();
}
-MTFace* KX_BlenderMaterial::GetMTFace(void) const
+MTFace* KX_BlenderMaterial::GetMTFace() const
{
// fonts on polys
return &mMaterial->tface;
}
-unsigned int* KX_BlenderMaterial::GetMCol(void) const
+unsigned int* KX_BlenderMaterial::GetMCol() const
{
// fonts on polys
return mMaterial->rgb;
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index 0a2675f04a8..b7c64215eaf 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -79,8 +79,8 @@ public:
Material* GetBlenderMaterial() const;
Image* GetBlenderImage() const;
- MTFace* GetMTFace(void) const;
- unsigned int* GetMCol(void) const;
+ MTFace* GetMTFace() const;
+ unsigned int* GetMCol() const;
BL_Texture * getTex (unsigned int idx) {
return (idx < MAXTEX) ? mTextures + idx : NULL;
}
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
deleted file mode 100644
index e990974a646..00000000000
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/Ketsji/KX_BulletPhysicsController.cpp
- * \ingroup ketsji
- */
-
-//under visual studio the #define in KX_ConvertPhysicsObject.h is quicker for recompilation
-#include "KX_ConvertPhysicsObject.h"
-
-#ifdef WITH_BULLET
-
-#include "KX_BulletPhysicsController.h"
-
-#include "btBulletDynamicsCommon.h"
-#include "SG_Spatial.h"
-
-#include "KX_GameObject.h"
-#include "KX_MotionState.h"
-#include "KX_ClientObjectInfo.h"
-
-#include "PHY_IPhysicsEnvironment.h"
-#include "CcdPhysicsEnvironment.h"
-#include "BulletSoftBody/btSoftBody.h"
-
-
-KX_BulletPhysicsController::KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool character, bool compound)
-: KX_IPhysicsController(dyna,sensor,character,compound,(PHY_IPhysicsController*)this),
-CcdPhysicsController(ci),
-m_savedCollisionFlags(0),
-m_savedCollisionFilterGroup(0),
-m_savedCollisionFilterMask(0),
-m_savedMass(0.0),
-m_savedDyna(false),
-m_suspended(false),
-m_bulletChildShape(NULL)
-{
-}
-
-KX_BulletPhysicsController::~KX_BulletPhysicsController ()
-{
- // The game object has a direct link to
- if (m_pObject)
- {
- // If we cheat in SetObject, we must also cheat here otherwise the
- // object will still things it has a physical controller
- // Note that it requires that m_pObject is reset in case the object is deleted
- // before the controller (usual case, see KX_Scene::RemoveNodeDestructObjec)
- // The non usual case is when the object is not deleted because its reference is hanging
- // in a AddObject actuator but the node is deleted. This case is covered here.
- KX_GameObject* gameobj = (KX_GameObject*) m_pObject->GetSGClientObject();
- gameobj->SetPhysicsController(NULL,false);
- }
-}
-
-void KX_BulletPhysicsController::resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ)
-{
- CcdPhysicsController::resolveCombinedVelocities(linvelX,linvelY,linvelZ,angVelX,angVelY,angVelZ);
-
-}
-
-
- ///////////////////////////////////
- // KX_IPhysicsController interface
- ////////////////////////////////////
-
-void KX_BulletPhysicsController::applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse)
-{
- CcdPhysicsController::applyImpulse(attach[0],attach[1],attach[2],impulse[0],impulse[1],impulse[2]);
-
-}
-
-float KX_BulletPhysicsController::GetLinVelocityMin()
-{
- return (float)CcdPhysicsController::GetLinVelocityMin();
-}
-void KX_BulletPhysicsController::SetLinVelocityMin(float val)
-{
- CcdPhysicsController::SetLinVelocityMin(val);
-}
-
-void KX_BulletPhysicsController::Jump()
-{
- CcdPhysicsController::Jump();
-}
-
-float KX_BulletPhysicsController::GetLinVelocityMax()
-{
- return (float)CcdPhysicsController::GetLinVelocityMax();
-}
-void KX_BulletPhysicsController::SetLinVelocityMax(float val)
-{
- CcdPhysicsController::SetLinVelocityMax(val);
-}
-
-void KX_BulletPhysicsController::SetObject (SG_IObject* object)
-{
- SG_Controller::SetObject(object);
-
- // cheating here...
- //should not be necessary, is it for duplicates ?
-
- KX_GameObject* gameobj = (KX_GameObject*) object->GetSGClientObject();
- gameobj->SetPhysicsController(this,gameobj->IsDynamic());
- CcdPhysicsController::setNewClientInfo(gameobj->getClientInfo());
-
- if (m_bSensor)
- {
- // use a different callback function for sensor object,
- // bullet will not synchronize, we must do it explicitly
- SG_Callbacks& callbacks = gameobj->GetSGNode()->GetCallBackFunctions();
- callbacks.m_updatefunc = KX_GameObject::SynchronizeTransformFunc;
- }
-}
-
-MT_Scalar KX_BulletPhysicsController::GetRadius()
-{
- return MT_Scalar(CcdPhysicsController::GetRadius());
-}
-
-void KX_BulletPhysicsController::setMargin (float collisionMargin)
-{
- CcdPhysicsController::SetMargin(collisionMargin);
-}
-void KX_BulletPhysicsController::RelativeTranslate(const MT_Vector3& dloc,bool local)
-{
- CcdPhysicsController::RelativeTranslate(dloc[0],dloc[1],dloc[2],local);
-
-}
-
-void KX_BulletPhysicsController::SetWalkDirection(const MT_Vector3& dloc,bool local)
-{
- CcdPhysicsController::SetWalkDirection(dloc[0],dloc[1],dloc[2],local);
-}
-
-void KX_BulletPhysicsController::RelativeRotate(const MT_Matrix3x3& drot,bool local)
-{
- float rotval[9];
- drot.getValue3x3(rotval);
- CcdPhysicsController::RelativeRotate(rotval,local);
-}
-
-void KX_BulletPhysicsController::ApplyTorque(const MT_Vector3& torque,bool local)
-{
- CcdPhysicsController::ApplyTorque(torque.x(),torque.y(),torque.z(),local);
-}
-void KX_BulletPhysicsController::ApplyForce(const MT_Vector3& force,bool local)
-{
- CcdPhysicsController::ApplyForce(force.x(),force.y(),force.z(),local);
-}
-MT_Vector3 KX_BulletPhysicsController::GetLinearVelocity()
-{
- float angVel[3];
- //CcdPhysicsController::GetAngularVelocity(angVel[0],angVel[1],angVel[2]);
- CcdPhysicsController::GetLinearVelocity(angVel[0],angVel[1],angVel[2]);//rcruiz
- return MT_Vector3(angVel[0],angVel[1],angVel[2]);
-}
-MT_Vector3 KX_BulletPhysicsController::GetAngularVelocity()
-{
- float angVel[3];
- //CcdPhysicsController::GetAngularVelocity(angVel[0],angVel[1],angVel[2]);
- CcdPhysicsController::GetAngularVelocity(angVel[0],angVel[1],angVel[2]);//rcruiz
- return MT_Vector3(angVel[0],angVel[1],angVel[2]);
-}
-MT_Vector3 KX_BulletPhysicsController::GetVelocity(const MT_Point3& pos)
-{
- float linVel[3];
- CcdPhysicsController::GetVelocity(pos[0], pos[1], pos[2], linVel[0],linVel[1],linVel[2]);
- return MT_Vector3(linVel[0],linVel[1],linVel[2]);
-}
-
-MT_Vector3 KX_BulletPhysicsController::GetWalkDirection()
-{
- float dir[3];
- CcdPhysicsController::GetWalkDirection(dir[0], dir[1], dir[2]);
- return MT_Vector3(dir[0], dir[1], dir[2]);
-}
-
-void KX_BulletPhysicsController::SetAngularVelocity(const MT_Vector3& ang_vel,bool local)
-{
- CcdPhysicsController::SetAngularVelocity(ang_vel.x(),ang_vel.y(),ang_vel.z(),local);
-
-}
-void KX_BulletPhysicsController::SetLinearVelocity(const MT_Vector3& lin_vel,bool local)
-{
- CcdPhysicsController::SetLinearVelocity(lin_vel.x(),lin_vel.y(),lin_vel.z(),local);
-}
-void KX_BulletPhysicsController::getOrientation(MT_Quaternion& orn)
-{
- float myorn[4];
- CcdPhysicsController::getOrientation(myorn[0],myorn[1],myorn[2],myorn[3]);
- orn = MT_Quaternion(myorn[0],myorn[1],myorn[2],myorn[3]);
-}
-void KX_BulletPhysicsController::setOrientation(const MT_Matrix3x3& orn)
-{
- btMatrix3x3 btmat(orn[0][0], orn[0][1], orn[0][2], orn[1][0], orn[1][1], orn[1][2], orn[2][0], orn[2][1], orn[2][2]);
- CcdPhysicsController::setWorldOrientation(btmat);
-}
-void KX_BulletPhysicsController::setPosition(const MT_Point3& pos)
-{
- CcdPhysicsController::setPosition(pos.x(),pos.y(),pos.z());
-}
-void KX_BulletPhysicsController::setScaling(const MT_Vector3& scaling)
-{
- CcdPhysicsController::setScaling(scaling.x(),scaling.y(),scaling.z());
-}
-void KX_BulletPhysicsController::SetTransform()
-{
- btVector3 pos;
- btVector3 scale;
- float ori[12];
- m_MotionState->getWorldPosition(pos.m_floats[0],pos.m_floats[1],pos.m_floats[2]);
- m_MotionState->getWorldScaling(scale.m_floats[0],scale.m_floats[1],scale.m_floats[2]);
- m_MotionState->getWorldOrientation(ori);
- btMatrix3x3 rot(ori[0], ori[4], ori[8],
- ori[1], ori[5], ori[9],
- ori[2], ori[6], ori[10]);
- CcdPhysicsController::forceWorldTransform(rot, pos);
-}
-
-MT_Scalar KX_BulletPhysicsController::GetMass()
-{
- if (GetSoftBody())
- return GetSoftBody()->getTotalMass();
-
- MT_Scalar invmass = 0.f;
- if (GetRigidBody())
- invmass = GetRigidBody()->getInvMass();
- if (invmass)
- return 1.f/invmass;
- return 0.f;
-
-}
-
-MT_Vector3 KX_BulletPhysicsController::GetLocalInertia()
-{
- MT_Vector3 inertia(0.f, 0.f, 0.f);
- btVector3 inv_inertia;
- if (GetRigidBody()) {
- inv_inertia = GetRigidBody()->getInvInertiaDiagLocal();
- if (!btFuzzyZero(inv_inertia.getX()) &&
- !btFuzzyZero(inv_inertia.getY()) &&
- !btFuzzyZero(inv_inertia.getZ()))
- inertia = MT_Vector3(1.f/inv_inertia.getX(), 1.f/inv_inertia.getY(), 1.f/inv_inertia.getZ());
- }
- return inertia;
-}
-
-MT_Vector3 KX_BulletPhysicsController::getReactionForce()
-{
- assert(0);
- return MT_Vector3(0.f,0.f,0.f);
-}
-void KX_BulletPhysicsController::setRigidBody(bool rigid)
-{
- CcdPhysicsController::setRigidBody(rigid);
-}
-
-/* This function dynamically adds the collision shape of another controller to
- * the current controller shape provided it is a compound shape.
- * The idea is that dynamic parenting on a compound object will dynamically extend the shape
- */
-void KX_BulletPhysicsController::AddCompoundChild(KX_IPhysicsController* child)
-{
- if (child == NULL || !IsCompound())
- return;
- // other controller must be a bullet controller too
- // verify that body and shape exist and match
- KX_BulletPhysicsController* childCtrl = dynamic_cast<KX_BulletPhysicsController*>(child);
- btRigidBody* rootBody = GetRigidBody();
- btRigidBody* childBody = childCtrl->GetRigidBody();
- if (!rootBody || !childBody)
- return;
- const btCollisionShape* rootShape = rootBody->getCollisionShape();
- const btCollisionShape* childShape = childBody->getCollisionShape();
- if (!rootShape ||
- !childShape ||
- rootShape->getShapeType() != COMPOUND_SHAPE_PROXYTYPE ||
- childShape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE)
- return;
- btCompoundShape* compoundShape = (btCompoundShape*)rootShape;
- // compute relative transformation between parent and child
- btTransform rootTrans;
- btTransform childTrans;
- rootBody->getMotionState()->getWorldTransform(rootTrans);
- childBody->getMotionState()->getWorldTransform(childTrans);
- btVector3 rootScale = rootShape->getLocalScaling();
- rootScale[0] = 1.0/rootScale[0];
- rootScale[1] = 1.0/rootScale[1];
- rootScale[2] = 1.0/rootScale[2];
- // relative scale = child_scale/parent_scale
- btVector3 relativeScale = childShape->getLocalScaling()*rootScale;
- btMatrix3x3 rootRotInverse = rootTrans.getBasis().transpose();
- // relative pos = parent_rot^-1 * ((parent_pos-child_pos)/parent_scale)
- btVector3 relativePos = rootRotInverse*((childTrans.getOrigin()-rootTrans.getOrigin())*rootScale);
- // relative rot = parent_rot^-1 * child_rot
- btMatrix3x3 relativeRot = rootRotInverse*childTrans.getBasis();
- // create a proxy shape info to store the transformation
- CcdShapeConstructionInfo* proxyShapeInfo = new CcdShapeConstructionInfo();
- // store the transformation to this object shapeinfo
- proxyShapeInfo->m_childTrans.setOrigin(relativePos);
- proxyShapeInfo->m_childTrans.setBasis(relativeRot);
- proxyShapeInfo->m_childScale.setValue(relativeScale[0], relativeScale[1], relativeScale[2]);
- // we will need this to make sure that we remove the right proxy later when unparenting
- proxyShapeInfo->m_userData = childCtrl;
- proxyShapeInfo->SetProxy(childCtrl->GetShapeInfo()->AddRef());
- // add to parent compound shapeinfo (increments ref count)
- GetShapeInfo()->AddShape(proxyShapeInfo);
- // create new bullet collision shape from the object shapeinfo and set scaling
- btCollisionShape* newChildShape = proxyShapeInfo->CreateBulletShape(childCtrl->GetMargin(), childCtrl->getConstructionInfo().m_bGimpact, true);
- newChildShape->setLocalScaling(relativeScale);
- // add bullet collision shape to parent compound collision shape
- compoundShape->addChildShape(proxyShapeInfo->m_childTrans,newChildShape);
- // proxyShapeInfo is not needed anymore, release it
- proxyShapeInfo->Release();
- // remember we created this shape
- childCtrl->m_bulletChildShape = newChildShape;
- // recompute inertia of parent
- if (!rootBody->isStaticOrKinematicObject())
- {
- btVector3 localInertia;
- float mass = 1.f/rootBody->getInvMass();
- compoundShape->calculateLocalInertia(mass,localInertia);
- rootBody->setMassProps(mass,localInertia);
- }
- // must update the broadphase cache,
- GetPhysicsEnvironment()->refreshCcdPhysicsController(this);
- // remove the children
- GetPhysicsEnvironment()->disableCcdPhysicsController(childCtrl);
-}
-
-/* Reverse function of the above, it will remove a shape from a compound shape
- * provided that the former was added to the later using AddCompoundChild()
- */
-void KX_BulletPhysicsController::RemoveCompoundChild(KX_IPhysicsController* child)
-{
- if (child == NULL || !IsCompound())
- return;
- // other controller must be a bullet controller too
- // verify that body and shape exist and match
- KX_BulletPhysicsController* childCtrl = dynamic_cast<KX_BulletPhysicsController*>(child);
- btRigidBody* rootBody = GetRigidBody();
- btRigidBody* childBody = childCtrl->GetRigidBody();
- if (!rootBody || !childBody)
- return;
- const btCollisionShape* rootShape = rootBody->getCollisionShape();
- if (!rootShape ||
- rootShape->getShapeType() != COMPOUND_SHAPE_PROXYTYPE)
- return;
- btCompoundShape* compoundShape = (btCompoundShape*)rootShape;
- // retrieve the shapeInfo
- CcdShapeConstructionInfo* childShapeInfo = childCtrl->GetShapeInfo();
- CcdShapeConstructionInfo* rootShapeInfo = GetShapeInfo();
- // and verify that the child is part of the parent
- int i = rootShapeInfo->FindChildShape(childShapeInfo, childCtrl);
- if (i < 0)
- return;
- rootShapeInfo->RemoveChildShape(i);
- if (childCtrl->m_bulletChildShape)
- {
- int numChildren = compoundShape->getNumChildShapes();
- for (i=0; i<numChildren; i++)
- {
- if (compoundShape->getChildShape(i) == childCtrl->m_bulletChildShape)
- {
- compoundShape->removeChildShapeByIndex(i);
- compoundShape->recalculateLocalAabb();
- break;
- }
- }
- delete childCtrl->m_bulletChildShape;
- childCtrl->m_bulletChildShape = NULL;
- }
- // recompute inertia of parent
- if (!rootBody->isStaticOrKinematicObject())
- {
- btVector3 localInertia;
- float mass = 1.f/rootBody->getInvMass();
- compoundShape->calculateLocalInertia(mass,localInertia);
- rootBody->setMassProps(mass,localInertia);
- }
- // must update the broadphase cache,
- GetPhysicsEnvironment()->refreshCcdPhysicsController(this);
- // reactivate the children
- GetPhysicsEnvironment()->enableCcdPhysicsController(childCtrl);
-}
-
-void KX_BulletPhysicsController::SetMass(MT_Scalar newmass)
-{
- btRigidBody *body = GetRigidBody();
- if (body && !m_suspended && newmass>MT_EPSILON && GetMass()>MT_EPSILON)
- {
- btVector3 grav = body->getGravity();
- btVector3 accel = grav / GetMass();
-
- btBroadphaseProxy* handle = body->getBroadphaseHandle();
- GetPhysicsEnvironment()->updateCcdPhysicsController(this,
- newmass,
- body->getCollisionFlags(),
- handle->m_collisionFilterGroup,
- handle->m_collisionFilterMask);
- body->setGravity(accel);
- }
-}
-
-void KX_BulletPhysicsController::SuspendDynamics(bool ghost)
-{
- btRigidBody *body = GetRigidBody();
- if (body && !m_suspended && !IsSensor())
- {
- btBroadphaseProxy* handle = body->getBroadphaseHandle();
- m_savedCollisionFlags = body->getCollisionFlags();
- m_savedMass = GetMass();
- m_savedDyna = m_bDyna;
- m_savedCollisionFilterGroup = handle->m_collisionFilterGroup;
- m_savedCollisionFilterMask = handle->m_collisionFilterMask;
- m_suspended = true;
- GetPhysicsEnvironment()->updateCcdPhysicsController(this,
- 0.0,
- btCollisionObject::CF_STATIC_OBJECT|((ghost)?btCollisionObject::CF_NO_CONTACT_RESPONSE:(m_savedCollisionFlags&btCollisionObject::CF_NO_CONTACT_RESPONSE)),
- btBroadphaseProxy::StaticFilter,
- btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
- m_bDyna = false;
- }
-}
-
-void KX_BulletPhysicsController::RestoreDynamics()
-{
- btRigidBody *body = GetRigidBody();
- if (body && m_suspended)
- {
- // before make sure any position change that was done in this logic frame are accounted for
- SetTransform();
- GetPhysicsEnvironment()->updateCcdPhysicsController(this,
- m_savedMass,
- m_savedCollisionFlags,
- m_savedCollisionFilterGroup,
- m_savedCollisionFilterMask);
- body->activate();
- m_bDyna = m_savedDyna;
- m_suspended = false;
- }
-}
-
-SG_Controller* KX_BulletPhysicsController::GetReplica(class SG_Node* destnode)
-{
- PHY_IMotionState* motionstate = new KX_MotionState(destnode);
-
- KX_BulletPhysicsController* physicsreplica = new KX_BulletPhysicsController(*this);
-
- //parentcontroller is here be able to avoid collisions between parent/child
-
- PHY_IPhysicsController* parentctrl = NULL;
- KX_BulletPhysicsController* parentKxCtrl = NULL;
- CcdPhysicsController* ccdParent = NULL;
-
-
- if (destnode != destnode->GetRootSGParent())
- {
- KX_GameObject* clientgameobj = (KX_GameObject*) destnode->GetRootSGParent()->GetSGClientObject();
- if (clientgameobj)
- {
- parentctrl = (KX_BulletPhysicsController*)clientgameobj->GetPhysicsController();
- } else
- {
- // it could be a false node, try the children
- NodeList::const_iterator childit;
- for (
- childit = destnode->GetSGChildren().begin();
- childit!= destnode->GetSGChildren().end();
- ++childit
- ) {
- KX_GameObject *clientgameobj_child = static_cast<KX_GameObject*>( (*childit)->GetSGClientObject());
- if (clientgameobj_child)
- {
- parentKxCtrl = (KX_BulletPhysicsController*)clientgameobj_child->GetPhysicsController();
- parentctrl = parentKxCtrl;
- ccdParent = parentKxCtrl;
- }
- }
- }
- }
-
- physicsreplica->setParentCtrl(ccdParent);
- physicsreplica->PostProcessReplica(motionstate,parentctrl);
- physicsreplica->m_userdata = (PHY_IPhysicsController*)physicsreplica;
- physicsreplica->m_bulletChildShape = NULL;
- return physicsreplica;
-
-}
-
-
-
-void KX_BulletPhysicsController::SetSumoTransform(bool nondynaonly)
-{
-
- if (!m_bDyna && !m_bSensor && !m_bCharacter)
- {
- btCollisionObject* object = GetRigidBody();
- object->setActivationState(ACTIVE_TAG);
- object->setCollisionFlags(object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);
- } else
- {
- if (!nondynaonly)
- {
- /*
- btTransform worldTrans;
- if (GetRigidBody())
- {
- GetRigidBody()->getMotionState()->getWorldTransform(worldTrans);
- GetRigidBody()->setCenterOfMassTransform(worldTrans);
- }
- */
- /*
- scaling?
- if (m_bDyna)
- {
- m_sumoObj->setScaling(MT_Vector3(1,1,1));
- } else
- {
- MT_Vector3 scale;
- GetWorldScaling(scale);
- m_sumoObj->setScaling(scale);
- }
- */
-
- }
- }
-}
-
-// todo: remove next line !
-void KX_BulletPhysicsController::SetSimulatedTime(double time)
-{
-}
-
-// call from scene graph to update
-bool KX_BulletPhysicsController::Update(double time)
-{
- return false;
-
- // todo: check this code
- //if (GetMass())
- //{
- // return false;//true;
-// }
-// return false;
-}
-
-
-const char* KX_BulletPhysicsController::getName()
-{
- if (m_pObject)
- {
- KX_GameObject* gameobj = (KX_GameObject*) m_pObject->GetSGClientObject();
- return gameobj->GetName();
- }
- return 0;
-}
-
-#endif // WITH_BULLET
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
deleted file mode 100644
index 3d13744567b..00000000000
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h
+++ /dev/null
@@ -1,102 +0,0 @@
-
-/** \file KX_BulletPhysicsController.h
- * \ingroup ketsji
- */
-
-#ifndef __KX_BULLETPHYSICSCONTROLLER_H__
-#define __KX_BULLETPHYSICSCONTROLLER_H__
-
-
-#include "KX_IPhysicsController.h"
-#ifdef WITH_BULLET
-#include "CcdPhysicsController.h"
-#endif
-
-class KX_BulletPhysicsController : public KX_IPhysicsController, public CcdPhysicsController
-{
-private:
- int m_savedCollisionFlags;
- int m_savedActivationState;
- short int m_savedCollisionFilterGroup;
- short int m_savedCollisionFilterMask;
- MT_Scalar m_savedMass;
- bool m_savedDyna;
- bool m_suspended;
- btCollisionShape* m_bulletChildShape;
-
-public:
-#ifdef WITH_BULLET
- KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool character, bool compound);
- virtual ~KX_BulletPhysicsController ();
-#endif
- ///////////////////////////////////
- // KX_IPhysicsController interface
- ////////////////////////////////////
-
- virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse);
- virtual void SetObject (SG_IObject* object);
- virtual void setMargin (float collisionMargin);
- virtual void RelativeTranslate(const MT_Vector3& dloc,bool local);
- virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local);
- virtual void ApplyTorque(const MT_Vector3& torque,bool local);
- virtual void ApplyForce(const MT_Vector3& force,bool local);
- virtual void SetWalkDirection(const MT_Vector3& dir,bool local);
- virtual MT_Vector3 GetLinearVelocity();
- virtual MT_Vector3 GetAngularVelocity();
- virtual MT_Vector3 GetVelocity(const MT_Point3& pos);
- virtual MT_Vector3 GetWalkDirection();
- virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local);
- virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local);
- virtual void Jump();
- virtual void getOrientation(MT_Quaternion& orn);
- virtual void setOrientation(const MT_Matrix3x3& orn);
- virtual void setPosition(const MT_Point3& pos);
- virtual void setScaling(const MT_Vector3& scaling);
- virtual void SetTransform();
- virtual MT_Scalar GetMass();
- virtual void SetMass(MT_Scalar newmass);
- virtual MT_Vector3 GetLocalInertia();
- virtual MT_Vector3 getReactionForce();
- virtual void setRigidBody(bool rigid);
- virtual void AddCompoundChild(KX_IPhysicsController* child);
- virtual void RemoveCompoundChild(KX_IPhysicsController* child);
-
- virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ);
-
- virtual void SuspendDynamics(bool ghost);
- virtual void RestoreDynamics();
-
- virtual SG_Controller* GetReplica(class SG_Node* destnode);
-
- virtual MT_Scalar GetRadius();
-
- virtual float GetLinVelocityMin();
- virtual void SetLinVelocityMin(float val);
- virtual float GetLinVelocityMax();
- virtual void SetLinVelocityMax(float val);
-
- virtual void SetSumoTransform(bool nondynaonly);
- // todo: remove next line !
- virtual void SetSimulatedTime(double time);
-
- // call from scene graph to update
- virtual bool Update(double time);
- void* GetUserData() { return m_userdata;}
-
- virtual const char* getName();
-
- void
- SetOption(
- int option,
- int value
- ) {
- // intentionally empty
- };
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BulletPhysicsController")
-#endif
-};
-
-#endif /* __KX_BULLETPHYSICSCONTROLLER_H__ */
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 73ebf89bea3..4ab768e4240 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -37,6 +37,9 @@
#include "KX_PythonInit.h"
#include "KX_Python.h"
#include "KX_PyMath.h"
+
+#include "RAS_ICanvas.h"
+
KX_Camera::KX_Camera(void* sgReplicationInfo,
SG_Callbacks callbacks,
const RAS_CameraData& camdata,
diff --git a/source/gameengine/Ketsji/KX_CharacterWrapper.cpp b/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
index 899a153d80f..fdf4fa01b03 100644
--- a/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
@@ -34,8 +34,6 @@ KX_CharacterWrapper::KX_CharacterWrapper(PHY_ICharacter* character) :
KX_CharacterWrapper::~KX_CharacterWrapper()
{
- if (m_character)
- delete m_character; // We're responsible for the character object!
}
#ifdef WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
index a3059317d36..0c5e21322df 100644
--- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
@@ -331,7 +331,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame)
{
MT_Point3 topoint = position + (m_maximumBound) * direction;
PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
- KX_IPhysicsController *spc = obj->GetPhysicsController();
+ PHY_IPhysicsController *spc = obj->GetPhysicsController();
if (!pe) {
std::cout << "WARNING: Constraint actuator " << GetName() << ": There is no physics environment!" << std::endl;
@@ -345,7 +345,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame)
parent->Release();
}
}
- KX_RayCast::Callback<KX_ConstraintActuator> callback(this,spc);
+ KX_RayCast::Callback<KX_ConstraintActuator> callback(this,dynamic_cast<PHY_IPhysicsController*>(spc));
result = KX_RayCast::RayTest(pe, position, topoint, callback);
if (result) {
MT_Vector3 newnormal = callback.m_hitNormal;
@@ -379,7 +379,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame)
// logically we should cancel the speed along the ray direction as we set the
// position along that axis
spc = obj->GetPhysicsController();
- if (spc && spc->IsDyna()) {
+ if (spc && spc->IsDynamic()) {
MT_Vector3 linV = spc->GetLinearVelocity();
// cancel the projection along the ray direction
MT_Scalar fallspeed = linV.dot(direction);
@@ -444,20 +444,20 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame)
normal.normalize();
{
PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
- KX_IPhysicsController *spc = obj->GetPhysicsController();
+ PHY_IPhysicsController *spc = obj->GetPhysicsController();
if (!pe) {
std::cout << "WARNING: Constraint actuator " << GetName() << ": There is no physics environment!" << std::endl;
goto CHECK_TIME;
}
- if (!spc || !spc->IsDyna()) {
+ if (!spc || !spc->IsDynamic()) {
// the object is not dynamic, it won't support setting speed
goto CHECK_TIME;
}
m_hitObject = NULL;
// distance of Fh area is stored in m_minimum
MT_Point3 topoint = position + (m_minimumBound+spc->GetRadius()) * direction;
- KX_RayCast::Callback<KX_ConstraintActuator> callback(this,spc);
+ KX_RayCast::Callback<KX_ConstraintActuator> callback(this, spc);
result = KX_RayCast::RayTest(pe, position, topoint, callback);
// we expect a hit object
if (!m_hitObject)
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
index e09449c4f1d..793324fab75 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
@@ -64,7 +64,7 @@ PyObject *KX_ConstraintWrapper::PyGetParam(PyObject *args, PyObject *kwds)
if (!PyArg_ParseTuple(args,"i:getParam",&dof))
return NULL;
- value = m_physenv->getConstraintParam(m_constraintId,dof);
+ value = m_physenv->GetConstraintParam(m_constraintId,dof);
return PyFloat_FromDouble(value);
}
@@ -77,7 +77,7 @@ PyObject *KX_ConstraintWrapper::PySetParam(PyObject *args, PyObject *kwds)
if (!PyArg_ParseTuple(args,"iff:setParam",&dof,&minLimit,&maxLimit))
return NULL;
- m_physenv->setConstraintParam(m_constraintId,dof,minLimit,maxLimit);
+ m_physenv->SetConstraintParam(m_constraintId,dof,minLimit,maxLimit);
Py_RETURN_NONE;
}
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
index ece6abc9447..bde50588fd3 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
@@ -65,7 +65,6 @@ extern "C"{
#include "CcdPhysicsController.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
-#include "KX_BulletPhysicsController.h"
#include "btBulletDynamicsCommon.h"
#ifdef WIN32
@@ -255,7 +254,7 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
{
//find parent, compound shape and add to it
//take relative transform into account!
- KX_BulletPhysicsController* parentCtrl = (KX_BulletPhysicsController*)objprop->m_dynamic_parent->GetPhysicsController();
+ CcdPhysicsController* parentCtrl = (CcdPhysicsController*)objprop->m_dynamic_parent->GetPhysicsController();
assert(parentCtrl);
CcdShapeConstructionInfo* parentShapeInfo = parentCtrl->GetShapeInfo();
btRigidBody* rigidbody = parentCtrl->GetRigidBody();
@@ -424,12 +423,13 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
ci.m_contactProcessingThreshold = objprop->m_contactProcessingThreshold;//todo: expose this in advanced settings, just like margin, default to 10000 or so
ci.m_bSoft = objprop->m_softbody;
+ ci.m_bDyna = isbulletdyna;
ci.m_bSensor = isbulletsensor;
ci.m_bCharacter = isbulletchar;
ci.m_bGimpact = useGimpact;
MT_Vector3 scaling = gameobj->NodeGetWorldScaling();
ci.m_scaling.setValue(scaling[0], scaling[1], scaling[2]);
- KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,isbulletdyna,isbulletsensor,isbulletchar,objprop->m_hasCompoundChildren);
+ CcdPhysicsController* physicscontroller = new CcdPhysicsController(ci);
// shapeInfo is reference counted, decrement now as we don't use it anymore
if (shapeInfo)
shapeInfo->Release();
@@ -438,9 +438,9 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
// don't add automatically sensor object, they are added when a collision sensor is registered
if (!isbulletsensor && objprop->m_in_active_layer)
{
- env->addCcdPhysicsController( physicscontroller);
+ env->AddCcdPhysicsController( physicscontroller);
}
- physicscontroller->setNewClientInfo(gameobj->getClientInfo());
+ physicscontroller->SetNewClientInfo(gameobj->getClientInfo());
{
btRigidBody* rbody = physicscontroller->GetRigidBody();
@@ -459,8 +459,8 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
}
}
- CcdPhysicsController* parentCtrl = objprop->m_dynamic_parent ? (KX_BulletPhysicsController*)objprop->m_dynamic_parent->GetPhysicsController() : 0;
- physicscontroller->setParentCtrl(parentCtrl);
+ CcdPhysicsController* parentCtrl = objprop->m_dynamic_parent ? (CcdPhysicsController*)objprop->m_dynamic_parent->GetPhysicsController() : 0;
+ physicscontroller->SetParentCtrl(parentCtrl);
//Now done directly in ci.m_collisionFlags so that it propagates to replica
@@ -504,13 +504,11 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
}
- gameobj->GetSGNode()->AddSGController(physicscontroller);
STR_String materialname;
if (meshobj)
materialname = meshobj->GetMaterialName(0);
- physicscontroller->SetObject(gameobj->GetSGNode());
#if 0
///test for soft bodies
@@ -546,7 +544,7 @@ void KX_ClearBulletSharedShapes()
*/
bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *from_gameobj, RAS_MeshObject* from_meshobj)
{
- KX_BulletPhysicsController *spc= static_cast<KX_BulletPhysicsController*>((gameobj->GetPhysicsController()));
+ CcdPhysicsController *spc= static_cast<CcdPhysicsController*>(gameobj->GetPhysicsController());
CcdShapeConstructionInfo *shapeInfo;
/* if this is the child of a compound shape this can happen
@@ -568,7 +566,7 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro
shapeInfo->UpdateMesh(from_gameobj, from_meshobj);
/* create the new bullet mesh */
- CcdConstructionInfo& cci = spc->getConstructionInfo();
+ CcdConstructionInfo& cci = spc->GetConstructionInfo();
btCollisionShape* bm= shapeInfo->CreateBulletShape(cci.m_margin, cci.m_bGimpact, !cci.m_bSoft);
spc->ReplaceControllerShape(bm);
diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp
index 85fa0b2b3ce..f87d4799abc 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -48,8 +48,6 @@ KX_Dome::KX_Dome (
RAS_ICanvas* canvas,
/// rasterizer
RAS_IRasterizer* rasterizer,
- /// render tools
- RAS_IRenderTools* rendertools,
/// engine
KX_KetsjiEngine* engine,
@@ -71,7 +69,6 @@ KX_Dome::KX_Dome (
m_tilt(tilt),
m_canvas(canvas),
m_rasterizer(rasterizer),
- m_rendertools(rendertools),
m_engine(engine)
{
warp.usemesh = false;
@@ -2047,6 +2044,6 @@ void KX_Dome::RenderDomeFrame(KX_Scene* scene, KX_Camera* cam, int i)
cam->NodeUpdateGS(0.f);
scene->CalculateVisibleMeshes(m_rasterizer,cam);
- scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
+ scene->RenderBuckets(camtrans, m_rasterizer);
}
diff --git a/source/gameengine/Ketsji/KX_Dome.h b/source/gameengine/Ketsji/KX_Dome.h
index 3bc90bf6c35..a7e798a3944 100644
--- a/source/gameengine/Ketsji/KX_Dome.h
+++ b/source/gameengine/Ketsji/KX_Dome.h
@@ -36,7 +36,6 @@
#include "DNA_screen_types.h"
#include "RAS_ICanvas.h"
#include "RAS_IRasterizer.h"
-#include "RAS_IRenderTools.h"
#include "KX_KetsjiEngine.h"
#include "GL/glew.h"
@@ -62,8 +61,6 @@ public:
KX_Dome (RAS_ICanvas* m_canvas,
/// rasterizer
RAS_IRasterizer* m_rasterizer,
- /// render tools
- RAS_IRenderTools* m_rendertools,
/// engine
KX_KetsjiEngine* m_engine,
diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp
index c6d1041a12a..a0266a54411 100644
--- a/source/gameengine/Ketsji/KX_FontObject.cpp
+++ b/source/gameengine/Ketsji/KX_FontObject.cpp
@@ -31,10 +31,12 @@
#include "KX_FontObject.h"
#include "DNA_curve_types.h"
+#include "DNA_vfont_types.h"
#include "KX_Scene.h"
#include "KX_PythonInit.h"
#include "BLI_math.h"
#include "StringValue.h"
+#include "RAS_IRasterizer.h"
/* paths needed for font load */
#include "BLI_blenlib.h"
@@ -75,14 +77,14 @@ static std::vector<STR_String> split_string(STR_String str)
KX_FontObject::KX_FontObject(void* sgReplicationInfo,
SG_Callbacks callbacks,
- RAS_IRenderTools* rendertools,
+ RAS_IRasterizer* rasterizer,
Object *ob,
bool do_color_management):
KX_GameObject(sgReplicationInfo, callbacks),
m_object(ob),
m_dpi(72),
m_resolution(1.f),
- m_rendertools(rendertools),
+ m_rasterizer(rasterizer),
m_do_color_management(do_color_management)
{
Curve *text = static_cast<Curve *> (ob->data);
@@ -212,7 +214,7 @@ void KX_FontObject::DrawText()
mat[13] -= spacing[1];
mat[14] -= spacing[2];
}
- m_rendertools->RenderText3D(m_fontid, m_text[i], int(size), m_dpi, color, mat, aspect);
+ m_rasterizer->RenderText3D(m_fontid, m_text[i], int(size), m_dpi, color, mat, aspect);
}
}
diff --git a/source/gameengine/Ketsji/KX_FontObject.h b/source/gameengine/Ketsji/KX_FontObject.h
index 3d8c1d99dcc..8b66accb797 100644
--- a/source/gameengine/Ketsji/KX_FontObject.h
+++ b/source/gameengine/Ketsji/KX_FontObject.h
@@ -32,8 +32,6 @@
#ifndef __KX_FONTOBJECT_H__
#define __KX_FONTOBJECT_H__
#include "KX_GameObject.h"
-#include "DNA_vfont_types.h"
-#include "RAS_IRenderTools.h"
class KX_FontObject : public KX_GameObject
{
@@ -41,7 +39,7 @@ public:
Py_Header
KX_FontObject(void* sgReplicationInfo,
SG_Callbacks callbacks,
- RAS_IRenderTools* rendertools,
+ RAS_IRasterizer* rasterizer,
Object *ob,
bool do_color_management);
@@ -68,7 +66,7 @@ protected:
float m_line_spacing;
MT_Vector3 m_offset;
- class RAS_IRenderTools* m_rendertools; //needed for drawing routine
+ class RAS_IRasterizer* m_rasterizer; //needed for drawing routine
bool m_do_color_management;
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index e06f7ab6633..96f76ff21b1 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -55,7 +55,6 @@ typedef unsigned long uint_ptr;
#include "KX_PolyProxy.h"
#include <stdio.h> // printf
#include "SG_Controller.h"
-#include "KX_IPhysicsController.h"
#include "PHY_IGraphicController.h"
#include "SG_Node.h"
#include "SG_Controller.h"
@@ -105,7 +104,7 @@ KX_GameObject::KX_GameObject(
m_bVisible(true),
m_bCulled(true),
m_bOccluder(false),
- m_pPhysicsController1(NULL),
+ m_pPhysicsController(NULL),
m_pGraphicController(NULL),
m_xray(false),
m_pHitObject(NULL),
@@ -177,6 +176,11 @@ KX_GameObject::~KX_GameObject()
delete m_pGraphicController;
}
+ if (m_pPhysicsController)
+ {
+ delete m_pPhysicsController;
+ }
+
if (m_pObstacleSimulation)
{
m_pObstacleSimulation->DestroyObstacleForObj(this);
@@ -245,9 +249,9 @@ void KX_GameObject::SetName(const char *name)
m_name = name;
}
-KX_IPhysicsController* KX_GameObject::GetPhysicsController()
+PHY_IPhysicsController* KX_GameObject::GetPhysicsController()
{
- return m_pPhysicsController1;
+ return m_pPhysicsController;
}
KX_GameObject* KX_GameObject::GetDupliGroupObject()
@@ -333,9 +337,9 @@ void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj, bool addToCom
RemoveParent(scene);
obj->GetSGNode()->AddChild(GetSGNode());
- if (m_pPhysicsController1)
+ if (m_pPhysicsController)
{
- m_pPhysicsController1->SuspendDynamics(ghost);
+ m_pPhysicsController->SuspendDynamics(ghost);
}
// Set us to our new scale, position, and orientation
scale2[0] = 1.0/scale2[0];
@@ -356,16 +360,16 @@ void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj, bool addToCom
Release();
// if the new parent is a compound object, add this object shape to the compound shape.
// step 0: verify this object has physical controller
- if (m_pPhysicsController1 && addToCompound)
+ if (m_pPhysicsController && addToCompound)
{
// step 1: find the top parent (not necessarily obj)
KX_GameObject* rootobj = (KX_GameObject*)obj->GetSGNode()->GetRootSGParent()->GetSGClientObject();
// step 2: verify it has a physical controller and compound shape
if (rootobj != NULL &&
- rootobj->m_pPhysicsController1 != NULL &&
- rootobj->m_pPhysicsController1->IsCompound())
+ rootobj->m_pPhysicsController != NULL &&
+ rootobj->m_pPhysicsController->IsCompound())
{
- rootobj->m_pPhysicsController1->AddCompoundChild(m_pPhysicsController1);
+ rootobj->m_pPhysicsController->AddCompoundChild(m_pPhysicsController);
}
}
// graphically, the object hasn't change place, no need to update m_pGraphicController
@@ -392,27 +396,27 @@ void KX_GameObject::RemoveParent(KX_Scene *scene)
if (!rootlist->SearchValue(this))
// object was not in root list, add it now and increment ref count
rootlist->Add(AddRef());
- if (m_pPhysicsController1)
+ if (m_pPhysicsController)
{
// in case this controller was added as a child shape to the parent
if (rootobj != NULL &&
- rootobj->m_pPhysicsController1 != NULL &&
- rootobj->m_pPhysicsController1->IsCompound())
+ rootobj->m_pPhysicsController != NULL &&
+ rootobj->m_pPhysicsController->IsCompound())
{
- rootobj->m_pPhysicsController1->RemoveCompoundChild(m_pPhysicsController1);
+ rootobj->m_pPhysicsController->RemoveCompoundChild(m_pPhysicsController);
}
- m_pPhysicsController1->RestoreDynamics();
- if (m_pPhysicsController1->IsDyna() && (rootobj != NULL && rootobj->m_pPhysicsController1))
+ m_pPhysicsController->RestoreDynamics();
+ if (m_pPhysicsController->IsDynamic() && (rootobj != NULL && rootobj->m_pPhysicsController))
{
// dynamic object should remember the velocity they had while being parented
MT_Point3 childPoint = GetSGNode()->GetWorldPosition();
MT_Point3 rootPoint = rootobj->GetSGNode()->GetWorldPosition();
MT_Point3 relPoint;
relPoint = (childPoint-rootPoint);
- MT_Vector3 linVel = rootobj->m_pPhysicsController1->GetVelocity(relPoint);
- MT_Vector3 angVel = rootobj->m_pPhysicsController1->GetAngularVelocity();
- m_pPhysicsController1->SetLinearVelocity(linVel, false);
- m_pPhysicsController1->SetAngularVelocity(angVel, false);
+ MT_Vector3 linVel = rootobj->m_pPhysicsController->GetVelocity(relPoint);
+ MT_Vector3 angVel = rootobj->m_pPhysicsController->GetAngularVelocity();
+ m_pPhysicsController->SetLinearVelocity(linVel, false);
+ m_pPhysicsController->SetAngularVelocity(angVel, false);
}
}
// graphically, the object hasn't change place, no need to update m_pGraphicController
@@ -488,9 +492,9 @@ void KX_GameObject::SetTimes(short layer, float start, float end)
void KX_GameObject::ProcessReplica()
{
SCA_IObject::ProcessReplica();
-
- m_pPhysicsController1 = NULL;
+
m_pGraphicController = NULL;
+ m_pPhysicsController = NULL;
m_pSGNode = NULL;
m_pClient_info = new KX_ClientObjectInfo(*m_pClient_info);
m_pClient_info->m_gameobject = this;
@@ -570,16 +574,16 @@ CValue* KX_GameObject::GetReplica()
void KX_GameObject::ApplyForce(const MT_Vector3& force,bool local)
{
- if (m_pPhysicsController1)
- m_pPhysicsController1->ApplyForce(force,local);
+ if (m_pPhysicsController)
+ m_pPhysicsController->ApplyForce(force,local);
}
void KX_GameObject::ApplyTorque(const MT_Vector3& torque,bool local)
{
- if (m_pPhysicsController1)
- m_pPhysicsController1->ApplyTorque(torque,local);
+ if (m_pPhysicsController)
+ m_pPhysicsController->ApplyTorque(torque,local);
}
@@ -588,9 +592,9 @@ void KX_GameObject::ApplyMovement(const MT_Vector3& dloc,bool local)
{
if (GetSGNode())
{
- if (m_pPhysicsController1) // (IsDynamic())
+ if (m_pPhysicsController) // (IsDynamic())
{
- m_pPhysicsController1->RelativeTranslate(dloc,local);
+ m_pPhysicsController->RelativeTranslate(dloc,local);
}
GetSGNode()->RelativeTranslate(dloc,GetSGNode()->GetSGParent(),local);
}
@@ -605,8 +609,8 @@ void KX_GameObject::ApplyRotation(const MT_Vector3& drot,bool local)
if (GetSGNode()) {
GetSGNode()->RelativeRotate(rotmat,local);
- if (m_pPhysicsController1) { // (IsDynamic())
- m_pPhysicsController1->RelativeRotate(rotmat,local);
+ if (m_pPhysicsController) { // (IsDynamic())
+ m_pPhysicsController->RelativeRotate(rotmat,local);
}
}
}
@@ -730,11 +734,8 @@ void KX_GameObject::RemoveMeshes()
void KX_GameObject::UpdateTransform()
{
// HACK: saves function call for dynamic object, they are handled differently
- if (m_pPhysicsController1 && !m_pPhysicsController1->IsDyna())
- // Note that for Bullet, this does not even update the transform of static object
- // but merely sets there collision flag to "kinematic" because the synchronization is
- // done during physics simulation
- m_pPhysicsController1->SetSumoTransform(true);
+ if (m_pPhysicsController && !m_pPhysicsController->IsDynamic())
+ m_pPhysicsController->SetTransform();
if (m_pGraphicController)
// update the culling tree
m_pGraphicController->SetGraphicTransform();
@@ -749,8 +750,8 @@ void KX_GameObject::UpdateTransformFunc(SG_IObject* node, void* gameobj, void* s
void KX_GameObject::SynchronizeTransform()
{
// only used for sensor object, do full synchronization as bullet doesn't do it
- if (m_pPhysicsController1)
- m_pPhysicsController1->SetTransform();
+ if (m_pPhysicsController)
+ m_pPhysicsController->SetTransform();
if (m_pGraphicController)
m_pGraphicController->SetGraphicTransform();
}
@@ -935,10 +936,10 @@ KX_GameObject::GetLayer(
void KX_GameObject::addLinearVelocity(const MT_Vector3& lin_vel,bool local)
{
- if (m_pPhysicsController1)
+ if (m_pPhysicsController)
{
MT_Vector3 lv = local ? NodeGetWorldOrientation() * lin_vel : lin_vel;
- m_pPhysicsController1->SetLinearVelocity(lv + m_pPhysicsController1->GetLinearVelocity(), 0);
+ m_pPhysicsController->SetLinearVelocity(lv + m_pPhysicsController->GetLinearVelocity(), 0);
}
}
@@ -946,16 +947,16 @@ void KX_GameObject::addLinearVelocity(const MT_Vector3& lin_vel,bool local)
void KX_GameObject::setLinearVelocity(const MT_Vector3& lin_vel,bool local)
{
- if (m_pPhysicsController1)
- m_pPhysicsController1->SetLinearVelocity(lin_vel,local);
+ if (m_pPhysicsController)
+ m_pPhysicsController->SetLinearVelocity(lin_vel,local);
}
void KX_GameObject::setAngularVelocity(const MT_Vector3& ang_vel,bool local)
{
- if (m_pPhysicsController1)
- m_pPhysicsController1->SetAngularVelocity(ang_vel,local);
+ if (m_pPhysicsController)
+ m_pPhysicsController->SetAngularVelocity(ang_vel,local);
}
@@ -965,12 +966,12 @@ void KX_GameObject::ResolveCombinedVelocities(
bool lin_vel_local,
bool ang_vel_local
) {
- if (m_pPhysicsController1)
+ if (m_pPhysicsController)
{
MT_Vector3 lv = lin_vel_local ? NodeGetWorldOrientation() * lin_vel : lin_vel;
MT_Vector3 av = ang_vel_local ? NodeGetWorldOrientation() * ang_vel : ang_vel;
- m_pPhysicsController1->resolveCombinedVelocities(
+ m_pPhysicsController->ResolveCombinedVelocities(
lv.x(),lv.y(),lv.z(),av.x(),av.y(),av.z());
}
}
@@ -1082,9 +1083,9 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac)
MT_Scalar KX_GameObject::GetMass()
{
- if (m_pPhysicsController1)
+ if (m_pPhysicsController)
{
- return m_pPhysicsController1->GetMass();
+ return m_pPhysicsController->GetMass();
}
return 0.0;
}
@@ -1092,9 +1093,9 @@ MT_Scalar KX_GameObject::GetMass()
MT_Vector3 KX_GameObject::GetLocalInertia()
{
MT_Vector3 local_inertia(0.0,0.0,0.0);
- if (m_pPhysicsController1)
+ if (m_pPhysicsController)
{
- local_inertia = m_pPhysicsController1->GetLocalInertia();
+ local_inertia = m_pPhysicsController->GetLocalInertia();
}
return local_inertia;
}
@@ -1103,9 +1104,9 @@ MT_Vector3 KX_GameObject::GetLinearVelocity(bool local)
{
MT_Vector3 velocity(0.0,0.0,0.0), locvel;
MT_Matrix3x3 ori;
- if (m_pPhysicsController1)
+ if (m_pPhysicsController)
{
- velocity = m_pPhysicsController1->GetLinearVelocity();
+ velocity = m_pPhysicsController->GetLinearVelocity();
if (local)
{
@@ -1122,9 +1123,9 @@ MT_Vector3 KX_GameObject::GetAngularVelocity(bool local)
{
MT_Vector3 velocity(0.0,0.0,0.0), locvel;
MT_Matrix3x3 ori;
- if (m_pPhysicsController1)
+ if (m_pPhysicsController)
{
- velocity = m_pPhysicsController1->GetAngularVelocity();
+ velocity = m_pPhysicsController->GetAngularVelocity();
if (local)
{
@@ -1139,9 +1140,9 @@ MT_Vector3 KX_GameObject::GetAngularVelocity(bool local)
MT_Vector3 KX_GameObject::GetVelocity(const MT_Point3& point)
{
- if (m_pPhysicsController1)
+ if (m_pPhysicsController)
{
- return m_pPhysicsController1->GetVelocity(point);
+ return m_pPhysicsController->GetVelocity(point);
}
return MT_Vector3(0.0,0.0,0.0);
}
@@ -1154,13 +1155,13 @@ void KX_GameObject::NodeSetLocalPosition(const MT_Point3& trans)
if (!GetSGNode())
return;
- if (m_pPhysicsController1 && !GetSGNode()->GetSGParent())
+ if (m_pPhysicsController && !GetSGNode()->GetSGParent())
{
// don't update physic controller if the object is a child:
// 1) the transformation will not be right
// 2) in this case, the physic controller is necessarily a static object
// that is updated from the normal kinematic synchronization
- m_pPhysicsController1->setPosition(trans);
+ m_pPhysicsController->SetPosition(trans);
}
GetSGNode()->SetLocalPosition(trans);
@@ -1175,10 +1176,10 @@ void KX_GameObject::NodeSetLocalOrientation(const MT_Matrix3x3& rot)
if (!GetSGNode())
return;
- if (m_pPhysicsController1 && !GetSGNode()->GetSGParent())
+ if (m_pPhysicsController && !GetSGNode()->GetSGParent())
{
// see note above
- m_pPhysicsController1->setOrientation(rot);
+ m_pPhysicsController->SetOrientation(rot);
}
GetSGNode()->SetLocalOrientation(rot);
}
@@ -1201,10 +1202,10 @@ void KX_GameObject::NodeSetLocalScale(const MT_Vector3& scale)
if (!GetSGNode())
return;
- if (m_pPhysicsController1 && !GetSGNode()->GetSGParent())
+ if (m_pPhysicsController && !GetSGNode()->GetSGParent())
{
// see note above
- m_pPhysicsController1->setScaling(scale);
+ m_pPhysicsController->SetScaling(scale);
}
GetSGNode()->SetLocalScale(scale);
}
@@ -1216,13 +1217,13 @@ void KX_GameObject::NodeSetRelativeScale(const MT_Vector3& scale)
if (GetSGNode())
{
GetSGNode()->RelativeScale(scale);
- if (m_pPhysicsController1 && (!GetSGNode()->GetSGParent()))
+ if (m_pPhysicsController && (!GetSGNode()->GetSGParent()))
{
// see note above
// we can use the local scale: it's the same thing for a root object
// and the world scale is not yet updated
MT_Vector3 newscale = GetSGNode()->GetLocalScale();
- m_pPhysicsController1->setScaling(newscale);
+ m_pPhysicsController->SetScaling(newscale);
}
}
}
@@ -1355,13 +1356,13 @@ void KX_GameObject::UnregisterCollisionCallbacks()
// Unregister from callbacks
KX_Scene* scene = GetScene();
PHY_IPhysicsEnvironment* pe = scene->GetPhysicsEnvironment();
- PHY_IPhysicsController* spc = static_cast<PHY_IPhysicsController*> (GetPhysicsController()->GetUserData());
+ PHY_IPhysicsController* spc = GetPhysicsController();
// If we are the last to unregister on this physics controller
- if (pe->removeCollisionCallback(spc)){
+ if (pe->RemoveCollisionCallback(spc)){
// If we are a sensor object
if (m_pClient_info->isSensor())
// Remove sensor body from physics world
- pe->removeSensor(spc);
+ pe->RemoveSensor(spc);
}
}
@@ -1375,13 +1376,13 @@ void KX_GameObject::RegisterCollisionCallbacks()
// Register from callbacks
KX_Scene* scene = GetScene();
PHY_IPhysicsEnvironment* pe = scene->GetPhysicsEnvironment();
- PHY_IPhysicsController* spc = static_cast<PHY_IPhysicsController*> (GetPhysicsController()->GetUserData());
+ PHY_IPhysicsController* spc = GetPhysicsController();
// If we are the first to register on this physics controller
- if (pe->requestCollisionCallback(spc)){
+ if (pe->RequestCollisionCallback(spc)){
// If we are a sensor object
if (m_pClient_info->isSensor())
// Add sensor body to physics world
- pe->addSensor(spc);
+ pe->AddSensor(spc);
}
}
void KX_GameObject::RunCollisionCallbacks(KX_GameObject *collider)
@@ -2170,14 +2171,14 @@ PyObject *KX_GameObject::pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF
PyObject *KX_GameObject::pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
- KX_IPhysicsController *spc = self->GetPhysicsController();
+ PHY_IPhysicsController *spc = self->GetPhysicsController();
return PyFloat_FromDouble(spc ? spc->GetMass() : 0.0);
}
int KX_GameObject::pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
- KX_IPhysicsController *spc = self->GetPhysicsController();
+ PHY_IPhysicsController *spc = self->GetPhysicsController();
MT_Scalar val = PyFloat_AsDouble(value);
if (val < 0.0) { /* also accounts for non float */
PyErr_SetString(PyExc_AttributeError, "gameOb.mass = float: KX_GameObject, expected a float zero or above");
@@ -2193,14 +2194,14 @@ int KX_GameObject::pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrd
PyObject *KX_GameObject::pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
- KX_IPhysicsController *spc = self->GetPhysicsController();
+ PHY_IPhysicsController *spc = self->GetPhysicsController();
return PyFloat_FromDouble(spc ? spc->GetLinVelocityMin() : 0.0f);
}
int KX_GameObject::pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
- KX_IPhysicsController *spc = self->GetPhysicsController();
+ PHY_IPhysicsController *spc = self->GetPhysicsController();
MT_Scalar val = PyFloat_AsDouble(value);
if (val < 0.0) { /* also accounts for non float */
PyErr_SetString(PyExc_AttributeError, "gameOb.linVelocityMin = float: KX_GameObject, expected a float zero or above");
@@ -2216,14 +2217,14 @@ int KX_GameObject::pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF
PyObject *KX_GameObject::pyattr_get_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
- KX_IPhysicsController *spc = self->GetPhysicsController();
+ PHY_IPhysicsController *spc = self->GetPhysicsController();
return PyFloat_FromDouble(spc ? spc->GetLinVelocityMax() : 0.0f);
}
int KX_GameObject::pyattr_set_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
- KX_IPhysicsController *spc = self->GetPhysicsController();
+ PHY_IPhysicsController *spc = self->GetPhysicsController();
MT_Scalar val = PyFloat_AsDouble(value);
if (val < 0.0) { /* also accounts for non float */
PyErr_SetString(PyExc_AttributeError, "gameOb.linVelocityMax = float: KX_GameObject, expected a float zero or above");
@@ -2307,8 +2308,8 @@ PyObject *KX_GameObject::pyattr_get_localInertia(void *self_v, const KX_PYATTRIB
return Vector_CreatePyObject_cb(BGE_PROXY_FROM_REF(self_v), 3, mathutils_kxgameob_vector_cb_index, MATHUTILS_VEC_CB_INERTIA_LOCAL);
#else
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
- if (self->GetPhysicsController())
- return PyObjectFrom(self->GetPhysicsController()->GetLocalInertia());
+ if (self->GetPhysicsController1())
+ return PyObjectFrom(self->GetPhysicsController1()->GetLocalInertia());
return Py_BuildValue("fff", 0.0f, 0.0f, 0.0f);
#endif
}
@@ -2854,14 +2855,8 @@ PyObject *KX_GameObject::PyGetVelocity(PyObject *args)
if (!PyArg_ParseTuple(args, "|O:getVelocity", &pypos) || (pypos && !PyVecTo(pypos, point)))
return NULL;
-
- if (m_pPhysicsController1)
- {
- return PyObjectFrom(m_pPhysicsController1->GetVelocity(point));
- }
- else {
- return PyObjectFrom(MT_Vector3(0.0,0.0,0.0));
- }
+
+ return PyObjectFrom(GetVelocity(point));
}
PyObject *KX_GameObject::PyGetReactionForce()
@@ -2870,8 +2865,8 @@ PyObject *KX_GameObject::PyGetReactionForce()
// XXX - Currently not working with bullet intergration, see KX_BulletPhysicsController.cpp's getReactionForce
#if 0
- if (GetPhysicsController())
- return PyObjectFrom(GetPhysicsController()->getReactionForce());
+ if (GetPhysicsController1())
+ return PyObjectFrom(GetPhysicsController1()->getReactionForce());
return PyObjectFrom(dummy_point);
#endif
@@ -2884,7 +2879,7 @@ PyObject *KX_GameObject::PyGetReactionForce()
PyObject *KX_GameObject::PyEnableRigidBody()
{
if (GetPhysicsController())
- GetPhysicsController()->setRigidBody(true);
+ GetPhysicsController()->SetRigidBody(true);
Py_RETURN_NONE;
}
@@ -2894,7 +2889,7 @@ PyObject *KX_GameObject::PyEnableRigidBody()
PyObject *KX_GameObject::PyDisableRigidBody()
{
if (GetPhysicsController())
- GetPhysicsController()->setRigidBody(false);
+ GetPhysicsController()->SetRigidBody(false);
Py_RETURN_NONE;
}
@@ -2935,9 +2930,9 @@ PyObject *KX_GameObject::PySetCollisionMargin(PyObject *value)
return NULL;
}
- if (m_pPhysicsController1)
+ if (m_pPhysicsController)
{
- m_pPhysicsController1->setMargin(collisionMargin);
+ m_pPhysicsController->SetMargin(collisionMargin);
Py_RETURN_NONE;
}
PyErr_SetString(PyExc_RuntimeError, "This object has no physics controller");
@@ -2951,7 +2946,7 @@ PyObject *KX_GameObject::PyApplyImpulse(PyObject *args)
PyObject *pyattach;
PyObject *pyimpulse;
- if (!m_pPhysicsController1) {
+ if (!m_pPhysicsController) {
PyErr_SetString(PyExc_RuntimeError, "This object has no physics controller");
return NULL;
}
@@ -2962,7 +2957,7 @@ PyObject *KX_GameObject::PyApplyImpulse(PyObject *args)
MT_Vector3 impulse;
if (PyVecTo(pyattach, attach) && PyVecTo(pyimpulse, impulse))
{
- m_pPhysicsController1->applyImpulse(attach, impulse);
+ m_pPhysicsController->ApplyImpulse(attach, impulse);
Py_RETURN_NONE;
}
@@ -2975,7 +2970,7 @@ PyObject *KX_GameObject::PyApplyImpulse(PyObject *args)
PyObject *KX_GameObject::PySuspendDynamics()
{
- SuspendDynamics();
+ GetPhysicsController()->SuspendDynamics();
Py_RETURN_NONE;
}
@@ -2983,7 +2978,7 @@ PyObject *KX_GameObject::PySuspendDynamics()
PyObject *KX_GameObject::PyRestoreDynamics()
{
- RestoreDynamics();
+ GetPhysicsController()->RestoreDynamics();
Py_RETURN_NONE;
}
@@ -3023,11 +3018,11 @@ PyObject *KX_GameObject::PyGetAxisVect(PyObject *value)
PyObject *KX_GameObject::PyGetPhysicsId()
{
- KX_IPhysicsController* ctrl = GetPhysicsController();
+ PHY_IPhysicsController* ctrl = GetPhysicsController();
uint_ptr physid=0;
if (ctrl)
{
- physid= (uint_ptr)ctrl->GetUserData();
+ physid= (uint_ptr)ctrl;
}
return PyLong_FromLong((long)physid);
}
@@ -3190,7 +3185,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized();
PHY_IPhysicsEnvironment* pe = GetScene()->GetPhysicsEnvironment();
- KX_IPhysicsController *spc = GetPhysicsController();
+ PHY_IPhysicsController *spc = GetPhysicsController();
KX_GameObject *parent = GetParent();
if (!spc && parent)
spc = parent->GetPhysicsController();
@@ -3336,7 +3331,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
}
PHY_IPhysicsEnvironment* pe = GetScene()->GetPhysicsEnvironment();
- KX_IPhysicsController *spc = GetPhysicsController();
+ PHY_IPhysicsController *spc = GetPhysicsController();
KX_GameObject *parent = GetParent();
if (!spc && parent)
spc = parent->GetPhysicsController();
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index dde3ff53299..55e2b31c5bf 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -49,7 +49,6 @@
#include "CTR_HashedPtr.h"
#include "KX_Scene.h"
#include "KX_KetsjiEngine.h" /* for m_anim_framerate */
-#include "KX_IPhysicsController.h" /* for suspend/resume */
#include "DNA_object_types.h"
#include "SCA_LogicManager.h" /* for ConvertPythonToGameObject to search object names */
@@ -57,9 +56,9 @@
struct KX_ClientObjectInfo;
class KX_RayCast;
class RAS_MeshObject;
-class KX_IPhysicsController;
class PHY_IGraphicController;
class PHY_IPhysicsEnvironment;
+class PHY_IPhysicsController;
class BL_ActionManager;
struct Object;
class KX_ObstacleSimulation;
@@ -107,7 +106,7 @@ protected:
bool m_bCulled;
bool m_bOccluder;
- KX_IPhysicsController* m_pPhysicsController1;
+ PHY_IPhysicsController* m_pPhysicsController;
PHY_IGraphicController* m_pGraphicController;
STR_String m_testPropName;
bool m_xray;
@@ -465,12 +464,12 @@ public:
* \return a pointer to the physics controller owned by this class.
*/
- KX_IPhysicsController* GetPhysicsController();
+ PHY_IPhysicsController* GetPhysicsController();
- void SetPhysicsController(KX_IPhysicsController* physicscontroller,bool isDynamic)
+ void SetPhysicsController(PHY_IPhysicsController* physicscontroller,bool isDynamic)
{
m_bDyna = isDynamic;
- m_pPhysicsController1 = physicscontroller;
+ m_pPhysicsController = physicscontroller;
}
virtual class RAS_Deformer* GetDeformer()
@@ -885,32 +884,6 @@ public:
* Resume making progress
*/
void Resume(void);
-
- void SuspendDynamics(void) {
- if (m_bSuspendDynamics)
- {
- return;
- }
-
- if (m_pPhysicsController1)
- {
- m_pPhysicsController1->SuspendDynamics();
- }
- m_bSuspendDynamics = true;
- }
-
- void RestoreDynamics(void) {
- if (!m_bSuspendDynamics)
- {
- return;
- }
-
- if (m_pPhysicsController1)
- {
- m_pPhysicsController1->RestoreDynamics();
- }
- m_bSuspendDynamics = false;
- }
void RegisterObstacle(KX_ObstacleSimulation* obstacleSimulation)
{
diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
index f221b7c6cd4..f75633659ff 100644
--- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp
+++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
@@ -48,7 +48,7 @@ typedef unsigned long uint_ptr;
#include "KX_IPO_SGController.h"
#include "KX_ScalarInterpolator.h"
#include "KX_GameObject.h"
-#include "KX_IPhysicsController.h"
+#include "PHY_IPhysicsController.h"
#include "DNA_ipo_types.h"
#include "BLI_math.h"
@@ -154,9 +154,10 @@ bool KX_IpoSGController::Update(double currentTime)
{
if (m_game_object && ob && m_game_object->GetPhysicsController())
{
- m_game_object->GetPhysicsController()->ApplyForce(m_ipo_local ?
- ob->GetWorldOrientation() * m_ipo_xform.GetPosition() :
- m_ipo_xform.GetPosition(), false);
+ MT_Vector3 vec = m_ipo_local ?
+ ob->GetWorldOrientation() * m_ipo_xform.GetPosition() :
+ m_ipo_xform.GetPosition();
+ m_game_object->GetPhysicsController()->ApplyForce(vec, false);
}
}
else
diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.cpp b/source/gameengine/Ketsji/KX_IPhysicsController.cpp
deleted file mode 100644
index f0e57ceac02..00000000000
--- a/source/gameengine/Ketsji/KX_IPhysicsController.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/Ketsji/KX_IPhysicsController.cpp
- * \ingroup ketsji
- */
-
-#include "KX_IPhysicsController.h"
-
-#include "PHY_DynamicTypes.h"
-
-KX_IPhysicsController::KX_IPhysicsController(bool dyna, bool sensor, bool character, bool compound, void* userdata)
-
-: m_bDyna(dyna),
- m_bSensor(sensor),
- m_bCharacter(character),
- m_bCompound(compound),
- m_suspendDynamics(false),
- m_userdata(userdata)
-{
-}
-
-KX_IPhysicsController::~KX_IPhysicsController()
-{
-}
diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.h b/source/gameengine/Ketsji/KX_IPhysicsController.h
deleted file mode 100644
index 2019be57679..00000000000
--- a/source/gameengine/Ketsji/KX_IPhysicsController.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file KX_IPhysicsController.h
- * \ingroup ketsji
- */
-
-#ifndef __KX_IPHYSICSCONTROLLER_H__
-#define __KX_IPHYSICSCONTROLLER_H__
-
-#include "SG_Controller.h"
-#include "MT_Vector3.h"
-#include "MT_Point3.h"
-#include "MT_Transform.h"
-#include "MT_Matrix3x3.h"
-
-struct KX_ClientObjectInfo;
-
-/**
- * Physics Controller, a special kind of Scene Graph Transformation Controller.
- * It get's callbacks from Physics in case a transformation change took place.
- * Each time the scene graph get's updated, the controller get's a chance
- * in the 'Update' method to reflect changed.
- */
-
-class KX_IPhysicsController : public SG_Controller
-
-{
-protected:
- bool m_bDyna;
- bool m_bSensor;
- bool m_bCharacter;
- bool m_bCompound;
- bool m_suspendDynamics;
- void* m_userdata;
-public:
- KX_IPhysicsController(bool dyna,bool sensor,bool character,bool compound, void* userdata);
- virtual ~KX_IPhysicsController();
-
-
- virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse)=0;
- virtual void SetObject (SG_IObject* object)=0;
- virtual void setMargin (float collisionMargin)=0;
-
- virtual void RelativeTranslate(const MT_Vector3& dloc,bool local)=0;
- virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local)=0;
- virtual void ApplyTorque(const MT_Vector3& torque,bool local)=0;
- virtual void ApplyForce(const MT_Vector3& force,bool local)=0;
- virtual void SetWalkDirection(const MT_Vector3& dir,bool local)=0;
- virtual MT_Vector3 GetLinearVelocity()=0;
- virtual MT_Vector3 GetAngularVelocity()=0;
- virtual MT_Vector3 GetVelocity(const MT_Point3& pos)=0;
- virtual MT_Vector3 GetWalkDirection()=0;
- virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local)=0;
- virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local)=0;
- virtual void Jump()=0;
- virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) = 0;
-
- virtual void getOrientation(MT_Quaternion& orn)=0;
- virtual void setOrientation(const MT_Matrix3x3& orn)=0;
- virtual void SetTransform()=0;
- //virtual void setOrientation(const MT_Quaternion& orn)=0;
- virtual void setPosition(const MT_Point3& pos)=0;
- virtual void setScaling(const MT_Vector3& scaling)=0;
- virtual MT_Scalar GetMass()=0;
- virtual void SetMass(MT_Scalar newmass)=0;
-
- virtual float GetLinVelocityMin()=0;
- virtual void SetLinVelocityMin(float newmass)=0;
- virtual float GetLinVelocityMax()=0;
- virtual void SetLinVelocityMax(float newmass)=0;
-
- virtual MT_Vector3 GetLocalInertia()=0;
- virtual MT_Vector3 getReactionForce()=0;
- virtual void setRigidBody(bool rigid)=0;
- virtual void AddCompoundChild(KX_IPhysicsController* child) = 0;
- virtual void RemoveCompoundChild(KX_IPhysicsController* child) = 0;
-
- virtual void SuspendDynamics(bool ghost=false)=0;
- virtual void RestoreDynamics()=0;
-
- virtual SG_Controller* GetReplica(class SG_Node* destnode)=0;
-
- void SetDyna(bool isDynamic) {
- m_bDyna = isDynamic;
- }
-
- void SetSensor(bool isSensor) {
- m_bSensor = isSensor;
- }
-
- void SetCharacter(bool isCharacter) {
- m_bCharacter = isCharacter;
- }
-
- bool IsDyna(void) {
- return m_bDyna;
- }
-
- bool IsSensor(void) {
- return m_bSensor;
- }
-
- bool IsCharacter(void) {
- return m_bCharacter;
- }
-
- bool IsCompound(void) {
- return m_bCompound;
- }
-
- virtual MT_Scalar GetRadius()=0;
- virtual void SetSumoTransform(bool nondynaonly)=0;
- // todo: remove next line !
- virtual void SetSimulatedTime(double time)=0;
-
- // call from scene graph to update
- virtual bool Update(double time)=0;
- void* GetUserData() { return m_userdata;}
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_IPhysicsController")
-#endif
-};
-
-#endif /* __KX_IPHYSICSCONTROLLER_H__ */
diff --git a/source/gameengine/Ketsji/KX_ISceneConverter.h b/source/gameengine/Ketsji/KX_ISceneConverter.h
index 616895a8269..a07d4b2195c 100644
--- a/source/gameengine/Ketsji/KX_ISceneConverter.h
+++ b/source/gameengine/Ketsji/KX_ISceneConverter.h
@@ -56,7 +56,7 @@ public:
*/
virtual void ConvertScene(
class KX_Scene* destinationscene,
- class RAS_IRenderTools* rendertools,
+ class RAS_IRasterizer* rendertools,
class RAS_ICanvas* canvas,
bool libloading=false)=0;
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index c685dcfe068..0e9e2cd8328 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -48,7 +48,6 @@
#include "RAS_BucketManager.h"
#include "RAS_Rect.h"
#include "RAS_IRasterizer.h"
-#include "RAS_IRenderTools.h"
#include "RAS_ICanvas.h"
#include "MT_Vector3.h"
#include "MT_Transform.h"
@@ -121,7 +120,6 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
: m_canvas(NULL),
m_rasterizer(NULL),
m_kxsystem(system),
- m_rendertools(NULL),
m_sceneconverter(NULL),
m_networkdevice(NULL),
#ifdef WITH_PYTHON
@@ -237,14 +235,6 @@ void KX_KetsjiEngine::SetCanvas(RAS_ICanvas* canvas)
-void KX_KetsjiEngine::SetRenderTools(RAS_IRenderTools* rendertools)
-{
- MT_assert(rendertools);
- m_rendertools = rendertools;
-}
-
-
-
void KX_KetsjiEngine::SetRasterizer(RAS_IRasterizer* rasterizer)
{
MT_assert(rasterizer);
@@ -278,7 +268,7 @@ void KX_KetsjiEngine::SetSceneConverter(KX_ISceneConverter* sceneconverter)
void KX_KetsjiEngine::InitDome(short res, short mode, short angle, float resbuf, short tilt, struct Text* text)
{
- m_dome = new KX_Dome(m_canvas, m_rasterizer, m_rendertools,this, res, mode, angle, resbuf, tilt, text);
+ m_dome = new KX_Dome(m_canvas, m_rasterizer,this, res, mode, angle, resbuf, tilt, text);
m_usedome = true;
}
@@ -319,7 +309,6 @@ void KX_KetsjiEngine::RenderDome()
scene = *sceneit;
KX_Camera* cam = scene->GetActiveCamera();
- m_rendertools->BeginFrame(m_rasterizer);
// pass the scene's worldsettings to the rasterizer
SetWorldSettings(scene->GetWorldInfo());
@@ -333,7 +322,7 @@ void KX_KetsjiEngine::RenderDome()
if (scene->IsClearingZBuffer())
m_rasterizer->ClearDepthBuffer();
- m_rendertools->SetAuxilaryClientInfo(scene);
+ m_rasterizer->SetAuxilaryClientInfo(scene);
// do the rendering
m_dome->RenderDomeFrame(scene,cam, i);
@@ -351,7 +340,7 @@ void KX_KetsjiEngine::RenderDome()
if (scene->IsClearingZBuffer())
m_rasterizer->ClearDepthBuffer();
- m_rendertools->SetAuxilaryClientInfo(scene);
+ m_rasterizer->SetAuxilaryClientInfo(scene);
// do the rendering
m_dome->RenderDomeFrame(scene, (*it),i);
@@ -362,7 +351,7 @@ void KX_KetsjiEngine::RenderDome()
it++;
}
// Part of PostRenderScene()
- m_rendertools->MotionBlur(m_rasterizer);
+ m_rasterizer->MotionBlur();
scene->Render2DFilters(m_canvas);
// no RunDrawingCallBacks
// no FlushDebugLines
@@ -499,7 +488,6 @@ bool KX_KetsjiEngine::BeginFrame()
ClearFrame();
m_rasterizer->BeginFrame(m_drawingmode , m_kxsystem->GetTimeInSeconds());
- m_rendertools->BeginFrame(m_rasterizer);
return true;
}
@@ -510,7 +498,7 @@ bool KX_KetsjiEngine::BeginFrame()
void KX_KetsjiEngine::EndFrame()
{
- m_rendertools->MotionBlur(m_rasterizer);
+ m_rasterizer->MotionBlur();
// Show profiling info
m_logger->StartLog(tc_overhead, m_kxsystem->GetTimeInSeconds(), true);
@@ -546,9 +534,6 @@ void KX_KetsjiEngine::EndFrame()
m_logger->StartLog(tc_latency, m_kxsystem->GetTimeInSeconds(), true);
m_rasterizer->SwapBuffers();
m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true);
-
- m_rendertools->EndFrame(m_rasterizer);
-
m_canvas->EndDraw();
}
@@ -661,7 +646,7 @@ bool KX_KetsjiEngine::NextFrame()
#endif
KX_SetActiveScene(scene);
- scene->GetPhysicsEnvironment()->endFrame();
+ scene->GetPhysicsEnvironment()->EndFrame();
// Update scenegraph after physics step. This maps physics calculations
// into node positions.
@@ -703,11 +688,11 @@ bool KX_KetsjiEngine::NextFrame()
m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true);
SG_SetActiveStage(SG_STAGE_PHYSICS2);
- scene->GetPhysicsEnvironment()->beginFrame();
+ scene->GetPhysicsEnvironment()->BeginFrame();
// Perform physics calculations on the scene. This can involve
// many iterations of the physics solver.
- scene->GetPhysicsEnvironment()->proceedDeltaTime(m_frameTime,timestep,framestep);//m_deltatimerealDeltaTime);
+ scene->GetPhysicsEnvironment()->ProceedDeltaTime(m_frameTime,timestep,framestep);//m_deltatimerealDeltaTime);
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
SG_SetActiveStage(SG_STAGE_PHYSICS2_UPDATE);
@@ -777,7 +762,7 @@ bool KX_KetsjiEngine::NextFrame()
// Perform physics calculations on the scene. This can involve
// many iterations of the physics solver.
m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true);
- scene->GetPhysicsEnvironment()->proceedDeltaTime(m_clockTime,timestep,timestep);
+ scene->GetPhysicsEnvironment()->ProceedDeltaTime(m_clockTime,timestep,timestep);
// Update scenegraph after physics step. This maps physics calculations
// into node positions.
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
@@ -905,7 +890,7 @@ void KX_KetsjiEngine::Render()
if (scene->IsClearingZBuffer())
m_rasterizer->ClearDepthBuffer();
- m_rendertools->SetAuxilaryClientInfo(scene);
+ m_rasterizer->SetAuxilaryClientInfo(scene);
// do the rendering
RenderFrame(scene, cam);
@@ -921,7 +906,7 @@ void KX_KetsjiEngine::Render()
if (scene->IsClearingZBuffer())
m_rasterizer->ClearDepthBuffer();
- m_rendertools->SetAuxilaryClientInfo(scene);
+ m_rasterizer->SetAuxilaryClientInfo(scene);
// do the rendering
RenderFrame(scene, (*it));
@@ -954,7 +939,7 @@ void KX_KetsjiEngine::Render()
m_rasterizer->ClearDepthBuffer();
//pass the scene, for picking and raycasting (shadows)
- m_rendertools->SetAuxilaryClientInfo(scene);
+ m_rasterizer->SetAuxilaryClientInfo(scene);
// do the rendering
//RenderFrame(scene);
@@ -970,7 +955,7 @@ void KX_KetsjiEngine::Render()
if (scene->IsClearingZBuffer())
m_rasterizer->ClearDepthBuffer();
- m_rendertools->SetAuxilaryClientInfo(scene);
+ m_rasterizer->SetAuxilaryClientInfo(scene);
// do the rendering
RenderFrame(scene, (*it));
@@ -1172,7 +1157,7 @@ void KX_KetsjiEngine::RenderShadowBuffers(KX_Scene *scene)
CListValue *lightlist = scene->GetLightList();
int i, drawmode;
- m_rendertools->SetAuxilaryClientInfo(scene);
+ m_rasterizer->SetAuxilaryClientInfo(scene);
for (i=0; i<lightlist->GetCount(); i++) {
KX_GameObject *gameobj = (KX_GameObject*)lightlist->GetValue(i);
@@ -1202,7 +1187,7 @@ void KX_KetsjiEngine::RenderShadowBuffers(KX_Scene *scene)
/* render */
m_rasterizer->ClearDepthBuffer();
m_rasterizer->ClearColorBuffer();
- scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
+ scene->RenderBuckets(camtrans, m_rasterizer);
/* unbind framebuffer object, restore drawmode, free camera */
light->UnbindShadowBuffer(m_rasterizer);
@@ -1338,13 +1323,13 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam)
scene->RunDrawingCallbacks(scene->GetPreDrawCB());
#endif
- scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
+ scene->RenderBuckets(camtrans, m_rasterizer);
//render all the font objects for this scene
scene->RenderFonts();
if (scene->GetPhysicsEnvironment())
- scene->GetPhysicsEnvironment()->debugDrawWorld();
+ scene->GetPhysicsEnvironment()->DebugDrawWorld();
}
/*
@@ -1475,7 +1460,7 @@ void KX_KetsjiEngine::RenderDebugProperties()
if (m_show_framerate || m_show_profile) {
/* Title for profiling("Profile") */
- m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
+ m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED,
"Profile",
xcoord + const_xindent + title_xmargin, // Adds the constant x indent (0 for now) to the title x margin
ycoord,
@@ -1490,7 +1475,7 @@ void KX_KetsjiEngine::RenderDebugProperties()
/* Framerate display */
if (m_show_framerate) {
- m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
+ m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED,
"Frametime :",
xcoord + const_xindent,
ycoord,
@@ -1498,7 +1483,7 @@ void KX_KetsjiEngine::RenderDebugProperties()
m_canvas->GetHeight() /* RdV, TODO ?? */);
debugtxt.Format("%5.1fms (%.1ffps)", tottime * 1000.f, 1.0/tottime);
- m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
+ m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED,
debugtxt.ReadPtr(),
xcoord + const_xindent + profile_indent,
ycoord,
@@ -1511,7 +1496,7 @@ void KX_KetsjiEngine::RenderDebugProperties()
/* Profile display */
if (m_show_profile) {
for (int j = tc_first; j < tc_numCategories; j++) {
- m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
+ m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED,
m_profileLabels[j],
xcoord + const_xindent,
ycoord,
@@ -1521,13 +1506,13 @@ void KX_KetsjiEngine::RenderDebugProperties()
double time = m_logger->GetAverage((KX_TimeCategory)j);
debugtxt.Format("%5.2fms | %d%%", time*1000.f, (int)(time/tottime * 100.f));
- m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
+ m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED,
debugtxt.ReadPtr(),
xcoord + const_xindent + profile_indent, ycoord,
m_canvas->GetWidth(),
m_canvas->GetHeight());
- m_rendertools->RenderBox2D(xcoord + (int)(2.2 * profile_indent), ycoord, m_canvas->GetWidth(), m_canvas->GetHeight(), time/tottime);
+ m_rasterizer->RenderBox2D(xcoord + (int)(2.2 * profile_indent), ycoord, m_canvas->GetWidth(), m_canvas->GetHeight(), time/tottime);
ycoord += const_ysize;
}
}
@@ -1538,7 +1523,7 @@ void KX_KetsjiEngine::RenderDebugProperties()
if (m_show_debug_properties) {
/* Title for debugging("Debug properties") */
- m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
+ m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED,
"Debug Properties",
xcoord + const_xindent + title_xmargin, // Adds the constant x indent (0 for now) to the title x margin
ycoord,
@@ -1584,7 +1569,7 @@ void KX_KetsjiEngine::RenderDebugProperties()
first = false;
}
}
- m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
+ m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED,
debugtxt.ReadPtr(),
xcoord + const_xindent,
ycoord,
@@ -1597,7 +1582,7 @@ void KX_KetsjiEngine::RenderDebugProperties()
if (propval) {
STR_String text = propval->GetText();
debugtxt = objname + ": '" + propname + "' = " + text;
- m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
+ m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED,
debugtxt.ReadPtr(),
xcoord + const_xindent,
ycoord,
@@ -1704,7 +1689,7 @@ KX_Scene* KX_KetsjiEngine::CreateScene(Scene *scene, bool libloading)
m_canvas);
m_sceneconverter->ConvertScene(tmpscene,
- m_rendertools,
+ m_rasterizer,
m_canvas,
libloading);
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index d5d7262a418..e7fb250c2d9 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -74,7 +74,6 @@ private:
class RAS_ICanvas* m_canvas; // 2D Canvas (2D Rendering Device Context)
class RAS_IRasterizer* m_rasterizer; // 3D Rasterizer (3D Rendering)
class KX_ISystem* m_kxsystem;
- class RAS_IRenderTools* m_rendertools;
class KX_ISceneConverter* m_sceneconverter;
class NG_NetworkDeviceInterface* m_networkdevice;
#ifdef WITH_PYTHON
@@ -217,7 +216,6 @@ public:
void SetMouseDevice(SCA_IInputDevice* mousedevice);
void SetNetworkDevice(NG_NetworkDeviceInterface* networkdevice);
void SetCanvas(RAS_ICanvas* canvas);
- void SetRenderTools(RAS_IRenderTools* rendertools);
void SetRasterizer(RAS_IRasterizer* rasterizer);
#ifdef WITH_PYTHON
void SetPyNamespace(PyObject *pythondictionary);
@@ -229,7 +227,6 @@ public:
RAS_IRasterizer* GetRasterizer() { return m_rasterizer; }
RAS_ICanvas* GetCanvas() { return m_canvas; }
- RAS_IRenderTools* GetRenderTools() { return m_rendertools; }
SCA_IInputDevice* GetKeyboardDevice() { return m_keyboarddevice; }
SCA_IInputDevice* GetMouseDevice() { return m_mousedevice; }
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index 0e4db0d351e..4567c17cc3e 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -40,7 +40,7 @@
#include "KX_Light.h"
#include "KX_Camera.h"
#include "RAS_IRasterizer.h"
-#include "RAS_IRenderTools.h"
+#include "RAS_ICanvas.h"
#include "KX_PyMath.h"
@@ -53,16 +53,16 @@
#include "MEM_guardedalloc.h"
KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,
- class RAS_IRenderTools* rendertools,
+ RAS_IRasterizer* rasterizer,
const RAS_LightObject& lightobj,
bool glsl)
: KX_GameObject(sgReplicationInfo,callbacks),
- m_rendertools(rendertools)
+ m_rasterizer(rasterizer)
{
m_lightobj = lightobj;
m_lightobj.m_scene = sgReplicationInfo;
m_lightobj.m_light = this;
- m_rendertools->AddLight(&m_lightobj);
+ m_rasterizer->AddLight(&m_lightobj);
m_glsl = glsl;
m_blenderscene = ((KX_Scene*)sgReplicationInfo)->GetBlenderScene();
m_base = NULL;
@@ -81,7 +81,7 @@ KX_LightObject::~KX_LightObject()
GPU_lamp_update_spot(lamp, la->spotsize, la->spotblend);
}
- m_rendertools->RemoveLight(&m_lightobj);
+ m_rasterizer->RemoveLight(&m_lightobj);
if (m_base) {
BKE_scene_base_unlink(m_blenderscene, m_base);
@@ -98,7 +98,7 @@ CValue* KX_LightObject::GetReplica()
replica->ProcessReplica();
replica->m_lightobj.m_light = replica;
- m_rendertools->AddLight(&replica->m_lightobj);
+ m_rasterizer->AddLight(&replica->m_lightobj);
return replica;
}
diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h
index 43421a3faf3..4f11c535cf0 100644
--- a/source/gameengine/Ketsji/KX_Light.h
+++ b/source/gameengine/Ketsji/KX_Light.h
@@ -40,7 +40,6 @@ struct Scene;
struct Base;
class KX_Camera;
class RAS_IRasterizer;
-class RAS_IRenderTools;
class MT_Transform;
class KX_LightObject : public KX_GameObject
@@ -48,13 +47,13 @@ class KX_LightObject : public KX_GameObject
Py_Header
protected:
RAS_LightObject m_lightobj;
- class RAS_IRenderTools* m_rendertools; //needed for registering and replication of lightobj
+ class RAS_IRasterizer* m_rasterizer; //needed for registering and replication of lightobj
bool m_glsl;
Scene* m_blenderscene;
Base* m_base;
public:
- KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,class RAS_IRenderTools* rendertools,const struct RAS_LightObject& lightobj, bool glsl);
+ KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,RAS_IRasterizer* rasterizer,const RAS_LightObject& lightobj, bool glsl);
virtual ~KX_LightObject();
virtual CValue* GetReplica();
RAS_LightObject* GetLightData() { return &m_lightobj;}
@@ -66,8 +65,8 @@ public:
struct GPULamp *GetGPULamp();
bool HasShadowBuffer();
int GetShadowLayer();
- void BindShadowBuffer(class RAS_IRasterizer *ras, class RAS_ICanvas *canvas, class KX_Camera *cam, class MT_Transform& camtrans);
- void UnbindShadowBuffer(class RAS_IRasterizer *ras);
+ void BindShadowBuffer(RAS_IRasterizer *ras, class RAS_ICanvas *canvas, class KX_Camera *cam, class MT_Transform& camtrans);
+ void UnbindShadowBuffer(RAS_IRasterizer *ras);
struct Image *GetTextureImage(short texslot);
void Update();
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index 2a9d59e8b7b..c288c647fa2 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -39,7 +39,6 @@
#include "KX_VertexProxy.h"
#include "KX_PolyProxy.h"
-#include "KX_PolygonMaterial.h"
#include "KX_BlenderMaterial.h"
#include "KX_PyMath.h"
@@ -388,14 +387,8 @@ PyObject *KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_
for (i=0; i<tot; mit++, i++) {
RAS_IPolyMaterial *polymat = mit->m_bucket->GetPolyMaterial();
- if (polymat->GetFlag() & RAS_BLENDERMAT) {
- KX_BlenderMaterial *mat = static_cast<KX_BlenderMaterial *>(polymat);
- PyList_SET_ITEM(materials, i, mat->GetProxy());
- }
- else {
- KX_PolygonMaterial *mat = static_cast<KX_PolygonMaterial *>(polymat);
- PyList_SET_ITEM(materials, i, mat->GetProxy());
- }
+ KX_BlenderMaterial *mat = static_cast<KX_BlenderMaterial *>(polymat);
+ PyList_SET_ITEM(materials, i, mat->GetProxy());
}
return materials;
}
diff --git a/source/gameengine/Ketsji/KX_MotionState.cpp b/source/gameengine/Ketsji/KX_MotionState.cpp
index 3ca01e7af74..4728f71a6ea 100644
--- a/source/gameengine/Ketsji/KX_MotionState.cpp
+++ b/source/gameengine/Ketsji/KX_MotionState.cpp
@@ -41,7 +41,7 @@ KX_MotionState::~KX_MotionState()
{
}
-void KX_MotionState::getWorldPosition(float& posX,float& posY,float& posZ)
+void KX_MotionState::GetWorldPosition(float& posX,float& posY,float& posZ)
{
const MT_Point3& pos = m_node->GetWorldPosition();
posX = pos[0];
@@ -49,7 +49,7 @@ void KX_MotionState::getWorldPosition(float& posX,float& posY,float& posZ)
posZ = pos[2];
}
-void KX_MotionState::getWorldScaling(float& scaleX,float& scaleY,float& scaleZ)
+void KX_MotionState::GetWorldScaling(float& scaleX,float& scaleY,float& scaleZ)
{
const MT_Vector3& scale = m_node->GetWorldScaling();
scaleX = scale[0];
@@ -57,7 +57,7 @@ void KX_MotionState::getWorldScaling(float& scaleX,float& scaleY,float& scaleZ)
scaleZ = scale[2];
}
-void KX_MotionState::getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal)
+void KX_MotionState::GetWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal)
{
MT_Quaternion orn = m_node->GetWorldOrientation().getRotation();
quatIma0 = orn[0];
@@ -66,24 +66,24 @@ void KX_MotionState::getWorldOrientation(float& quatIma0,float& quatIma1,float&
quatReal = orn[3];
}
-void KX_MotionState::getWorldOrientation(float* ori)
+void KX_MotionState::GetWorldOrientation(float* ori)
{
const MT_Matrix3x3& mat = m_node->GetWorldOrientation();
mat.getValue(ori);
}
-void KX_MotionState::setWorldOrientation(const float* ori)
+void KX_MotionState::SetWorldOrientation(const float* ori)
{
m_node->SetLocalOrientation(ori);
}
-void KX_MotionState::setWorldPosition(float posX,float posY,float posZ)
+void KX_MotionState::SetWorldPosition(float posX,float posY,float posZ)
{
m_node->SetLocalPosition(MT_Point3(posX,posY,posZ));
//m_node->SetWorldPosition(MT_Point3(posX,posY,posZ));
}
-void KX_MotionState::setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)
+void KX_MotionState::SetWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)
{
MT_Quaternion orn;
orn[0] = quatIma0;
@@ -96,7 +96,7 @@ void KX_MotionState::setWorldOrientation(float quatIma0,float quatIma1,float qua
}
-void KX_MotionState::calculateWorldTransformations()
+void KX_MotionState::CalculateWorldTransformations()
{
//Not needed, will be done in KX_Scene::UpdateParents() after the physics simulation
//bool parentUpdated = false;
diff --git a/source/gameengine/Ketsji/KX_MotionState.h b/source/gameengine/Ketsji/KX_MotionState.h
index 116e62f408f..38046fe4ff9 100644
--- a/source/gameengine/Ketsji/KX_MotionState.h
+++ b/source/gameengine/Ketsji/KX_MotionState.h
@@ -46,15 +46,15 @@ public:
KX_MotionState(class SG_Spatial* spatial);
virtual ~KX_MotionState();
- virtual void getWorldPosition(float& posX,float& posY,float& posZ);
- virtual void getWorldScaling(float& scaleX,float& scaleY,float& scaleZ);
- virtual void getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal);
- virtual void setWorldPosition(float posX,float posY,float posZ);
- virtual void setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal);
- virtual void getWorldOrientation(float* ori);
- virtual void setWorldOrientation(const float* ori);
+ virtual void GetWorldPosition(float& posX,float& posY,float& posZ);
+ virtual void GetWorldScaling(float& scaleX,float& scaleY,float& scaleZ);
+ virtual void GetWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal);
+ virtual void SetWorldPosition(float posX,float posY,float posZ);
+ virtual void SetWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal);
+ virtual void GetWorldOrientation(float* ori);
+ virtual void SetWorldOrientation(const float* ori);
- virtual void calculateWorldTransformations();
+ virtual void CalculateWorldTransformations();
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
index 82ae8c13633..2dbafdad3d9 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
@@ -47,7 +47,6 @@
#include "KX_PyMath.h"
#include "KX_RayCast.h"
-#include "KX_IPhysicsController.h"
#include "PHY_IPhysicsController.h"
#include "PHY_IPhysicsEnvironment.h"
@@ -280,7 +279,7 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam)
/* 2. Get the object from PhysicsEnvironment */
/* Shoot! Beware that the first argument here is an
* ignore-object. We don't ignore anything... */
- KX_IPhysicsController* physics_controller = cam->GetPhysicsController();
+ PHY_IPhysicsController* physics_controller = cam->GetPhysicsController();
PHY_IPhysicsEnvironment* physics_environment = m_kxscene->GetPhysicsEnvironment();
// get UV mapping
diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
index e45346db9c7..42f62886ff7 100644
--- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp
+++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
@@ -30,6 +30,7 @@
#include "BLI_math_vector.h"
#include "KX_NavMeshObject.h"
#include "RAS_MeshObject.h"
+#include "RAS_Polygon.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -126,7 +127,7 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts,
MEM_SAFE_FREE(dtrisToTrisMap);
MEM_SAFE_FREE(trisToFacesMap);
- unsigned short *verticesMap = new unsigned short[nAllVerts];
+ unsigned short *verticesMap = (unsigned short *)MEM_mallocN(sizeof(*verticesMap) * nAllVerts, __func__);
memset(verticesMap, 0xff, sizeof(*verticesMap) * nAllVerts);
int curIdx = 0;
//vertices - mesh verts
@@ -215,6 +216,8 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts,
}
MEM_SAFE_FREE(allVerts);
+
+ MEM_freeN(verticesMap);
}
else
{
diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp
index cbb4e77d165..6459f35192d 100644
--- a/source/gameengine/Ketsji/KX_NearSensor.cpp
+++ b/source/gameengine/Ketsji/KX_NearSensor.cpp
@@ -68,7 +68,7 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr,
if (m_physCtrl)
{
m_physCtrl->SetMargin(m_Margin);
- m_physCtrl->setNewClientInfo(m_client_info);
+ m_physCtrl->SetNewClientInfo(m_client_info);
}
SynchronizeTransform();
}
@@ -84,8 +84,8 @@ void KX_NearSensor::SynchronizeTransform()
const MT_Point3& pos = parent->NodeGetWorldPosition();
float ori[12];
parent->NodeGetWorldOrientation().getValue(ori);
- motionState->setWorldPosition(pos[0], pos[1], pos[2]);
- motionState->setWorldOrientation(ori);
+ motionState->SetWorldPosition(pos[0], pos[1], pos[2]);
+ motionState->SetWorldOrientation(ori);
m_physCtrl->WriteMotionStateToDynamics(true);
}
}
@@ -105,12 +105,12 @@ void KX_NearSensor::ProcessReplica()
if (m_physCtrl)
{
- m_physCtrl = m_physCtrl->GetReplica();
+ m_physCtrl = m_physCtrl->GetReplicaForSensors();
if (m_physCtrl)
{
//static_cast<KX_TouchEventManager*>(m_eventmgr)->GetPhysicsEnvironment()->addSensor(replica->m_physCtrl);
m_physCtrl->SetMargin(m_Margin);
- m_physCtrl->setNewClientInfo(m_client_info);
+ m_physCtrl->SetNewClientInfo(m_client_info);
}
}
@@ -186,7 +186,7 @@ bool KX_NearSensor::BroadPhaseFilterCollision(void*obj1,void*obj2)
// need the mapping from PHY_IPhysicsController to gameobjects now
assert(obj1==m_physCtrl && obj2);
- KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*>((static_cast<PHY_IPhysicsController*>(obj2))->getNewClientInfo());
+ KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*>((static_cast<PHY_IPhysicsController*>(obj2))->GetNewClientInfo());
KX_GameObject* gameobj = ( client_info ?
client_info->m_gameobject :
@@ -216,8 +216,8 @@ bool KX_NearSensor::NewHandleCollision(void *obj1, void *obj2, const PHY_CollDat
// need the mapping from PHY_IPhysicsController to gameobjects now
KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*> (obj1 == m_physCtrl?
- ((PHY_IPhysicsController*)obj2)->getNewClientInfo() :
- ((PHY_IPhysicsController*)obj1)->getNewClientInfo());
+ ((PHY_IPhysicsController*)obj2)->GetNewClientInfo() :
+ ((PHY_IPhysicsController*)obj1)->GetNewClientInfo());
KX_GameObject* gameobj = ( client_info ?
client_info->m_gameobject :
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index 2965faba8f4..2f85453dd23 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -36,7 +36,9 @@
#include "KX_ObjectActuator.h"
#include "KX_GameObject.h"
#include "KX_PyMath.h" // For PyVecTo - should this include be put in PyObjectPlus?
-#include "KX_IPhysicsController.h"
+#include "PHY_IPhysicsController.h"
+#include "PHY_ICharacter.h"
+#include "PHY_IPhysicsEnvironment.h"
/* ------------------------------------------------------------------------- */
/* Native functions */
@@ -84,8 +86,9 @@ KX_ObjectActuator(
if (m_bitLocalFlag.CharacterMotion)
{
KX_GameObject *parent = static_cast<KX_GameObject *>(GetParent());
+ PHY_ICharacter *character = parent->GetScene()->GetPhysicsEnvironment()->GetCharacterController(parent);
- if (!parent->GetPhysicsController() || !parent->GetPhysicsController()->IsCharacter())
+ if (!character)
{
printf("Character motion enabled on non-character object (%s), falling back to simple motion.\n", parent->GetName().Ptr());
m_bitLocalFlag.CharacterMotion = false;
@@ -109,6 +112,7 @@ bool KX_ObjectActuator::Update()
RemoveAllEvents();
KX_GameObject *parent = static_cast<KX_GameObject *>(GetParent());
+ PHY_ICharacter *character = parent->GetScene()->GetPhysicsEnvironment()->GetCharacterController(parent);
if (bNegativeEvent) {
// If we previously set the linear velocity we now have to inform
@@ -128,8 +132,7 @@ bool KX_ObjectActuator::Update()
// Explicitly stop the movement if we're using character motion
if (m_bitLocalFlag.CharacterMotion) {
- MT_Vector3 vec(0.0, 0.0, 0.0);
- parent->GetPhysicsController()->SetWalkDirection(vec, true);
+ character->SetWalkDirection(MT_Vector3 (0.0, 0.0, 0.0));
}
m_linear_damping_active = false;
@@ -220,7 +223,7 @@ bool KX_ObjectActuator::Update()
MT_Vector3 dir = m_dloc;
if (m_bitLocalFlag.AddOrSetCharLoc) {
- MT_Vector3 old_dir = parent->GetPhysicsController()->GetWalkDirection();
+ MT_Vector3 old_dir = character->GetWalkDirection();
if (!old_dir.fuzzyZero()) {
MT_Scalar mag = old_dir.length();
@@ -232,7 +235,12 @@ bool KX_ObjectActuator::Update()
}
// We always want to set the walk direction since a walk direction of (0, 0, 0) should stop the character
- parent->GetPhysicsController()->SetWalkDirection(dir, (m_bitLocalFlag.DLoc) != 0);
+ if (m_bitLocalFlag.DLoc)
+ {
+ MT_Matrix3x3 basis = parent->GetPhysicsController()->GetOrientation();
+ dir = basis*dir;
+ }
+ character->SetWalkDirection(dir/parent->GetScene()->GetPhysicsEnvironment()->GetNumTimeSubSteps());
if (!m_bitLocalFlag.ZeroDRot)
{
@@ -240,7 +248,8 @@ bool KX_ObjectActuator::Update()
}
if (m_bitLocalFlag.CharacterJump)
{
- parent->GetPhysicsController()->Jump();
+
+ character->Jump();
}
}
else {
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp
index 83092c7d89c..ccc10eb06e3 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.cpp
+++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp
@@ -35,8 +35,8 @@
#include "KX_PolyProxy.h"
#include "KX_MeshProxy.h"
#include "RAS_MeshObject.h"
+#include "RAS_Polygon.h"
#include "KX_BlenderMaterial.h"
-#include "KX_PolygonMaterial.h"
#include "KX_PyMath.h"
@@ -259,16 +259,8 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterial,
"getMaterial() : returns a material\n")
{
RAS_IPolyMaterial *polymat = m_polygon->GetMaterial()->GetPolyMaterial();
- if (polymat->GetFlag() & RAS_BLENDERMAT)
- {
- KX_BlenderMaterial* mat = static_cast<KX_BlenderMaterial*>(polymat);
- return mat->GetProxy();
- }
- else
- {
- KX_PolygonMaterial* mat = static_cast<KX_PolygonMaterial*>(polymat);
- return mat->GetProxy();
- }
+ KX_BlenderMaterial* mat = static_cast<KX_BlenderMaterial*>(polymat);
+ return mat->GetProxy();
}
#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
deleted file mode 100644
index 0f53c510cf7..00000000000
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/Ketsji/KX_PolygonMaterial.cpp
- * \ingroup ketsji
- */
-
-
-#include <stddef.h>
-
-#include "KX_PolygonMaterial.h"
-
-#include "BKE_mesh.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-
-#include "DNA_material_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_image_types.h"
-#include "DNA_meshdata_types.h"
-
-#include "IMB_imbuf_types.h"
-
-#include "GPU_draw.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "RAS_LightObject.h"
-#include "RAS_MaterialBucket.h"
-
-#include "KX_PyMath.h"
-
-#define KX_POLYGONMATERIAL_CAPSULE_ID "KX_POLYGONMATERIAL_PTR"
-
-KX_PolygonMaterial::KX_PolygonMaterial()
- : PyObjectPlus(),
- RAS_IPolyMaterial(),
-
- m_material(NULL),
-#ifdef WITH_PYTHON
- m_pymaterial(NULL),
-#endif
- m_pass(0)
-{
- memset(&m_tface, 0, sizeof(m_tface));
- memset(&m_mcol, 0, sizeof(m_mcol));
-}
-
-void KX_PolygonMaterial::Initialize(
- const STR_String &texname,
- Material* ma,
- int materialindex,
- int tile,
- int tilexrep,
- int tileyrep,
- int alphablend,
- bool alpha,
- bool zsort,
- bool light,
- int lightlayer,
- struct MTFace* tface,
- unsigned int* mcol)
-{
- RAS_IPolyMaterial::Initialize(
- texname,
- ma?ma->id.name:"",
- materialindex,
- tile,
- tilexrep,
- tileyrep,
- alphablend,
- alpha,
- zsort,
- light,
- (texname && texname != ""?true:false), /* if we have a texture we have image */
- ma?&ma->game:NULL);
-
- if (tface) {
- m_tface = *tface;
- }
- else {
- memset(&m_tface, 0, sizeof(m_tface));
- }
- if (mcol) {
- m_mcol = *mcol;
- }
- else {
- memset(&m_mcol, 0, sizeof(m_mcol));
- }
-
- m_material = ma;
-#ifdef WITH_PYTHON
- m_pymaterial = 0;
-#endif
- m_pass = 0;
-}
-
-KX_PolygonMaterial::~KX_PolygonMaterial()
-{
-#ifdef WITH_PYTHON
- if (m_pymaterial)
- {
- Py_DECREF(m_pymaterial);
- }
-#endif // WITH_PYTHON
-}
-
-Image *KX_PolygonMaterial::GetBlenderImage() const
-{
- return m_tface.tpage;
-}
-
-bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const
-{
- bool dopass = false;
-
-#ifdef WITH_PYTHON
- if (m_pymaterial)
- {
- PyObject *pyRasty = PyCapsule_New((void*)rasty, KX_POLYGONMATERIAL_CAPSULE_ID, NULL); /* new reference */
- PyObject *pyCachingInfo = PyCapsule_New((void*) &cachingInfo, KX_POLYGONMATERIAL_CAPSULE_ID, NULL); /* new reference */
- PyObject *ret = PyObject_CallMethod(m_pymaterial, (char *)"activate", (char *)"(NNO)", pyRasty, pyCachingInfo, (PyObject *) this->m_proxy);
- if (ret)
- {
- bool value = PyLong_AsLong(ret);
- Py_DECREF(ret);
- dopass = value;
- }
- else
- {
- PyErr_Print();
- PyErr_Clear();
- PySys_SetObject("last_traceback", NULL);
- }
- }
- else
-#endif // WITH_PYTHON
- {
- switch (m_pass++)
- {
- case 0:
- DefaultActivate(rasty, cachingInfo);
- dopass = true;
- break;
- default:
- m_pass = 0;
- dopass = false;
- break;
- }
- }
-
- return dopass;
-}
-
-void KX_PolygonMaterial::DefaultActivate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const
-{
- if (GetCachingInfo() != cachingInfo)
- {
- if (!cachingInfo)
- GPU_set_tpage(NULL, 0, 0);
-
- cachingInfo = GetCachingInfo();
-
- if ((m_drawingmode & RAS_IRasterizer::KX_TEX)&& (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED))
- {
- Image *ima = m_tface.tpage;
- GPU_update_image_time(ima, rasty->GetTime());
- GPU_set_tpage(&m_tface, 1, m_alphablend);
- }
- else
- GPU_set_tpage(NULL, 0, 0);
-
- if (m_drawingmode & RAS_IRasterizer::KX_BACKCULL)
- rasty->SetCullFace(true);
- else
- rasty->SetCullFace(false);
-
- if ((m_drawingmode & RAS_IRasterizer::KX_LINES) ||
- (rasty->GetDrawingMode() <= RAS_IRasterizer::KX_WIREFRAME))
- rasty->SetLines(true);
- else
- rasty->SetLines(false);
- rasty->SetSpecularity(m_specular[0],m_specular[1],m_specular[2],m_specularity);
- rasty->SetShinyness(m_shininess);
- rasty->SetDiffuse(m_diffuse[0], m_diffuse[1],m_diffuse[2], 1.0);
- if (m_material)
- rasty->SetPolygonOffset(-m_material->zoffs, 0.0);
- }
-
- //rasty->SetSpecularity(m_specular[0],m_specular[1],m_specular[2],m_specularity);
- //rasty->SetShinyness(m_shininess);
- //rasty->SetDiffuse(m_diffuse[0], m_diffuse[1],m_diffuse[2], 1.0);
- //if (m_material)
- // rasty->SetPolygonOffset(-m_material->zoffs, 0.0);
-}
-
-void KX_PolygonMaterial::GetMaterialRGBAColor(unsigned char *rgba) const
-{
- if (m_material) {
- *rgba++ = (unsigned char) (m_material->r*255.0);
- *rgba++ = (unsigned char) (m_material->g*255.0);
- *rgba++ = (unsigned char) (m_material->b*255.0);
- *rgba++ = (unsigned char) (m_material->alpha*255.0);
- } else
- RAS_IPolyMaterial::GetMaterialRGBAColor(rgba);
-}
-
-#ifdef WITH_PYTHON
-
-//----------------------------------------------------------------------------
-//Python
-
-
-PyMethodDef KX_PolygonMaterial::Methods[] = {
- KX_PYMETHODTABLE(KX_PolygonMaterial, setCustomMaterial),
- KX_PYMETHODTABLE(KX_PolygonMaterial, updateTexture),
- KX_PYMETHODTABLE(KX_PolygonMaterial, setTexture),
- KX_PYMETHODTABLE(KX_PolygonMaterial, activate),
-// KX_PYMETHODTABLE(KX_PolygonMaterial, setPerPixelLights),
-
- {NULL,NULL} //Sentinel
-};
-
-PyAttributeDef KX_PolygonMaterial::Attributes[] = {
- KX_PYATTRIBUTE_RO_FUNCTION("texture", KX_PolygonMaterial, pyattr_get_texture),
- KX_PYATTRIBUTE_RO_FUNCTION("material", KX_PolygonMaterial, pyattr_get_material), /* should probably be .name ? */
-
- KX_PYATTRIBUTE_INT_RW("tile", INT_MIN, INT_MAX, true, KX_PolygonMaterial, m_tile),
- KX_PYATTRIBUTE_INT_RW("tilexrep", INT_MIN, INT_MAX, true, KX_PolygonMaterial, m_tilexrep),
- KX_PYATTRIBUTE_INT_RW("tileyrep", INT_MIN, INT_MAX, true, KX_PolygonMaterial, m_tileyrep),
- KX_PYATTRIBUTE_INT_RW("drawingmode", INT_MIN, INT_MAX, true, KX_PolygonMaterial, m_drawingmode),
- //KX_PYATTRIBUTE_INT_RW("lightlayer", INT_MIN, INT_MAX, true, KX_PolygonMaterial, m_lightlayer),
-
- KX_PYATTRIBUTE_BOOL_RW("transparent", KX_PolygonMaterial, m_alpha),
- KX_PYATTRIBUTE_BOOL_RW("zsort", KX_PolygonMaterial, m_zsort),
-
- KX_PYATTRIBUTE_FLOAT_RW("shininess", 0.0f, 1000.0f, KX_PolygonMaterial, m_shininess),
- KX_PYATTRIBUTE_FLOAT_RW("specularity", 0.0f, 1000.0f, KX_PolygonMaterial, m_specularity),
-
- KX_PYATTRIBUTE_RW_FUNCTION("diffuse", KX_PolygonMaterial, pyattr_get_diffuse, pyattr_set_diffuse),
- KX_PYATTRIBUTE_RW_FUNCTION("specular",KX_PolygonMaterial, pyattr_get_specular, pyattr_set_specular),
-
- KX_PYATTRIBUTE_RO_FUNCTION("tface", KX_PolygonMaterial, pyattr_get_tface), /* How the heck is this even useful??? - Campbell */
- KX_PYATTRIBUTE_RO_FUNCTION("gl_texture", KX_PolygonMaterial, pyattr_get_gl_texture), /* could be called 'bindcode' */
- { NULL } //Sentinel
-};
-
-PyTypeObject KX_PolygonMaterial::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "KX_PolygonMaterial",
- sizeof(PyObjectPlus_Proxy),
- 0,
- py_base_dealloc,
- 0,
- 0,
- 0,
- 0,
- py_base_repr,
- 0,0,0,0,0,0,0,0,0,
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- 0,0,0,0,0,0,0,
- Methods,
- 0,
- 0,
- &PyObjectPlus::Type,
- 0,0,0,0,0,0,
- py_base_new
-};
-
-KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setCustomMaterial, "setCustomMaterial(material)")
-{
- PyObject *material;
- if (PyArg_ParseTuple(args, "O:setCustomMaterial", &material))
- {
- if (m_pymaterial) {
- Py_DECREF(m_pymaterial);
- }
- m_pymaterial = material;
- Py_INCREF(m_pymaterial);
- Py_RETURN_NONE;
- }
-
- return NULL;
-}
-
-KX_PYMETHODDEF_DOC(KX_PolygonMaterial, updateTexture, "updateTexture(tface, rasty)")
-{
- PyObject *pyrasty, *pytface;
- if (PyArg_ParseTuple(args, "O!O!:updateTexture", &PyCapsule_Type, &pytface, &PyCapsule_Type, &pyrasty))
- {
- MTFace *tface = (MTFace*) PyCapsule_GetPointer(pytface, KX_POLYGONMATERIAL_CAPSULE_ID);
- RAS_IRasterizer *rasty = (RAS_IRasterizer*) PyCapsule_GetPointer(pyrasty, KX_POLYGONMATERIAL_CAPSULE_ID);
- Image *ima = (Image*)tface->tpage;
- GPU_update_image_time(ima, rasty->GetTime());
-
- Py_RETURN_NONE;
- }
-
- return NULL;
-}
-
-KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setTexture, "setTexture(tface)")
-{
- PyObject *pytface;
- if (PyArg_ParseTuple(args, "O!:setTexture", &PyCapsule_Type, &pytface))
- {
- MTFace *tface = (MTFace*) PyCapsule_GetPointer(pytface, KX_POLYGONMATERIAL_CAPSULE_ID);
- GPU_set_tpage(tface, 1, m_alphablend);
- Py_RETURN_NONE;
- }
-
- return NULL;
-}
-
-KX_PYMETHODDEF_DOC(KX_PolygonMaterial, activate, "activate(rasty, cachingInfo)")
-{
- PyObject *pyrasty, *pyCachingInfo;
- if (PyArg_ParseTuple(args, "O!O!:activate", &PyCapsule_Type, &pyrasty, &PyCapsule_Type, &pyCachingInfo))
- {
- RAS_IRasterizer *rasty = static_cast<RAS_IRasterizer*>(PyCapsule_GetPointer(pyrasty, KX_POLYGONMATERIAL_CAPSULE_ID));
- TCachingInfo *cachingInfo = static_cast<TCachingInfo*>(PyCapsule_GetPointer(pyCachingInfo, KX_POLYGONMATERIAL_CAPSULE_ID));
- if (rasty && cachingInfo)
- {
- DefaultActivate(rasty, *cachingInfo);
- Py_RETURN_NONE;
- }
- }
-
- return NULL;
-}
-
-PyObject *KX_PolygonMaterial::pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
- return PyUnicode_From_STR_String(self->m_texturename);
-}
-
-PyObject *KX_PolygonMaterial::pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
- return PyUnicode_From_STR_String(self->m_materialname);
-}
-
-/* this does not seem useful */
-PyObject *KX_PolygonMaterial::pyattr_get_tface(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
- return PyCapsule_New(&self->m_tface, KX_POLYGONMATERIAL_CAPSULE_ID, NULL);
-}
-
-PyObject *KX_PolygonMaterial::pyattr_get_gl_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
- int bindcode= 0;
- if (self->m_tface.tpage)
- bindcode= self->m_tface.tpage->bindcode;
-
- return PyLong_FromLong(bindcode);
-}
-
-
-PyObject *KX_PolygonMaterial::pyattr_get_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
- return PyObjectFrom(self->m_diffuse);
-}
-
-int KX_PolygonMaterial::pyattr_set_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
-{
- KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
- MT_Vector3 vec;
-
- if (!PyVecTo(value, vec))
- return PY_SET_ATTR_FAIL;
-
- self->m_diffuse= vec;
- return PY_SET_ATTR_SUCCESS;
-}
-
-PyObject *KX_PolygonMaterial::pyattr_get_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
- return PyObjectFrom(self->m_specular);
-}
-
-int KX_PolygonMaterial::pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
-{
- KX_PolygonMaterial* self = static_cast<KX_PolygonMaterial*>(self_v);
- MT_Vector3 vec;
-
- if (!PyVecTo(value, vec))
- return PY_SET_ATTR_FAIL;
-
- self->m_specular= vec;
- return PY_SET_ATTR_SUCCESS;
-}
-
-#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h
deleted file mode 100644
index 89bfb4ff9fb..00000000000
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file KX_PolygonMaterial.h
- * \ingroup ketsji
- */
-
-#ifndef __KX_POLYGONMATERIAL_H__
-#define __KX_POLYGONMATERIAL_H__
-
-#include "PyObjectPlus.h"
-
-#include "RAS_MaterialBucket.h"
-#include "RAS_IRasterizer.h"
-#include "DNA_ID.h"
-#include "DNA_meshdata_types.h"
-
-#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
-#endif
-
-struct MTFace;
-struct Material;
-struct MTex;
-struct Image;
-
-/**
- * Material class.
- *
- * This holds the shader, textures and python methods for setting the render state before
- * rendering.
- */
-class KX_PolygonMaterial : public PyObjectPlus, public RAS_IPolyMaterial
-{
- Py_Header
-private:
- /** Blender texture face structure. */
- mutable MTFace m_tface;
- mutable unsigned int m_mcol;
- Material* m_material;
-
-#ifdef WITH_PYTHON
- PyObject* m_pymaterial;
-#endif
-
- mutable int m_pass;
-public:
-
- KX_PolygonMaterial();
- void Initialize(const STR_String &texname,
- Material* ma,
- int materialindex,
- int tile,
- int tilexrep,
- int tileyrep,
- int alphablend,
- bool alpha,
- bool zsort,
- bool light,
- int lightlayer,
- struct MTFace* tface,
- unsigned int* mcol);
-
- virtual ~KX_PolygonMaterial();
-
- /**
- * Returns the caching information for this material,
- * This can be used to speed up the rasterizing process.
- * \return The caching information.
- */
- virtual TCachingInfo GetCachingInfo(void) const
- {
- return (void*) this;
- }
-
- /**
- * Activates the material in the (OpenGL) rasterizer.
- * On entry, the cachingInfo contains info about the last activated material.
- * On exit, the cachingInfo should contain updated info about this material.
- * \param rasty The rasterizer in which the material should be active.
- * \param cachingInfo The information about the material used to speed up rasterizing.
- */
- void DefaultActivate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const;
- virtual bool Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const;
-
- Material *GetBlenderMaterial() const
- {
- return m_material;
- }
-
- Image *GetBlenderImage() const;
-
- /**
- * Returns the Blender texture face structure that is used for this material.
- * \return The material's texture face.
- */
- MTFace* GetMTFace(void) const
- {
- return &m_tface;
- }
-
- unsigned int* GetMCol(void) const
- {
- return &m_mcol;
- }
- virtual void GetMaterialRGBAColor(unsigned char *rgba) const;
-
-#ifdef WITH_PYTHON
- KX_PYMETHOD_DOC(KX_PolygonMaterial, updateTexture);
- KX_PYMETHOD_DOC(KX_PolygonMaterial, setTexture);
- KX_PYMETHOD_DOC(KX_PolygonMaterial, activate);
-
- KX_PYMETHOD_DOC(KX_PolygonMaterial, setCustomMaterial);
- KX_PYMETHOD_DOC(KX_PolygonMaterial, loadProgram);
-
- virtual PyObject *py_repr(void) { return PyUnicode_FromString(m_material ? ((ID *)m_material)->name+2 : ""); }
-
- static PyObject* pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-
- static PyObject* pyattr_get_tface(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static PyObject* pyattr_get_gl_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-
- static PyObject* pyattr_get_diffuse(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static int pyattr_set_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
- static PyObject* pyattr_get_specular(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
- static int pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-#endif
-
-};
-
-#endif /* __KX_POLYGONMATERIAL_H__ */
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index 2e9b988dff1..e9843b0af5b 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -100,7 +100,7 @@ static PyObject *gPySetGravity(PyObject *self,
if (PyArg_ParseTuple(args,"fff",&x,&y,&z))
{
if (PHY_GetActiveEnvironment())
- PHY_GetActiveEnvironment()->setGravity(x,y,z);
+ PHY_GetActiveEnvironment()->SetGravity(x,y,z);
}
else {
return NULL;
@@ -118,7 +118,7 @@ static PyObject *gPySetDebugMode(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setDebugMode(mode);
+ PHY_GetActiveEnvironment()->SetDebugMode(mode);
}
@@ -141,7 +141,7 @@ static PyObject *gPySetNumTimeSubSteps(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setNumTimeSubSteps(substep);
+ PHY_GetActiveEnvironment()->SetNumTimeSubSteps(substep);
}
}
else {
@@ -160,7 +160,7 @@ static PyObject *gPySetNumIterations(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setNumIterations(iter);
+ PHY_GetActiveEnvironment()->SetNumIterations(iter);
}
}
else {
@@ -179,7 +179,7 @@ static PyObject *gPySetDeactivationTime(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setDeactivationTime(deactive_time);
+ PHY_GetActiveEnvironment()->SetDeactivationTime(deactive_time);
}
}
else {
@@ -198,7 +198,7 @@ static PyObject *gPySetDeactivationLinearTreshold(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setDeactivationLinearTreshold( linearDeactivationTreshold);
+ PHY_GetActiveEnvironment()->SetDeactivationLinearTreshold( linearDeactivationTreshold);
}
}
else {
@@ -217,7 +217,7 @@ static PyObject *gPySetDeactivationAngularTreshold(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setDeactivationAngularTreshold( angularDeactivationTreshold);
+ PHY_GetActiveEnvironment()->SetDeactivationAngularTreshold( angularDeactivationTreshold);
}
}
else {
@@ -235,7 +235,7 @@ static PyObject *gPySetContactBreakingTreshold(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setContactBreakingTreshold( contactBreakingTreshold);
+ PHY_GetActiveEnvironment()->SetContactBreakingTreshold( contactBreakingTreshold);
}
}
else {
@@ -254,7 +254,7 @@ static PyObject *gPySetCcdMode(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setCcdMode( ccdMode);
+ PHY_GetActiveEnvironment()->SetCcdMode( ccdMode);
}
}
else {
@@ -272,7 +272,7 @@ static PyObject *gPySetSorConstant(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setSolverSorConstant( sor);
+ PHY_GetActiveEnvironment()->SetSolverSorConstant( sor);
}
}
else {
@@ -290,7 +290,7 @@ static PyObject *gPySetSolverTau(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setSolverTau( tau);
+ PHY_GetActiveEnvironment()->SetSolverTau( tau);
}
}
else {
@@ -309,7 +309,7 @@ static PyObject *gPySetSolverDamping(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setSolverDamping( damping);
+ PHY_GetActiveEnvironment()->SetSolverDamping( damping);
}
}
else {
@@ -327,7 +327,7 @@ static PyObject *gPySetLinearAirDamping(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setLinearAirDamping( damping);
+ PHY_GetActiveEnvironment()->SetLinearAirDamping( damping);
}
}
else {
@@ -346,7 +346,7 @@ static PyObject *gPySetUseEpa(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setUseEpa(epa);
+ PHY_GetActiveEnvironment()->SetUseEpa(epa);
}
}
else {
@@ -363,7 +363,7 @@ static PyObject *gPySetSolverType(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->setSolverType(solverType);
+ PHY_GetActiveEnvironment()->SetSolverType(solverType);
}
}
else {
@@ -389,7 +389,7 @@ static PyObject *gPyGetVehicleConstraint(PyObject *self,
if (PHY_GetActiveEnvironment())
{
- PHY_IVehicle* vehicle = PHY_GetActiveEnvironment()->getVehicleConstraint(constraintid);
+ PHY_IVehicle* vehicle = PHY_GetActiveEnvironment()->GetVehicleConstraint(constraintid);
if (vehicle)
{
KX_VehicleWrapper* pyWrapper = new KX_VehicleWrapper(vehicle,PHY_GetActiveEnvironment());
@@ -421,7 +421,7 @@ static PyObject* gPyGetCharacter(PyObject* self,
if (PHY_GetActiveEnvironment())
{
- PHY_ICharacter* character= PHY_GetActiveEnvironment()->getCharacterController(ob);
+ PHY_ICharacter* character= PHY_GetActiveEnvironment()->GetCharacterController(ob);
if (character)
{
KX_CharacterWrapper* pyWrapper = new KX_CharacterWrapper(character);
@@ -523,14 +523,14 @@ static PyObject *gPyCreateConstraint(PyObject *self,
MT_Vector3 axis1 = localCFrame.getColumn(1);
MT_Vector3 axis2 = localCFrame.getColumn(2);
- constraintid = PHY_GetActiveEnvironment()->createConstraint(physctrl,physctrl2,(enum PHY_ConstraintType)constrainttype,
+ constraintid = PHY_GetActiveEnvironment()->CreateConstraint(physctrl,physctrl2,(enum PHY_ConstraintType)constrainttype,
pivotX,pivotY,pivotZ,
(float)axis0.x(),(float)axis0.y(),(float)axis0.z(),
(float)axis1.x(),(float)axis1.y(),(float)axis1.z(),
(float)axis2.x(),(float)axis2.y(),(float)axis2.z(),flag);
}
else {
- constraintid = PHY_GetActiveEnvironment()->createConstraint(physctrl,physctrl2,(enum PHY_ConstraintType)constrainttype,pivotX,pivotY,pivotZ,axisX,axisY,axisZ,0);
+ constraintid = PHY_GetActiveEnvironment()->CreateConstraint(physctrl,physctrl2,(enum PHY_ConstraintType)constrainttype,pivotX,pivotY,pivotZ,axisX,axisY,axisZ,0);
}
KX_ConstraintWrapper* wrap = new KX_ConstraintWrapper((enum PHY_ConstraintType)constrainttype,constraintid,PHY_GetActiveEnvironment());
@@ -567,7 +567,7 @@ static PyObject *gPyGetAppliedImpulse(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- appliedImpulse = PHY_GetActiveEnvironment()->getAppliedImpulse(constraintid);
+ appliedImpulse = PHY_GetActiveEnvironment()->GetAppliedImpulse(constraintid);
}
}
else {
@@ -592,7 +592,7 @@ static PyObject *gPyRemoveConstraint(PyObject *self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->removeConstraint(constraintid);
+ PHY_GetActiveEnvironment()->RemoveConstraint(constraintid);
}
}
else {
@@ -610,7 +610,7 @@ static PyObject *gPyExportBulletFile(PyObject *, PyObject *args)
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->exportFile(filename);
+ PHY_GetActiveEnvironment()->ExportFile(filename);
}
Py_RETURN_NONE;
}
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 29f28b7cc24..08e240903d1 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -480,7 +480,7 @@ static PyObject *gPySetPhysicsTicRate(PyObject *, PyObject *args)
if (!PyArg_ParseTuple(args, "f:setPhysicsTicRate", &ticrate))
return NULL;
- PHY_GetActiveEnvironment()->setFixedTimeStep(true,ticrate);
+ PHY_GetActiveEnvironment()->SetFixedTimeStep(true,ticrate);
Py_RETURN_NONE;
}
#if 0 // unused
@@ -498,7 +498,7 @@ static PyObject *gPySetPhysicsDebug(PyObject *, PyObject *args)
static PyObject *gPyGetPhysicsTicRate(PyObject *)
{
- return PyFloat_FromDouble(PHY_GetActiveEnvironment()->getFixedTimeStep());
+ return PyFloat_FromDouble(PHY_GetActiveEnvironment()->GetFixedTimeStep());
}
static PyObject *gPyGetAverageFrameRate(PyObject *)
@@ -1226,7 +1226,6 @@ static PyObject *gPyGetGLSLMaterialSetting(PyObject *,
return PyLong_FromLong(enabled);
}
-#define KX_TEXFACE_MATERIAL 0
#define KX_BLENDER_MULTITEX_MATERIAL 1
#define KX_BLENDER_GLSL_MATERIAL 2
@@ -1244,8 +1243,6 @@ static PyObject *gPySetMaterialType(PyObject *,
gs->matmode= GAME_MAT_GLSL;
else if (type == KX_BLENDER_MULTITEX_MATERIAL)
gs->matmode= GAME_MAT_MULTITEX;
- else if (type == KX_TEXFACE_MATERIAL)
- gs->matmode= GAME_MAT_TEXFACE;
else {
PyErr_SetString(PyExc_ValueError, "Rasterizer.setMaterialType(int): material type is not known");
return NULL;
@@ -1261,10 +1258,8 @@ static PyObject *gPyGetMaterialType(PyObject *)
if (gs->matmode == GAME_MAT_GLSL)
flag = KX_BLENDER_GLSL_MATERIAL;
- else if (gs->matmode == GAME_MAT_MULTITEX)
- flag = KX_BLENDER_MULTITEX_MATERIAL;
else
- flag = KX_TEXFACE_MATERIAL;
+ flag = KX_BLENDER_MULTITEX_MATERIAL;
return PyLong_FromLong(flag);
}
@@ -2209,7 +2204,6 @@ PyObject *initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
Py_DECREF(ErrorObject);
/* needed for get/setMaterialType */
- KX_MACRO_addTypesToDict(d, KX_TEXFACE_MATERIAL, KX_TEXFACE_MATERIAL);
KX_MACRO_addTypesToDict(d, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL);
KX_MACRO_addTypesToDict(d, KX_BLENDER_GLSL_MATERIAL, KX_BLENDER_GLSL_MATERIAL);
diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
index 05bdb3463a6..bacace9199a 100644
--- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
@@ -57,7 +57,6 @@
#include "KX_ObjectActuator.h"
#include "KX_ParentActuator.h"
#include "KX_PolyProxy.h"
-#include "KX_PolygonMaterial.h"
#include "KX_PythonSeq.h"
#include "KX_SCA_AddObjectActuator.h"
#include "KX_SCA_EndObjectActuator.h"
@@ -211,7 +210,6 @@ void initPyTypes(void)
PyType_Ready_Attr(dict, KX_ObjectActuator, init_getset);
PyType_Ready_Attr(dict, KX_ParentActuator, init_getset);
PyType_Ready_Attr(dict, KX_PolyProxy, init_getset);
- PyType_Ready_Attr(dict, KX_PolygonMaterial, init_getset);
PyType_Ready_Attr(dict, KX_RadarSensor, init_getset);
PyType_Ready_Attr(dict, KX_RaySensor, init_getset);
PyType_Ready_Attr(dict, KX_SCA_AddObjectActuator, init_getset);
diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp
index 04d67fc73e1..732bcdc3773 100644
--- a/source/gameengine/Ketsji/KX_RadarSensor.cpp
+++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp
@@ -166,8 +166,8 @@ void KX_RadarSensor::SynchronizeTransform()
const MT_Point3& pos = trans.getOrigin();
float ori[12];
trans.getBasis().getValue(ori);
- motionState->setWorldPosition(pos[0], pos[1], pos[2]);
- motionState->setWorldOrientation(ori);
+ motionState->SetWorldPosition(pos[0], pos[1], pos[2]);
+ motionState->SetWorldOrientation(ori);
m_physCtrl->WriteMotionStateToDynamics(true);
}
diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp
index f1bfb10220a..333e7b57d67 100644
--- a/source/gameengine/Ketsji/KX_RayCast.cpp
+++ b/source/gameengine/Ketsji/KX_RayCast.cpp
@@ -39,12 +39,11 @@
#include "MT_Point3.h"
#include "MT_Vector3.h"
-#include "KX_IPhysicsController.h"
#include "PHY_IPhysicsEnvironment.h"
#include "PHY_IPhysicsController.h"
-KX_RayCast::KX_RayCast(KX_IPhysicsController* ignoreController, bool faceNormal, bool faceUV)
- :PHY_IRayCastFilterCallback(dynamic_cast<PHY_IPhysicsController*>(ignoreController), faceNormal, faceUV)
+KX_RayCast::KX_RayCast(PHY_IPhysicsController* ignoreController, bool faceNormal, bool faceUV)
+ :PHY_IRayCastFilterCallback(ignoreController, faceNormal, faceUV)
{
}
@@ -76,11 +75,11 @@ bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_
PHY_IPhysicsController* hit_controller;
- while ((hit_controller = physics_environment->rayTest(callback,
+ while ((hit_controller = physics_environment->RayTest(callback,
frompoint.x(),frompoint.y(),frompoint.z(),
topoint.x(),topoint.y(),topoint.z())) != NULL)
{
- KX_ClientObjectInfo *info = static_cast<KX_ClientObjectInfo*>(hit_controller->getNewClientInfo());
+ KX_ClientObjectInfo *info = static_cast<KX_ClientObjectInfo*>(hit_controller->GetNewClientInfo());
if (!info)
{
diff --git a/source/gameengine/Ketsji/KX_RayCast.h b/source/gameengine/Ketsji/KX_RayCast.h
index 544080f31d0..e47ac676eb1 100644
--- a/source/gameengine/Ketsji/KX_RayCast.h
+++ b/source/gameengine/Ketsji/KX_RayCast.h
@@ -40,7 +40,6 @@
class RAS_MeshObject;
struct KX_ClientObjectInfo;
-class KX_IPhysicsController;
/**
* Defines a function for doing a ray cast.
@@ -65,7 +64,7 @@ public:
int m_hitUVOK; // !=0 if UV coordinate in m_hitUV is valid
MT_Vector2 m_hitUV;
- KX_RayCast(KX_IPhysicsController* ignoreController, bool faceNormal, bool faceUV);
+ KX_RayCast(PHY_IPhysicsController* ignoreController, bool faceNormal, bool faceUV);
virtual ~KX_RayCast() {}
/**
@@ -105,7 +104,7 @@ template<class T> class KX_RayCast::Callback : public KX_RayCast
T *self;
void *data;
public:
- Callback(T *_self, KX_IPhysicsController* controller=NULL, void *_data = NULL, bool faceNormal=false, bool faceUV=false)
+ Callback(T *_self, PHY_IPhysicsController* controller=NULL, void *_data = NULL, bool faceNormal=false, bool faceUV=false)
: KX_RayCast(controller, faceNormal, faceUV),
self(_self),
data(_data)
@@ -121,7 +120,7 @@ public:
virtual bool needBroadphaseRayCast(PHY_IPhysicsController* controller)
{
- KX_ClientObjectInfo* info = static_cast<KX_ClientObjectInfo*>(controller->getNewClientInfo());
+ KX_ClientObjectInfo* info = static_cast<KX_ClientObjectInfo*>(controller->GetNewClientInfo());
if (!info)
{
diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp
index 3fbce690a9f..afd39557130 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.cpp
+++ b/source/gameengine/Ketsji/KX_RaySensor.cpp
@@ -44,7 +44,6 @@
#include "KX_RayCast.h"
#include "KX_PyMath.h"
#include "PHY_IPhysicsEnvironment.h"
-#include "KX_IPhysicsController.h"
#include "PHY_IPhysicsController.h"
#include "DNA_sensor_types.h"
@@ -261,7 +260,7 @@ bool KX_RaySensor::Evaluate()
return false;
}
- KX_IPhysicsController *spc = obj->GetPhysicsController();
+ PHY_IPhysicsController *spc = obj->GetPhysicsController();
KX_GameObject *parent = obj->GetParent();
if (!spc && parent)
spc = parent->GetPhysicsController();
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
index 56dccc1d045..f8f79269eaa 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
@@ -38,7 +38,6 @@
#include "KX_SCA_AddObjectActuator.h"
#include "SCA_IScene.h"
#include "KX_GameObject.h"
-#include "KX_IPhysicsController.h"
#include "PyObjectPlus.h"
/* ------------------------------------------------------------------------- */
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
index 5dc67a4cff3..e02eca3db63 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
@@ -35,6 +35,7 @@
* Please look here for revision history. */
#include "KX_SCA_DynamicActuator.h"
+#include "PHY_IPhysicsController.h"
#ifdef WITH_PYTHON
@@ -105,7 +106,7 @@ bool KX_SCA_DynamicActuator::Update()
// bool result = false; /*unused*/
KX_GameObject *obj = (KX_GameObject*) GetParent();
bool bNegativeEvent = IsNegativeEvent();
- KX_IPhysicsController* controller;
+ PHY_IPhysicsController* controller;
RemoveAllEvents();
if (bNegativeEvent)
@@ -120,16 +121,16 @@ bool KX_SCA_DynamicActuator::Update()
switch (m_dyn_operation)
{
case 0:
- obj->RestoreDynamics();
+ controller->RestoreDynamics();
break;
case 1:
- obj->SuspendDynamics();
+ controller->SuspendDynamics();
break;
case 2:
- controller->setRigidBody(true);
+ controller->SetRigidBody(true);
break;
case 3:
- controller->setRigidBody(false);
+ controller->SetRigidBody(false);
break;
case 4:
controller->SetMass(m_setmass);
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
index 01a91624c41..4eb337c54f5 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
@@ -38,7 +38,6 @@
#include "SCA_LogicManager.h"
#include "KX_GameObject.h"
-#include "KX_IPhysicsController.h"
class KX_SCA_DynamicActuator : public SCA_IActuator
{
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 4fa51b48ab8..5a956ffc048 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -62,6 +62,7 @@
#include "SCA_IScene.h"
#include "RAS_IRasterizer.h"
+#include "RAS_ICanvas.h"
#include "RAS_BucketManager.h"
#include "FloatValue.h"
@@ -81,7 +82,6 @@
#include "KX_NetworkEventManager.h"
#include "NG_NetworkScene.h"
#include "PHY_IPhysicsEnvironment.h"
-#include "KX_IPhysicsController.h"
#include "PHY_IGraphicController.h"
#include "KX_BlenderSceneConverter.h"
#include "KX_MotionState.h"
@@ -544,7 +544,7 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal
for (cit = scenegraphcontrollers.begin();!(cit==scenegraphcontrollers.end());++cit)
{
// controller replication is quite complicated
- // only replicate ipo and physics controller for now
+ // only replicate ipo controller for now
SG_Controller* replicacontroller = (*cit)->GetReplica((SG_Node*) replicanode);
if (replicacontroller)
@@ -558,9 +558,29 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal
{
PHY_IMotionState* motionstate = new KX_MotionState(newobj->GetSGNode());
PHY_IGraphicController* newctrl = orgobj->GetGraphicController()->GetReplica(motionstate);
- newctrl->setNewClientInfo(newobj->getClientInfo());
+ newctrl->SetNewClientInfo(newobj->getClientInfo());
newobj->SetGraphicController(newctrl);
}
+
+#ifdef WITH_BULLET
+ // replicate physics controller
+ if (orgobj->GetPhysicsController())
+ {
+ PHY_IMotionState* motionstate = new KX_MotionState(newobj->GetSGNode());
+ PHY_IPhysicsController* newctrl = orgobj->GetPhysicsController()->GetReplica();
+
+ KX_GameObject *parent = newobj->GetParent();
+ PHY_IPhysicsController* parentctrl = (parent) ? parent->GetPhysicsController() : NULL;
+
+ newctrl->SetNewClientInfo(newobj->getClientInfo());
+ newobj->SetPhysicsController(newctrl, newobj->IsDynamic());
+ newctrl->PostProcessReplica(motionstate, parentctrl);
+
+ if (parent)
+ parent->Release();
+ }
+#endif
+
return newobj;
}
@@ -610,7 +630,7 @@ void KX_Scene::ReplicateLogic(KX_GameObject* newobj)
newsensorobj = (SCA_IObject*)(*h_obj);
if (!newsensorobj)
{
- // no, then the sensor points outside the hierachy, keep it the same
+ // no, then the sensor points outside the hierarchy, keep it the same
if (m_objectlist->SearchValue(oldsensorobj))
// only replicate links that points to active objects
m_logicmgr->RegisterToSensor(cont,oldsensor);
@@ -650,7 +670,7 @@ void KX_Scene::ReplicateLogic(KX_GameObject* newobj)
if (!newactuatorobj)
{
- // no, then the sensor points outside the hierachy, keep it the same
+ // no, then the sensor points outside the hierarchy, keep it the same
if (m_objectlist->SearchValue(oldactuatorobj))
// only replicate links that points to active objects
m_logicmgr->RegisterToActuator(cont,oldactuator);
@@ -1524,7 +1544,7 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* rasty,KX_Camera* cam, int
double pmat[16] = {0};
cam->GetProjectionMatrix().getValue(pmat);
- dbvt_culling = m_physicsEnvironment->cullingTest(PhysicsCullingCallback,&info,planes,5,m_dbvt_occlusion_res,
+ dbvt_culling = m_physicsEnvironment->CullingTest(PhysicsCullingCallback,&info,planes,5,m_dbvt_occlusion_res,
KX_GetActiveEngine()->GetCanvas()->GetViewPort(),
mvmat, pmat);
}
@@ -1678,10 +1698,9 @@ RAS_MaterialBucket* KX_Scene::FindBucket(class RAS_IPolyMaterial* polymat, bool
void KX_Scene::RenderBuckets(const MT_Transform & cameratransform,
- class RAS_IRasterizer* rasty,
- class RAS_IRenderTools* rendertools)
+ class RAS_IRasterizer* rasty)
{
- m_bucketmanager->Renderbuckets(cameratransform,rasty,rendertools);
+ m_bucketmanager->Renderbuckets(cameratransform,rasty);
KX_BlenderMaterial::EndFrame();
}
@@ -1755,14 +1774,14 @@ void KX_Scene::SetNetworkScene(NG_NetworkScene *newScene)
void KX_Scene::SetGravity(const MT_Vector3& gravity)
{
- GetPhysicsEnvironment()->setGravity(gravity[0],gravity[1],gravity[2]);
+ GetPhysicsEnvironment()->SetGravity(gravity[0],gravity[1],gravity[2]);
}
MT_Vector3 KX_Scene::GetGravity()
{
MT_Vector3 gravity;
- GetPhysicsEnvironment()->getGravity(gravity);
+ GetPhysicsEnvironment()->GetGravity(gravity);
return gravity;
}
@@ -1803,10 +1822,6 @@ short KX_Scene::GetAnimationFPS()
return m_blenderScene->r.frs_sec;
}
-#ifdef WITH_BULLET
-#include "KX_BulletPhysicsController.h"
-#endif
-
static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
{
SCA_LogicManager *logicmgr= to->GetLogicManager();
@@ -1839,7 +1854,6 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
#ifdef WITH_BULLET
#include "CcdGraphicController.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
#include "CcdPhysicsEnvironment.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
-#include "KX_BulletPhysicsController.h"
#endif
static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene *from)
@@ -1888,12 +1902,19 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
}
/* graphics controller */
- PHY_IGraphicController *ctrl = gameobj->GetGraphicController();
+ PHY_IController *ctrl = gameobj->GetGraphicController();
if (ctrl) {
/* SHOULD update the m_cullingTree */
ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
}
+#ifdef WITH_BULLET
+ ctrl = gameobj->GetPhysicsController();
+ if (ctrl) {
+ ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
+ }
+#endif
+
/* SG_Node can hold a scene reference */
SG_Node *sg= gameobj->GetSGNode();
if (sg) {
@@ -1905,16 +1926,6 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
for (int i=0; i<children.size(); i++)
children[i]->SetSGClientInfo(to);
}
-#ifdef WITH_BULLET
- SGControllerList::iterator contit;
- SGControllerList& controllers = sg->GetSGControllerList();
- for (contit = controllers.begin();contit!=controllers.end();++contit)
- {
- KX_BulletPhysicsController *phys_ctrl= dynamic_cast<KX_BulletPhysicsController *>(*contit);
- if (phys_ctrl)
- phys_ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
- }
-#endif // WITH_BULLET
}
/* If the object is a light, update it's scene */
if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT)
diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h
index edaa0663b22..ee2a994d53c 100644
--- a/source/gameengine/Ketsji/KX_Scene.h
+++ b/source/gameengine/Ketsji/KX_Scene.h
@@ -309,8 +309,7 @@ public:
RAS_BucketManager* GetBucketManager();
RAS_MaterialBucket* FindBucket(RAS_IPolyMaterial* polymat, bool &bucketCreated);
void RenderBuckets(const MT_Transform& cameratransform,
- RAS_IRasterizer* rasty,
- RAS_IRenderTools* rendertools);
+ RAS_IRasterizer* rasty);
/**
* Update all transforms according to the scenegraph.
diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
index 1a9e1442cc8..d010d3d50a0 100644
--- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp
+++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
@@ -48,9 +48,9 @@ KX_TouchEventManager::KX_TouchEventManager(class SCA_LogicManager* logicmgr,
//m_scene->addTouchCallback(OBJECT_RESPONSE, KX_TouchEventManager::collisionResponse, this);
//m_scene->addTouchCallback(SENSOR_RESPONSE, KX_TouchEventManager::collisionResponse, this);
- m_physEnv->addTouchCallback(PHY_OBJECT_RESPONSE, KX_TouchEventManager::newCollisionResponse, this);
- m_physEnv->addTouchCallback(PHY_SENSOR_RESPONSE, KX_TouchEventManager::newCollisionResponse, this);
- m_physEnv->addTouchCallback(PHY_BROADPH_RESPONSE, KX_TouchEventManager::newBroadphaseResponse, this);
+ m_physEnv->AddTouchCallback(PHY_OBJECT_RESPONSE, KX_TouchEventManager::newCollisionResponse, this);
+ m_physEnv->AddTouchCallback(PHY_SENSOR_RESPONSE, KX_TouchEventManager::newCollisionResponse, this);
+ m_physEnv->AddTouchCallback(PHY_BROADPH_RESPONSE, KX_TouchEventManager::newBroadphaseResponse, this);
}
@@ -84,8 +84,8 @@ bool KX_TouchEventManager::newBroadphaseResponse(void *client_data,
PHY_IPhysicsController* ctrl1 = static_cast<PHY_IPhysicsController*>(object1);
PHY_IPhysicsController* ctrl2 = static_cast<PHY_IPhysicsController*>(object2);
- KX_ClientObjectInfo *info1 = (ctrl1) ? static_cast<KX_ClientObjectInfo*>(ctrl1->getNewClientInfo()) : NULL;
- KX_ClientObjectInfo *info2 = (ctrl1) ? static_cast<KX_ClientObjectInfo*>(ctrl2->getNewClientInfo()) : NULL;
+ KX_ClientObjectInfo *info1 = (ctrl1) ? static_cast<KX_ClientObjectInfo*>(ctrl1->GetNewClientInfo()) : NULL;
+ KX_ClientObjectInfo *info2 = (ctrl1) ? static_cast<KX_ClientObjectInfo*>(ctrl2->GetNewClientInfo()) : NULL;
// This call back should only be called for controllers of Near and Radar sensor
if (!info1)
@@ -184,7 +184,7 @@ void KX_TouchEventManager::NextFrame()
list<SCA_ISensor*>::iterator sit;
// First client info
- KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*>(ctrl1->getNewClientInfo());
+ KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*>(ctrl1->GetNewClientInfo());
// First gameobject
KX_GameObject *kxObj1 = KX_GameObject::GetClientObject(client_info);
// Invoke sensor response for each object
@@ -195,7 +195,7 @@ void KX_TouchEventManager::NextFrame()
}
// Second client info
- client_info = static_cast<KX_ClientObjectInfo *>(ctrl2->getNewClientInfo());
+ client_info = static_cast<KX_ClientObjectInfo *>(ctrl2->GetNewClientInfo());
// Second gameobject
KX_GameObject *kxObj2 = KX_GameObject::GetClientObject(client_info);
if (client_info) {
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp
index 9d87da48fae..b231a2191ed 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.cpp
+++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp
@@ -117,7 +117,7 @@ m_bTouchPulse(bTouchPulse)
//client_info->m_auxilary_info = NULL;
client_info->m_sensors.push_back(this);
- m_physCtrl = dynamic_cast<PHY_IPhysicsController*>(gameobj->GetPhysicsController());
+ m_physCtrl = gameobj->GetPhysicsController();
MT_assert( !gameobj->GetPhysicsController() || m_physCtrl );
Init();
}
@@ -156,7 +156,7 @@ void KX_TouchSensor::ProcessReplica()
void KX_TouchSensor::ReParent(SCA_IObject* parent)
{
KX_GameObject *gameobj = static_cast<KX_GameObject *>(parent);
- PHY_IPhysicsController *sphy = dynamic_cast<PHY_IPhysicsController*>(((KX_GameObject*)parent)->GetPhysicsController());
+ PHY_IPhysicsController *sphy = ((KX_GameObject*)parent)->GetPhysicsController();
if (sphy)
m_physCtrl = sphy;
@@ -173,11 +173,11 @@ void KX_TouchSensor::RegisterSumo(KX_TouchEventManager *touchman)
{
if (m_physCtrl)
{
- if (touchman->GetPhysicsEnvironment()->requestCollisionCallback(m_physCtrl))
+ if (touchman->GetPhysicsEnvironment()->RequestCollisionCallback(m_physCtrl))
{
- KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*>(m_physCtrl->getNewClientInfo());
+ KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*>(m_physCtrl->GetNewClientInfo());
if (client_info->isSensor())
- touchman->GetPhysicsEnvironment()->addSensor(m_physCtrl);
+ touchman->GetPhysicsEnvironment()->AddSensor(m_physCtrl);
}
}
}
@@ -185,12 +185,12 @@ void KX_TouchSensor::UnregisterSumo(KX_TouchEventManager* touchman)
{
if (m_physCtrl)
{
- if (touchman->GetPhysicsEnvironment()->removeCollisionCallback(m_physCtrl))
+ if (touchman->GetPhysicsEnvironment()->RemoveCollisionCallback(m_physCtrl))
{
// no more sensor on the controller, can remove it if it is a sensor object
- KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*>(m_physCtrl->getNewClientInfo());
+ KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*>(m_physCtrl->GetNewClientInfo());
if (client_info->isSensor())
- touchman->GetPhysicsEnvironment()->removeSensor(m_physCtrl);
+ touchman->GetPhysicsEnvironment()->RemoveSensor(m_physCtrl);
}
}
}
@@ -203,8 +203,8 @@ bool KX_TouchSensor::BroadPhaseSensorFilterCollision(void*obj1,void*obj2)
KX_GameObject* myobj = (KX_GameObject*)GetParent();
KX_GameObject* myparent = myobj->GetParent();
- KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*>(((PHY_IPhysicsController*)obj2)->getNewClientInfo());
- KX_ClientObjectInfo *my_client_info = static_cast<KX_ClientObjectInfo*>(m_physCtrl->getNewClientInfo());
+ KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*>(((PHY_IPhysicsController*)obj2)->GetNewClientInfo());
+ KX_ClientObjectInfo *my_client_info = static_cast<KX_ClientObjectInfo*>(m_physCtrl->GetNewClientInfo());
KX_GameObject* otherobj = ( client_info ? client_info->m_gameobject : NULL);
// first, decrement refcount as GetParent() increases it
@@ -244,8 +244,8 @@ bool KX_TouchSensor::NewHandleCollision(void*object1,void*object2,const PHY_Coll
// need the mapping from PHY_IPhysicsController to gameobjects now
KX_ClientObjectInfo *client_info = static_cast<KX_ClientObjectInfo*> (object1 == m_physCtrl?
- ((PHY_IPhysicsController*)object2)->getNewClientInfo():
- ((PHY_IPhysicsController*)object1)->getNewClientInfo());
+ ((PHY_IPhysicsController*)object2)->GetNewClientInfo():
+ ((PHY_IPhysicsController*)object1)->GetNewClientInfo());
KX_GameObject* gameobj = ( client_info ?
client_info->m_gameobject :
diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp
index 3cb80e53e12..fdafc4e507d 100644
--- a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp
@@ -35,48 +35,48 @@ CcdGraphicController::CcdGraphicController (CcdPhysicsEnvironment* phyEnv, PHY_I
CcdGraphicController::~CcdGraphicController()
{
if (m_phyEnv)
- m_phyEnv->removeCcdGraphicController(this);
+ m_phyEnv->RemoveCcdGraphicController(this);
if (m_motionState)
delete m_motionState;
}
-void CcdGraphicController::setLocalAabb(const btVector3& aabbMin,const btVector3& aabbMax)
+void CcdGraphicController::SetLocalAabb(const btVector3& aabbMin,const btVector3& aabbMax)
{
m_localAabbMin = aabbMin;
m_localAabbMax = aabbMax;
SetGraphicTransform();
}
-void CcdGraphicController::setLocalAabb(const MT_Point3& aabbMin,const MT_Point3& aabbMax)
+void CcdGraphicController::SetLocalAabb(const MT_Point3& aabbMin,const MT_Point3& aabbMax)
{
m_localAabbMin.setValue(aabbMin[0],aabbMin[1],aabbMin[2]);
m_localAabbMax.setValue(aabbMax[0],aabbMax[1],aabbMax[2]);
SetGraphicTransform();
}
-void CcdGraphicController::setLocalAabb(const MT_Vector3& aabbMin,const MT_Vector3& aabbMax)
+void CcdGraphicController::SetLocalAabb(const MT_Vector3& aabbMin,const MT_Vector3& aabbMax)
{
m_localAabbMin.setValue(aabbMin[0],aabbMin[1],aabbMin[2]);
m_localAabbMax.setValue(aabbMax[0],aabbMax[1],aabbMax[2]);
SetGraphicTransform();
}
-void CcdGraphicController::setLocalAabb(const float* aabbMin,const float* aabbMax)
+void CcdGraphicController::SetLocalAabb(const float* aabbMin,const float* aabbMax)
{
m_localAabbMin.setValue(aabbMin[0],aabbMin[1],aabbMin[2]);
m_localAabbMax.setValue(aabbMax[0],aabbMax[1],aabbMax[2]);
SetGraphicTransform();
}
-void CcdGraphicController::getAabb(btVector3& aabbMin, btVector3& aabbMax)
+void CcdGraphicController::GetAabb(btVector3& aabbMin, btVector3& aabbMax)
{
btVector3 pos;
btVector3 scale;
float ori[12];
- m_motionState->getWorldPosition(pos.m_floats[0],pos.m_floats[1],pos.m_floats[2]);
- m_motionState->getWorldScaling(scale.m_floats[0],scale.m_floats[1],scale.m_floats[2]);
- m_motionState->getWorldOrientation(ori);
+ m_motionState->GetWorldPosition(pos.m_floats[0],pos.m_floats[1],pos.m_floats[2]);
+ m_motionState->GetWorldScaling(scale.m_floats[0],scale.m_floats[1],scale.m_floats[2]);
+ m_motionState->GetWorldOrientation(ori);
btMatrix3x3 rot(ori[0], ori[4], ori[8],
ori[1], ori[5], ori[9],
ori[2], ori[6], ori[10]);
@@ -109,9 +109,9 @@ bool CcdGraphicController::SetGraphicTransform()
return false;
btVector3 aabbMin;
btVector3 aabbMax;
- getAabb(aabbMin, aabbMax);
+ GetAabb(aabbMin, aabbMax);
// update Aabb in broadphase
- m_phyEnv->getCullingTree()->setAabb(m_handle,aabbMin,aabbMax,NULL);
+ m_phyEnv->GetCullingTree()->setAabb(m_handle,aabbMin,aabbMax,NULL);
return true;
}
@@ -131,7 +131,7 @@ void CcdGraphicController::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment*
{
CcdPhysicsEnvironment* phyEnv = static_cast<CcdPhysicsEnvironment*>(env);
/* Updates the m_phyEnv's m_cullingTree & m_cullingCache */
- if (getBroadphaseHandle()) {
+ if (GetBroadphaseHandle()) {
/* insert into the new physics scene */
Activate(false);
m_phyEnv= phyEnv;
@@ -145,8 +145,8 @@ void CcdGraphicController::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment*
void CcdGraphicController::Activate(bool active)
{
if (active)
- m_phyEnv->addCcdGraphicController(this);
+ m_phyEnv->AddCcdGraphicController(this);
else
- m_phyEnv->removeCcdGraphicController(this);
+ m_phyEnv->RemoveCcdGraphicController(this);
}
diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.h b/source/gameengine/Physics/Bullet/CcdGraphicController.h
index 064f86040f6..e76ad86301e 100644
--- a/source/gameengine/Physics/Bullet/CcdGraphicController.h
+++ b/source/gameengine/Physics/Bullet/CcdGraphicController.h
@@ -40,16 +40,16 @@ public:
virtual ~CcdGraphicController();
- void setLocalAabb(const btVector3& aabbMin,const btVector3& aabbMax);
- void setLocalAabb(const MT_Point3& aabbMin,const MT_Point3& aabbMax);
- virtual void setLocalAabb(const MT_Vector3& aabbMin,const MT_Vector3& aabbMax);
- virtual void setLocalAabb(const float aabbMin[3],const float aabbMax[3]);
+ void SetLocalAabb(const btVector3& aabbMin,const btVector3& aabbMax);
+ void SetLocalAabb(const MT_Point3& aabbMin,const MT_Point3& aabbMax);
+ virtual void SetLocalAabb(const MT_Vector3& aabbMin,const MT_Vector3& aabbMax);
+ virtual void SetLocalAabb(const float aabbMin[3],const float aabbMax[3]);
PHY_IMotionState* GetMotionState() { return m_motionState; }
- void getAabb(btVector3& aabbMin, btVector3& aabbMax);
+ void GetAabb(btVector3& aabbMin, btVector3& aabbMax);
- virtual void setBroadphaseHandle(btBroadphaseProxy* handle) { m_handle = handle; }
- virtual btBroadphaseProxy* getBroadphaseHandle() { return m_handle; }
+ virtual void SetBroadphaseHandle(btBroadphaseProxy* handle) { m_handle = handle; }
+ virtual btBroadphaseProxy* GetBroadphaseHandle() { return m_handle; }
virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* env);
@@ -67,8 +67,8 @@ public:
virtual void Activate(bool active);
// client info for culling
- virtual void* getNewClientInfo() { return m_newClientInfo; }
- virtual void setNewClientInfo(void* clientinfo) { m_newClientInfo = clientinfo; }
+ virtual void* GetNewClientInfo() { return m_newClientInfo; }
+ virtual void SetNewClientInfo(void* clientinfo) { m_newClientInfo = clientinfo; }
virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate);
private:
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 1a8fda0749a..71bdce0e1ae 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -29,6 +29,8 @@ subject to the following restrictions:
#include "PHY_IMotionState.h"
#include "CcdPhysicsEnvironment.h"
#include "RAS_MeshObject.h"
+#include "RAS_Polygon.h"
+#include "RAS_Deformer.h"
#include "KX_GameObject.h"
#include "BulletSoftBody/btSoftBody.h"
@@ -137,9 +139,14 @@ CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci)
m_shapeInfo = ci.m_shapeInfo;
if (m_shapeInfo)
m_shapeInfo->AddRef();
+
+ m_bulletChildShape = NULL;
m_bulletMotionState = 0;
m_characterController = 0;
+ m_savedCollisionFlags = 0;
+ m_savedMass = 0.0;
+ m_suspended = false;
CreateRigidbody();
}
@@ -148,11 +155,11 @@ btTransform& CcdPhysicsController::GetTransformFromMotionState(PHY_IMotionState*
{
static btTransform trans;
btVector3 tmp;
- motionState->getWorldPosition(tmp.m_floats[0], tmp.m_floats[1], tmp.m_floats[2]);
+ motionState->GetWorldPosition(tmp.m_floats[0], tmp.m_floats[1], tmp.m_floats[2]);
trans.setOrigin(tmp);
float ori[12];
- motionState->getWorldOrientation(ori);
+ motionState->GetWorldOrientation(ori);
trans.getBasis().setFromOpenGLSubMatrix(ori);
//btQuaternion orn;
//motionState->getWorldOrientation(orn[0],orn[1],orn[2],orn[3]);
@@ -178,18 +185,18 @@ public:
btVector3 pos;
float ori[12];
- m_blenderMotionState->getWorldPosition(pos.m_floats[0],pos.m_floats[1],pos.m_floats[2]);
- m_blenderMotionState->getWorldOrientation(ori);
+ m_blenderMotionState->GetWorldPosition(pos.m_floats[0],pos.m_floats[1],pos.m_floats[2]);
+ m_blenderMotionState->GetWorldOrientation(ori);
worldTrans.setOrigin(pos);
worldTrans.getBasis().setFromOpenGLSubMatrix(ori);
}
void setWorldTransform(const btTransform& worldTrans)
{
- m_blenderMotionState->setWorldPosition(worldTrans.getOrigin().getX(),worldTrans.getOrigin().getY(),worldTrans.getOrigin().getZ());
+ m_blenderMotionState->SetWorldPosition(worldTrans.getOrigin().getX(),worldTrans.getOrigin().getY(),worldTrans.getOrigin().getZ());
btQuaternion rotQuat = worldTrans.getRotation();
- m_blenderMotionState->setWorldOrientation(rotQuat[0],rotQuat[1],rotQuat[2],rotQuat[3]);
- m_blenderMotionState->calculateWorldTransformations();
+ m_blenderMotionState->SetWorldOrientation(rotQuat[0],rotQuat[1],rotQuat[2],rotQuat[3]);
+ m_blenderMotionState->CalculateWorldTransformations();
}
};
@@ -236,7 +243,7 @@ bool CcdPhysicsController::CreateSoftbody()
btVector3 p(0,0,0);// = getOrigin();
//btSoftBody* psb=btSoftBodyHelpers::CreateRope(worldInfo, btVector3(-10,0,i*0.25),btVector3(10,0,i*0.25), 16,1+2);
btSoftBody* psb = 0;
- btSoftBodyWorldInfo& worldInfo = m_cci.m_physicsEnv->getDynamicsWorld()->getWorldInfo();
+ btSoftBodyWorldInfo& worldInfo = m_cci.m_physicsEnv->GetDynamicsWorld()->getWorldInfo();
if (m_cci.m_collisionShape->getShapeType() == CONVEX_HULL_SHAPE_PROXYTYPE) {
btConvexHullShape* convexHull = (btConvexHullShape* )m_cci.m_collisionShape;
@@ -454,8 +461,8 @@ bool CcdPhysicsController::CreateSoftbody()
btTransform startTrans;
rbci.m_motionState->getWorldTransform(startTrans);
- m_MotionState->setWorldPosition(startTrans.getOrigin().getX(),startTrans.getOrigin().getY(),startTrans.getOrigin().getZ());
- m_MotionState->setWorldOrientation(0,0,0,1);
+ m_MotionState->SetWorldPosition(startTrans.getOrigin().getX(),startTrans.getOrigin().getY(),startTrans.getOrigin().getZ());
+ m_MotionState->SetWorldOrientation(0,0,0,1);
if (!m_prototypeTransformInitialized)
{
@@ -607,7 +614,7 @@ bool CcdPhysicsController::ReplaceControllerShape(btCollisionShape *newShape)
if (GetSoftBody()) {
// soft body must be recreated
- m_cci.m_physicsEnv->removeCcdPhysicsController(this);
+ m_cci.m_physicsEnv->RemoveCcdPhysicsController(this);
delete m_object;
m_object = NULL;
// force complete reinitialization
@@ -617,14 +624,14 @@ bool CcdPhysicsController::ReplaceControllerShape(btCollisionShape *newShape)
CreateSoftbody();
assert(m_object);
// reinsert the new body
- m_cci.m_physicsEnv->addCcdPhysicsController(this);
+ m_cci.m_physicsEnv->AddCcdPhysicsController(this);
}
/* Copied from CcdPhysicsEnvironment::addCcdPhysicsController() */
/* without this, an object can rest on the old physics mesh
* and not move to account for the physics mesh, even with 'nosleep' */
- btSoftRigidDynamicsWorld* dw= GetPhysicsEnvironment()->getDynamicsWorld();
+ btSoftRigidDynamicsWorld* dw= GetPhysicsEnvironment()->GetDynamicsWorld();
btCollisionObjectArray &obarr= dw->getCollisionObjectArray();
btCollisionObject *ob;
btBroadphaseProxy* proxy;
@@ -646,7 +653,7 @@ CcdPhysicsController::~CcdPhysicsController()
{
//will be reference counted, due to sharing
if (m_cci.m_physicsEnv)
- m_cci.m_physicsEnv->removeCcdPhysicsController(this);
+ m_cci.m_physicsEnv->RemoveCcdPhysicsController(this);
if (m_MotionState)
delete m_MotionState;
@@ -681,17 +688,17 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time)
btQuaternion worldquat;
btMatrix3x3 trs = sb->m_pose.m_rot*sb->m_pose.m_scl;
trs.getRotation(worldquat);
- m_MotionState->setWorldPosition(worldPos[0],worldPos[1],worldPos[2]);
- m_MotionState->setWorldOrientation(worldquat[0],worldquat[1],worldquat[2],worldquat[3]);
+ m_MotionState->SetWorldPosition(worldPos[0],worldPos[1],worldPos[2]);
+ m_MotionState->SetWorldOrientation(worldquat[0],worldquat[1],worldquat[2],worldquat[3]);
}
else
{
btVector3 aabbMin,aabbMax;
sb->getAabb(aabbMin,aabbMax);
btVector3 worldPos = (aabbMax+aabbMin)*0.5f;
- m_MotionState->setWorldPosition(worldPos[0],worldPos[1],worldPos[2]);
+ m_MotionState->SetWorldPosition(worldPos[0],worldPos[1],worldPos[2]);
}
- m_MotionState->calculateWorldTransformations();
+ m_MotionState->CalculateWorldTransformations();
return true;
}
@@ -717,12 +724,12 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time)
const btVector3& worldPos = xform.getOrigin();
float ori[12];
worldOri.getOpenGLSubMatrix(ori);
- m_MotionState->setWorldOrientation(ori);
- m_MotionState->setWorldPosition(worldPos[0],worldPos[1],worldPos[2]);
- m_MotionState->calculateWorldTransformations();
+ m_MotionState->SetWorldOrientation(ori);
+ m_MotionState->SetWorldPosition(worldPos[0],worldPos[1],worldPos[2]);
+ m_MotionState->CalculateWorldTransformations();
float scale[3];
- m_MotionState->getWorldScaling(scale[0],scale[1],scale[2]);
+ m_MotionState->GetWorldScaling(scale[0],scale[1],scale[2]);
btVector3 scaling(scale[0],scale[1],scale[2]);
GetCollisionShape()->setLocalScaling(scaling);
} else
@@ -741,7 +748,7 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time)
m_MotionState->calculateWorldTransformations();
*/
float scale[3];
- m_MotionState->getWorldScaling(scale[0],scale[1],scale[2]);
+ m_MotionState->GetWorldScaling(scale[0],scale[1],scale[2]);
btVector3 scaling(scale[0],scale[1],scale[2]);
GetCollisionShape()->setLocalScaling(scaling);
}
@@ -765,7 +772,7 @@ void CcdPhysicsController::WriteDynamicsToMotionState()
// controller replication
void CcdPhysicsController::PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl)
{
-
+ SetParentCtrl((CcdPhysicsController*)parentctrl);
m_softBodyTransformInitialized=false;
m_MotionState = motionstate;
m_registerCount = 0;
@@ -810,7 +817,7 @@ void CcdPhysicsController::PostProcessReplica(class PHY_IMotionState* motionsta
}
// sensor object are added when needed
if (!m_cci.m_bSensor)
- m_cci.m_physicsEnv->addCcdPhysicsController(this);
+ m_cci.m_physicsEnv->AddCcdPhysicsController(this);
/* SM_Object* dynaparent=0;
@@ -855,9 +862,9 @@ void CcdPhysicsController::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment *
// since the environment is changing, we must also move the controler to the
// new environment. Note that we don't handle sensor explicitly: this
// function can be called on sensor but only when they are not registered
- if (m_cci.m_physicsEnv->removeCcdPhysicsController(this))
+ if (m_cci.m_physicsEnv->RemoveCcdPhysicsController(this))
{
- physicsEnv->addCcdPhysicsController(this);
+ physicsEnv->AddCcdPhysicsController(this);
// Set the object to be active so it can at least by evaluated once.
// This fixes issues with static objects not having their physics meshes
@@ -902,7 +909,7 @@ void CcdPhysicsController::SetCenterOfMassTransform(btTransform& xform)
}
// kinematic methods
-void CcdPhysicsController::RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local)
+void CcdPhysicsController::RelativeTranslate(const MT_Vector3& dlocin,bool local)
{
if (m_object)
{
@@ -915,7 +922,7 @@ void CcdPhysicsController::RelativeTranslate(float dlocX,float dlocY,float dloc
return;
}
- btVector3 dloc(dlocX,dlocY,dlocZ);
+ btVector3 dloc(dlocin.x(), dlocin.y(), dlocin.z());
btTransform xform = m_object->getWorldTransform();
if (local)
@@ -927,22 +934,7 @@ void CcdPhysicsController::RelativeTranslate(float dlocX,float dlocY,float dloc
}
-void CcdPhysicsController::SetWalkDirection(float dirX,float dirY,float dirZ,bool local)
-{
-
- if (m_object && m_characterController)
- {
- btVector3 dir(dirX,dirY,dirZ);
- btTransform xform = m_object->getWorldTransform();
-
- if (local)
- dir = xform.getBasis()*dir;
-
- m_characterController->setWalkDirection(dir/GetPhysicsEnvironment()->getNumTimeSubSteps());
- }
-}
-
-void CcdPhysicsController::RelativeRotate(const float rotval[9],bool local)
+void CcdPhysicsController::RelativeRotate(const MT_Matrix3x3& rotval,bool local)
{
if (m_object)
{
@@ -955,9 +947,9 @@ void CcdPhysicsController::RelativeRotate(const float rotval[9],bool local)
return;
}
- btMatrix3x3 drotmat(rotval[0], rotval[3], rotval[6],
- rotval[1], rotval[4], rotval[7],
- rotval[2], rotval[5], rotval[8]);
+ btMatrix3x3 drotmat(rotval[0].x(), rotval[1].x(), rotval[2].x(),
+ rotval[0].y(), rotval[1].y(), rotval[2].y(),
+ rotval[0].z(), rotval[1].z(), rotval[2].z());
btMatrix3x3 currentOrn;
@@ -976,45 +968,23 @@ void CcdPhysicsController::RelativeRotate(const float rotval[9],bool local)
void CcdPhysicsController::GetWorldOrientation(btMatrix3x3& mat)
{
float ori[12];
- m_MotionState->getWorldOrientation(ori);
+ m_MotionState->GetWorldOrientation(ori);
mat.setFromOpenGLSubMatrix(ori);
}
-void CcdPhysicsController::getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal)
+MT_Matrix3x3 CcdPhysicsController::GetOrientation()
{
- btQuaternion q = m_object->getWorldTransform().getRotation();
- quatImag0 = q[0];
- quatImag1 = q[1];
- quatImag2 = q[2];
- quatReal = q[3];
+ btMatrix3x3 orn = m_object->getWorldTransform().getBasis();
+ return MT_Matrix3x3(orn[0][0], orn[0][1], orn[0][2], orn[1][0], orn[1][1], orn[1][2], orn[2][0], orn[2][1], orn[2][2]);
}
-void CcdPhysicsController::setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal)
-{
- if (m_object)
- {
- m_object->activate(true);
- if (m_object->isStaticObject())
- {
- if (!m_cci.m_bSensor)
- m_object->setCollisionFlags(m_object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);
- // kinematic object should not set the transform, it disturbs the velocity interpolation
- return;
- }
- // not required
- //m_MotionState->setWorldOrientation(quatImag0,quatImag1,quatImag2,quatReal);
- btTransform xform = m_object->getWorldTransform();
- xform.setRotation(btQuaternion(quatImag0,quatImag1,quatImag2,quatReal));
- SetCenterOfMassTransform(xform);
- // not required
- //m_bulletMotionState->setWorldTransform(xform);
-
-
-
- }
+void CcdPhysicsController::SetOrientation(const MT_Matrix3x3& orn)
+{
+ btMatrix3x3 btmat(orn[0][0], orn[0][1], orn[0][2], orn[1][0], orn[1][1], orn[1][2], orn[2][0], orn[2][1], orn[2][2]);
+ SetWorldOrientation(btmat);
}
-void CcdPhysicsController::setWorldOrientation(const btMatrix3x3& orn)
+void CcdPhysicsController::SetWorldOrientation(const btMatrix3x3& orn)
{
if (m_object)
{
@@ -1043,7 +1013,7 @@ void CcdPhysicsController::setWorldOrientation(const btMatrix3x3& orn)
}
-void CcdPhysicsController::setPosition(float posX,float posY,float posZ)
+void CcdPhysicsController::SetPosition(const MT_Vector3& pos)
{
if (m_object)
{
@@ -1058,7 +1028,7 @@ void CcdPhysicsController::setPosition(float posX,float posY,float posZ)
// not required, this function is only used to update the physic controller
//m_MotionState->setWorldPosition(posX,posY,posZ);
btTransform xform = m_object->getWorldTransform();
- xform.setOrigin(btVector3(posX,posY,posZ));
+ xform.setOrigin(btVector3(pos.x(), pos.y(), pos.z()));
SetCenterOfMassTransform(xform);
if (!m_softBodyTransformInitialized)
m_softbodyStartTrans.setOrigin(xform.getOrigin());
@@ -1067,7 +1037,7 @@ void CcdPhysicsController::setPosition(float posX,float posY,float posZ)
}
}
-void CcdPhysicsController::forceWorldTransform(const btMatrix3x3& mat, const btVector3& pos)
+void CcdPhysicsController::ForceWorldTransform(const btMatrix3x3& mat, const btVector3& pos)
{
if (m_object)
{
@@ -1078,11 +1048,44 @@ void CcdPhysicsController::forceWorldTransform(const btMatrix3x3& mat, const btV
}
-void CcdPhysicsController::resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ)
+void CcdPhysicsController::ResolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ)
{
}
-void CcdPhysicsController::getPosition(MT_Vector3& pos) const
+void CcdPhysicsController::SuspendDynamics(bool ghost)
+{
+ btRigidBody *body = GetRigidBody();
+ if (body && !m_suspended && !GetConstructionInfo().m_bSensor)
+ {
+ m_savedCollisionFlags = body->getCollisionFlags();
+ m_savedMass = GetMass();
+ m_suspended = true;
+ GetPhysicsEnvironment()->UpdateCcdPhysicsController(this,
+ 0.0,
+ btCollisionObject::CF_STATIC_OBJECT|((ghost)?btCollisionObject::CF_NO_CONTACT_RESPONSE:(m_savedCollisionFlags&btCollisionObject::CF_NO_CONTACT_RESPONSE)),
+ btBroadphaseProxy::StaticFilter,
+ btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
+ }
+}
+
+void CcdPhysicsController::RestoreDynamics()
+{
+ btRigidBody *body = GetRigidBody();
+ if (body && m_suspended)
+ {
+ // before make sure any position change that was done in this logic frame are accounted for
+ SetTransform();
+ GetPhysicsEnvironment()->UpdateCcdPhysicsController(this,
+ m_savedMass,
+ m_savedCollisionFlags,
+ GetConstructionInfo().m_collisionFilterGroup,
+ GetConstructionInfo().m_collisionFilterMask);
+ body->activate();
+ m_suspended = false;
+ }
+}
+
+void CcdPhysicsController::GetPosition(MT_Vector3& pos) const
{
const btTransform& xform = m_object->getWorldTransform();
pos[0] = xform.getOrigin().x();
@@ -1090,13 +1093,13 @@ void CcdPhysicsController::getPosition(MT_Vector3& pos) const
pos[2] = xform.getOrigin().z();
}
-void CcdPhysicsController::setScaling(float scaleX,float scaleY,float scaleZ)
+void CcdPhysicsController::SetScaling(const MT_Vector3& scale)
{
- if (!btFuzzyZero(m_cci.m_scaling.x()-scaleX) ||
- !btFuzzyZero(m_cci.m_scaling.y()-scaleY) ||
- !btFuzzyZero(m_cci.m_scaling.z()-scaleZ))
+ if (!btFuzzyZero(m_cci.m_scaling.x()-scale.x()) ||
+ !btFuzzyZero(m_cci.m_scaling.y()-scale.y()) ||
+ !btFuzzyZero(m_cci.m_scaling.z()-scale.z()))
{
- m_cci.m_scaling = btVector3(scaleX,scaleY,scaleZ);
+ m_cci.m_scaling = btVector3(scale.x(),scale.y(),scale.z());
if (m_object && m_object->getCollisionShape())
{
@@ -1114,11 +1117,64 @@ void CcdPhysicsController::setScaling(float scaleX,float scaleY,float scaleZ)
}
}
}
+
+void CcdPhysicsController::SetTransform()
+{
+ btVector3 pos;
+ btVector3 scale;
+ float ori[12];
+ m_MotionState->GetWorldPosition(pos.m_floats[0],pos.m_floats[1],pos.m_floats[2]);
+ m_MotionState->GetWorldScaling(scale.m_floats[0],scale.m_floats[1],scale.m_floats[2]);
+ m_MotionState->GetWorldOrientation(ori);
+ btMatrix3x3 rot(ori[0], ori[4], ori[8],
+ ori[1], ori[5], ori[9],
+ ori[2], ori[6], ori[10]);
+ ForceWorldTransform(rot, pos);
+
+ if (!IsDynamic() && !GetConstructionInfo().m_bSensor && !GetCharacterController())
+ {
+ btCollisionObject* object = GetRigidBody();
+ object->setActivationState(ACTIVE_TAG);
+ object->setCollisionFlags(object->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);
+ }
+}
+
+MT_Scalar CcdPhysicsController::GetMass()
+{
+ if (GetSoftBody())
+ return GetSoftBody()->getTotalMass();
+
+ MT_Scalar invmass = 0.f;
+ if (GetRigidBody())
+ invmass = GetRigidBody()->getInvMass();
+ if (invmass)
+ return 1.f/invmass;
+ return 0.f;
+
+}
+
+void CcdPhysicsController::SetMass(MT_Scalar newmass)
+{
+ btRigidBody *body = GetRigidBody();
+ if (body && !m_suspended && newmass>MT_EPSILON && GetMass()>MT_EPSILON)
+ {
+ btVector3 grav = body->getGravity();
+ btVector3 accel = grav / GetMass();
+
+ btBroadphaseProxy* handle = body->getBroadphaseHandle();
+ GetPhysicsEnvironment()->UpdateCcdPhysicsController(this,
+ newmass,
+ body->getCollisionFlags(),
+ handle->m_collisionFilterGroup,
+ handle->m_collisionFilterMask);
+ body->setGravity(accel);
+ }
+}
// physics methods
-void CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local)
+void CcdPhysicsController::ApplyTorque(const MT_Vector3& torquein,bool local)
{
- btVector3 torque(torqueX,torqueY,torqueZ);
+ btVector3 torque(torquein.x(),torquein.y(),torquein.z());
btTransform xform = m_object->getWorldTransform();
@@ -1156,9 +1212,9 @@ void CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torque
}
}
-void CcdPhysicsController::ApplyForce(float forceX,float forceY,float forceZ,bool local)
+void CcdPhysicsController::ApplyForce(const MT_Vector3& forcein,bool local)
{
- btVector3 force(forceX,forceY,forceZ);
+ btVector3 force(forcein.x(),forcein.y(),forcein.z());
if (m_object && force.length2() > (SIMD_EPSILON*SIMD_EPSILON))
@@ -1189,9 +1245,9 @@ void CcdPhysicsController::ApplyForce(float forceX,float forceY,float forceZ,bo
}
}
}
-void CcdPhysicsController::SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local)
+void CcdPhysicsController::SetAngularVelocity(const MT_Vector3& ang_vel,bool local)
{
- btVector3 angvel(ang_velX,ang_velY,ang_velZ);
+ btVector3 angvel(ang_vel.x(),ang_vel.y(),ang_vel.z());
if (m_object && angvel.length2() > (SIMD_EPSILON*SIMD_EPSILON))
{
m_object->activate(true);
@@ -1212,10 +1268,10 @@ void CcdPhysicsController::SetAngularVelocity(float ang_velX,float ang_velY,flo
}
}
-void CcdPhysicsController::SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local)
+void CcdPhysicsController::SetLinearVelocity(const MT_Vector3& lin_vel,bool local)
{
- btVector3 linVel(lin_velX,lin_velY,lin_velZ);
+ btVector3 linVel(lin_vel.x(),lin_vel.y(),lin_vel.z());
if (m_object/* && linVel.length2() > (SIMD_EPSILON*SIMD_EPSILON)*/)
{
m_object->activate(true);
@@ -1247,9 +1303,9 @@ void CcdPhysicsController::SetLinearVelocity(float lin_velX,float lin_velY,floa
}
}
}
-void CcdPhysicsController::applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ)
+void CcdPhysicsController::ApplyImpulse(const MT_Point3& attach, const MT_Vector3& impulsein)
{
- btVector3 impulse(impulseX,impulseY,impulseZ);
+ btVector3 impulse(impulsein.x(), impulsein.y(), impulsein.z());
if (m_object && impulse.length2() > (SIMD_EPSILON*SIMD_EPSILON))
{
@@ -1261,7 +1317,7 @@ void CcdPhysicsController::applyImpulse(float attachX,float attachY,float attac
return;
}
- btVector3 pos(attachX,attachY,attachZ);
+ btVector3 pos(attach.x(), attach.y(), attach.z());
btRigidBody* body = GetRigidBody();
if (body)
body->applyImpulse(impulse,pos);
@@ -1280,82 +1336,59 @@ void CcdPhysicsController::SetActive(bool active)
{
}
// reading out information from physics
-void CcdPhysicsController::GetLinearVelocity(float& linvX,float& linvY,float& linvZ)
+MT_Vector3 CcdPhysicsController::GetLinearVelocity()
{
btRigidBody* body = GetRigidBody();
if (body)
{
const btVector3& linvel = body->getLinearVelocity();
- linvX = linvel.x();
- linvY = linvel.y();
- linvZ = linvel.z();
- } else
- {
- linvX = 0.f;
- linvY = 0.f;
- linvZ = 0.f;
+ return MT_Vector3(linvel.x(), linvel.y(), linvel.z());
}
+ return MT_Vector3(0.f, 0.f, 0.f);
}
-void CcdPhysicsController::GetAngularVelocity(float& angVelX,float& angVelY,float& angVelZ)
+MT_Vector3 CcdPhysicsController::GetAngularVelocity()
{
btRigidBody* body = GetRigidBody();
if (body)
{
const btVector3& angvel= body->getAngularVelocity();
- angVelX = angvel.x();
- angVelY = angvel.y();
- angVelZ = angvel.z();
- } else
- {
- angVelX = 0.f;
- angVelY = 0.f;
- angVelZ = 0.f;
+ return MT_Vector3(angvel.x(), angvel.y(), angvel.z());
}
+
+ return MT_Vector3(0.f, 0.f, 0.f);
}
-void CcdPhysicsController::GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ)
+MT_Vector3 CcdPhysicsController::GetVelocity(const MT_Point3 &posin)
{
- btVector3 pos(posX,posY,posZ);
+ btVector3 pos(posin.x(), posin.y(), posin.z());
btRigidBody* body = GetRigidBody();
if (body)
{
btVector3 linvel = body->getVelocityInLocalPoint(pos);
- linvX = linvel.x();
- linvY = linvel.y();
- linvZ = linvel.z();
- } else
- {
- linvX = 0.f;
- linvY = 0.f;
- linvZ = 0.f;
+ return MT_Vector3(linvel.x(), linvel.y(), linvel.z());
}
-}
-void CcdPhysicsController::GetWalkDirection(float& dirX,float& dirY,float& dirZ)
-{
- if (m_object && m_characterController)
- {
- const btVector3 dir = m_characterController->getWalkDirection();
- dirX = dir.x();
- dirY = dir.y();
- dirZ = dir.z();
- }
- else
- {
- dirX = 0.f;
- dirY = 0.f;
- dirZ = 0.f;
- }
+ return MT_Vector3(0.f, 0.f, 0.f);
}
-void CcdPhysicsController::getReactionForce(float& forceX,float& forceY,float& forceZ)
+MT_Vector3 CcdPhysicsController::GetLocalInertia()
{
+ MT_Vector3 inertia(0.f, 0.f, 0.f);
+ btVector3 inv_inertia;
+ if (GetRigidBody()) {
+ inv_inertia = GetRigidBody()->getInvInertiaDiagLocal();
+ if (!btFuzzyZero(inv_inertia.getX()) &&
+ !btFuzzyZero(inv_inertia.getY()) &&
+ !btFuzzyZero(inv_inertia.getZ()))
+ inertia = MT_Vector3(1.f/inv_inertia.getX(), 1.f/inv_inertia.getY(), 1.f/inv_inertia.getZ());
+ }
+ return inertia;
}
// dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted
-void CcdPhysicsController::setRigidBody(bool rigid)
+void CcdPhysicsController::SetRigidBody(bool rigid)
{
btRigidBody* body = GetRigidBody();
if (body)
@@ -1371,13 +1404,21 @@ void CcdPhysicsController::setRigidBody(bool rigid)
}
// clientinfo for raycasts for example
-void* CcdPhysicsController::getNewClientInfo()
+void* CcdPhysicsController::GetNewClientInfo()
{
return m_newClientInfo;
}
-void CcdPhysicsController::setNewClientInfo(void* clientinfo)
+void CcdPhysicsController::SetNewClientInfo(void* clientinfo)
{
m_newClientInfo = clientinfo;
+
+ if (m_cci.m_bSensor)
+ {
+ // use a different callback function for sensor object,
+ // bullet will not synchronize, we must do it explicitly
+ SG_Callbacks& callbacks = KX_GameObject::GetClientObject((KX_ClientObjectInfo*)clientinfo)->GetSGNode()->GetCallBackFunctions();
+ callbacks.m_updatefunc = KX_GameObject::SynchronizeTransformFunc;
+ }
}
@@ -1390,7 +1431,7 @@ void CcdPhysicsController::UpdateDeactivation(float timeStep)
}
}
-bool CcdPhysicsController::wantsSleeping()
+bool CcdPhysicsController::WantsSleeping()
{
btRigidBody* body = GetRigidBody();
if (body)
@@ -1400,8 +1441,143 @@ bool CcdPhysicsController::wantsSleeping()
//check it out
return true;
}
+/* This function dynamically adds the collision shape of another controller to
+ * the current controller shape provided it is a compound shape.
+ * The idea is that dynamic parenting on a compound object will dynamically extend the shape
+ */
+void CcdPhysicsController::AddCompoundChild(PHY_IPhysicsController* child)
+{
+ if (child == NULL || !IsCompound())
+ return;
+ // other controller must be a bullet controller too
+ // verify that body and shape exist and match
+ CcdPhysicsController* childCtrl = dynamic_cast<CcdPhysicsController*>(child);
+ btRigidBody* rootBody = GetRigidBody();
+ btRigidBody* childBody = childCtrl->GetRigidBody();
+ if (!rootBody || !childBody)
+ return;
+ const btCollisionShape* rootShape = rootBody->getCollisionShape();
+ const btCollisionShape* childShape = childBody->getCollisionShape();
+ if (!rootShape ||
+ !childShape ||
+ rootShape->getShapeType() != COMPOUND_SHAPE_PROXYTYPE ||
+ childShape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE)
+ return;
+ btCompoundShape* compoundShape = (btCompoundShape*)rootShape;
+ // compute relative transformation between parent and child
+ btTransform rootTrans;
+ btTransform childTrans;
+ rootBody->getMotionState()->getWorldTransform(rootTrans);
+ childBody->getMotionState()->getWorldTransform(childTrans);
+ btVector3 rootScale = rootShape->getLocalScaling();
+ rootScale[0] = 1.0/rootScale[0];
+ rootScale[1] = 1.0/rootScale[1];
+ rootScale[2] = 1.0/rootScale[2];
+ // relative scale = child_scale/parent_scale
+ btVector3 relativeScale = childShape->getLocalScaling()*rootScale;
+ btMatrix3x3 rootRotInverse = rootTrans.getBasis().transpose();
+ // relative pos = parent_rot^-1 * ((parent_pos-child_pos)/parent_scale)
+ btVector3 relativePos = rootRotInverse*((childTrans.getOrigin()-rootTrans.getOrigin())*rootScale);
+ // relative rot = parent_rot^-1 * child_rot
+ btMatrix3x3 relativeRot = rootRotInverse*childTrans.getBasis();
+ // create a proxy shape info to store the transformation
+ CcdShapeConstructionInfo* proxyShapeInfo = new CcdShapeConstructionInfo();
+ // store the transformation to this object shapeinfo
+ proxyShapeInfo->m_childTrans.setOrigin(relativePos);
+ proxyShapeInfo->m_childTrans.setBasis(relativeRot);
+ proxyShapeInfo->m_childScale.setValue(relativeScale[0], relativeScale[1], relativeScale[2]);
+ // we will need this to make sure that we remove the right proxy later when unparenting
+ proxyShapeInfo->m_userData = childCtrl;
+ proxyShapeInfo->SetProxy(childCtrl->GetShapeInfo()->AddRef());
+ // add to parent compound shapeinfo (increments ref count)
+ GetShapeInfo()->AddShape(proxyShapeInfo);
+ // create new bullet collision shape from the object shapeinfo and set scaling
+ btCollisionShape* newChildShape = proxyShapeInfo->CreateBulletShape(childCtrl->GetMargin(), childCtrl->GetConstructionInfo().m_bGimpact, true);
+ newChildShape->setLocalScaling(relativeScale);
+ // add bullet collision shape to parent compound collision shape
+ compoundShape->addChildShape(proxyShapeInfo->m_childTrans,newChildShape);
+ // proxyShapeInfo is not needed anymore, release it
+ proxyShapeInfo->Release();
+ // remember we created this shape
+ childCtrl->m_bulletChildShape = newChildShape;
+ // recompute inertia of parent
+ if (!rootBody->isStaticOrKinematicObject())
+ {
+ btVector3 localInertia;
+ float mass = 1.f/rootBody->getInvMass();
+ compoundShape->calculateLocalInertia(mass,localInertia);
+ rootBody->setMassProps(mass,localInertia);
+ }
+ // must update the broadphase cache,
+ GetPhysicsEnvironment()->RefreshCcdPhysicsController(this);
+ // remove the children
+ GetPhysicsEnvironment()->DisableCcdPhysicsController(childCtrl);
+}
+
+/* Reverse function of the above, it will remove a shape from a compound shape
+ * provided that the former was added to the later using AddCompoundChild()
+ */
+void CcdPhysicsController::RemoveCompoundChild(PHY_IPhysicsController* child)
+{
+ if (child == NULL || !IsCompound())
+ return;
+ // other controller must be a bullet controller too
+ // verify that body and shape exist and match
+ CcdPhysicsController* childCtrl = dynamic_cast<CcdPhysicsController*>(child);
+ btRigidBody* rootBody = GetRigidBody();
+ btRigidBody* childBody = childCtrl->GetRigidBody();
+ if (!rootBody || !childBody)
+ return;
+ const btCollisionShape* rootShape = rootBody->getCollisionShape();
+ if (!rootShape ||
+ rootShape->getShapeType() != COMPOUND_SHAPE_PROXYTYPE)
+ return;
+ btCompoundShape* compoundShape = (btCompoundShape*)rootShape;
+ // retrieve the shapeInfo
+ CcdShapeConstructionInfo* childShapeInfo = childCtrl->GetShapeInfo();
+ CcdShapeConstructionInfo* rootShapeInfo = GetShapeInfo();
+ // and verify that the child is part of the parent
+ int i = rootShapeInfo->FindChildShape(childShapeInfo, childCtrl);
+ if (i < 0)
+ return;
+ rootShapeInfo->RemoveChildShape(i);
+ if (childCtrl->m_bulletChildShape)
+ {
+ int numChildren = compoundShape->getNumChildShapes();
+ for (i=0; i<numChildren; i++)
+ {
+ if (compoundShape->getChildShape(i) == childCtrl->m_bulletChildShape)
+ {
+ compoundShape->removeChildShapeByIndex(i);
+ compoundShape->recalculateLocalAabb();
+ break;
+ }
+ }
+ delete childCtrl->m_bulletChildShape;
+ childCtrl->m_bulletChildShape = NULL;
+ }
+ // recompute inertia of parent
+ if (!rootBody->isStaticOrKinematicObject())
+ {
+ btVector3 localInertia;
+ float mass = 1.f/rootBody->getInvMass();
+ compoundShape->calculateLocalInertia(mass,localInertia);
+ rootBody->setMassProps(mass,localInertia);
+ }
+ // must update the broadphase cache,
+ GetPhysicsEnvironment()->RefreshCcdPhysicsController(this);
+ // reactivate the children
+ GetPhysicsEnvironment()->EnableCcdPhysicsController(childCtrl);
+}
+
+PHY_IPhysicsController* CcdPhysicsController::GetReplica()
+{
+ CcdPhysicsController* replica = new CcdPhysicsController(*this);
+ return replica;
+}
-PHY_IPhysicsController* CcdPhysicsController::GetReplica()
+// Keeping this separate for now, maybe we can combine it with GetReplica()...
+PHY_IPhysicsController* CcdPhysicsController::GetReplicaForSensors()
{
// This is used only to replicate Near and Radar sensor controllers
// The replication of object physics controller is done in KX_BulletPhysicsController::GetReplica()
@@ -1460,21 +1636,21 @@ DefaultMotionState::~DefaultMotionState()
}
-void DefaultMotionState::getWorldPosition(float& posX,float& posY,float& posZ)
+void DefaultMotionState::GetWorldPosition(float& posX,float& posY,float& posZ)
{
posX = m_worldTransform.getOrigin().x();
posY = m_worldTransform.getOrigin().y();
posZ = m_worldTransform.getOrigin().z();
}
-void DefaultMotionState::getWorldScaling(float& scaleX,float& scaleY,float& scaleZ)
+void DefaultMotionState::GetWorldScaling(float& scaleX,float& scaleY,float& scaleZ)
{
scaleX = m_localScaling.getX();
scaleY = m_localScaling.getY();
scaleZ = m_localScaling.getZ();
}
-void DefaultMotionState::getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal)
+void DefaultMotionState::GetWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal)
{
btQuaternion quat = m_worldTransform.getRotation();
quatIma0 = quat.x();
@@ -1483,28 +1659,28 @@ void DefaultMotionState::getWorldOrientation(float& quatIma0,float& quatIma1,flo
quatReal = quat[3];
}
-void DefaultMotionState::getWorldOrientation(float* ori)
+void DefaultMotionState::GetWorldOrientation(float* ori)
{
m_worldTransform.getBasis().getOpenGLSubMatrix(ori);
}
-void DefaultMotionState::setWorldOrientation(const float* ori)
+void DefaultMotionState::SetWorldOrientation(const float* ori)
{
m_worldTransform.getBasis().setFromOpenGLSubMatrix(ori);
}
-void DefaultMotionState::setWorldPosition(float posX,float posY,float posZ)
+void DefaultMotionState::SetWorldPosition(float posX,float posY,float posZ)
{
btVector3 pos(posX,posY,posZ);
m_worldTransform.setOrigin( pos );
}
-void DefaultMotionState::setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)
+void DefaultMotionState::SetWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)
{
btQuaternion orn(quatIma0,quatIma1,quatIma2,quatReal);
m_worldTransform.setRotation( orn );
}
-void DefaultMotionState::calculateWorldTransformations()
+void DefaultMotionState::CalculateWorldTransformations()
{
}
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
index f1f0ca31419..194a47ae2df 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
@@ -33,6 +33,7 @@ subject to the following restrictions:
#include "LinearMath/btTransform.h"
#include "PHY_IMotionState.h"
+#include "PHY_ICharacter.h"
extern float gDeactivationTime;
extern float gLinearSleepingTreshold;
@@ -266,6 +267,7 @@ struct CcdConstructionInfo
m_soft_kSHR(1.0f),
m_soft_kAHR(0.7f),
m_collisionFlags(0),
+ m_bDyna(false),
m_bRigid(false),
m_bSoft(false),
m_bSensor(false),
@@ -349,6 +351,7 @@ struct CcdConstructionInfo
int m_collisionFlags;
+ bool m_bDyna;
bool m_bRigid;
bool m_bSoft;
bool m_bSensor;
@@ -396,7 +399,7 @@ class btCollisionObject;
class btSoftBody;
class btPairCachingGhostObject;
-class BlenderBulletCharacterController : public btKinematicCharacterController
+class BlenderBulletCharacterController : public btKinematicCharacterController, public PHY_ICharacter
{
private:
btMotionState* m_motionState;
@@ -419,6 +422,30 @@ public:
virtual void jump();
const btVector3& getWalkDirection();
+
+ // PHY_ICharacter interface
+ virtual void Jump() { jump(); }
+ virtual bool OnGround(){ return onGround(); }
+ virtual float GetGravity() { return getGravity(); }
+ virtual void SetGravity(float gravity) { setGravity(gravity); }
+ virtual int GetMaxJumps() { return getMaxJumps(); }
+ virtual void SetMaxJumps(int maxJumps) { setMaxJumps(maxJumps); }
+ virtual int GetJumpCount() { return getJumpCount(); }
+ virtual void SetWalkDirection(const MT_Vector3& dir)
+ {
+ btVector3 vec = btVector3(dir[0], dir[1], dir[2]);
+ setWalkDirection(vec);
+ }
+ virtual MT_Vector3 GetWalkDirection()
+ {
+ btVector3 vec = getWalkDirection();
+ return MT_Vector3(vec[0], vec[1], vec[2]);
+ }
+
+#ifdef WITH_CXX_GUARDEDALLOC
+ using PHY_ICharacter::operator new;
+ using PHY_ICharacter::operator delete;
+#endif
};
///CcdPhysicsController is a physics object that supports continuous collision detection and time of impact based physics resolution.
@@ -433,6 +460,7 @@ protected:
btMotionState* m_bulletMotionState;
class btCollisionShape* m_collisionShape;
class CcdShapeConstructionInfo* m_shapeInfo;
+ btCollisionShape* m_bulletChildShape;
friend class CcdPhysicsEnvironment; // needed when updating the controller
@@ -449,6 +477,10 @@ protected:
CcdPhysicsController* m_parentCtrl;
+ int m_savedCollisionFlags;
+ MT_Scalar m_savedMass;
+ bool m_suspended;
+
void GetWorldOrientation(btMatrix3x3& mat);
void CreateRigidbody();
@@ -462,8 +494,8 @@ protected:
return (--m_registerCount == 0) ? true : false;
}
- void setWorldOrientation(const btMatrix3x3& mat);
- void forceWorldTransform(const btMatrix3x3& mat, const btVector3& pos);
+ void SetWorldOrientation(const btMatrix3x3& mat);
+ void ForceWorldTransform(const btMatrix3x3& mat, const btVector3& pos);
public:
@@ -477,11 +509,11 @@ protected:
virtual ~CcdPhysicsController();
- CcdConstructionInfo& getConstructionInfo()
+ CcdConstructionInfo& GetConstructionInfo()
{
return m_cci;
}
- const CcdConstructionInfo& getConstructionInfo() const
+ const CcdConstructionInfo& GetConstructionInfo() const
{
return m_cci;
}
@@ -518,42 +550,51 @@ protected:
virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment *env);
// kinematic methods
- virtual void RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local);
- virtual void SetWalkDirection(float dirX,float dirY,float dirZ,bool local);
- virtual void RelativeRotate(const float drot[9],bool local);
- virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal);
- virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal);
- virtual void setPosition(float posX,float posY,float posZ);
- virtual void getPosition(MT_Vector3& pos) const;
-
- virtual void setScaling(float scaleX,float scaleY,float scaleZ);
+ virtual void RelativeTranslate(const MT_Vector3& dloc,bool local);
+ virtual void RelativeRotate(const MT_Matrix3x3&rotval, bool local);
+ virtual MT_Matrix3x3 GetOrientation();
+ virtual void SetOrientation(const MT_Matrix3x3& orn);
+ virtual void SetPosition(const MT_Vector3& pos);
+ virtual void GetPosition(MT_Vector3& pos) const;
+ virtual void SetScaling(const MT_Vector3& scale);
+ virtual void SetTransform();
+
+ virtual MT_Scalar GetMass();
+ virtual void SetMass(MT_Scalar newmass);
// physics methods
- virtual void ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local);
- virtual void ApplyForce(float forceX,float forceY,float forceZ,bool local);
- virtual void SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local);
- virtual void SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local);
- virtual void applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ);
+ virtual void ApplyImpulse(const MT_Point3& attach, const MT_Vector3& impulsein);
+ virtual void ApplyTorque(const MT_Vector3& torque,bool local);
+ virtual void ApplyForce(const MT_Vector3& force,bool local);
+ virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local);
+ virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local);
virtual void Jump();
virtual void SetActive(bool active);
// reading out information from physics
- virtual void GetLinearVelocity(float& linvX,float& linvY,float& linvZ);
- virtual void GetAngularVelocity(float& angVelX,float& angVelY,float& angVelZ);
- virtual void GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ);
- virtual void getReactionForce(float& forceX,float& forceY,float& forceZ);
- virtual void GetWalkDirection(float& dirX,float& dirY,float& dirZ);
+ virtual MT_Vector3 GetLinearVelocity();
+ virtual MT_Vector3 GetAngularVelocity();
+ virtual MT_Vector3 GetVelocity(const MT_Point3& posin);
+ virtual MT_Vector3 GetLocalInertia();
// dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted
- virtual void setRigidBody(bool rigid);
+ virtual void SetRigidBody(bool rigid);
- virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ);
+ virtual void ResolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ);
+
+ virtual void SuspendDynamics(bool ghost);
+ virtual void RestoreDynamics();
+
+ // Shape control
+ virtual void AddCompoundChild(PHY_IPhysicsController* child);
+ virtual void RemoveCompoundChild(PHY_IPhysicsController* child);
// clientinfo for raycasts for example
- virtual void* getNewClientInfo();
- virtual void setNewClientInfo(void* clientinfo);
+ virtual void* GetNewClientInfo();
+ virtual void SetNewClientInfo(void* clientinfo);
virtual PHY_IPhysicsController* GetReplica();
+ virtual PHY_IPhysicsController* GetReplicaForSensors();
///There should be no 'SetCollisionFilterGroup' method, as changing this during run-time is will result in errors
short int GetCollisionFilterGroup() const
@@ -566,7 +607,7 @@ protected:
return m_cci.m_collisionFilterMask;
}
- virtual void calcXform() {}
+ virtual void CalcXform() {}
virtual void SetMargin(float margin)
{
if (m_collisionShape)
@@ -609,7 +650,7 @@ protected:
return m_cci.m_clamp_vel_max;
}
- bool wantsSleeping();
+ bool WantsSleeping();
void UpdateDeactivation(float timeStep);
@@ -635,24 +676,29 @@ protected:
return m_cci.m_physicsEnv;
}
- void setParentCtrl(CcdPhysicsController* parentCtrl)
+ void SetParentCtrl(CcdPhysicsController* parentCtrl)
{
m_parentCtrl = parentCtrl;
}
- CcdPhysicsController* getParentCtrl()
+ CcdPhysicsController* GetParentCtrl()
{
return m_parentCtrl;
}
- const CcdPhysicsController* getParentCtrl() const
+ const CcdPhysicsController* GetParentCtrl() const
{
return m_parentCtrl;
}
- virtual const char* getName()
+ virtual bool IsDynamic()
+ {
+ return GetConstructionInfo().m_bDyna;
+ }
+
+ virtual bool IsCompound()
{
- return 0;
+ return GetConstructionInfo().m_shapeInfo->m_shapeType == PHY_SHAPE_COMPOUND;
}
#ifdef WITH_CXX_GUARDEDALLOC
@@ -672,16 +718,16 @@ class DefaultMotionState : public PHY_IMotionState
virtual ~DefaultMotionState();
- virtual void getWorldPosition(float& posX,float& posY,float& posZ);
- virtual void getWorldScaling(float& scaleX,float& scaleY,float& scaleZ);
- virtual void getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal);
+ virtual void GetWorldPosition(float& posX,float& posY,float& posZ);
+ virtual void GetWorldScaling(float& scaleX,float& scaleY,float& scaleZ);
+ virtual void GetWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal);
- virtual void setWorldPosition(float posX,float posY,float posZ);
- virtual void setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal);
- virtual void getWorldOrientation(float* ori);
- virtual void setWorldOrientation(const float* ori);
+ virtual void SetWorldPosition(float posX,float posY,float posZ);
+ virtual void SetWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal);
+ virtual void GetWorldOrientation(float* ori);
+ virtual void SetWorldOrientation(const float* ori);
- virtual void calculateWorldTransformations();
+ virtual void CalculateWorldTransformations();
btTransform m_worldTransform;
btVector3 m_localScaling;
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index e01530f2b11..71ed6af2f99 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -127,8 +127,8 @@ public:
btTransform trans = m_vehicle->getWheelInfo(i).m_worldTransform;
btQuaternion orn = trans.getRotation();
const btVector3& pos = trans.getOrigin();
- motionState->setWorldOrientation(orn.x(),orn.y(),orn.z(),orn[3]);
- motionState->setWorldPosition(pos.x(),pos.y(),pos.z());
+ motionState->SetWorldOrientation(orn.x(),orn.y(),orn.z(),orn[3]);
+ motionState->SetWorldPosition(pos.x(),pos.y(),pos.z());
}
}
@@ -265,63 +265,6 @@ public:
};
#endif //NEW_BULLET_VEHICLE_SUPPORT
-class CharacterWrapper : public PHY_ICharacter
-{
-private:
- BlenderBulletCharacterController* m_controller;
-
-public:
- CharacterWrapper(BlenderBulletCharacterController* cont)
- : m_controller(cont)
- {}
-
- virtual void Jump()
- {
- m_controller->jump();
- }
-
- virtual bool OnGround()
- {
- return m_controller->onGround();
- }
-
- virtual float GetGravity()
- {
- return m_controller->getGravity();
- }
- virtual void SetGravity(float gravity)
- {
- m_controller->setGravity(gravity);
- }
-
- virtual int GetMaxJumps()
- {
- return m_controller->getMaxJumps();
- }
-
- virtual void SetMaxJumps(int maxJumps)
- {
- m_controller->setMaxJumps(maxJumps);
- }
-
- virtual int GetJumpCount()
- {
- return m_controller->getJumpCount();
- }
-
- virtual void SetWalkDirection(const MT_Vector3& dir)
- {
- btVector3 vec = btVector3(dir[0], dir[1], dir[2]);
- m_controller->setWalkDirection(vec);
- }
-
- virtual MT_Vector3 GetWalkDirection()
- {
- btVector3 vec = m_controller->getWalkDirection();
- return MT_Vector3(vec[0], vec[1], vec[2]);
- }
-};
-
class CcdOverlapFilterCallBack : public btOverlapFilterCallback
{
private:
@@ -339,7 +282,7 @@ public:
};
-void CcdPhysicsEnvironment::setDebugDrawer(btIDebugDraw* debugDrawer)
+void CcdPhysicsEnvironment::SetDebugDrawer(btIDebugDraw* debugDrawer)
{
if (debugDrawer && m_dynamicsWorld)
m_dynamicsWorld->setDebugDrawer(debugDrawer);
@@ -429,17 +372,17 @@ m_scalingPropagated(false)
m_broadphase->getOverlappingPairCache()->setOverlapFilterCallback(m_filterCallback);
m_broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(m_ghostPairCallback);
- setSolverType(1);//issues with quickstep and memory allocations
+ SetSolverType(1);//issues with quickstep and memory allocations
// m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
m_dynamicsWorld = new btSoftRigidDynamicsWorld(dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
//m_dynamicsWorld->getSolverInfo().m_linearSlop = 0.01f;
//m_dynamicsWorld->getSolverInfo().m_solverMode= SOLVER_USE_WARMSTARTING + SOLVER_USE_2_FRICTION_DIRECTIONS + SOLVER_RANDMIZE_ORDER + SOLVER_USE_FRICTION_WARMSTARTING;
m_debugDrawer = 0;
- setGravity(0.f,0.f,-9.81f);
+ SetGravity(0.f,0.f,-9.81f);
}
-void CcdPhysicsEnvironment::addCcdPhysicsController(CcdPhysicsController* ctrl)
+void CcdPhysicsEnvironment::AddCcdPhysicsController(CcdPhysicsController* ctrl)
{
btRigidBody* body = ctrl->GetRigidBody();
btCollisionObject* obj = ctrl->GetCollisionObject();
@@ -483,7 +426,7 @@ void CcdPhysicsEnvironment::addCcdPhysicsController(CcdPhysicsController* ctrl)
-bool CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctrl)
+bool CcdPhysicsEnvironment::RemoveCcdPhysicsController(CcdPhysicsController* ctrl)
{
//also remove constraint
btRigidBody* body = ctrl->GetRigidBody();
@@ -522,7 +465,7 @@ bool CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctr
return (m_controllers.erase(ctrl) != 0);
}
-void CcdPhysicsEnvironment::updateCcdPhysicsController(CcdPhysicsController* ctrl, btScalar newMass, int newCollisionFlags, short int newCollisionGroup, short int newCollisionMask)
+void CcdPhysicsEnvironment::UpdateCcdPhysicsController(CcdPhysicsController* ctrl, btScalar newMass, int newCollisionFlags, short int newCollisionGroup, short int newCollisionMask)
{
// this function is used when the collisionning group of a controller is changed
// remove and add the collistioning object
@@ -551,7 +494,7 @@ void CcdPhysicsEnvironment::updateCcdPhysicsController(CcdPhysicsController* ctr
ctrl->m_cci.m_collisionFlags = newCollisionFlags;
}
-void CcdPhysicsEnvironment::enableCcdPhysicsController(CcdPhysicsController* ctrl)
+void CcdPhysicsEnvironment::EnableCcdPhysicsController(CcdPhysicsController* ctrl)
{
if (m_controllers.insert(ctrl).second)
{
@@ -568,7 +511,7 @@ void CcdPhysicsEnvironment::enableCcdPhysicsController(CcdPhysicsController* ctr
}
}
-void CcdPhysicsEnvironment::disableCcdPhysicsController(CcdPhysicsController* ctrl)
+void CcdPhysicsEnvironment::DisableCcdPhysicsController(CcdPhysicsController* ctrl)
{
if (m_controllers.erase(ctrl))
{
@@ -588,7 +531,7 @@ void CcdPhysicsEnvironment::disableCcdPhysicsController(CcdPhysicsController* ct
}
}
-void CcdPhysicsEnvironment::refreshCcdPhysicsController(CcdPhysicsController* ctrl)
+void CcdPhysicsEnvironment::RefreshCcdPhysicsController(CcdPhysicsController* ctrl)
{
btCollisionObject* obj = ctrl->GetCollisionObject();
if (obj)
@@ -601,15 +544,15 @@ void CcdPhysicsEnvironment::refreshCcdPhysicsController(CcdPhysicsController* ct
}
}
-void CcdPhysicsEnvironment::addCcdGraphicController(CcdGraphicController* ctrl)
+void CcdPhysicsEnvironment::AddCcdGraphicController(CcdGraphicController* ctrl)
{
- if (m_cullingTree && !ctrl->getBroadphaseHandle())
+ if (m_cullingTree && !ctrl->GetBroadphaseHandle())
{
btVector3 minAabb;
btVector3 maxAabb;
- ctrl->getAabb(minAabb, maxAabb);
+ ctrl->GetAabb(minAabb, maxAabb);
- ctrl->setBroadphaseHandle(m_cullingTree->createProxy(
+ ctrl->SetBroadphaseHandle(m_cullingTree->createProxy(
minAabb,
maxAabb,
INVALID_SHAPE_PROXYTYPE, // this parameter is not used
@@ -619,35 +562,35 @@ void CcdPhysicsEnvironment::addCcdGraphicController(CcdGraphicController* ctrl)
NULL, // dispatcher => this parameter is not used
0));
- assert(ctrl->getBroadphaseHandle());
+ assert(ctrl->GetBroadphaseHandle());
}
}
-void CcdPhysicsEnvironment::removeCcdGraphicController(CcdGraphicController* ctrl)
+void CcdPhysicsEnvironment::RemoveCcdGraphicController(CcdGraphicController* ctrl)
{
if (m_cullingTree)
{
- btBroadphaseProxy* bp = ctrl->getBroadphaseHandle();
+ btBroadphaseProxy* bp = ctrl->GetBroadphaseHandle();
if (bp)
{
m_cullingTree->destroyProxy(bp,NULL);
- ctrl->setBroadphaseHandle(0);
+ ctrl->SetBroadphaseHandle(0);
}
}
}
-void CcdPhysicsEnvironment::beginFrame()
+void CcdPhysicsEnvironment::BeginFrame()
{
}
-void CcdPhysicsEnvironment::debugDrawWorld()
+void CcdPhysicsEnvironment::DebugDrawWorld()
{
if (m_dynamicsWorld->getDebugDrawer() && m_dynamicsWorld->getDebugDrawer()->getDebugMode() >0)
m_dynamicsWorld->debugDrawWorld();
}
-bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep,float interval)
+bool CcdPhysicsEnvironment::ProceedDeltaTime(double curTime,float timeStep,float interval)
{
std::set<CcdPhysicsController*>::iterator it;
int i;
@@ -662,7 +605,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep,float
//uncomment next line to see where Bullet spend its time (printf in console)
//CProfileManager::dumpAll();
- processFhSprings(curTime,i*subStep);
+ ProcessFhSprings(curTime,i*subStep);
for (it=m_controllers.begin(); it!=m_controllers.end(); it++)
{
@@ -714,7 +657,7 @@ public:
};
-void CcdPhysicsEnvironment::processFhSprings(double curTime,float interval)
+void CcdPhysicsEnvironment::ProcessFhSprings(double curTime,float interval)
{
std::set<CcdPhysicsController*>::iterator it;
// dynamic of Fh spring is based on a timestep of 1/60
@@ -725,12 +668,12 @@ void CcdPhysicsEnvironment::processFhSprings(double curTime,float interval)
CcdPhysicsController* ctrl = (*it);
btRigidBody* body = ctrl->GetRigidBody();
- if (body && (ctrl->getConstructionInfo().m_do_fh || ctrl->getConstructionInfo().m_do_rot_fh))
+ if (body && (ctrl->GetConstructionInfo().m_do_fh || ctrl->GetConstructionInfo().m_do_rot_fh))
{
//printf("has Fh or RotFh\n");
//re-implement SM_FhObject.cpp using btCollisionWorld::rayTest and info from ctrl->getConstructionInfo()
//send a ray from {0.0, 0.0, 0.0} towards {0.0, 0.0, -10.0}, in local coordinates
- CcdPhysicsController* parentCtrl = ctrl->getParentCtrl();
+ CcdPhysicsController* parentCtrl = ctrl->GetParentCtrl();
btRigidBody* parentBody = parentCtrl?parentCtrl->GetRigidBody() : 0;
btRigidBody* cl_object = parentBody ? parentBody : body;
@@ -756,16 +699,16 @@ void CcdPhysicsEnvironment::processFhSprings(double curTime,float interval)
if (controller)
{
- if (controller->getConstructionInfo().m_fh_distance < SIMD_EPSILON)
+ if (controller->GetConstructionInfo().m_fh_distance < SIMD_EPSILON)
continue;
btRigidBody* hit_object = controller->GetRigidBody();
if (!hit_object)
continue;
- CcdConstructionInfo& hitObjShapeProps = controller->getConstructionInfo();
+ CcdConstructionInfo& hitObjShapeProps = controller->GetConstructionInfo();
- float distance = resultCallback.m_closestHitFraction*rayDirLocal.length()-ctrl->getConstructionInfo().m_radius;
+ float distance = resultCallback.m_closestHitFraction*rayDirLocal.length()-ctrl->GetConstructionInfo().m_radius;
if (distance >= hitObjShapeProps.m_fh_distance)
continue;
@@ -778,7 +721,7 @@ void CcdPhysicsEnvironment::processFhSprings(double curTime,float interval)
for (int i=0; i<numIter; i++)
{
- if (ctrl->getConstructionInfo().m_do_fh)
+ if (ctrl->GetConstructionInfo().m_do_fh)
{
btVector3 lspot = cl_object->getCenterOfMassPosition() +
rayDirLocal * resultCallback.m_closestHitFraction;
@@ -790,7 +733,7 @@ void CcdPhysicsEnvironment::processFhSprings(double curTime,float interval)
btVector3 rel_vel = cl_object->getLinearVelocity() - hit_object->getVelocityInLocalPoint(lspot);
btScalar rel_vel_ray = ray_dir.dot(rel_vel);
btScalar spring_extent = 1.0 - distance / hitObjShapeProps.m_fh_distance;
-
+
btScalar i_spring = spring_extent * hitObjShapeProps.m_fh_spring;
btScalar i_damp = rel_vel_ray * hitObjShapeProps.m_fh_damping;
@@ -803,7 +746,7 @@ void CcdPhysicsEnvironment::processFhSprings(double curTime,float interval)
btVector3 lateral = rel_vel - rel_vel_ray * ray_dir;
- if (ctrl->getConstructionInfo().m_do_anisotropic) {
+ if (ctrl->GetConstructionInfo().m_do_anisotropic) {
//Bullet basis contains no scaling/shear etc.
const btMatrix3x3& lcs = cl_object->getCenterOfMassTransform().getBasis();
btVector3 loc_lateral = lateral * lcs;
@@ -830,7 +773,7 @@ void CcdPhysicsEnvironment::processFhSprings(double curTime,float interval)
}
- if (ctrl->getConstructionInfo().m_do_rot_fh) {
+ if (ctrl->GetConstructionInfo().m_do_rot_fh) {
btVector3 up2 = cl_object->getWorldTransform().getBasis().getColumn(2);
btVector3 t_spring = up2.cross(normal) * hitObjShapeProps.m_fh_spring;
@@ -850,69 +793,69 @@ void CcdPhysicsEnvironment::processFhSprings(double curTime,float interval)
}
}
-void CcdPhysicsEnvironment::setDebugMode(int debugMode)
+void CcdPhysicsEnvironment::SetDebugMode(int debugMode)
{
if (m_debugDrawer) {
m_debugDrawer->setDebugMode(debugMode);
}
}
-void CcdPhysicsEnvironment::setNumIterations(int numIter)
+void CcdPhysicsEnvironment::SetNumIterations(int numIter)
{
m_numIterations = numIter;
}
-void CcdPhysicsEnvironment::setDeactivationTime(float dTime)
+void CcdPhysicsEnvironment::SetDeactivationTime(float dTime)
{
gDeactivationTime = dTime;
}
-void CcdPhysicsEnvironment::setDeactivationLinearTreshold(float linTresh)
+void CcdPhysicsEnvironment::SetDeactivationLinearTreshold(float linTresh)
{
gLinearSleepingTreshold = linTresh;
}
-void CcdPhysicsEnvironment::setDeactivationAngularTreshold(float angTresh)
+void CcdPhysicsEnvironment::SetDeactivationAngularTreshold(float angTresh)
{
gAngularSleepingTreshold = angTresh;
}
-void CcdPhysicsEnvironment::setContactBreakingTreshold(float contactBreakingTreshold)
+void CcdPhysicsEnvironment::SetContactBreakingTreshold(float contactBreakingTreshold)
{
gContactBreakingThreshold = contactBreakingTreshold;
}
-void CcdPhysicsEnvironment::setCcdMode(int ccdMode)
+void CcdPhysicsEnvironment::SetCcdMode(int ccdMode)
{
m_ccdMode = ccdMode;
}
-void CcdPhysicsEnvironment::setSolverSorConstant(float sor)
+void CcdPhysicsEnvironment::SetSolverSorConstant(float sor)
{
m_dynamicsWorld->getSolverInfo().m_sor = sor;
}
-void CcdPhysicsEnvironment::setSolverTau(float tau)
+void CcdPhysicsEnvironment::SetSolverTau(float tau)
{
m_dynamicsWorld->getSolverInfo().m_tau = tau;
}
-void CcdPhysicsEnvironment::setSolverDamping(float damping)
+void CcdPhysicsEnvironment::SetSolverDamping(float damping)
{
m_dynamicsWorld->getSolverInfo().m_damping = damping;
}
-void CcdPhysicsEnvironment::setLinearAirDamping(float damping)
+void CcdPhysicsEnvironment::SetLinearAirDamping(float damping)
{
//gLinearAirDamping = damping;
}
-void CcdPhysicsEnvironment::setUseEpa(bool epa)
+void CcdPhysicsEnvironment::SetUseEpa(bool epa)
{
//gUseEpa = epa;
}
-void CcdPhysicsEnvironment::setSolverType(int solverType)
+void CcdPhysicsEnvironment::SetSolverType(int solverType)
{
switch (solverType)
@@ -945,7 +888,7 @@ void CcdPhysicsEnvironment::setSolverType(int solverType)
-void CcdPhysicsEnvironment::getGravity(MT_Vector3& grav)
+void CcdPhysicsEnvironment::GetGravity(MT_Vector3& grav)
{
const btVector3& gravity = m_dynamicsWorld->getGravity();
grav[0] = gravity.getX();
@@ -954,7 +897,7 @@ void CcdPhysicsEnvironment::getGravity(MT_Vector3& grav)
}
-void CcdPhysicsEnvironment::setGravity(float x,float y,float z)
+void CcdPhysicsEnvironment::SetGravity(float x,float y,float z)
{
m_gravity = btVector3(x,y,z);
m_dynamicsWorld->setGravity(m_gravity);
@@ -967,7 +910,7 @@ void CcdPhysicsEnvironment::setGravity(float x,float y,float z)
static int gConstraintUid = 1;
//Following the COLLADA physics specification for constraints
-int CcdPhysicsEnvironment::createUniversalD6Constraint(
+int CcdPhysicsEnvironment::CreateUniversalD6Constraint(
class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther,
btTransform& frameInA,
btTransform& frameInB,
@@ -1025,7 +968,7 @@ int CcdPhysicsEnvironment::createUniversalD6Constraint(
-void CcdPhysicsEnvironment::removeConstraint(int constraintId)
+void CcdPhysicsEnvironment::RemoveConstraint(int constraintId)
{
int i;
@@ -1144,7 +1087,7 @@ static bool GetHitTriangle(btCollisionShape* shape, CcdShapeConstructionInfo* sh
return true;
}
-PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ)
+PHY_IPhysicsController* CcdPhysicsEnvironment::RayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ)
{
btVector3 rayFrom(fromX,fromY,fromZ);
btVector3 rayTo(toX,toY,toZ);
@@ -1798,7 +1741,7 @@ struct DbvtCullingCallback : btDbvt::ICollide
btBroadphaseProxy* proxy=(btBroadphaseProxy*)leaf->data;
// the client object is a graphic controller
CcdGraphicController* ctrl = static_cast<CcdGraphicController*>(proxy->m_clientObject);
- KX_ClientObjectInfo *info = (KX_ClientObjectInfo*)ctrl->getNewClientInfo();
+ KX_ClientObjectInfo *info = (KX_ClientObjectInfo*)ctrl->GetNewClientInfo();
if (m_ocb)
{
// means we are doing occlusion culling. Check if this object is an occluders
@@ -1846,7 +1789,7 @@ struct DbvtCullingCallback : btDbvt::ICollide
};
static OcclusionBuffer gOcb;
-bool CcdPhysicsEnvironment::cullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4 *planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16])
+bool CcdPhysicsEnvironment::CullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4 *planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16])
{
if (!m_cullingTree)
return false;
@@ -1876,12 +1819,12 @@ bool CcdPhysicsEnvironment::cullingTest(PHY_CullingCallback callback, void* user
return true;
}
-int CcdPhysicsEnvironment::getNumContactPoints()
+int CcdPhysicsEnvironment::GetNumContactPoints()
{
return 0;
}
-void CcdPhysicsEnvironment::getContactPoint(int i,float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ)
+void CcdPhysicsEnvironment::GetContactPoint(int i,float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ)
{
}
@@ -1889,12 +1832,12 @@ void CcdPhysicsEnvironment::getContactPoint(int i,float& hitX,float& hitY,float&
-btBroadphaseInterface* CcdPhysicsEnvironment::getBroadphase()
+btBroadphaseInterface* CcdPhysicsEnvironment::GetBroadphase()
{
return m_dynamicsWorld->getBroadphase();
}
-btDispatcher* CcdPhysicsEnvironment::getDispatcher()
+btDispatcher* CcdPhysicsEnvironment::GetDispatcher()
{
return m_dynamicsWorld->getDispatcher();
}
@@ -1908,8 +1851,8 @@ void CcdPhysicsEnvironment::MergeEnvironment(CcdPhysicsEnvironment *other)
it= other->m_controllers.begin();
CcdPhysicsController* ctrl= (*it);
- other->removeCcdPhysicsController(ctrl);
- this->addCcdPhysicsController(ctrl);
+ other->RemoveCcdPhysicsController(ctrl);
+ this->AddCcdPhysicsController(ctrl);
}
}
@@ -1961,9 +1904,9 @@ CcdPhysicsEnvironment::~CcdPhysicsEnvironment()
}
-float CcdPhysicsEnvironment::getConstraintParam(int constraintId,int param)
+float CcdPhysicsEnvironment::GetConstraintParam(int constraintId,int param)
{
- btTypedConstraint* typedConstraint = getConstraintById(constraintId);
+ btTypedConstraint* typedConstraint = GetConstraintById(constraintId);
switch (typedConstraint->getUserConstraintType())
{
case PHY_GENERIC_6DOF_CONSTRAINT:
@@ -2000,9 +1943,9 @@ float CcdPhysicsEnvironment::getConstraintParam(int constraintId,int param)
return 0.f;
}
-void CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float value0,float value1)
+void CcdPhysicsEnvironment::SetConstraintParam(int constraintId,int param,float value0,float value1)
{
- btTypedConstraint* typedConstraint = getConstraintById(constraintId);
+ btTypedConstraint* typedConstraint = GetConstraintById(constraintId);
switch (typedConstraint->getUserConstraintType())
{
case PHY_GENERIC_6DOF_CONSTRAINT:
@@ -2110,7 +2053,7 @@ void CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float
};
}
-btTypedConstraint* CcdPhysicsEnvironment::getConstraintById(int constraintId)
+btTypedConstraint* CcdPhysicsEnvironment::GetConstraintById(int constraintId)
{
int numConstraints = m_dynamicsWorld->getNumConstraints();
@@ -2127,7 +2070,7 @@ btTypedConstraint* CcdPhysicsEnvironment::getConstraintById(int constraintId)
}
-void CcdPhysicsEnvironment::addSensor(PHY_IPhysicsController* ctrl)
+void CcdPhysicsEnvironment::AddSensor(PHY_IPhysicsController* ctrl)
{
CcdPhysicsController* ctrl1 = (CcdPhysicsController* )ctrl;
@@ -2137,10 +2080,10 @@ void CcdPhysicsEnvironment::addSensor(PHY_IPhysicsController* ctrl)
//{
// addCcdPhysicsController(ctrl1);
//}
- enableCcdPhysicsController(ctrl1);
+ EnableCcdPhysicsController(ctrl1);
}
-bool CcdPhysicsEnvironment::removeCollisionCallback(PHY_IPhysicsController* ctrl)
+bool CcdPhysicsEnvironment::RemoveCollisionCallback(PHY_IPhysicsController* ctrl)
{
CcdPhysicsController* ccdCtrl = (CcdPhysicsController*)ctrl;
if (!ccdCtrl->Unregister())
@@ -2150,12 +2093,12 @@ bool CcdPhysicsEnvironment::removeCollisionCallback(PHY_IPhysicsController* ctrl
}
-void CcdPhysicsEnvironment::removeSensor(PHY_IPhysicsController* ctrl)
+void CcdPhysicsEnvironment::RemoveSensor(PHY_IPhysicsController* ctrl)
{
- disableCcdPhysicsController((CcdPhysicsController*)ctrl);
+ DisableCcdPhysicsController((CcdPhysicsController*)ctrl);
}
-void CcdPhysicsEnvironment::addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user)
+void CcdPhysicsEnvironment::AddTouchCallback(int response_class, PHY_ResponseCallback callback, void *user)
{
/* printf("addTouchCallback\n(response class = %i)\n",response_class);
@@ -2187,7 +2130,7 @@ void CcdPhysicsEnvironment::addTouchCallback(int response_class, PHY_ResponseCal
m_triggerCallbacksUserPtrs[response_class] = user;
}
-bool CcdPhysicsEnvironment::requestCollisionCallback(PHY_IPhysicsController* ctrl)
+bool CcdPhysicsEnvironment::RequestCollisionCallback(PHY_IPhysicsController* ctrl)
{
CcdPhysicsController* ccdCtrl = static_cast<CcdPhysicsController*>(ctrl);
@@ -2270,12 +2213,12 @@ bool CcdOverlapFilterCallBack::needBroadphaseCollision(btBroadphaseProxy* proxy0
(KX_ClientObjectInfo*)
((CcdPhysicsController*)
(((btCollisionObject*)proxy0->m_clientObject)->getUserPointer()))
- ->getNewClientInfo());
+ ->GetNewClientInfo());
KX_GameObject *kxObj1 = KX_GameObject::GetClientObject(
(KX_ClientObjectInfo*)
((CcdPhysicsController*)
(((btCollisionObject*)proxy1->m_clientObject)->getUserPointer()))
- ->getNewClientInfo());
+ ->GetNewClientInfo());
// First check the filters. Note that this is called during scene
// conversion, so we can't assume the KX_GameObject instances exist. This
@@ -2324,7 +2267,7 @@ bool CcdOverlapFilterCallBack::needBroadphaseCollision(btBroadphaseProxy* proxy0
#ifdef NEW_BULLET_VEHICLE_SUPPORT
//complex constraint for vehicles
-PHY_IVehicle* CcdPhysicsEnvironment::getVehicleConstraint(int constraintId)
+PHY_IVehicle* CcdPhysicsEnvironment::GetVehicleConstraint(int constraintId)
{
int i;
@@ -2342,13 +2285,10 @@ PHY_IVehicle* CcdPhysicsEnvironment::getVehicleConstraint(int constraintId)
#endif //NEW_BULLET_VEHICLE_SUPPORT
-PHY_ICharacter* CcdPhysicsEnvironment::getCharacterController(KX_GameObject *ob)
+PHY_ICharacter* CcdPhysicsEnvironment::GetCharacterController(KX_GameObject *ob)
{
- CcdPhysicsController* controller = (CcdPhysicsController*)ob->GetPhysicsController()->GetUserData();
- if (controller->GetCharacterController())
- return new CharacterWrapper((BlenderBulletCharacterController*)controller->GetCharacterController());
-
- return NULL;
+ CcdPhysicsController* controller = (CcdPhysicsController*)ob->GetPhysicsController();
+ return (controller) ? dynamic_cast<BlenderBulletCharacterController*>(controller->GetCharacterController()) : NULL;
}
@@ -2398,7 +2338,7 @@ int findClosestNode(btSoftBody* sb,const btVector3& worldPoint)
return node;
}
-int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl0,class PHY_IPhysicsController* ctrl1,PHY_ConstraintType type,
+int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl0,class PHY_IPhysicsController* ctrl1,PHY_ConstraintType type,
float pivotX,float pivotY,float pivotZ,
float axisX,float axisY,float axisZ,
float axis1X,float axis1Y,float axis1Z,
@@ -2891,7 +2831,7 @@ float CcdPhysicsEnvironment::getAppliedImpulse(int constraintid)
return 0.f;
}
-void CcdPhysicsEnvironment::exportFile(const char* filename)
+void CcdPhysicsEnvironment::ExportFile(const char* filename)
{
btDefaultSerializer* serializer = new btDefaultSerializer();
@@ -2904,7 +2844,7 @@ void CcdPhysicsEnvironment::exportFile(const char* filename)
CcdPhysicsController* controller = static_cast<CcdPhysicsController*>(colObj->getUserPointer());
if (controller)
{
- const char* name = controller->getName();
+ const char* name = KX_GameObject::GetClientObject((KX_ClientObjectInfo*)controller->GetNewClientInfo())->GetName();
if (name)
{
serializer->registerNameForPointer(colObj,name);
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
index 8cf88526969..0e8ac9417f0 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
@@ -24,6 +24,7 @@ subject to the following restrictions:
#include "PHY_IPhysicsEnvironment.h"
#include <vector>
#include <set>
+#include <map>
class CcdPhysicsController;
class CcdGraphicController;
#include "LinearMath/btVector3.h"
@@ -83,7 +84,7 @@ protected:
int m_profileTimings;
bool m_enableSatCollisionDetection;
- void processFhSprings(double curTime,float timeStep);
+ void ProcessFhSprings(double curTime,float timeStep);
public:
CcdPhysicsEnvironment(bool useDbvtCulling, btDispatcher* dispatcher=0, btOverlappingPairCache* pairCache=0);
@@ -96,54 +97,54 @@ protected:
/// Perform an integration step of duration 'timeStep'.
- virtual void setDebugDrawer(btIDebugDraw* debugDrawer);
+ virtual void SetDebugDrawer(btIDebugDraw* debugDrawer);
- virtual void setNumIterations(int numIter);
- virtual void setNumTimeSubSteps(int numTimeSubSteps)
+ virtual void SetNumIterations(int numIter);
+ virtual void SetNumTimeSubSteps(int numTimeSubSteps)
{
m_numTimeSubSteps = numTimeSubSteps;
}
- virtual void setDeactivationTime(float dTime);
- virtual void setDeactivationLinearTreshold(float linTresh);
- virtual void setDeactivationAngularTreshold(float angTresh);
- virtual void setContactBreakingTreshold(float contactBreakingTreshold);
- virtual void setCcdMode(int ccdMode);
- virtual void setSolverType(int solverType);
- virtual void setSolverSorConstant(float sor);
- virtual void setSolverTau(float tau);
- virtual void setSolverDamping(float damping);
- virtual void setLinearAirDamping(float damping);
- virtual void setUseEpa(bool epa);
-
- int getNumTimeSubSteps()
+ virtual void SetDeactivationTime(float dTime);
+ virtual void SetDeactivationLinearTreshold(float linTresh);
+ virtual void SetDeactivationAngularTreshold(float angTresh);
+ virtual void SetContactBreakingTreshold(float contactBreakingTreshold);
+ virtual void SetCcdMode(int ccdMode);
+ virtual void SetSolverType(int solverType);
+ virtual void SetSolverSorConstant(float sor);
+ virtual void SetSolverTau(float tau);
+ virtual void SetSolverDamping(float damping);
+ virtual void SetLinearAirDamping(float damping);
+ virtual void SetUseEpa(bool epa);
+
+ virtual int GetNumTimeSubSteps()
{
return m_numTimeSubSteps;
}
- virtual void beginFrame();
- virtual void endFrame() {}
+ virtual void BeginFrame();
+ virtual void EndFrame() {}
/// Perform an integration step of duration 'timeStep'.
- virtual bool proceedDeltaTime(double curTime,float timeStep,float interval);
-
- virtual void debugDrawWorld();
+ virtual bool ProceedDeltaTime(double curTime,float timeStep,float interval);
+
+ virtual void DebugDrawWorld();
// virtual bool proceedDeltaTimeOneStep(float timeStep);
- virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)
+ virtual void SetFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)
{
//based on DEFAULT_PHYSICS_TIC_RATE of 60 hertz
- setNumTimeSubSteps((int)(fixedTimeStep / 60.f));
+ SetNumTimeSubSteps((int)(fixedTimeStep / 60.f));
}
//returns 0.f if no fixed timestep is used
- virtual float getFixedTimeStep() { return 0.f; }
+ virtual float GetFixedTimeStep() { return 0.f; }
- virtual void setDebugMode(int debugMode);
+ virtual void SetDebugMode(int debugMode);
- virtual void setGravity(float x,float y,float z);
- virtual void getGravity(MT_Vector3& grav);
+ virtual void SetGravity(float x,float y,float z);
+ virtual void GetGravity(MT_Vector3& grav);
- virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
+ virtual int CreateConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
float pivotX,float pivotY,float pivotZ,
float axisX,float axisY,float axisZ,
float axis1X=0,float axis1Y=0,float axis1Z=0,
@@ -152,7 +153,7 @@ protected:
//Following the COLLADA physics specification for constraints
- virtual int createUniversalD6Constraint(
+ virtual int CreateUniversalD6Constraint(
class PHY_IPhysicsController* ctrlRef,class PHY_IPhysicsController* ctrlOther,
btTransform& localAttachmentFrameRef,
btTransform& localAttachmentOther,
@@ -163,11 +164,11 @@ protected:
);
- virtual void setConstraintParam(int constraintId,int param,float value,float value1);
+ virtual void SetConstraintParam(int constraintId,int param,float value,float value1);
- virtual float getConstraintParam(int constraintId,int param);
+ virtual float GetConstraintParam(int constraintId,int param);
- virtual void removeConstraint(int constraintid);
+ virtual void RemoveConstraint(int constraintid);
virtual float getAppliedImpulse(int constraintid);
@@ -177,61 +178,61 @@ protected:
#ifdef NEW_BULLET_VEHICLE_SUPPORT
//complex constraint for vehicles
- virtual PHY_IVehicle* getVehicleConstraint(int constraintId);
+ virtual PHY_IVehicle* GetVehicleConstraint(int constraintId);
#else
- virtual class PHY_IVehicle* getVehicleConstraint(int constraintId)
+ virtual class PHY_IVehicle* GetVehicleConstraint(int constraintId)
{
return 0;
}
#endif /* NEW_BULLET_VEHICLE_SUPPORT */
// Character physics wrapper
- virtual PHY_ICharacter* getCharacterController(class KX_GameObject* ob);
+ virtual PHY_ICharacter* GetCharacterController(class KX_GameObject* ob);
- btTypedConstraint* getConstraintById(int constraintId);
+ btTypedConstraint* GetConstraintById(int constraintId);
- virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ);
- virtual bool cullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]);
+ virtual PHY_IPhysicsController* RayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ);
+ virtual bool CullingTest(PHY_CullingCallback callback, void* userData, MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]);
//Methods for gamelogic collision/physics callbacks
- virtual void addSensor(PHY_IPhysicsController* ctrl);
- virtual void removeSensor(PHY_IPhysicsController* ctrl);
- virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user);
- virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl);
- virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl);
+ virtual void AddSensor(PHY_IPhysicsController* ctrl);
+ virtual void RemoveSensor(PHY_IPhysicsController* ctrl);
+ virtual void AddTouchCallback(int response_class, PHY_ResponseCallback callback, void *user);
+ virtual bool RequestCollisionCallback(PHY_IPhysicsController* ctrl);
+ virtual bool RemoveCollisionCallback(PHY_IPhysicsController* ctrl);
//These two methods are used *solely* to create controllers for Near/Radar sensor! Don't use for anything else
virtual PHY_IPhysicsController* CreateSphereController(float radius,const MT_Vector3& position);
virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight);
- virtual int getNumContactPoints();
+ virtual int GetNumContactPoints();
- virtual void getContactPoint(int i,float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ);
+ virtual void GetContactPoint(int i,float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ);
//////////////////////
//CcdPhysicsEnvironment interface
////////////////////////
- void addCcdPhysicsController(CcdPhysicsController* ctrl);
+ void AddCcdPhysicsController(CcdPhysicsController* ctrl);
- bool removeCcdPhysicsController(CcdPhysicsController* ctrl);
+ bool RemoveCcdPhysicsController(CcdPhysicsController* ctrl);
- void updateCcdPhysicsController(CcdPhysicsController* ctrl, btScalar newMass, int newCollisionFlags, short int newCollisionGroup, short int newCollisionMask);
+ void UpdateCcdPhysicsController(CcdPhysicsController* ctrl, btScalar newMass, int newCollisionFlags, short int newCollisionGroup, short int newCollisionMask);
- void disableCcdPhysicsController(CcdPhysicsController* ctrl);
+ void DisableCcdPhysicsController(CcdPhysicsController* ctrl);
- void enableCcdPhysicsController(CcdPhysicsController* ctrl);
+ void EnableCcdPhysicsController(CcdPhysicsController* ctrl);
- void refreshCcdPhysicsController(CcdPhysicsController* ctrl);
+ void RefreshCcdPhysicsController(CcdPhysicsController* ctrl);
- void addCcdGraphicController(CcdGraphicController* ctrl);
+ void AddCcdGraphicController(CcdGraphicController* ctrl);
- void removeCcdGraphicController(CcdGraphicController* ctrl);
+ void RemoveCcdGraphicController(CcdGraphicController* ctrl);
- btBroadphaseInterface* getBroadphase();
- btDbvtBroadphase* getCullingTree() { return m_cullingTree; }
+ btBroadphaseInterface* GetBroadphase();
+ btDbvtBroadphase* GetCullingTree() { return m_cullingTree; }
- btDispatcher* getDispatcher();
+ btDispatcher* GetDispatcher();
bool IsSatCollisionDetectionEnabled() const
@@ -250,7 +251,7 @@ protected:
void SyncMotionStates(float timeStep);
- class btSoftRigidDynamicsWorld* getDynamicsWorld()
+ class btSoftRigidDynamicsWorld* GetDynamicsWorld()
{
return m_dynamicsWorld;
}
@@ -291,7 +292,7 @@ protected:
bool m_scalingPropagated;
- virtual void exportFile(const char* filename);
+ virtual void ExportFile(const char* filename);
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
index 72450e4307c..1bb5431c749 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
@@ -47,19 +47,19 @@ DummyPhysicsEnvironment::~DummyPhysicsEnvironment()
//destroy physicsengine data
}
-void DummyPhysicsEnvironment::beginFrame()
+void DummyPhysicsEnvironment::BeginFrame()
{
// beginning of logic frame: apply forces
}
-void DummyPhysicsEnvironment::endFrame()
+void DummyPhysicsEnvironment::EndFrame()
{
// end of logic frame: clear forces
}
-bool DummyPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep,float interval)
+bool DummyPhysicsEnvironment::ProceedDeltaTime(double curTime,float timeStep,float interval)
{
//step physics simulation, typically perform
@@ -69,11 +69,11 @@ bool DummyPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep,f
// return true if an update was done.
return true;
}
-void DummyPhysicsEnvironment::setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)
+void DummyPhysicsEnvironment::SetFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)
{
}
-float DummyPhysicsEnvironment::getFixedTimeStep()
+float DummyPhysicsEnvironment::GetFixedTimeStep()
{
return 0.f;
}
@@ -81,18 +81,18 @@ float DummyPhysicsEnvironment::getFixedTimeStep()
-void DummyPhysicsEnvironment::setGravity(float x,float y,float z)
+void DummyPhysicsEnvironment::SetGravity(float x,float y,float z)
{
}
-void DummyPhysicsEnvironment::getGravity(class MT_Vector3& grav)
+void DummyPhysicsEnvironment::GetGravity(class MT_Vector3& grav)
{
}
-int DummyPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
+int DummyPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
float pivotX,float pivotY,float pivotZ,float axisX,float axisY,float axisZ,
float axis1X,float axis1Y,float axis1Z,
float axis2X,float axis2Y,float axis2Z,int flag
@@ -104,14 +104,14 @@ int DummyPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ct
}
-void DummyPhysicsEnvironment::removeConstraint(int constraintid)
+void DummyPhysicsEnvironment::RemoveConstraint(int constraintid)
{
if (constraintid)
{
}
}
-PHY_IPhysicsController* DummyPhysicsEnvironment::rayTest(PHY_IRayCastFilterCallback &filterCallback,float fromX,float fromY,float fromZ, float toX,float toY,float toZ)
+PHY_IPhysicsController* DummyPhysicsEnvironment::RayTest(PHY_IRayCastFilterCallback &filterCallback,float fromX,float fromY,float fromZ, float toX,float toY,float toZ)
{
//collision detection / raytesting
return NULL;
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
index 9f6bc85fced..41462f91840 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
@@ -48,57 +48,57 @@ class DummyPhysicsEnvironment : public PHY_IPhysicsEnvironment
public:
DummyPhysicsEnvironment ();
virtual ~DummyPhysicsEnvironment ();
- virtual void beginFrame();
- virtual void endFrame();
+ virtual void BeginFrame();
+ virtual void EndFrame();
// Perform an integration step of duration 'timeStep'.
- virtual bool proceedDeltaTime(double curTime,float timeStep,float interval);
- virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep);
- virtual float getFixedTimeStep();
+ virtual bool ProceedDeltaTime(double curTime,float timeStep,float interval);
+ virtual void SetFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep);
+ virtual float GetFixedTimeStep();
- virtual void setGravity(float x,float y,float z);
- virtual void getGravity(class MT_Vector3& grav);
+ virtual void SetGravity(float x,float y,float z);
+ virtual void GetGravity(class MT_Vector3& grav);
- virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
+ virtual int CreateConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
float pivotX,float pivotY,float pivotZ,
float axisX,float axisY,float axisZ,
float axis1X=0,float axis1Y=0,float axis1Z=0,
float axis2X=0,float axis2Y=0,float axis2Z=0,int flag=0
);
- virtual void removeConstraint(int constraintid);
+ virtual void RemoveConstraint(int constraintid);
//complex constraint for vehicles
- virtual PHY_IVehicle* getVehicleConstraint(int constraintId)
+ virtual PHY_IVehicle* GetVehicleConstraint(int constraintId)
{
return 0;
}
// Character physics wrapper
- virtual PHY_ICharacter* getCharacterController(class KX_GameObject* ob)
+ virtual PHY_ICharacter* GetCharacterController(class KX_GameObject* ob)
{
return 0;
}
- virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ);
- virtual bool cullingTest(PHY_CullingCallback callback, void* userData, class MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) { return false; }
+ virtual PHY_IPhysicsController* RayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ);
+ virtual bool CullingTest(PHY_CullingCallback callback, void* userData, class MT_Vector4* planes, int nplanes, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) { return false; }
//gamelogic callbacks
- virtual void addSensor(PHY_IPhysicsController* ctrl) {}
- virtual void removeSensor(PHY_IPhysicsController* ctrl) {}
- virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user)
+ virtual void AddSensor(PHY_IPhysicsController* ctrl) {}
+ virtual void RemoveSensor(PHY_IPhysicsController* ctrl) {}
+ virtual void AddTouchCallback(int response_class, PHY_ResponseCallback callback, void *user)
{
}
- virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl) { return false; }
- virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl) { return false;}
+ virtual bool RequestCollisionCallback(PHY_IPhysicsController* ctrl) { return false; }
+ virtual bool RemoveCollisionCallback(PHY_IPhysicsController* ctrl) { return false;}
virtual PHY_IPhysicsController* CreateSphereController(float radius,const class MT_Vector3& position) {return 0;}
virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight) { return 0;}
- virtual void setConstraintParam(int constraintId,int param,float value,float value1)
+ virtual void SetConstraintParam(int constraintId,int param,float value,float value1)
{
}
- virtual float getConstraintParam(int constraintId,int param)
+ virtual float GetConstraintParam(int constraintId,int param)
{
return 0.f;
}
diff --git a/source/gameengine/Physics/common/PHY_IController.h b/source/gameengine/Physics/common/PHY_IController.h
index ae1b2d9ad53..284d77ca221 100644
--- a/source/gameengine/Physics/common/PHY_IController.h
+++ b/source/gameengine/Physics/common/PHY_IController.h
@@ -50,8 +50,8 @@ class PHY_IController
public:
virtual ~PHY_IController(){};
// clientinfo for raycasts for example
- virtual void* getNewClientInfo()=0;
- virtual void setNewClientInfo(void* clientinfo)=0;
+ virtual void* GetNewClientInfo()=0;
+ virtual void SetNewClientInfo(void* clientinfo)=0;
virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment *env)=0;
diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.h b/source/gameengine/Physics/common/PHY_IGraphicController.h
index 5f64e7ccc80..b047edd93eb 100644
--- a/source/gameengine/Physics/common/PHY_IGraphicController.h
+++ b/source/gameengine/Physics/common/PHY_IGraphicController.h
@@ -47,8 +47,8 @@ class PHY_IGraphicController : public PHY_IController
*/
virtual bool SetGraphicTransform()=0;
virtual void Activate(bool active=true)=0;
- virtual void setLocalAabb(const class MT_Vector3& aabbMin,const class MT_Vector3& aabbMax)=0;
- virtual void setLocalAabb(const float* aabbMin,const float* aabbMax)=0;
+ virtual void SetLocalAabb(const class MT_Vector3& aabbMin,const class MT_Vector3& aabbMax)=0;
+ virtual void SetLocalAabb(const float* aabbMin,const float* aabbMax)=0;
virtual PHY_IGraphicController* GetReplica(class PHY_IMotionState* motionstate) {return 0;}
diff --git a/source/gameengine/Physics/common/PHY_IMotionState.h b/source/gameengine/Physics/common/PHY_IMotionState.h
index be5b2b54907..d40b8da9451 100644
--- a/source/gameengine/Physics/common/PHY_IMotionState.h
+++ b/source/gameengine/Physics/common/PHY_IMotionState.h
@@ -46,18 +46,18 @@ class PHY_IMotionState
public:
virtual ~PHY_IMotionState(){};
- virtual void getWorldPosition(float& posX,float& posY,float& posZ)=0;
- virtual void getWorldScaling(float& scaleX,float& scaleY,float& scaleZ)=0;
- virtual void getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal)=0;
+ virtual void GetWorldPosition(float& posX,float& posY,float& posZ)=0;
+ virtual void GetWorldScaling(float& scaleX,float& scaleY,float& scaleZ)=0;
+ virtual void GetWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal)=0;
// ori = array 12 floats, [0..3] = first column + 0, [4..7] = second column, [8..11] = third column
- virtual void getWorldOrientation(float* ori)=0;
- virtual void setWorldOrientation(const float* ori)=0;
+ virtual void GetWorldOrientation(float* ori)=0;
+ virtual void SetWorldOrientation(const float* ori)=0;
- virtual void setWorldPosition(float posX,float posY,float posZ)=0;
- virtual void setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)=0;
+ virtual void SetWorldPosition(float posX,float posY,float posZ)=0;
+ virtual void SetWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal)=0;
- virtual void calculateWorldTransformations()=0;
+ virtual void CalculateWorldTransformations()=0;
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.h b/source/gameengine/Physics/common/PHY_IPhysicsController.h
index 18af42adc15..a1d0972a950 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsController.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsController.h
@@ -37,6 +37,10 @@
class PHY_IMotionState;
class PHY_IPhysicsEnvironment;
+class MT_Vector3;
+class MT_Point3;
+class MT_Matrix3x3;
+
/**
* PHY_IPhysicsController is the abstract simplified Interface to a physical object.
* It contains the IMotionState and IDeformableMesh Interfaces.
@@ -59,37 +63,47 @@ class PHY_IPhysicsController : public PHY_IController
virtual class PHY_IMotionState* GetMotionState() = 0;
// controller replication
virtual void PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl)=0;
+ virtual void SetPhysicsEnvironment(class PHY_IPhysicsEnvironment *env)=0;
// kinematic methods
- virtual void RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local)=0;
- virtual void RelativeRotate(const float drot[12],bool local)=0;
- virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal)=0;
- virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal)=0;
- virtual void setPosition(float posX,float posY,float posZ)=0;
- virtual void getPosition(class MT_Vector3& pos) const=0;
- virtual void setScaling(float scaleX,float scaleY,float scaleZ)=0;
-
+ virtual void RelativeTranslate(const MT_Vector3& dloc,bool local)=0;
+ virtual void RelativeRotate(const MT_Matrix3x3&,bool local)=0;
+ virtual MT_Matrix3x3 GetOrientation()=0;
+ virtual void SetOrientation(const MT_Matrix3x3& orn)=0;
+ virtual void SetPosition(const MT_Vector3& pos)=0;
+ virtual void GetPosition(MT_Vector3& pos) const=0;
+ virtual void SetScaling(const MT_Vector3& scale)=0;
+ virtual void SetTransform()=0;
+
+ virtual MT_Scalar GetMass()=0;
+ virtual void SetMass(MT_Scalar newmass)=0;
+
// physics methods
- virtual void ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local)=0;
- virtual void ApplyForce(float forceX,float forceY,float forceZ,bool local)=0;
- virtual void SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local)=0;
- virtual void SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local)=0;
- virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) = 0;
+ virtual void ApplyImpulse(const MT_Point3& attach, const MT_Vector3& impulse)=0;
+ virtual void ApplyTorque(const MT_Vector3& torque,bool local)=0;
+ virtual void ApplyForce(const MT_Vector3& force,bool local)=0;
+ virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local)=0;
+ virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local)=0;
+ virtual void ResolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) = 0;
+
+ virtual void SuspendDynamics(bool ghost=false)=0;
+ virtual void RestoreDynamics()=0;
- virtual void applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ)=0;
virtual void SetActive(bool active)=0;
// reading out information from physics
- virtual void GetLinearVelocity(float& linvX,float& linvY,float& linvZ)=0;
- virtual void GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ)=0;
- virtual void getReactionForce(float& forceX,float& forceY,float& forceZ)=0;
+ virtual MT_Vector3 GetLinearVelocity()=0;
+ virtual MT_Vector3 GetAngularVelocity()=0;
+ virtual MT_Vector3 GetVelocity(const MT_Point3& pos)=0;
+ virtual MT_Vector3 GetLocalInertia()=0;
// dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted
- virtual void setRigidBody(bool rigid)=0;
+ virtual void SetRigidBody(bool rigid)=0;
virtual PHY_IPhysicsController* GetReplica() {return 0;}
+ virtual PHY_IPhysicsController* GetReplicaForSensors() {return 0;}
- virtual void calcXform() =0;
+ virtual void CalcXform() =0;
virtual void SetMargin(float margin) =0;
virtual float GetMargin() const=0;
virtual float GetRadius() const=0;
@@ -100,7 +114,15 @@ class PHY_IPhysicsController : public PHY_IController
virtual float GetLinVelocityMax() const=0;
virtual void SetLinVelocityMax(float val) = 0;
- class MT_Vector3 GetWorldPosition(class MT_Vector3& localpos);
+ MT_Vector3 GetWorldPosition(MT_Vector3& localpos);
+
+ // Shape control
+ virtual void AddCompoundChild(PHY_IPhysicsController* child) = 0;
+ virtual void RemoveCompoundChild(PHY_IPhysicsController* child) = 0;
+
+
+ virtual bool IsDynamic() = 0;
+ virtual bool IsCompound() = 0;
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
index 14904a70553..b1a0480ab14 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
@@ -105,87 +105,88 @@ public:
class PHY_IPhysicsEnvironment
{
public:
- virtual ~PHY_IPhysicsEnvironment(){};
- virtual void beginFrame() = 0;
- virtual void endFrame() = 0;
+ virtual ~PHY_IPhysicsEnvironment(){}
+ virtual void BeginFrame() = 0;
+ virtual void EndFrame() = 0;
/// Perform an integration step of duration 'timeStep'.
- virtual bool proceedDeltaTime(double curTime,float timeStep,float interval)=0;
+ virtual bool ProceedDeltaTime(double curTime,float timeStep,float interval)=0;
///draw debug lines (make sure to call this during the render phase, otherwise lines are not drawn properly)
- virtual void debugDrawWorld() {}
- virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)=0;
+ virtual void DebugDrawWorld() {}
+ virtual void SetFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)=0;
//returns 0.f if no fixed timestep is used
- virtual float getFixedTimeStep()=0;
+ virtual float GetFixedTimeStep()=0;
///setDebugMode is used to support several ways of debug lines, contact point visualization
- virtual void setDebugMode(int debugMode) {}
+ virtual void SetDebugMode(int debugMode) {}
///setNumIterations set the number of iterations for iterative solvers
- virtual void setNumIterations(int numIter) {}
+ virtual void SetNumIterations(int numIter) {}
///setNumTimeSubSteps set the number of divisions of the timestep. Tradeoff quality versus performance.
- virtual void setNumTimeSubSteps(int numTimeSubSteps) {}
+ virtual void SetNumTimeSubSteps(int numTimeSubSteps) {}
+ virtual int GetNumTimeSubSteps() {return 0; }
///setDeactivationTime sets the minimum time that an objects has to stay within the velocity tresholds until it gets fully deactivated
- virtual void setDeactivationTime(float dTime) {}
+ virtual void SetDeactivationTime(float dTime) {}
///setDeactivationLinearTreshold sets the linear velocity treshold, see setDeactivationTime
- virtual void setDeactivationLinearTreshold(float linTresh) {}
+ virtual void SetDeactivationLinearTreshold(float linTresh) {}
///setDeactivationAngularTreshold sets the angular velocity treshold, see setDeactivationTime
- virtual void setDeactivationAngularTreshold(float angTresh) {}
+ virtual void SetDeactivationAngularTreshold(float angTresh) {}
///setContactBreakingTreshold sets tresholds to do with contact point management
- virtual void setContactBreakingTreshold(float contactBreakingTreshold) {}
+ virtual void SetContactBreakingTreshold(float contactBreakingTreshold) {}
///continuous collision detection mode, very experimental for Bullet
- virtual void setCcdMode(int ccdMode) {}
+ virtual void SetCcdMode(int ccdMode) {}
///successive overrelaxation constant, in case PSOR is used, values in between 1 and 2 guarantee converging behavior
- virtual void setSolverSorConstant(float sor) {}
+ virtual void SetSolverSorConstant(float sor) {}
///setSolverType, internal setting, chooses solvertype, PSOR, Dantzig, impulse based, penalty based
- virtual void setSolverType(int solverType) {}
+ virtual void SetSolverType(int solverType) {}
///setTau sets the spring constant of a penalty based solver
- virtual void setSolverTau(float tau) {}
+ virtual void SetSolverTau(float tau) {}
///setDamping sets the damper constant of a penalty based solver
- virtual void setSolverDamping(float damping) {}
+ virtual void SetSolverDamping(float damping) {}
///linear air damping for rigidbodies
- virtual void setLinearAirDamping(float damping) {}
+ virtual void SetLinearAirDamping(float damping) {}
/// penetrationdepth setting
- virtual void setUseEpa(bool epa) {}
+ virtual void SetUseEpa(bool epa) {}
- virtual void setGravity(float x,float y,float z)=0;
- virtual void getGravity(MT_Vector3& grav) = 0;
+ virtual void SetGravity(float x,float y,float z)=0;
+ virtual void GetGravity(MT_Vector3& grav) = 0;
- virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
+ virtual int CreateConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
float pivotX,float pivotY,float pivotZ,
float axis0X,float axis0Y,float axis0Z,
float axis1X=0,float axis1Y=0,float axis1Z=0,
float axis2X=0,float axis2Y=0,float axis2Z=0,int flag=0
)=0;
- virtual void removeConstraint(int constraintid)=0;
- virtual float getAppliedImpulse(int constraintid) { return 0.0f; }
+ virtual void RemoveConstraint(int constraintid)=0;
+ virtual float GetAppliedImpulse(int constraintid) { return 0.0f; }
//complex constraint for vehicles
- virtual PHY_IVehicle* getVehicleConstraint(int constraintId) =0;
+ virtual PHY_IVehicle* GetVehicleConstraint(int constraintId) =0;
// Character physics wrapper
- virtual PHY_ICharacter* getCharacterController(class KX_GameObject* ob) =0;
+ virtual PHY_ICharacter* GetCharacterController(class KX_GameObject* ob) =0;
- virtual PHY_IPhysicsController* rayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ)=0;
+ virtual PHY_IPhysicsController* RayTest(PHY_IRayCastFilterCallback &filterCallback, float fromX,float fromY,float fromZ, float toX,float toY,float toZ)=0;
//culling based on physical broad phase
// the plane number must be set as follow: near, far, left, right, top, botton
// the near plane must be the first one and must always be present, it is used to get the direction of the view
- virtual bool cullingTest(PHY_CullingCallback callback, void *userData, MT_Vector4* planeNormals, int planeNumber, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) = 0;
+ virtual bool CullingTest(PHY_CullingCallback callback, void *userData, MT_Vector4* planeNormals, int planeNumber, int occlusionRes, const int *viewport, double modelview[16], double projection[16]) = 0;
//Methods for gamelogic collision/physics callbacks
//todo:
- virtual void addSensor(PHY_IPhysicsController* ctrl)=0;
- virtual void removeSensor(PHY_IPhysicsController* ctrl)=0;
- virtual void addTouchCallback(int response_class, PHY_ResponseCallback callback, void *user)=0;
- virtual bool requestCollisionCallback(PHY_IPhysicsController* ctrl)=0;
- virtual bool removeCollisionCallback(PHY_IPhysicsController* ctrl)=0;
+ virtual void AddSensor(PHY_IPhysicsController* ctrl)=0;
+ virtual void RemoveSensor(PHY_IPhysicsController* ctrl)=0;
+ virtual void AddTouchCallback(int response_class, PHY_ResponseCallback callback, void *user)=0;
+ virtual bool RequestCollisionCallback(PHY_IPhysicsController* ctrl)=0;
+ virtual bool RemoveCollisionCallback(PHY_IPhysicsController* ctrl)=0;
//These two methods are *solely* used to create controllers for sensor! Don't use for anything else
virtual PHY_IPhysicsController* CreateSphereController(float radius,const MT_Vector3& position) =0;
virtual PHY_IPhysicsController* CreateConeController(float coneradius,float coneheight)=0;
- virtual void setConstraintParam(int constraintId,int param,float value,float value1) = 0;
- virtual float getConstraintParam(int constraintId,int param) = 0;
+ virtual void SetConstraintParam(int constraintId,int param,float value,float value1) = 0;
+ virtual float GetConstraintParam(int constraintId,int param) = 0;
- virtual void exportFile(const char* filename) {};
+ virtual void ExportFile(const char* filename) {};
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt
index 9061532ba5d..879115add47 100644
--- a/source/gameengine/Rasterizer/CMakeLists.txt
+++ b/source/gameengine/Rasterizer/CMakeLists.txt
@@ -47,7 +47,6 @@ set(SRC
RAS_BucketManager.cpp
RAS_FramingManager.cpp
RAS_IPolygonMaterial.cpp
- RAS_IRenderTools.cpp
RAS_MaterialBucket.cpp
RAS_MeshObject.cpp
RAS_Polygon.cpp
@@ -62,7 +61,6 @@ set(SRC
RAS_ICanvas.h
RAS_IPolygonMaterial.h
RAS_IRasterizer.h
- RAS_IRenderTools.h
RAS_LightObject.h
RAS_MaterialBucket.h
RAS_MeshObject.h
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.h b/source/gameengine/Rasterizer/RAS_2DFilterManager.h
index a637baa3d09..bb727fe3b29 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.h
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.h
@@ -32,13 +32,14 @@
#ifndef __RAS_2DFILTERMANAGER_H__
#define __RAS_2DFILTERMANAGER_H__
-#include "RAS_ICanvas.h"
#define MAX_RENDER_PASS 100
#ifdef WITH_CXX_GUARDEDALLOC
#include "MEM_guardedalloc.h"
#endif
+class RAS_ICanvas;
+
class RAS_2DFilterManager
{
private:
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
index 713d324bf17..eaa9b3df494 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
@@ -35,16 +35,14 @@
#endif
#include "RAS_MaterialBucket.h"
-#include "STR_HashedString.h"
#include "RAS_MeshObject.h"
+#include "RAS_Polygon.h"
+#include "RAS_IPolygonMaterial.h"
#include "RAS_IRasterizer.h"
-#include "RAS_IRenderTools.h"
#include "RAS_BucketManager.h"
#include <algorithm>
-#include <set>
-
/* sorting */
struct RAS_BucketManager::sortedmeshslot
@@ -139,8 +137,7 @@ void RAS_BucketManager::OrderBuckets(const MT_Transform& cameratrans, BucketList
sort(slots.begin(), slots.end(), fronttoback());
}
-void RAS_BucketManager::RenderAlphaBuckets(
- const MT_Transform& cameratrans, RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools)
+void RAS_BucketManager::RenderAlphaBuckets(const MT_Transform& cameratrans, RAS_IRasterizer* rasty)
{
vector<sortedmeshslot> slots;
vector<sortedmeshslot>::iterator sit;
@@ -154,10 +151,10 @@ void RAS_BucketManager::RenderAlphaBuckets(
OrderBuckets(cameratrans, m_AlphaBuckets, slots, true);
for (sit=slots.begin(); sit!=slots.end(); ++sit) {
- rendertools->SetClientObject(rasty, sit->m_ms->m_clientObj);
+ rasty->SetClientObject(sit->m_ms->m_clientObj);
- while (sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools))
- sit->m_bucket->RenderMeshSlot(cameratrans, rasty, rendertools, *(sit->m_ms));
+ while (sit->m_bucket->ActivateMaterial(cameratrans, rasty))
+ sit->m_bucket->RenderMeshSlot(cameratrans, rasty, *(sit->m_ms));
// make this mesh slot culled automatically for next frame
// it will be culled out by frustrum culling
@@ -167,8 +164,7 @@ void RAS_BucketManager::RenderAlphaBuckets(
rasty->SetDepthMask(RAS_IRasterizer::KX_DEPTHMASK_ENABLED);
}
-void RAS_BucketManager::RenderSolidBuckets(
- const MT_Transform& cameratrans, RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools)
+void RAS_BucketManager::RenderSolidBuckets(const MT_Transform& cameratrans, RAS_IRasterizer* rasty)
{
BucketList::iterator bit;
@@ -180,9 +176,9 @@ void RAS_BucketManager::RenderSolidBuckets(
RAS_MeshSlot* ms;
// remove the mesh slot form the list, it culls them automatically for next frame
while ((ms = bucket->GetNextActiveMeshSlot())) {
- rendertools->SetClientObject(rasty, ms->m_clientObj);
- while (bucket->ActivateMaterial(cameratrans, rasty, rendertools))
- bucket->RenderMeshSlot(cameratrans, rasty, rendertools, *ms);
+ rasty->SetClientObject(ms->m_clientObj);
+ while (bucket->ActivateMaterial(cameratrans, rasty))
+ bucket->RenderMeshSlot(cameratrans, rasty, *ms);
// make this mesh slot culled automatically for next frame
// it will be culled out by frustrum culling
@@ -194,10 +190,10 @@ void RAS_BucketManager::RenderSolidBuckets(
if (mit->IsCulled())
continue;
- rendertools->SetClientObject(rasty, mit->m_clientObj);
+ rasty->SetClientObject(rasty, mit->m_clientObj);
- while ((*bit)->ActivateMaterial(cameratrans, rasty, rendertools))
- (*bit)->RenderMeshSlot(cameratrans, rasty, rendertools, *mit);
+ while ((*bit)->ActivateMaterial(cameratrans, rasty))
+ (*bit)->RenderMeshSlot(cameratrans, rasty, *mit);
// make this mesh slot culled automatically for next frame
// it will be culled out by frustrum culling
@@ -218,20 +214,19 @@ void RAS_BucketManager::RenderSolidBuckets(
for (sit=slots.begin(); sit!=slots.end(); ++sit) {
rendertools->SetClientObject(rasty, sit->m_ms->m_clientObj);
- while (sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools))
- sit->m_bucket->RenderMeshSlot(cameratrans, rasty, rendertools, *(sit->m_ms));
+ while (sit->m_bucket->ActivateMaterial(cameratrans, rasty))
+ sit->m_bucket->RenderMeshSlot(cameratrans, rasty, *(sit->m_ms));
}
#endif
}
-void RAS_BucketManager::Renderbuckets(
- const MT_Transform& cameratrans, RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools)
+void RAS_BucketManager::Renderbuckets(const MT_Transform& cameratrans, RAS_IRasterizer* rasty)
{
/* beginning each frame, clear (texture/material) caching information */
rasty->ClearCachingInfo();
- RenderSolidBuckets(cameratrans, rasty, rendertools);
- RenderAlphaBuckets(cameratrans, rasty, rendertools);
+ RenderSolidBuckets(cameratrans, rasty);
+ RenderAlphaBuckets(cameratrans, rasty);
/* All meshes should be up to date now */
/* Don't do this while processing buckets because some meshes are split between buckets */
@@ -259,7 +254,7 @@ void RAS_BucketManager::Renderbuckets(
}
- rendertools->SetClientObject(rasty, NULL);
+ rasty->SetClientObject(NULL);
}
RAS_MaterialBucket *RAS_BucketManager::FindBucket(RAS_IPolyMaterial *material, bool &bucketCreated)
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.h b/source/gameengine/Rasterizer/RAS_BucketManager.h
index bf88da6f1ba..f8c6375d474 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.h
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.h
@@ -51,8 +51,7 @@ public:
RAS_BucketManager();
virtual ~RAS_BucketManager();
- void Renderbuckets(const MT_Transform & cameratrans,
- RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools);
+ void Renderbuckets(const MT_Transform & cameratrans, RAS_IRasterizer* rasty);
RAS_MaterialBucket* FindBucket(RAS_IPolyMaterial *material, bool &bucketCreated);
void OptimizeBuckets(MT_Scalar distance);
@@ -78,10 +77,10 @@ public:
private:
void OrderBuckets(const MT_Transform& cameratrans, BucketList& buckets, vector<sortedmeshslot>& slots, bool alpha);
- void RenderSolidBuckets(const MT_Transform& cameratrans,
- RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools);
- void RenderAlphaBuckets(const MT_Transform& cameratrans,
- RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools);
+ void RenderSolidBuckets(const MT_Transform& cameratrans,
+ RAS_IRasterizer* rasty);
+ void RenderAlphaBuckets(const MT_Transform& cameratrans,
+ RAS_IRasterizer* rasty);
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
index ddadd97b567..47e52318b33 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
@@ -33,8 +33,6 @@
#include "RAS_IPolygonMaterial.h"
#include "RAS_IRasterizer.h"
-#include "DNA_image_types.h"
-#include "DNA_meshdata_types.h"
#include "DNA_material_types.h"
void RAS_IPolyMaterial::Initialize(
@@ -235,6 +233,15 @@ Image *RAS_IPolyMaterial::GetBlenderImage() const
{
return NULL;
}
+MTFace *RAS_IPolyMaterial::GetMTFace() const
+{
+ return NULL;
+}
+
+unsigned int *RAS_IPolyMaterial::GetMCol() const
+{
+ return NULL;
+}
Scene* RAS_IPolyMaterial::GetBlenderScene() const
{
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
index 7aeeb364b47..2db71c3a2fe 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
@@ -35,7 +35,6 @@
#include "STR_HashedString.h"
#include "MT_Vector3.h"
-#include "STR_HashedString.h"
#ifdef WITH_CXX_GUARDEDALLOC
#include "MEM_guardedalloc.h"
@@ -167,6 +166,8 @@ public:
virtual Material* GetBlenderMaterial() const;
virtual Image* GetBlenderImage() const;
+ virtual MTFace* GetMTFace() const;
+ virtual unsigned int* GetMCol() const;
virtual Scene* GetBlenderScene() const;
virtual void ReleaseMaterial();
virtual void GetMaterialRGBAColor(unsigned char *rgba) const;
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h
index ace91f6dd51..034ea7f87a9 100644
--- a/source/gameengine/Rasterizer/RAS_IRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h
@@ -65,6 +65,13 @@ typedef vector< KX_IndexArray* > vecIndexArrays;
class RAS_IRasterizer
{
public:
+ enum RAS_TEXT_RENDER_MODE {
+ RAS_TEXT_RENDER_NODEF = 0,
+ RAS_TEXT_NORMAL,
+ RAS_TEXT_PADDED,
+ RAS_TEXT_MAX
+ };
+
RAS_IRasterizer(RAS_ICanvas* canv) {};
virtual ~RAS_IRasterizer() {};
@@ -247,11 +254,9 @@ public:
/**
* IndexPrimitives_3DText will render text into the polygons.
- * The text to be rendered is from \param rendertools client object's text property.
*/
virtual void IndexPrimitives_3DText(class RAS_MeshSlot& ms,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools)=0;
+ class RAS_IPolyMaterial* polymat)=0;
virtual void SetProjectionMatrix(MT_CmMatrix4x4 & mat)=0;
/* This one should become our final version, methinks. */
@@ -434,6 +439,78 @@ public:
virtual void SetUsingOverrideShader(bool val)=0;
virtual bool GetUsingOverrideShader()=0;
+ /**
+ * Render Tools
+ */
+ virtual void applyTransform(double* oglmatrix, int drawingmode)=0;
+
+ /**
+ * Renders 2D boxes.
+ * \param xco Position on the screen (origin in lower left corner).
+ * \param yco Position on the screen (origin in lower left corner).
+ * \param width Width of the canvas to draw to.
+ * \param height Height of the canvas to draw to.
+ * \param percentage Percentage of bar.
+ */
+ virtual void RenderBox2D(int xco,
+ int yco,
+ int width,
+ int height,
+ float percentage) = 0;
+
+ /**
+ * Renders 3D text string using BFL.
+ * \param fontid The id of the font.
+ * \param text The string to render.
+ * \param size The size of the text.
+ * \param dpi The resolution of the text.
+ * \param color The color of the object.
+ * \param mat The Matrix of the text object.
+ * \param aspect A scaling factor to compensate for the size.
+ */
+ virtual void RenderText3D(int fontid,
+ const char* text,
+ int size,
+ int dpi,
+ float* color,
+ double* mat,
+ float aspect
+ ) = 0;
+
+
+ /**
+ * Renders 2D text string.
+ * \param mode The type of text
+ * \param text The string to render.
+ * \param xco Position on the screen (origin in lower left corner).
+ * \param yco Position on the screen (origin in lower left corner).
+ * \param width Width of the canvas to draw to.
+ * \param height Height of the canvas to draw to.
+ */
+ virtual void RenderText2D(RAS_TEXT_RENDER_MODE mode,
+ const char* text,
+ int xco,
+ int yco,
+ int width,
+ int height
+ ) = 0;
+
+ virtual void ProcessLighting(bool uselights, const MT_Transform& trans)=0;
+
+ virtual void PushMatrix()=0;
+
+ virtual void PopMatrix()=0;
+
+ virtual void AddLight(struct RAS_LightObject* lightobject)=0;
+
+ virtual void RemoveLight(struct RAS_LightObject* lightobject)=0;
+
+ virtual void MotionBlur()=0;
+
+ virtual void SetClientObject(void* obj)=0;
+
+ virtual void SetAuxilaryClientInfo(void* inf)=0;
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_IRasterizer")
#endif
diff --git a/source/gameengine/Rasterizer/RAS_IRenderTools.cpp b/source/gameengine/Rasterizer/RAS_IRenderTools.cpp
deleted file mode 100644
index 045373eff85..00000000000
--- a/source/gameengine/Rasterizer/RAS_IRenderTools.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file gameengine/Rasterizer/RAS_IRenderTools.cpp
- * \ingroup bgerast
- */
-
-
-#include "RAS_IRenderTools.h"
-
-void RAS_IRenderTools::SetClientObject(RAS_IRasterizer* rasty, void *obj)
-{
- if (m_clientobject != obj)
- m_clientobject = obj;
-}
-
-void RAS_IRenderTools::SetAuxilaryClientInfo(void* inf)
-{
- m_auxilaryClientInfo = inf;
-}
-
-void RAS_IRenderTools::AddLight(struct RAS_LightObject* lightobject)
-{
- m_lights.push_back(lightobject);
-}
-
-void RAS_IRenderTools::RemoveLight(struct RAS_LightObject* lightobject)
-{
- std::vector<struct RAS_LightObject*>::iterator lit =
- std::find(m_lights.begin(),m_lights.end(),lightobject);
-
- if (!(lit==m_lights.end()))
- m_lights.erase(lit);
-}
-
diff --git a/source/gameengine/Rasterizer/RAS_IRenderTools.h b/source/gameengine/Rasterizer/RAS_IRenderTools.h
deleted file mode 100644
index 6131abc0650..00000000000
--- a/source/gameengine/Rasterizer/RAS_IRenderTools.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file RAS_IRenderTools.h
- * \ingroup bgerast
- */
-
-#ifndef __RAS_IRENDERTOOLS_H__
-#define __RAS_IRENDERTOOLS_H__
-
-#include "MT_Transform.h"
-#include "RAS_IRasterizer.h"
-#include "RAS_2DFilterManager.h"
-
-#include <vector>
-#include <algorithm>
-
-#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
-#endif
-
-class RAS_IPolyMaterial;
-struct RAS_LightObject;
-
-
-class RAS_IRenderTools
-{
-
-protected:
- void* m_clientobject;
- void* m_auxilaryClientInfo;
-
- std::vector<struct RAS_LightObject*> m_lights;
-
- RAS_2DFilterManager m_filtermanager;
-
-public:
- enum RAS_TEXT_RENDER_MODE {
- RAS_TEXT_RENDER_NODEF = 0,
- RAS_TEXT_NORMAL,
- RAS_TEXT_PADDED,
- RAS_TEXT_MAX
- };
-
- RAS_IRenderTools(
- ) :
- m_clientobject(NULL)
- {
- };
-
- virtual
- ~RAS_IRenderTools(
- ) {};
-
- virtual
- void
- BeginFrame(
- RAS_IRasterizer* rasty
- )=0;
-
- virtual
- void
- EndFrame(
- RAS_IRasterizer* rasty
- )=0;
-
- // the following function was formerly called 'Render'
- // by it doesn't render anymore
- // It only sets the transform for the rasterizer
- // so must be renamed to 'applyTransform' or something
-
- virtual
- void
- applyTransform(
- class RAS_IRasterizer* rasty,
- double* oglmatrix,
- int drawingmode
- )=0;
-
- /**
- * Renders 2D boxes.
- * \param xco Position on the screen (origin in lower left corner).
- * \param yco Position on the screen (origin in lower left corner).
- * \param width Width of the canvas to draw to.
- * \param height Height of the canvas to draw to.
- * \param percentage Percentage of bar.
- */
- virtual
- void
- RenderBox2D(int xco,
- int yco,
- int width,
- int height,
- float percentage) = 0;
-
- /**
- * Renders 3D text string using BFL.
- * \param fontid The id of the font.
- * \param text The string to render.
- * \param size The size of the text.
- * \param dpi The resolution of the text.
- * \param color The color of the object.
- * \param mat The Matrix of the text object.
- * \param aspect A scaling factor to compensate for the size.
- */
- virtual
- void
- RenderText3D(int fontid,
- const char* text,
- int size,
- int dpi,
- float* color,
- double* mat,
- float aspect
- ) = 0;
-
-
- /**
- * Renders 2D text string.
- * \param mode The type of text
- * \param text The string to render.
- * \param xco Position on the screen (origin in lower left corner).
- * \param yco Position on the screen (origin in lower left corner).
- * \param width Width of the canvas to draw to.
- * \param height Height of the canvas to draw to.
- */
- virtual
- void
- RenderText2D(
- RAS_TEXT_RENDER_MODE mode,
- const char* text,
- int xco,
- int yco,
- int width,
- int height
- ) = 0;
-
- // 3d text, mapped on polygon
- virtual
- void
- RenderText(
- int mode,
- RAS_IPolyMaterial* polymat,
- float v1[3],
- float v2[3],
- float v3[3],
- float v4[3],
- int glattrib
- )=0;
-
- virtual
- void
- ProcessLighting(
- RAS_IRasterizer *rasty,
- bool uselights,
- const MT_Transform& trans
- )=0;
-
- virtual
- void
- SetClientObject(
- RAS_IRasterizer* rasty,
- void* obj
- );
-
- void
- SetAuxilaryClientInfo(
- void* inf
- );
-
- virtual
- void
- PushMatrix(
- )=0;
-
- virtual
- void
- PopMatrix(
- )=0;
-
- virtual
- void
- AddLight(
- struct RAS_LightObject* lightobject
- );
-
- virtual
- void
- RemoveLight(
- struct RAS_LightObject* lightobject
- );
-
- virtual
- void
- MotionBlur(RAS_IRasterizer* rasterizer)=0;
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_IRenderTools")
-#endif
-};
-
-#endif /* __RAS_IRENDERTOOLS_H__ */
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
index 8ea09029a35..0c715524218 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
@@ -40,10 +40,9 @@
#include <windows.h>
#endif // WIN32
-#include "RAS_Polygon.h"
+#include "RAS_IPolygonMaterial.h"
#include "RAS_TexVert.h"
#include "RAS_IRasterizer.h"
-#include "RAS_IRenderTools.h"
#include "RAS_MeshObject.h"
#include "RAS_Deformer.h" // __NLA
@@ -581,8 +580,7 @@ list<RAS_MeshSlot>::iterator RAS_MaterialBucket::msEnd()
return m_meshSlots.end();
}
-bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty,
- RAS_IRenderTools *rendertools)
+bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty)
{
bool uselights;
@@ -593,13 +591,12 @@ bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_I
return false;
uselights= m_material->UsesLighting(rasty);
- rendertools->ProcessLighting(rasty, uselights, cameratrans);
+ rasty->ProcessLighting(uselights, cameratrans);
return true;
}
-void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRasterizer* rasty,
- RAS_IRenderTools* rendertools, RAS_MeshSlot &ms)
+void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRasterizer* rasty, RAS_MeshSlot &ms)
{
m_material->ActivateMeshSlot(ms, rasty);
@@ -613,10 +610,10 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
if (IsZSort() && rasty->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID)
ms.m_mesh->SortPolygons(ms, cameratrans*MT_Transform(ms.m_OpenGLMatrix));
- rendertools->PushMatrix();
+ rasty->PushMatrix();
if (!ms.m_pDeformer || !ms.m_pDeformer->SkipVertexTransform())
{
- rendertools->applyTransform(rasty,ms.m_OpenGLMatrix,m_material->GetDrawingMode());
+ rasty->applyTransform(ms.m_OpenGLMatrix,m_material->GetDrawingMode());
}
if (rasty->QueryLists())
@@ -641,7 +638,7 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
// for text drawing using faces
if (m_material->GetDrawingMode() & RAS_IRasterizer::RAS_RENDER_3DPOLYGON_TEXT)
- rasty->IndexPrimitives_3DText(ms, m_material, rendertools);
+ rasty->IndexPrimitives_3DText(ms, m_material);
// for multitexturing
else if ((m_material->GetFlag() & (RAS_MULTITEX|RAS_BLENDERGLSL)))
rasty->IndexPrimitivesMulti(ms);
@@ -649,7 +646,7 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
else
rasty->IndexPrimitives(ms);
- rendertools->PopMatrix();
+ rasty->PopMatrix();
}
void RAS_MaterialBucket::Optimize(MT_Scalar distance)
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
index 4c72f128817..007fdf240c4 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
@@ -34,17 +34,23 @@
#include "RAS_TexVert.h"
#include "CTR_Map.h"
-#include "STR_HashedString.h"
#include "SG_QList.h"
#include "MT_Transform.h"
-#include "RAS_IPolygonMaterial.h"
-#include "RAS_IRasterizer.h"
-#include "RAS_Deformer.h"
+#include "MT_Matrix4x4.h"
#include <vector>
#include <set>
#include <list>
+
+class RAS_MaterialBucket;
+struct DerivedMesh;
+class CTR_HashedPtr;
+class RAS_Deformer;
+class RAS_IPolyMaterial;
+class RAS_IRasterizer;
+class RAS_MeshObject;
+
using namespace std;
/* Display List Slot */
@@ -69,12 +75,6 @@ public:
virtual void SetModified(bool mod)=0;
};
-class RAS_DisplayArray;
-class RAS_MeshSlot;
-class RAS_MeshMaterial;
-class RAS_MaterialBucket;
-struct DerivedMesh;
-
/* An array with data used for OpenGL drawing */
class RAS_DisplayArray
@@ -219,10 +219,8 @@ public:
bool IsZSort() const;
/* Rendering */
- bool ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty,
- RAS_IRenderTools *rendertools);
- void RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRasterizer* rasty,
- RAS_IRenderTools* rendertools, RAS_MeshSlot &ms);
+ bool ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty);
+ void RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRasterizer* rasty, RAS_MeshSlot &ms);
/* Mesh Slot Access */
list<RAS_MeshSlot>::iterator msBegin();
diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.cpp b/source/gameengine/Rasterizer/RAS_MeshObject.cpp
index 8a9672f0092..ff909b5955f 100644
--- a/source/gameengine/Rasterizer/RAS_MeshObject.cpp
+++ b/source/gameengine/Rasterizer/RAS_MeshObject.cpp
@@ -29,23 +29,19 @@
* \ingroup bgerast
*/
-#include "MEM_guardedalloc.h"
-
-#include "DNA_object_types.h"
#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
+
+#include "CTR_HashedPtr.h"
#include "RAS_MeshObject.h"
-#include "RAS_IRasterizer.h"
-#include "MT_MinMax.h"
+#include "RAS_Polygon.h"
+#include "RAS_IPolygonMaterial.h"
+#include "RAS_Deformer.h"
#include "MT_Point3.h"
#include <algorithm>
-extern "C" {
-# include "BKE_deform.h"
-}
/* polygon sorting */
@@ -540,6 +536,16 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor
}
+bool RAS_MeshObject::HasColliderPolygon()
+{
+ int numpolys= NumPolygons();
+ for (int p=0; p<numpolys; p++)
+ if (m_Polygons[p]->IsCollider())
+ return true;
+
+ return false;
+}
+
void RAS_MeshObject::SchedulePolygons(int drawingmode)
{
if (m_bModified)
diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.h b/source/gameengine/Rasterizer/RAS_MeshObject.h
index e5ae78d006e..4f352379d39 100644
--- a/source/gameengine/Rasterizer/RAS_MeshObject.h
+++ b/source/gameengine/Rasterizer/RAS_MeshObject.h
@@ -38,17 +38,15 @@
#endif
#include <vector>
-#include <set>
#include <list>
-#include "RAS_Polygon.h"
#include "RAS_MaterialBucket.h"
#include "MT_Transform.h"
-
-#include "CTR_HashedPtr.h"
+#include "STR_String.h"
struct Mesh;
class RAS_Deformer;
+class RAS_Polygon;
/* RAS_MeshObject is a mesh used for rendering. It stores polygons,
* but the actual vertices and index arrays are stored in material
@@ -65,7 +63,7 @@ private:
STR_String m_name;
static STR_String s_emptyname;
- vector<class RAS_Polygon*> m_Polygons;
+ vector<RAS_Polygon*> m_Polygons;
/* polygon sorting */
struct polygonSlot;
@@ -150,14 +148,7 @@ public:
void SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transform);
- bool HasColliderPolygon() {
- int numpolys= NumPolygons();
- for (int p=0; p<numpolys; p++)
- if (m_Polygons[p]->IsCollider())
- return true;
-
- return false;
- }
+ bool HasColliderPolygon();
/* for construction to find shared vertices */
struct SharedVertex {
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
index 6b53990770f..76ac6316e38 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
@@ -25,9 +25,15 @@
set(INC
..
+ # XXX Remove these <<<
../../BlenderRoutines
+ ../../Expressions
+ ../../GameLogic
../../Ketsji
+ ../../Physics/common
+ # >>>
../../SceneGraph
+ ../../../blender/blenfont
../../../blender/blenkernel
../../../blender/blenlib
../../../blender/gpu
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
index 665053984e6..32cc4ba9fea 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
@@ -32,6 +32,8 @@
#include <iostream>
+#include "GL/glew.h"
+
#include "RAS_GLExtensionManager.h"
namespace bgl
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h
index 1b4d3219335..9f2039b4c6f 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h
@@ -32,8 +32,6 @@
#ifndef __RAS_GLEXTENSIONMANAGER_H__
#define __RAS_GLEXTENSIONMANAGER_H__
-#include "GL/glew.h"
-
/** Note: this used to have a lot more code, but now extension handling
* is done by GLEW, so it does mostly debug stuff */
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
index f5c16bc8cd8..bfa6e1a6cb7 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
@@ -28,14 +28,11 @@
#ifndef __KX_STORAGE
#define __KX_STORAGE
-#include "RAS_MaterialBucket.h"
+#ifdef WITH_CXX_GUARDEDALLOC
+ #include "MEM_guardedalloc.h"
+#endif
-enum RAS_STORAGE_TYPE {
- RAS_AUTO_STORAGE,
- RAS_IMMEDIATE,
- RAS_VA,
- RAS_VBO
-};
+class RAS_MeshSlot;
class RAS_IStorage
{
@@ -47,15 +44,13 @@ public:
virtual void Exit()=0;
virtual void IndexPrimitives(RAS_MeshSlot& ms)=0;
- virtual void IndexPrimitivesMulti(class RAS_MeshSlot& ms)=0;
+ virtual void IndexPrimitivesMulti(RAS_MeshSlot& ms)=0;
virtual void SetDrawingMode(int drawingmode)=0;
#ifdef WITH_CXX_GUARDEDALLOC
-public:
- void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_IStorage"); }
- void operator delete( void *mem ) { MEM_freeN(mem); }
+ MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_IStorage")
#endif
};
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index bfc74e0c6dc..2a8c3ac7929 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -37,11 +37,13 @@
#include "GL/glew.h"
+#include "RAS_ICanvas.h"
#include "RAS_Rect.h"
#include "RAS_TexVert.h"
#include "RAS_MeshObject.h"
+#include "RAS_Polygon.h"
+#include "RAS_LightObject.h"
#include "MT_CmMatrix4x4.h"
-#include "RAS_IRenderTools.h" // rendering text
#include "RAS_StorageIM.h"
#include "RAS_StorageVA.h"
@@ -49,18 +51,20 @@
#include "GPU_draw.h"
#include "GPU_material.h"
-#include "GPU_extensions.h"
-
-#include "DNA_image_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_material_types.h"
-#include "DNA_scene_types.h"
extern "C"{
- #include "BLI_utildefines.h"
- #include "BKE_DerivedMesh.h"
+ #include "BLF_api.h"
}
+
+// XXX Clean these up <<<
+#include "Value.h"
+#include "KX_Light.h"
+#include "KX_Scene.h"
+#include "KX_RayCast.h"
+#include "KX_GameObject.h"
+// >>>
+
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
@@ -94,6 +98,8 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas, int storage)
m_motionblur(0),
m_motionblurvalue(-1.0),
m_usingoverrideshader(false),
+ m_clientobject(NULL),
+ m_auxilaryClientInfo(NULL),
m_texco_num(0),
m_attrib_num(0),
//m_last_alphablend(GPU_BLEND_SOLID),
@@ -131,6 +137,10 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas, int storage)
m_storage = m_failsafe_storage = new RAS_StorageIM(&m_texco_num, m_texco, &m_attrib_num, m_attrib, m_attrib_layer);
m_storage_type = RAS_IMMEDIATE;
}
+
+ glGetIntegerv(GL_MAX_LIGHTS, (GLint *) &m_numgllights);
+ if (m_numgllights < 8)
+ m_numgllights = 8;
}
@@ -350,6 +360,13 @@ bool RAS_OpenGLRasterizer::BeginFrame(int drawingmode, double time)
glEnable(GL_MULTISAMPLE_ARB);
m_2DCanvas->BeginFrame();
+
+ // Render Tools
+ m_clientobject = NULL;
+ m_lastlightlayer = -1;
+ m_lastauxinfo = NULL;
+ m_lastlighting = true; /* force disable in DisableOpenGLLights() */
+ DisableOpenGLLights();
return true;
}
@@ -650,13 +667,14 @@ const MT_Matrix4x4& RAS_OpenGLRasterizer::GetViewInvMatrix() const
}
void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools)
+ class RAS_IPolyMaterial* polymat)
{
bool obcolor = ms.m_bObjectColor;
MT_Vector4& rgba = ms.m_RGBAcolor;
RAS_MeshSlot::iterator it;
+ const STR_String& mytext = ((CValue*)m_clientobject)->GetPropertyText("Text");
+
// handle object color
if (obcolor) {
glDisableClientState(GL_COLOR_ARRAY);
@@ -707,9 +725,8 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms,
for (unit=0; unit<m_attrib_num; unit++)
if (m_attrib[unit] == RAS_TEXCO_UV)
glattrib = unit;
-
- rendertools->RenderText(polymat->GetDrawingMode(), polymat,
- v[0], v[1], v[2], (numvert == 4)? v[3]: NULL, glattrib);
+
+ GPU_render_text(polymat->GetMTFace(), polymat->GetDrawingMode(), mytext, mytext.Length(), polymat->GetMCol(), v[1], v[2], v[3], v[4], glattrib);
ClearCachingInfo();
}
@@ -1107,3 +1124,440 @@ bool RAS_OpenGLRasterizer::GetUsingOverrideShader()
return m_usingoverrideshader;
}
+/**
+ * Render Tools
+ */
+
+/* ProcessLighting performs lighting on objects. the layer is a bitfield that
+ * contains layer information. There are 20 'official' layers in blender. A
+ * light is applied on an object only when they are in the same layer. OpenGL
+ * has a maximum of 8 lights (simultaneous), so 20 * 8 lights are possible in
+ * a scene. */
+
+void RAS_OpenGLRasterizer::ProcessLighting(bool uselights, const MT_Transform& viewmat)
+{
+ bool enable = false;
+ int layer= -1;
+
+ /* find the layer */
+ if (uselights) {
+ if (m_clientobject)
+ layer = static_cast<KX_GameObject*>(m_clientobject)->GetLayer();
+ }
+
+ /* avoid state switching */
+ if (m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo)
+ return;
+
+ m_lastlightlayer = layer;
+ m_lastauxinfo = m_auxilaryClientInfo;
+
+ /* enable/disable lights as needed */
+ if (layer >= 0) {
+ //enable = ApplyLights(layer, viewmat);
+ // taken from blender source, incompatibility between Blender Object / GameObject
+ KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo;
+ float glviewmat[16];
+ unsigned int count;
+ std::vector<struct RAS_LightObject*>::iterator lit = m_lights.begin();
+
+ for (count=0; count<m_numgllights; count++)
+ glDisable((GLenum)(GL_LIGHT0+count));
+
+ viewmat.getValue(glviewmat);
+
+ glPushMatrix();
+ glLoadMatrixf(glviewmat);
+ for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end()) && count < m_numgllights; ++lit)
+ {
+ RAS_LightObject* lightdata = (*lit);
+ KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light;
+
+ if (kxlight->ApplyLight(kxscene, layer, count))
+ count++;
+ }
+ glPopMatrix();
+
+ enable = count > 0;
+ }
+
+ if (enable)
+ EnableOpenGLLights();
+ else
+ DisableOpenGLLights();
+}
+
+void RAS_OpenGLRasterizer::EnableOpenGLLights()
+{
+ if (m_lastlighting == true)
+ return;
+
+ glEnable(GL_LIGHTING);
+ glEnable(GL_COLOR_MATERIAL);
+
+ glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
+ glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+ glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (GetCameraOrtho())? GL_FALSE: GL_TRUE);
+ if (GLEW_EXT_separate_specular_color || GLEW_VERSION_1_2)
+ glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
+
+ m_lastlighting = true;
+}
+
+void RAS_OpenGLRasterizer::DisableOpenGLLights()
+{
+ if (m_lastlighting == false)
+ return;
+
+ glDisable(GL_LIGHTING);
+ glDisable(GL_COLOR_MATERIAL);
+
+ m_lastlighting = false;
+}
+
+void RAS_OpenGLRasterizer::AddLight(struct RAS_LightObject* lightobject)
+{
+ m_lights.push_back(lightobject);
+}
+
+void RAS_OpenGLRasterizer::RemoveLight(struct RAS_LightObject* lightobject)
+{
+ std::vector<struct RAS_LightObject*>::iterator lit =
+ std::find(m_lights.begin(),m_lights.end(),lightobject);
+
+ if (!(lit==m_lights.end()))
+ m_lights.erase(lit);
+}
+
+bool RAS_OpenGLRasterizer::RayHit(class KX_ClientObjectInfo *client, KX_RayCast *result, void * const data)
+{
+ double* const oglmatrix = (double* const) data;
+
+ RAS_Polygon* poly = result->m_hitMesh->GetPolygon(result->m_hitPolygon);
+ if (!poly->IsVisible())
+ return false;
+
+ MT_Point3 resultpoint(result->m_hitPoint);
+ MT_Vector3 resultnormal(result->m_hitNormal);
+ MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]);
+ MT_Vector3 dir = -(left.cross(resultnormal)).safe_normalized();
+ left = (dir.cross(resultnormal)).safe_normalized();
+ // for the up vector, we take the 'resultnormal' returned by the physics
+
+ double maat[16] = {left[0], left[1], left[2], 0,
+ dir[0], dir[1], dir[2], 0,
+ resultnormal[0], resultnormal[1], resultnormal[2], 0,
+ 0, 0, 0, 1};
+
+ glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]);
+ //glMultMatrixd(oglmatrix);
+ glMultMatrixd(maat);
+ return true;
+}
+
+void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode )
+{
+ /* FIXME:
+ blender: intern/moto/include/MT_Vector3.inl:42: MT_Vector3 operator/(const
+ MT_Vector3&, double): Assertion `!MT_fuzzyZero(s)' failed.
+
+ Program received signal SIGABRT, Aborted.
+ [Switching to Thread 16384 (LWP 1519)]
+ 0x40477571 in kill () from /lib/libc.so.6
+ (gdb) bt
+ #7 0x08334368 in MT_Vector3::normalized() const ()
+ #8 0x0833e6ec in RAS_OpenGLRasterizer::applyTransform(RAS_IRasterizer*, double*, int) ()
+ */
+
+ if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED ||
+ objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED)
+ {
+ // rotate the billboard/halo
+ //page 360/361 3D Game Engine Design, David Eberly for a discussion
+ // on screen aligned and axis aligned billboards
+ // assumed is that the preprocessor transformed all billboard polygons
+ // so that their normal points into the positive x direction (1.0, 0.0, 0.0)
+ // when new parenting for objects is done, this rotation
+ // will be moved into the object
+
+ MT_Point3 objpos (oglmatrix[12],oglmatrix[13],oglmatrix[14]);
+ MT_Point3 campos = GetCameraPosition();
+ MT_Vector3 dir = (campos - objpos).safe_normalized();
+ MT_Vector3 up(0,0,1.0);
+
+ KX_GameObject* gameobj = (KX_GameObject*)m_clientobject;
+ // get scaling of halo object
+ MT_Vector3 size = gameobj->GetSGNode()->GetWorldScaling();
+
+ bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned
+ if (screenaligned)
+ {
+ up = (up - up.dot(dir) * dir).safe_normalized();
+ } else
+ {
+ dir = (dir - up.dot(dir)*up).safe_normalized();
+ }
+
+ MT_Vector3 left = dir.normalized();
+ dir = (up.cross(left)).normalized();
+
+ // we have calculated the row vectors, now we keep
+ // local scaling into account:
+
+ left *= size[0];
+ dir *= size[1];
+ up *= size[2];
+
+ double maat[16] = {left[0], left[1], left[2], 0,
+ dir[0], dir[1], dir[2], 0,
+ up[0], up[1], up[2], 0,
+ 0, 0, 0, 1};
+
+ glTranslated(objpos[0],objpos[1],objpos[2]);
+ glMultMatrixd(maat);
+
+ }
+ else {
+ if (objectdrawmode & RAS_IPolyMaterial::SHADOW)
+ {
+ // shadow must be cast to the ground, physics system needed here!
+ MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]);
+ KX_GameObject *gameobj = (KX_GameObject*)m_clientobject;
+ MT_Vector3 direction = MT_Vector3(0,0,-1);
+
+ direction.normalize();
+ direction *= 100000;
+
+ MT_Point3 topoint = frompoint + direction;
+
+ KX_Scene* kxscene = (KX_Scene*) m_auxilaryClientInfo;
+ PHY_IPhysicsEnvironment* physics_environment = kxscene->GetPhysicsEnvironment();
+ PHY_IPhysicsController* physics_controller = gameobj->GetPhysicsController();
+
+ KX_GameObject *parent = gameobj->GetParent();
+ if (!physics_controller && parent)
+ physics_controller = parent->GetPhysicsController();
+ if (parent)
+ parent->Release();
+
+ KX_RayCast::Callback<RAS_OpenGLRasterizer> callback(this, physics_controller, oglmatrix);
+ if (!KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback))
+ {
+ // couldn't find something to cast the shadow on...
+ glMultMatrixd(oglmatrix);
+ }
+ else
+ { // we found the "ground", but the cast matrix doesn't take
+ // scaling in consideration, so we must apply the object scale
+ MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale();
+ glScalef(size[0], size[1], size[2]);
+ }
+ } else
+ {
+
+ // 'normal' object
+ glMultMatrixd(oglmatrix);
+ }
+ }
+}
+
+static void DisableForText()
+{
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */
+
+ glDisable(GL_BLEND);
+ glDisable(GL_ALPHA_TEST);
+
+ glDisable(GL_LIGHTING);
+ glDisable(GL_COLOR_MATERIAL);
+
+ if (GLEW_ARB_multitexture) {
+ for (int i=0; i<RAS_MAX_TEXCO; i++) {
+ glActiveTextureARB(GL_TEXTURE0_ARB+i);
+
+ if (GLEW_ARB_texture_cube_map)
+ glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+
+ glDisable(GL_TEXTURE_2D);
+ }
+
+ glActiveTextureARB(GL_TEXTURE0_ARB);
+ }
+ else {
+ if (GLEW_ARB_texture_cube_map)
+ glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+
+ glDisable(GL_TEXTURE_2D);
+ }
+}
+
+void RAS_OpenGLRasterizer::RenderBox2D(int xco,
+ int yco,
+ int width,
+ int height,
+ float percentage)
+{
+ /* This is a rather important line :( The gl-mode hasn't been left
+ * behind quite as neatly as we'd have wanted to. I don't know
+ * what cause it, though :/ .*/
+ glDisable(GL_DEPTH_TEST);
+
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+
+ glOrtho(0, width, 0, height, -100, 100);
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+
+ yco = height - yco;
+ int barsize = 50;
+
+ /* draw in black first*/
+ glColor3ub(0, 0, 0);
+ glBegin(GL_QUADS);
+ glVertex2f(xco + 1 + 1 + barsize * percentage, yco - 1 + 10);
+ glVertex2f(xco + 1, yco - 1 + 10);
+ glVertex2f(xco + 1, yco - 1);
+ glVertex2f(xco + 1 + 1 + barsize * percentage, yco - 1);
+ glEnd();
+
+ glColor3ub(255, 255, 255);
+ glBegin(GL_QUADS);
+ glVertex2f(xco + 1 + barsize * percentage, yco + 10);
+ glVertex2f(xco, yco + 10);
+ glVertex2f(xco, yco);
+ glVertex2f(xco + 1 + barsize * percentage, yco);
+ glEnd();
+
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
+}
+
+void RAS_OpenGLRasterizer::RenderText3D(int fontid,
+ const char* text,
+ int size,
+ int dpi,
+ float* color,
+ double* mat,
+ float aspect)
+{
+ /* gl prepping */
+ DisableForText();
+
+ /* the actual drawing */
+ glColor4fv(color);
+
+ /* multiply the text matrix by the object matrix */
+ BLF_enable(fontid, BLF_MATRIX|BLF_ASPECT);
+ BLF_matrix(fontid, mat);
+
+ /* aspect is the inverse scale that allows you to increase */
+ /* your resolution without sizing the final text size */
+ /* the bigger the size, the smaller the aspect */
+ BLF_aspect(fontid, aspect, aspect, aspect);
+
+ BLF_size(fontid, size, dpi);
+ BLF_position(fontid, 0, 0, 0);
+ BLF_draw(fontid, (char *)text, 65535);
+
+ BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT);
+}
+
+void RAS_OpenGLRasterizer::RenderText2D(RAS_TEXT_RENDER_MODE mode,
+ const char* text,
+ int xco,
+ int yco,
+ int width,
+ int height)
+{
+ /* This is a rather important line :( The gl-mode hasn't been left
+ * behind quite as neatly as we'd have wanted to. I don't know
+ * what cause it, though :/ .*/
+ DisableForText();
+ glDisable(GL_DEPTH_TEST);
+
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+
+ glOrtho(0, width, 0, height, -100, 100);
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+
+ if (mode == RAS_TEXT_PADDED) {
+ /* draw in black first*/
+ glColor3ub(0, 0, 0);
+ BLF_size(blf_mono_font, 11, 72);
+ BLF_position(blf_mono_font, (float)xco+1, (float)(height-yco-1), 0.0f);
+ BLF_draw(blf_mono_font, (char *)text, 65535);/* XXX, use real len */
+ }
+
+ /* the actual drawing */
+ glColor3ub(255, 255, 255);
+ BLF_size(blf_mono_font, 11, 72);
+ BLF_position(blf_mono_font, (float)xco, (float)(height-yco), 0.0f);
+ BLF_draw(blf_mono_font, (char *)text, 65535); /* XXX, use real len */
+
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ glEnable(GL_DEPTH_TEST);
+}
+
+void RAS_OpenGLRasterizer::PushMatrix()
+{
+ glPushMatrix();
+}
+
+void RAS_OpenGLRasterizer::PopMatrix()
+{
+ glPopMatrix();
+}
+
+void RAS_OpenGLRasterizer::MotionBlur()
+{
+ int state = GetMotionBlurState();
+ float motionblurvalue;
+ if (state)
+ {
+ motionblurvalue = GetMotionBlurValue();
+ if (state==1)
+ {
+ //bugfix:load color buffer into accum buffer for the first time(state=1)
+ glAccum(GL_LOAD, 1.0);
+ SetMotionBlurState(2);
+ }
+ else if (motionblurvalue >= 0.0f && motionblurvalue <= 1.0f) {
+ glAccum(GL_MULT, motionblurvalue);
+ glAccum(GL_ACCUM, 1-motionblurvalue);
+ glAccum(GL_RETURN, 1.0);
+ glFlush();
+ }
+ }
+}
+
+void RAS_OpenGLRasterizer::SetClientObject(void* obj)
+{
+ if (m_clientobject != obj)
+ {
+ bool ccw = (obj == NULL || !((KX_GameObject*)obj)->IsNegativeScaling());
+ SetFrontFace(ccw);
+
+ m_clientobject = obj;
+ }
+}
+
+void RAS_OpenGLRasterizer::SetAuxilaryClientInfo(void* inf)
+{
+ m_auxilaryClientInfo = inf;
+}
+
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
index c638c40d34b..e1159ab3d2d 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
@@ -41,13 +41,22 @@
using namespace std;
#include "RAS_IRasterizer.h"
-#include "RAS_IStorage.h"
#include "RAS_MaterialBucket.h"
-#include "RAS_ICanvas.h"
+#include "RAS_IPolygonMaterial.h"
+
+class RAS_IStorage;
+class RAS_ICanvas;
#define RAS_MAX_TEXCO 8 // match in BL_Material
#define RAS_MAX_ATTRIB 16 // match in BL_BlenderShader
+enum RAS_STORAGE_TYPE {
+ RAS_AUTO_STORAGE,
+ RAS_IMMEDIATE,
+ RAS_VA,
+ RAS_VBO
+};
+
struct OglDebugShape
{
enum SHAPE_TYPE{
@@ -105,6 +114,15 @@ class RAS_OpenGLRasterizer : public RAS_IRasterizer
bool m_usingoverrideshader;
+ // Render tools
+ void* m_clientobject;
+ void* m_auxilaryClientInfo;
+ std::vector<struct RAS_LightObject*> m_lights;
+ int m_lastlightlayer;
+ bool m_lastlighting;
+ void *m_lastauxinfo;
+ unsigned int m_numgllights;
+
protected:
int m_drawingmode;
TexCoGen m_texco[RAS_MAX_TEXCO];
@@ -171,10 +189,8 @@ public:
virtual void IndexPrimitives(class RAS_MeshSlot& ms);
virtual void IndexPrimitivesMulti(class RAS_MeshSlot& ms);
- virtual void IndexPrimitives_3DText(
- class RAS_MeshSlot& ms,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools);
+ virtual void IndexPrimitives_3DText(class RAS_MeshSlot& ms,
+ class RAS_IPolyMaterial* polymat);
virtual void SetProjectionMatrix(MT_CmMatrix4x4 & mat);
virtual void SetProjectionMatrix(const MT_Matrix4x4 & mat);
@@ -330,6 +346,56 @@ public:
virtual void SetUsingOverrideShader(bool val);
virtual bool GetUsingOverrideShader();
+ /**
+ * Render Tools
+ */
+ void EnableOpenGLLights();
+ void DisableOpenGLLights();
+ void ProcessLighting(bool uselights, const MT_Transform& viewmat);
+
+ void RenderBox2D(int xco,
+ int yco,
+ int width,
+ int height,
+ float percentage);
+
+
+ void RenderText3D(int fontid,
+ const char* text,
+ int size,
+ int dpi,
+ float* color,
+ double* mat,
+ float aspect);
+
+ void RenderText2D(RAS_TEXT_RENDER_MODE mode,
+ const char* text,
+ int xco,
+ int yco,
+ int width,
+ int height);
+
+ void applyTransform(double* oglmatrix, int objectdrawmode);
+
+ void PushMatrix();
+ void PopMatrix();
+
+ bool RayHit(class KX_ClientObjectInfo* client, class KX_RayCast* result, void * const data);
+ bool NeedRayCast(class KX_ClientObjectInfo*) { return true; }
+
+
+ void AddLight(struct RAS_LightObject* lightobject);
+
+ void RemoveLight(struct RAS_LightObject* lightobject);
+ int ApplyLights(int objectlayer, const MT_Transform& viewmat);
+
+ void MotionBlur();
+
+ void SetClientObject(void* obj);
+
+ void SetAuxilaryClientInfo(void* inf);
+
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_OpenGLRasterizer")
#endif
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
index 77bd540a039..40afcf04aac 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
@@ -26,16 +26,15 @@
*/
#include "RAS_StorageIM.h"
+#include "RAS_MaterialBucket.h"
+#include "RAS_IPolygonMaterial.h"
#include "GL/glew.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "GPU_material.h"
-#include "DNA_meshdata_types.h"
-
extern "C"{
- #include "BLI_utildefines.h"
#include "BKE_DerivedMesh.h"
}
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
index ce2f98b3837..0a7417656c6 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
@@ -13,13 +13,17 @@ incs = [
'#extern/glew/include',
'#intern/moto/include',
'#source/blender/blenkernel',
+ '#source/blender/blenfont',
'#source/blender/blenlib',
'#source/blender/gpu',
'#source/blender/makesdna',
'#source/gameengine/BlenderRoutines',
+ '#source/gameengine/Expressions',
+ '#source/gameengine/GameLogic',
+ '#source/gameengine/Physics/common',
'#source/gameengine/Rasterizer',
'#source/gameengine/SceneGraph',
- '#source/blender/gameengine/Ketsji',
+ '#source/gameengine/Ketsji',
env['BF_OPENGL_INC'],
]
incs = ' '.join(incs)
diff --git a/source/gameengine/Rasterizer/RAS_Polygon.cpp b/source/gameengine/Rasterizer/RAS_Polygon.cpp
index 72e09c9667d..1f23df90753 100644
--- a/source/gameengine/Rasterizer/RAS_Polygon.cpp
+++ b/source/gameengine/Rasterizer/RAS_Polygon.cpp
@@ -34,6 +34,7 @@
#endif
#include "RAS_Polygon.h"
+#include "RAS_MaterialBucket.h"
RAS_Polygon::RAS_Polygon(RAS_MaterialBucket* bucket, RAS_DisplayArray *darray, int numvert)
{
diff --git a/source/gameengine/Rasterizer/RAS_Polygon.h b/source/gameengine/Rasterizer/RAS_Polygon.h
index 088bdbd6844..b18477a72d2 100644
--- a/source/gameengine/Rasterizer/RAS_Polygon.h
+++ b/source/gameengine/Rasterizer/RAS_Polygon.h
@@ -32,11 +32,9 @@
#ifndef __RAS_POLYGON_H__
#define __RAS_POLYGON_H__
-#include "RAS_TexVert.h"
-#include "RAS_MaterialBucket.h"
-
-#include <vector>
-using namespace std;
+class RAS_DisplayArray;
+class RAS_MaterialBucket;
+class RAS_TexVert;
#ifdef WITH_CXX_GUARDEDALLOC
#include "MEM_guardedalloc.h"
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index d83cd2dc6fd..6908bc6db9c 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -42,6 +42,7 @@
#include "DNA_scene_types.h"
#include "RAS_CameraData.h"
#include "RAS_MeshObject.h"
+#include "RAS_Polygon.h"
#include "BLI_math.h"
#include "ImageRender.h"
@@ -80,7 +81,6 @@ ImageRender::ImageRender (KX_Scene *scene, KX_Camera * camera) :
m_engine = KX_GetActiveEngine();
m_rasterizer = m_engine->GetRasterizer();
m_canvas = m_engine->GetCanvas();
- m_rendertools = m_engine->GetRenderTools();
}
// destructor
@@ -200,9 +200,8 @@ void ImageRender::Render()
m_canvas->ClearColor(m_background[0], m_background[1], m_background[2], m_background[3]);
m_canvas->ClearBuffer(RAS_ICanvas::COLOR_BUFFER|RAS_ICanvas::DEPTH_BUFFER);
m_rasterizer->BeginFrame(RAS_IRasterizer::KX_TEXTURED,m_engine->GetClockTime());
- m_rendertools->BeginFrame(m_rasterizer);
m_engine->SetWorldSettings(m_scene->GetWorldInfo());
- m_rendertools->SetAuxilaryClientInfo(m_scene);
+ m_rasterizer->SetAuxilaryClientInfo(m_scene);
m_rasterizer->DisplayFog();
// matrix calculation, don't apply any of the stereo mode
m_rasterizer->SetStereoMode(RAS_IRasterizer::RAS_STEREO_NOSTEREO);
@@ -275,7 +274,7 @@ void ImageRender::Render()
m_scene->CalculateVisibleMeshes(m_rasterizer,m_camera);
- m_scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
+ m_scene->RenderBuckets(camtrans, m_rasterizer);
m_scene->RenderFonts();
@@ -595,7 +594,6 @@ ImageRender::ImageRender (KX_Scene *scene, KX_GameObject *observer, KX_GameObjec
m_engine = KX_GetActiveEngine();
m_rasterizer = m_engine->GetRasterizer();
m_canvas = m_engine->GetCanvas();
- m_rendertools = m_engine->GetRenderTools();
// locate the vertex assigned to mat and do following calculation in mesh coordinates
for (int meshIndex = 0; meshIndex < mirror->GetMeshCount(); meshIndex++)
{
diff --git a/source/gameengine/VideoTexture/ImageRender.h b/source/gameengine/VideoTexture/ImageRender.h
index 680e1cc1d89..98dceeaafe1 100644
--- a/source/gameengine/VideoTexture/ImageRender.h
+++ b/source/gameengine/VideoTexture/ImageRender.h
@@ -39,7 +39,6 @@
#include "DNA_screen_types.h"
#include "RAS_ICanvas.h"
#include "RAS_IRasterizer.h"
-#include "RAS_IRenderTools.h"
#include "ImageViewport.h"
@@ -88,8 +87,6 @@ protected:
RAS_ICanvas* m_canvas;
/// rasterizer
RAS_IRasterizer* m_rasterizer;
- /// render tools
- RAS_IRenderTools* m_rendertools;
/// engine
KX_KetsjiEngine* m_engine;
diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp
index 28fff8b9a6c..789b6006f99 100644
--- a/source/gameengine/VideoTexture/ImageViewport.cpp
+++ b/source/gameengine/VideoTexture/ImageViewport.cpp
@@ -36,6 +36,7 @@
#include "GL/glew.h"
#include "KX_PythonInit.h"
+#include "RAS_ICanvas.h"
#include "Texture.h"
#include "ImageBase.h"
#include "VideoBase.h"
diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp
index 1efbc50bfe0..c187f7c41c1 100644
--- a/source/gameengine/VideoTexture/Texture.cpp
+++ b/source/gameengine/VideoTexture/Texture.cpp
@@ -40,7 +40,6 @@
#include "DNA_meshdata_types.h"
#include "DNA_image_types.h"
#include "IMB_imbuf_types.h"
-#include "KX_PolygonMaterial.h"
#include "MEM_guardedalloc.h"
@@ -229,19 +228,12 @@ static int Texture_init(Texture *self, PyObject *args, PyObject *kwds)
{
self->m_imgTexture = static_cast<KX_BlenderMaterial*>(mat)->getImage(texID);
self->m_useMatTexture = false;
- } else if (mat->GetFlag() & RAS_BLENDERMAT)
+ } else
{
// get blender material texture
self->m_matTexture = static_cast<KX_BlenderMaterial*>(mat)->getTex(texID);
self->m_useMatTexture = true;
}
- else
- {
- // get texture pointer from polygon material
- MTFace * tface = static_cast<KX_PolygonMaterial*>(mat)->GetMTFace();
- self->m_imgTexture = (Image*)tface->tpage;
- self->m_useMatTexture = false;
- }
}
else if (lamp != NULL)
{