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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-11-26 06:32:34 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-11-26 06:32:34 +0400
commit53840c7db5114da8b35fb12c1cfa49427802b0d7 (patch)
treee1676e61881c903baff02bd69290ef0393a13465
parentb7cd9ec3ada529bf1d57cf08cc96851ceb67a47d (diff)
parent97b8a1f752fbe729c20c8398dfa9fdbc2e2e4ff3 (diff)
Merged changes in the trunk up to revision 52546.
Conflicts resolved: release/datafiles/startup.blend release/scripts/startup/bl_ui/space_view3d.py source/blender/blenkernel/intern/idcode.c
-rw-r--r--CMakeLists.txt114
-rw-r--r--GNUmakefile6
-rw-r--r--SConstruct11
-rwxr-xr-xbuild_files/build_environment/install_deps.sh395
-rw-r--r--build_files/buildbot/config/user-config-glibc211-i686.py2
-rw-r--r--build_files/buildbot/config/user-config-glibc211-x86_64.py2
-rw-r--r--build_files/buildbot/config/user-config-glibc27-i686.py2
-rw-r--r--build_files/buildbot/config/user-config-glibc27-x86_64.py2
-rw-r--r--build_files/cmake/Modules/FindIcuLinux.cmake146
-rw-r--r--build_files/cmake/macros.cmake3
-rw-r--r--build_files/scons/config/darwin-config.py10
-rw-r--r--build_files/scons/config/linux-config.py4
-rw-r--r--build_files/scons/config/win32-vc-config.py24
-rw-r--r--build_files/scons/config/win64-mingw-config.py2
-rw-r--r--build_files/scons/config/win64-vc-config.py24
-rw-r--r--doc/python_api/rst/bge.logic.rst536
-rw-r--r--doc/python_api/rst/bge.types.rst574
-rw-r--r--doc/python_api/rst/bgl.rst253
-rw-r--r--doc/python_api/rst/gpu.rst8
-rw-r--r--extern/libmv/libmv-capi.cpp5
-rw-r--r--intern/cycles/blender/blender_camera.cpp61
-rw-r--r--intern/cycles/blender/blender_shader.cpp35
-rw-r--r--intern/cycles/blender/blender_sync.h6
-rw-r--r--intern/cycles/device/device.cpp13
-rw-r--r--intern/cycles/device/device_cuda.cpp15
-rw-r--r--intern/cycles/kernel/kernel_camera.h15
-rw-r--r--intern/cycles/kernel/kernel_passes.h4
-rw-r--r--intern/cycles/kernel/kernel_path.h8
-rw-r--r--intern/cycles/kernel/kernel_shader.h5
-rw-r--r--intern/cycles/kernel/kernel_types.h3
-rw-r--r--intern/cycles/kernel/osl/osl_closures.h34
-rw-r--r--intern/cycles/kernel/osl/osl_globals.h1
-rw-r--r--intern/cycles/kernel/osl/osl_services.cpp74
-rw-r--r--intern/cycles/kernel/osl/osl_services.h17
-rw-r--r--intern/cycles/kernel/shaders/SConscript7
-rw-r--r--intern/cycles/kernel/shaders/node_brick_texture.osl9
-rw-r--r--intern/cycles/kernel/shaders/node_brightness.osl29
-rw-r--r--intern/cycles/kernel/shaders/node_checker_texture.osl9
-rw-r--r--intern/cycles/kernel/shaders/node_environment_texture.osl40
-rw-r--r--intern/cycles/kernel/shaders/node_gradient_texture.osl9
-rw-r--r--intern/cycles/kernel/shaders/node_hsv.osl3
-rw-r--r--intern/cycles/kernel/shaders/node_image_texture.osl15
-rw-r--r--intern/cycles/kernel/shaders/node_magic_texture.osl9
-rw-r--r--intern/cycles/kernel/shaders/node_musgrave_texture.osl9
-rw-r--r--intern/cycles/kernel/shaders/node_noise_texture.osl9
-rw-r--r--intern/cycles/kernel/shaders/node_sky_texture.osl15
-rw-r--r--intern/cycles/kernel/shaders/node_texture_coordinate.osl4
-rw-r--r--intern/cycles/kernel/shaders/node_voronoi_texture.osl9
-rw-r--r--intern/cycles/kernel/shaders/node_ward_bsdf.osl12
-rw-r--r--intern/cycles/kernel/shaders/node_wave_texture.osl9
-rw-r--r--intern/cycles/kernel/svm/svm_bsdf.h10
-rw-r--r--intern/cycles/kernel/svm/svm_closure.h9
-rw-r--r--intern/cycles/kernel/svm/svm_hsv.h2
-rw-r--r--intern/cycles/kernel/svm/svm_math.h17
-rw-r--r--intern/cycles/kernel/svm/svm_tex_coord.h19
-rw-r--r--intern/cycles/render/camera.cpp27
-rw-r--r--intern/cycles/render/camera.h8
-rw-r--r--intern/cycles/render/image.cpp24
-rw-r--r--intern/cycles/render/image.h7
-rw-r--r--intern/cycles/render/nodes.cpp63
-rw-r--r--intern/cycles/render/nodes.h7
-rw-r--r--intern/cycles/render/osl.cpp9
-rw-r--r--intern/cycles/render/osl.h3
-rw-r--r--intern/cycles/render/svm.cpp85
-rw-r--r--intern/cycles/render/svm.h14
-rw-r--r--intern/cycles/util/util_boundbox.h10
-rw-r--r--intern/elbeem/intern/ntl_geometryobject.cpp2
-rw-r--r--intern/elbeem/intern/ntl_world.cpp11
-rw-r--r--intern/elbeem/intern/ntl_world.h3
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h3
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm17
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp4
-rw-r--r--intern/iksolver/intern/IK_QJacobianSolver.cpp2
-rw-r--r--intern/locale/CMakeLists.txt1
-rw-r--r--intern/locale/boost_locale_wrapper.cpp29
-rw-r--r--intern/memutil/MEM_CacheLimiter.h6
-rw-r--r--intern/opencolorio/ocio_impl.cc5
-rw-r--r--intern/opennl/CMakeLists.txt6
-rw-r--r--release/datafiles/blender_icons.pngbin228237 -> 229017 bytes
-rw-r--r--release/datafiles/startup.blendbin413008 -> 417000 bytes
-rw-r--r--release/scripts/modules/bl_i18n_utils/settings.py14
-rwxr-xr-xrelease/scripts/modules/bl_i18n_utils/update_pot.py77
-rw-r--r--release/scripts/startup/bl_operators/object.py49
-rw-r--r--release/scripts/startup/bl_ui/properties_data_armature.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_data_bone.py1
-rw-r--r--release/scripts/startup/bl_ui/properties_data_camera.py8
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py3
-rw-r--r--release/scripts/startup/bl_ui/properties_object_constraint.py28
-rw-r--r--release/scripts/startup/bl_ui/space_dopesheet.py6
-rw-r--r--release/scripts/startup/bl_ui/space_graph.py6
-rw-r--r--release/scripts/startup/bl_ui/space_info.py2
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py2
-rw-r--r--release/scripts/startup/bl_ui/space_text.py15
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py2
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py10
-rw-r--r--release/scripts/templates/script_stub.py3
-rw-r--r--release/text/readme.html10
-rw-r--r--source/blender/blenfont/BLF_translation.h50
-rw-r--r--source/blender/blenkernel/BKE_text.h12
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c2
-rw-r--r--source/blender/blenkernel/intern/action.c4
-rw-r--r--source/blender/blenkernel/intern/armature.c9
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c13
-rw-r--r--source/blender/blenkernel/intern/collision.c10
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c6
-rw-r--r--source/blender/blenkernel/intern/idcode.c67
-rw-r--r--source/blender/blenkernel/intern/image.c15
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c3
-rw-r--r--source/blender/blenkernel/intern/sequencer.c11
-rw-r--r--source/blender/blenkernel/intern/text.c321
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c35
-rw-r--r--source/blender/blenlib/BLI_endian_switch_inline.h34
-rw-r--r--source/blender/blenlib/BLI_ghash.h2
-rw-r--r--source/blender/blenlib/BLI_math_base.h4
-rw-r--r--source/blender/blenlib/BLI_math_color.h2
-rw-r--r--source/blender/blenlib/BLI_math_geom.h2
-rw-r--r--source/blender/blenlib/BLI_math_inline.h5
-rw-r--r--source/blender/blenlib/BLI_math_vector.h2
-rw-r--r--source/blender/blenlib/CMakeLists.txt6
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c2
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c5
-rw-r--r--source/blender/blenlib/intern/math_geom_inline.c5
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c5
-rw-r--r--source/blender/blenlib/intern/string.c16
-rw-r--r--source/blender/blenlib/intern/string_utf8.c12
-rw-r--r--source/blender/blenloader/intern/readfile.c25
-rw-r--r--source/blender/blenloader/intern/writefile.c8
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c4
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c12
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.h1
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c772
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api.h141
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api_inline.h48
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c418
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.h5
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c3
-rw-r--r--source/blender/bmesh/intern/bmesh_private.h13
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c20
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.h6
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c17
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c14
-rw-r--r--source/blender/bmesh/operators/bmo_create.c80
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c30
-rw-r--r--source/blender/bmesh/operators/bmo_dupe.c157
-rw-r--r--source/blender/bmesh/operators/bmo_edgesplit.c20
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c60
-rw-r--r--source/blender/bmesh/operators/bmo_hull.c62
-rw-r--r--source/blender/bmesh/operators/bmo_inset.c57
-rw-r--r--source/blender/bmesh/operators/bmo_join_triangles.c12
-rw-r--r--source/blender/bmesh/operators/bmo_mesh_conv.c14
-rw-r--r--source/blender/bmesh/operators/bmo_mirror.c23
-rw-r--r--source/blender/bmesh/operators/bmo_primitive.c107
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c87
-rw-r--r--source/blender/bmesh/operators/bmo_similar.c30
-rw-r--r--source/blender/bmesh/operators/bmo_slide.c8
-rw-r--r--source/blender/bmesh/operators/bmo_smooth_laplacian.c40
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c63
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.h2
-rw-r--r--source/blender/bmesh/operators/bmo_symmetrize.c18
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c27
-rw-r--r--source/blender/bmesh/operators/bmo_unsubdivide.c6
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c107
-rw-r--r--source/blender/bmesh/operators/bmo_wireframe.c87
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c114
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp5
-rw-r--r--source/blender/compositor/nodes/COM_MuteNode.cpp4
-rw-r--r--source/blender/compositor/nodes/COM_OutputFileNode.cpp6
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp5
-rw-r--r--source/blender/compositor/operations/COM_GammaCorrectOperation.cpp2
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c20
-rw-r--r--source/blender/editors/animation/anim_markers.c36
-rw-r--r--source/blender/editors/armature/editarmature.c6
-rw-r--r--source/blender/editors/curve/editcurve.c24
-rw-r--r--source/blender/editors/include/UI_icons.h2
-rw-r--r--source/blender/editors/interface/interface.c26
-rw-r--r--source/blender/editors/interface/interface_layout.c19
-rw-r--r--source/blender/editors/interface/interface_templates.c369
-rw-r--r--source/blender/editors/mesh/editmesh_add.c24
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c2
-rw-r--r--source/blender/editors/mesh/editmesh_rip.c2
-rw-r--r--source/blender/editors/mesh/editmesh_select.c37
-rw-r--r--source/blender/editors/mesh/editmesh_slide.c4
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c184
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c12
-rw-r--r--source/blender/editors/mesh/mesh_ops.c12
-rw-r--r--source/blender/editors/object/object_edit.c3
-rw-r--r--source/blender/editors/object/object_shapekey.c8
-rw-r--r--source/blender/editors/object/object_vgroup.c14
-rw-r--r--source/blender/editors/physics/particle_edit.c10
-rw-r--r--source/blender/editors/physics/physics_fluid.c8
-rw-r--r--source/blender/editors/render/render_update.c42
-rw-r--r--source/blender/editors/screen/screen_ops.c14
-rw-r--r--source/blender/editors/space_clip/space_clip.c11
-rw-r--r--source/blender/editors/space_console/console_ops.c20
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c12
-rw-r--r--source/blender/editors/space_image/image_ops.c115
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c2
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c9
-rw-r--r--source/blender/editors/space_text/space_text.c5
-rw-r--r--source/blender/editors/space_text/text_draw.c127
-rw-r--r--source/blender/editors/space_text/text_intern.h8
-rw-r--r--source/blender/editors/space_text/text_ops.c223
-rw-r--r--source/blender/editors/space_text/text_python.c174
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c15
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c64
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c4
-rw-r--r--source/blender/editors/transform/transform.c22
-rw-r--r--source/blender/editors/transform/transform_constraints.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_buttons.c7
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c2
-rw-r--r--source/blender/gpu/shaders/gpu_shader_vertex.glsl8
-rw-r--r--source/blender/ikplugin/intern/iksolver_plugin.c3
-rw-r--r--source/blender/imbuf/intern/cineon/cineon_dpx.c16
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.c2
-rw-r--r--source/blender/imbuf/intern/openexr/CMakeLists.txt2
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp16
-rw-r--r--source/blender/imbuf/intern/util.c21
-rw-r--r--source/blender/makesdna/DNA_action_types.h2
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h15
-rw-r--r--source/blender/makesdna/DNA_text_types.h10
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesrna/RNA_access.h6
-rw-r--r--source/blender/makesrna/intern/makesrna.c88
-rw-r--r--source/blender/makesrna/intern/rna_access.c155
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c4
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c2
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c2
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c22
-rw-r--r--source/blender/makesrna/intern/rna_pose.c10
-rw-r--r--source/blender/makesrna/intern/rna_scene.c5
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c4
-rw-r--r--source/blender/makesrna/intern/rna_speaker.c4
-rw-r--r--source/blender/makesrna/intern/rna_text.c48
-rw-r--r--source/blender/makesrna/intern/rna_texture.c1
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c2
-rw-r--r--source/blender/modifiers/CMakeLists.txt1
-rw-r--r--source/blender/modifiers/MOD_modifiertypes.h1
-rw-r--r--source/blender/modifiers/intern/MOD_array.c74
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c6
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciansmooth.c6
-rw-r--r--source/blender/modifiers/intern/MOD_skin.c19
-rw-r--r--source/blender/modifiers/intern/MOD_triangulate.c144
-rw-r--r--source/blender/modifiers/intern/MOD_util.c1
-rw-r--r--source/blender/nodes/CMakeLists.txt9
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal_map.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops.c134
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c83
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c4
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c4
-rw-r--r--source/blender/python/generic/bgl.c22
-rw-r--r--source/blender/python/generic/idprop_py_api.c8
-rw-r--r--source/blender/python/generic/py_capi_utils.c6
-rw-r--r--source/blender/python/intern/bpy_app.c4
-rw-r--r--source/blender/python/intern/bpy_intern_string.c6
-rw-r--r--source/blender/python/intern/bpy_intern_string.h2
-rw-r--r--source/blender/python/intern/bpy_rna.c36
-rw-r--r--source/blender/python/intern/bpy_rna_array.c6
-rw-r--r--source/blender/render/intern/include/initrender.h5
-rw-r--r--source/blender/render/intern/source/convertblender.c4
-rw-r--r--source/blender/render/intern/source/external_engine.c8
-rw-r--r--source/blender/render/intern/source/initrender.c24
-rw-r--r--source/blender/render/intern/source/pipeline.c7
-rw-r--r--source/blender/render/intern/source/renderdatabase.c34
-rw-r--r--source/blender/render/intern/source/shadeoutput.c4
-rw-r--r--source/blender/render/intern/source/zbuf.c4
-rw-r--r--source/blender/windowmanager/WM_types.h1
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c9
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c3
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c6
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c5
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c2
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c69
-rw-r--r--source/creator/blender.map11
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.cpp22
-rw-r--r--source/gameengine/Expressions/IntValue.cpp5
-rw-r--r--source/gameengine/Expressions/ListValue.cpp10
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp28
-rw-r--r--source/gameengine/GameLogic/SCA_IController.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_ILogicBrick.cpp2
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp8
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.cpp16
-rw-r--r--source/gameengine/GameLogic/SCA_KeyboardSensor.cpp15
-rw-r--r--source/gameengine/GameLogic/SCA_MouseSensor.cpp11
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp10
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.h2
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp10
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.cpp4
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp2
-rw-r--r--source/gameengine/Ketsji/BL_Shader.cpp4
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt2
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp30
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp145
-rw-r--r--source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h59
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.cpp22
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.cpp5
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp21
-rw-r--r--source/gameengine/Ketsji/KX_PythonInitTypes.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_PythonSeq.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_VehicleWrapper.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.cpp4
-rw-r--r--source/gameengine/VideoTexture/FilterBlueScreen.cpp46
-rw-r--r--source/gameengine/VideoTexture/FilterColor.cpp4
-rw-r--r--source/gameengine/VideoTexture/FilterNormal.cpp2
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp9
-rw-r--r--source/gameengine/VideoTexture/ImageViewport.cpp46
-rw-r--r--source/gameengine/VideoTexture/ImageViewport.h4
-rw-r--r--source/gameengine/VideoTexture/VideoBase.cpp2
-rw-r--r--source/gameengine/VideoTexture/VideoFFmpeg.cpp2
-rw-r--r--source/tests/bl_rst_completeness.py159
-rw-r--r--source/tests/rst_to_doctree_mini.py91
325 files changed, 6502 insertions, 3973 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe1a6d03335..751c2dd548e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -234,6 +234,7 @@ option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)"
option(WITH_RAYOPTIMIZATION "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
if(UNIX AND NOT APPLE)
option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
+ option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF)
endif()
option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON)
option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder" ON)
@@ -502,10 +503,23 @@ set(PLATFORM_LINKFLAGS_DEBUG "")
#Platform specifics
if(UNIX AND NOT APPLE)
- find_package(JPEG REQUIRED)
- find_package(PNG REQUIRED)
- find_package(ZLIB REQUIRED)
- find_package(Freetype REQUIRED)
+ macro(find_package_wrapper)
+ STRING(TOUPPER ${ARGV0} _NAME_UPPER)
+ if(${WITH_STATIC_LIBS})
+ set(_cmake_find_library_suffixes_back ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ endif()
+ find_package(${ARGV})
+ if(${WITH_STATIC_LIBS})
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_cmake_find_library_suffixes_back})
+ unset(_cmake_find_library_suffixes_back)
+ endif()
+ endmacro()
+
+ find_package_wrapper(JPEG REQUIRED)
+ find_package_wrapper(PNG REQUIRED)
+ find_package_wrapper(ZLIB REQUIRED)
+ find_package_wrapper(Freetype REQUIRED)
if(WITH_PYTHON)
# No way to set py32. remove for now.
@@ -513,25 +527,28 @@ if(UNIX AND NOT APPLE)
# Use our own instead, since wothout py is such a rare case,
# require this package
+ # XXX Linking errors with debian static python :/
+# find_package_wrapper(PythonLibsUnix REQUIRED)
find_package(PythonLibsUnix REQUIRED)
endif()
-
if(WITH_IMAGE_OPENEXR)
- find_package(OpenEXR) # our own module
+ find_package_wrapper(OpenEXR) # our own module
if(NOT OPENEXR_FOUND)
set(WITH_IMAGE_OPENEXR OFF)
endif()
endif()
if(WITH_IMAGE_OPENJPEG)
- find_package(OpenJPEG)
+ find_package_wrapper(OpenJPEG)
if(NOT OPENJPEG_FOUND)
set(WITH_IMAGE_OPENJPEG OFF)
endif()
endif()
if(WITH_IMAGE_TIFF)
+ # XXX Linking errors with debian static tiff :/
+# find_package_wrapper(TIFF)
find_package(TIFF)
if(NOT TIFF_FOUND)
set(WITH_IMAGE_TIFF OFF)
@@ -540,14 +557,14 @@ if(UNIX AND NOT APPLE)
# Audio IO
if(WITH_OPENAL)
- find_package(OpenAL)
+ find_package_wrapper(OpenAL)
if(NOT OPENAL_FOUND)
set(WITH_OPENAL OFF)
endif()
endif()
if(WITH_SDL)
- find_package(SDL)
+ find_package_wrapper(SDL)
mark_as_advanced(
SDLMAIN_LIBRARY
SDL_INCLUDE_DIR
@@ -561,7 +578,7 @@ if(UNIX AND NOT APPLE)
endif()
if(WITH_JACK)
- find_package(Jack)
+ find_package_wrapper(Jack)
if(NOT JACK_FOUND)
set(WITH_JACK OFF)
endif()
@@ -569,7 +586,7 @@ if(UNIX AND NOT APPLE)
# Codecs
if(WITH_CODEC_SNDFILE)
- find_package(SndFile)
+ find_package_wrapper(SndFile)
if(NOT SNDFILE_FOUND)
set(WITH_CODEC_SNDFILE OFF)
endif()
@@ -594,31 +611,31 @@ if(UNIX AND NOT APPLE)
endif()
if(WITH_FFTW3)
- find_package(Fftw3)
+ find_package_wrapper(Fftw3)
if(NOT FFTW3_FOUND)
set(WITH_FFTW3 OFF)
endif()
endif()
if(WITH_OPENCOLLADA)
- find_package(OpenCOLLADA)
+ find_package_wrapper(OpenCOLLADA)
if(OPENCOLLADA_FOUND)
- find_package(XML2)
- find_package(PCRE)
+ find_package_wrapper(XML2)
+ find_package_wrapper(PCRE)
else()
set(WITH_OPENCOLLADA OFF)
endif()
endif()
if(WITH_MEM_JEMALLOC)
- find_package(JeMalloc)
+ find_package_wrapper(JeMalloc)
if(NOT JEMALLOC_FOUND)
set(WITH_MEM_JEMALLOC OFF)
endif()
endif()
if (WITH_INPUT_NDOF)
- find_package(Spacenav)
+ find_package_wrapper(Spacenav)
if(NOT SPACENAV_FOUND)
set(WITH_INPUT_NDOF OFF)
endif()
@@ -634,6 +651,9 @@ if(UNIX AND NOT APPLE)
# uses in build instructions to override include and library variables
if(NOT BOOST_CUSTOM)
# XXX No more lib dir, is this multithread stuff still needed?
+ if(${WITH_STATIC_LIBS})
+ set(Boost_USE_STATIC_LIBS ON)
+ endif()
if(NOT BOOST_ROOT)
set(Boost_USE_MULTITHREADED OFF)
else()
@@ -644,6 +664,9 @@ if(UNIX AND NOT APPLE)
list(APPEND __boost_packages locale)
endif()
find_package(Boost 1.34 COMPONENTS ${__boost_packages})
+ if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
+ find_package(IcuLinux)
+ endif()
mark_as_advanced(Boost_DIR) # why doesnt boost do this?
endif()
@@ -654,7 +677,7 @@ if(UNIX AND NOT APPLE)
endif()
if(WITH_OPENIMAGEIO)
- find_package(OpenImageIO)
+ find_package_wrapper(OpenImageIO)
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
@@ -674,7 +697,7 @@ if(UNIX AND NOT APPLE)
endif()
if(WITH_OPENCOLORIO)
- find_package(OpenColorIO)
+ find_package_wrapper(OpenColorIO)
set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
set(OPENCOLORIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
@@ -693,9 +716,16 @@ if(UNIX AND NOT APPLE)
set(LLVM_VERSION "3.0")
endif()
set(LLVM_STATIC YES)
- FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_DIRECTORY})
- if(NOT LLVM_CONFIG)
- FIND_PROGRAM(LLVM_CONFIG llvm-config HINTS ${LLVM_DIRECTORY})
+ if(LLVM_DIRECTORY)
+ FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
+ if(NOT LLVM_CONFIG)
+ FIND_PROGRAM(LLVM_CONFIG llvm-config HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
+ endif()
+ else()
+ FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION})
+ if(NOT LLVM_CONFIG)
+ FIND_PROGRAM(LLVM_CONFIG llvm-config)
+ endif()
endif()
execute_process(COMMAND ${LLVM_CONFIG} --version
OUTPUT_VARIABLE LLVM_VERSION
@@ -729,6 +759,9 @@ if(UNIX AND NOT APPLE)
else()
message(FATAL_ERROR "LLVM not found.")
endif()
+
+ # Fix for conflict with Mesa llvmpipe
+ set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/source/creator/blender.map")
endif()
if(WITH_CYCLES_OSL)
@@ -791,7 +824,7 @@ if(UNIX AND NOT APPLE)
endif()
endif()
- set(PLATFORM_LINKFLAGS "-pthread")
+ set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -pthread")
# lfs on glibc, all compilers should use
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
@@ -1043,6 +1076,7 @@ elseif(WIN32)
if(WITH_IMAGE_OPENEXR)
set_lib_path(OPENEXR "openexr")
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
+ set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
set(OPENEXR_LIBRARIES
${OPENEXR_LIBPATH}/Iex.lib
@@ -1051,12 +1085,6 @@ elseif(WIN32)
${OPENEXR_LIBPATH}/Imath.lib
${OPENEXR_LIBPATH}/IlmThread.lib
)
- set(OPENEXR_INCLUDE_DIRS
- ${OPENEXR_INCLUDE_DIR}
- ${OPENEXR_INCLUDE_DIR}/IlmImf
- ${OPENEXR_INCLUDE_DIR}/Iex
- ${OPENEXR_INCLUDE_DIR}/Imath
- )
endif()
if(WITH_IMAGE_TIFF)
@@ -1091,23 +1119,23 @@ elseif(WIN32)
if(MSVC10)
set(BOOST_LIBPATH ${BOOST}/vc2010/lib)
set(BOOST_POSTFIX "vc100-mt-s-1_49.lib")
- #set(BOOST_DEBUG_POSTFIX "vc100-mt-sgd-1_49.lib")
+ set(BOOST_DEBUG_POSTFIX "vc100-mt-sgd-1_49.lib")
else()
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_POSTFIX "vc90-mt-s-1_49.lib")
- #set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_49.lib")
+ set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_49.lib")
endif()
set(BOOST_LIBRARIES
optimized libboost_date_time-${BOOST_POSTFIX} optimized libboost_filesystem-${BOOST_POSTFIX}
optimized libboost_regex-${BOOST_POSTFIX}
- optimized libboost_system-${BOOST_POSTFIX} optimized libboost_thread-${BOOST_POSTFIX})
- #debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
- #debug libboost_regex-${BOOST_DEBUG_POSTFIX}
- #debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX}
+ optimized libboost_system-${BOOST_POSTFIX} optimized libboost_thread-${BOOST_POSTFIX}
+ debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
+ debug libboost_regex-${BOOST_DEBUG_POSTFIX}
+ debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX})
if(WITH_INTERNATIONAL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
- optimized libboost_locale-${BOOST_POSTFIX})
- #debug libboost_locale-${BOOST_DEBUG_POSTFIX}
+ optimized libboost_locale-${BOOST_POSTFIX}
+ debug libboost_locale-${BOOST_DEBUG_POSTFIX})
endif(WITH_INTERNATIONAL)
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
@@ -1115,7 +1143,7 @@ elseif(WIN32)
if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO ${LIBDIR}/openimageio)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
- set(OPENIMAGEIO_LIBRARIES OpenImageIO)
+ set(OPENIMAGEIO_LIBRARIES optimized OpenImageIO debug OpenImageIO_d)
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
endif()
@@ -1361,13 +1389,13 @@ elseif(APPLE)
if(WITH_PYTHON)
if(NOT WITH_PYTHON_MODULE)
- # we use precompiled libraries for py 3.2 and up by default
+ # we use precompiled libraries for py 3.3 and up by default
# normally cached but not since we include them with blender
- set(PYTHON_VERSION 3.2)
- set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
+ set(PYTHON_VERSION 3.3)
+ set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
# set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
- set(PYTHON_LIBRARY python${PYTHON_VERSION})
+ set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
# set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
else()
@@ -1531,7 +1559,7 @@ elseif(APPLE)
if(WITH_BOOST)
set(BOOST ${LIBDIR}/boost)
set(BOOST_INCLUDE_DIR ${BOOST}/include)
- set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt)
+ set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt boost_wave-mt)
if (WITH_INTERNATIONAL)
list(APPEND BOOST_LIBRARIES boost_locale-mt)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale needs it !
diff --git a/GNUmakefile b/GNUmakefile
index 8876b1db33d..c1b67c86ed2 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -241,13 +241,13 @@ test_style_c_qtc:
test_style_osl:
# run our own checks on C/C++ style
- PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/osl
+ PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/shaders
test_style_osl_qtc:
# run our own checks on C/C++ style
USE_QTC_TASK=1 \
- PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/osl > \
+ PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/shaders > \
test_style.tasks
@echo "written: test_style.tasks"
@@ -308,7 +308,7 @@ check_spelling_c_qtc:
$(BLENDER_DIR)/check_spelling_c.tasks
check_spelling_osl:
- cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/intern/cycles/kernel/osl
+ cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/intern/cycles/kernel/shaders
# -----------------------------------------------------------------------------
# Utilities
diff --git a/SConstruct b/SConstruct
index a765488d3f1..5a1797ec1dc 100644
--- a/SConstruct
+++ b/SConstruct
@@ -306,11 +306,12 @@ if env['OURPLATFORM']=='darwin':
else:
env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','Jackmp'])
- if env['WITH_BF_CYCLES_OSL'] == 1:
- # this is kinda hardcoded atm due not understood path issues, also look that we need 2 variants of passing the oslexec with the force_load option, why ?
- env.Append(LINKFLAGS=['-L../lib/darwin-9.x.universal/osl/lib','-loslcomp','-force_load ../lib/darwin-9.x.universal/osl/lib/liboslexec.a','-loslquery'])
- env.Append(BF_PROGRAM_LINKFLAGS=['-Xlinker','-force_load','-Xlinker','../lib/darwin-9.x.universal/osl/lib/liboslexec.a'])
-
+ 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
+ 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'])
+
if env['WITH_BF_OPENMP'] == 1:
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
env['CCFLAGS'].append('/openmp')
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index 7077b66fc5e..935f37b53da 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -10,11 +10,23 @@ CWD=$PWD
# and only then do it automatically
BUILD_OSL=false
+# Try to link everything statically. Use this to produce protable versions of blender.
+ALL_STATIC=false
+
THREADS=`cat /proc/cpuinfo | grep cores | uniq | sed -e "s/.*: *\(.*\)/\\1/"`
if [ -z "$THREADS" ]; then
THREADS=1
fi
+COMMON_INFO="Source code of dependencies needed to be compiled will be downloaded and extracted into '$SRC'.
+Built libs of dependencies needed to be compiled will be installed into '$INST'.
+Please edit \$SRC and/or \$INST variables at the begining of this script if you want to use other paths!
+
+Number of threads for building: $THREADS.
+Building OSL: $BUILD_OSL (edit \$BUILD_OSL var to change this).
+All static linking: $ALL_STATIC (edit \$ALL_STATIC var to change this)."
+
+
PYTHON_VERSION="3.3.0"
PYTHON_VERSION_MIN="3.3"
PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2"
@@ -35,6 +47,8 @@ OIIO_VERSION_MIN="1.1"
LLVM_VERSION="3.1"
LLVM_VERSION_MIN="3.0"
LLVM_VERSION_FOUND=""
+LLVM_SOURCE="http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz"
+LLVM_CLANG_SOURCE="http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz"
# OSL needs to be compiled for now!
OSL_VERSION="1.2.0"
@@ -78,12 +92,54 @@ INFO() {
echo "${@}"
}
+# Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1.
+# $1 and $2 should be version numbers made of numbers only.
+version_eq() {
+ backIFS=$IFS
+ IFS='.'
+
+ # Split both version numbers into their numeric elements.
+ arr1=( $1 )
+ arr2=( $2 )
+
+ ret=1
+
+ count1=${#arr1[@]}
+ count2=${#arr2[@]}
+ if [ $count2 -ge $count1 ]; then
+ _t=$count1
+ count1=$count2
+ count2=$_t
+ arr1=( $2 )
+ arr2=( $1 )
+ fi
+
+ ret=0
+ for (( i=0; $i < $count2; i++ ))
+ do
+ if [ $(( 10#${arr1[$i]} )) -ne $(( 10#${arr2[$i]} )) ]; then
+ ret=1
+ break
+ fi
+ done
+
+ for (( i=$count2; $i < $count1; i++ ))
+ do
+ if [ $(( 10#${arr1[$i]} )) -ne 0 ]; then
+ ret=1
+ break
+ fi
+ done
+
+ IFS=$backIFS
+ return $ret
+}
+
# Return 0 if $1 >= $2, else 1.
# $1 and $2 should be version numbers made of numbers only.
version_ge() {
- # XXX Not yet perfect, won't always work as expected with e.g. 1.0.0 and 1.0... :/
- if [ "$1" != "$2" ] &&
- [ $(echo -e "$1\n$2" | sort --version-sort | head --lines=1) = "$1" ]; then
+ version_eq $1 $2
+ if [ $? -eq 1 -a $(echo -e "$1\n$2" | sort --version-sort | head --lines=1) = "$1" ]; then
return 1
else
return 0
@@ -300,6 +356,8 @@ compile_OCIO() {
-D CMAKE_INSTALL_PREFIX=$_inst \
-D CMAKE_CXX_FLAGS="$cflags" \
-D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" \
+ -D OCIO_BUILD_APPS=OFF \
+ -D OCIO_BUILD_PYGLUE=OFF \
..
make -j$THREADS && make install
@@ -332,7 +390,7 @@ compile_OCIO() {
compile_OIIO() {
# To be changed each time we make edits that would modify the compiled result!
- oiio_magic=5
+ oiio_magic=6
_src=$SRC/OpenImageIO-$OIIO_VERSION
_inst=$INST/oiio-$OIIO_VERSION
@@ -376,6 +434,8 @@ index b9e6c8b..c761185 100644
#define SHA1_MAX_FILE_BUFFER 8000
EOF
+ cd $CWD
+
fi
cd $_src
@@ -386,13 +446,17 @@ EOF
mkdir build
cd build
- cmake_d="-D CMAKE_BUILD_TYPE=Release \
- -D CMAKE_PREFIX_PATH=$_inst \
- -D CMAKE_INSTALL_PREFIX=$_inst \
- -D BUILDSTATIC=ON"
+ cmake_d="-D CMAKE_BUILD_TYPE=Release"
+ cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
+ cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
+ cmake_d="$cmake_d -D BUILDSTATIC=ON"
+ cmake_d="$cmake_d -D LINKSTATIC=ON"
if [ -d $INST/boost ]; then
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
+ if $ALL_STATIC; then
+ cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
+ fi
fi
# Looks like we do not need ocio in oiio for now...
@@ -428,9 +492,101 @@ EOF
fi
}
+compile_LLVM() {
+ # To be changed each time we make edits that would modify the compiled result!
+ llvm_magic=1
+
+ _src=$SRC/LLVM-$LLVM_VERSION
+ _inst=$INST/llvm-$LLVM_VERSION
+ _src_clang=$SRC/CLANG-$LLVM_VERSION
+
+ # Clean install if needed!
+ magic_compile_check llvm-$LLVM_VERSION $llvm_magic
+ if [ $? -eq 1 ]; then
+ rm -rf $_inst
+ rm -rf $_inst_clang
+ fi
+
+ if [ ! -d $_inst ]; then
+ INFO "Building LLVM-$LLVM_VERSION (CLANG included!)"
+
+ prepare_opt
+
+ if [ ! -d $_src -o true ]; then
+ wget -c $LLVM_SOURCE -O "$_src.tar.gz"
+ wget -c $LLVM_CLANG_SOURCE -O "$_src_clang.tar.gz"
+
+ INFO "Unpacking LLVM-$LLVM_VERSION"
+ tar -C $SRC --transform "s,([^/]*/?)llvm-[^/]*(.*),\1LLVM-$LLVM_VERSION\2,x" \
+ -xf $_src.tar.gz
+ INFO "Unpacking CLANG-$LLVM_VERSION to $_src/tools/clang"
+ tar -C $_src/tools \
+ --transform "s,([^/]*/?)clang-[^/]*(.*),\1clang\2,x" \
+ -xf $_src_clang.tar.gz
+
+ cd $_src
+
+ # XXX Ugly patching hack!
+ cat << EOF | patch -p1
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -13,7 +13,7 @@
+ set(LLVM_VERSION_MAJOR 3)
+ set(LLVM_VERSION_MINOR 1)
+
+-set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}svn")
++set(PACKAGE_VERSION "\${LLVM_VERSION_MAJOR}.\${LLVM_VERSION_MINOR}")
+
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+
+EOF
+
+ cd $CWD
+
+ fi
+
+ cd $_src
+
+ # Always refresh the whole build!
+ if [ -d build ]; then
+ rm -rf build
+ fi
+ mkdir build
+ cd build
+
+ cmake_d="-D CMAKE_BUILD_TYPE=Release"
+ cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
+ cmake_d="$cmake_d -D LLVM_ENABLE_FFI=ON"
+
+ if [ -d $_FFI_INCLUDE_DIR ]; then
+ cmake_d="$cmake_d -D FFI_INCLUDE_DIR=$_FFI_INCLUDE_DIR"
+ fi
+
+ cmake $cmake_d ..
+
+ make -j$THREADS && make install
+ make clean
+
+ if [ -d $_inst ]; then
+ rm -f $INST/llvm
+ ln -s llvm-$LLVM_VERSION $INST/llvm
+ else
+ ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
+ exit 1
+ fi
+
+ magic_compile_set llvm-$LLVM_VERSION $llvm_magic
+
+ cd $CWD
+ else
+ INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
+ INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories."
+ fi
+}
+
compile_OSL() {
# To be changed each time we make edits that would modify the compiled result!
- osl_magic=5
+ osl_magic=7
_src=$SRC/OpenShadingLanguage-$OSL_VERSION
_inst=$INST/osl-$OSL_VERSION
@@ -461,7 +617,7 @@ compile_OSL() {
cd $_src
# XXX For now, always update from latest repo...
- git checkout .
+ git pull origin
# Always refresh the whole build!
if [ -d build ]; then
@@ -476,7 +632,10 @@ compile_OSL() {
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
if [ -d $INST/boost ]; then
- cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
+ cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
+ if $ALL_STATIC; then
+ cmake_d="$cmake_d -D Boost_USE_STATIC_LIBS=ON"
+ fi
fi
if [ -d $INST/oiio ]; then
@@ -485,6 +644,10 @@ compile_OSL() {
if [ ! -z $LLVM_VERSION_FOUND ]; then
cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
+ if [ -d $INST/llvm ]; then
+ cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
+ cmake_d="$cmake_d -D LLVM_STATIC=ON"
+ fi
fi
cmake $cmake_d ../src
@@ -511,7 +674,7 @@ compile_OSL() {
compile_FFmpeg() {
# To be changed each time we make edits that would modify the compiled result!
- ffmpeg_magic=0
+ ffmpeg_magic=3
_src=$SRC/ffmpeg-$FFMPEG_VERSION
_inst=$INST/ffmpeg-$FFMPEG_VERSION
@@ -547,7 +710,8 @@ compile_FFmpeg() {
extra="$extra --enable-libtheora"
fi
- if $SCHRO_USE; then
+ # XXX At least under Debian, static schro gives problem at blender linking time... :/
+ if $SCHRO_USE && ! $ALL_STATIC; then
extra="$extra --enable-libschroedinger"
fi
@@ -571,8 +735,12 @@ compile_FFmpeg() {
extra="$extra --enable-libopenjpeg"
fi
- ./configure --cc="gcc -Wl,--as-needed" --extra-ldflags="-pthread -static-libgcc" \
- --prefix=$_inst --enable-static --enable-avfilter --disable-vdpau \
+ ./configure --cc="gcc -Wl,--as-needed" \
+ --extra-ldflags="-pthread -static-libgcc" \
+ --prefix=$_inst --enable-static \
+ --disable-ffplay --disable-ffserver --disable-doc \
+ --enable-gray \
+ --enable-avfilter --disable-vdpau \
--disable-bzlib --disable-libgsm --disable-libspeex \
--enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
--disable-vaapi --disable-libfaac --disable-nonfree --enable-gpl \
@@ -640,9 +808,7 @@ check_package_version_ge_DEB() {
install_DEB() {
INFO ""
INFO "Installing dependencies for DEB-based distribution"
- INFO "Source code of dependencies needed to be compiled will be downloaded and extracted into $SRC"
- INFO "Built libs of dependencies needed to be compiled will be installed into $INST"
- INFO "Please edit \$SRC and/or \$INST variables at the begining of this script if you want to use other paths!"
+ INFO "$COMMON_INFO"
INFO ""
sudo apt-get update
@@ -718,7 +884,7 @@ install_DEB() {
if [ $? -eq 0 ]; then
sudo apt-get install -y libboost-dev
- boost_version=`get_package_version_DEB libboost-dev`
+ boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
check_package_DEB libboost-locale$boost_version-dev
if [ $? -eq 0 ]; then
@@ -803,7 +969,7 @@ check_package_RPM() {
}
check_package_version_match_RPM() {
- v=`yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'`
+ v=`get_package_version_RPM $1`
if [ -z "$v" ]; then
return 1
@@ -814,7 +980,7 @@ check_package_version_match_RPM() {
}
check_package_version_ge_RPM() {
- v=`yum info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'`
+ v=`get_package_version_RPM $1`
if [ -z "$v" ]; then
return 1
@@ -827,9 +993,7 @@ check_package_version_ge_RPM() {
install_RPM() {
INFO ""
INFO "Installing dependencies for RPM-based distribution"
- INFO "Source code of dependencies needed to be compiled will be downloaded and extracted into $SRC"
- INFO "Built libs of dependencies needed to be compiled will be installed into $INST"
- INFO "Please edit \$SRC and/or \$INST variables at the begining of this script if you want to use other paths!"
+ INFO "$COMMON_INFO"
INFO ""
sudo yum -y update
@@ -917,19 +1081,25 @@ install_RPM() {
have_llvm=true
LLVM_VERSION_FOUND=$LLVM_VERSION
else
- check_package_RPM llvm-$LLVM_VERSION_MIN-devel
- if [ $? -eq 0 ]; then
- sudo yum install -y llvm-$LLVM_VERSION_MIN-devel
- have_llvm=true
- LLVM_VERSION_FOUND=$LLVM_VERSION_MIN
- else
- check_package_version_ge_RPM llvm-devel $LLVM_VERSION_MIN
- if [ $? -eq 0 ]; then
- sudo yum install -y llvm-devel
- have_llvm=true
- LLVM_VERSION_FOUND=`get_package_version_RPM llvm-devel`
- fi
- fi
+# check_package_RPM llvm-$LLVM_VERSION_MIN-devel
+# if [ $? -eq 0 ]; then
+# sudo yum install -y llvm-$LLVM_VERSION_MIN-devel
+# have_llvm=true
+# LLVM_VERSION_FOUND=$LLVM_VERSION_MIN
+# else
+# check_package_version_ge_RPM llvm-devel $LLVM_VERSION_MIN
+# if [ $? -eq 0 ]; then
+# sudo yum install -y llvm-devel
+# have_llvm=true
+# LLVM_VERSION_FOUND=`get_package_version_RPM llvm-devel`
+# fi
+# fi
+ sudo yum install -y libffi-devel
+ # XXX Stupid fedora puts ffi header into a darn stupid dir!
+ _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
+ compile_LLVM
+ have_llvm=true
+ LLVM_VERSION_FOUND=$LLVM_VERSION
fi
if $have_llvm; then
@@ -943,6 +1113,10 @@ install_RPM() {
compile_FFmpeg
}
+get_package_version_SUSE() {
+ zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'
+}
+
check_package_SUSE() {
r=`zypper info $1 | grep -c 'Summary'`
@@ -953,56 +1127,150 @@ check_package_SUSE() {
fi
}
-check_package_version_SUSE() {
- v=`zypper info $1 | grep Version | tail -n 1 | sed -r 's/.*:\s+(([0-9]+\.?)+).*/\1/'`
+check_package_version_match_SUSE() {
+ v=`get_package_version_SUSE $1`
- # for now major and minor versions only (as if x.y, not x.y.z)
- r=`echo $v | grep -c $2`
+ if [ -z "$v" ]; then
+ return 1
+ fi
- if [ $r -ge 1 ]; then
- return 0
- else
+ version_match $v $2
+ return $?
+}
+
+check_package_version_ge_SUSE() {
+ v=`get_package_version_SUSE $1`
+
+ if [ -z "$v" ]; then
return 1
fi
+
+ version_ge $v $2
+ return $?
}
install_SUSE() {
INFO ""
INFO "Installing dependencies for SuSE-based distribution"
- INFO "Source code of dependencies needed to be compiled will be downloaded and extracted into $SRC"
- INFO "Built libs of dependencies needed to be compiled will be installed into $INST"
- INFO "Please edit \$SRC and/or \$INST variables at the begining of this script if you want to use other paths!"
+ INFO "$COMMON_INFO"
INFO ""
sudo zypper --non-interactive update --auto-agree-with-licenses
+ # These libs should always be available in debian/ubuntu official repository...
+ OPENJPEG_DEV="openjpeg-devel"
+ SCHRO_DEV="schroedinger-devel"
+ VORBIS_DEV="libvorbis-devel"
+ THEORA_DEV="libtheora-devel"
+
sudo zypper --non-interactive install --auto-agree-with-licenses \
- gcc gcc-c++ libSDL-devel openal-soft-devel libpng12-devel libjpeg62-devel \
- libtiff-devel OpenEXR-devel yasm libtheora-devel libvorbis-devel cmake \
- scons patch
+ gawk gcc gcc-c++ cmake scons libpng12-devel libtiff-devel \
+ freetype-devel libX11-devel libXi-devel wget sqlite3-devel ncurses-devel \
+ readline-devel $OPENJPEG_DEV libopenexr-devel openal-soft-devel \
+ glew-devel yasm $SCHRO_DEV $THEORA_DEV $VORBIS_DEV libSDL-devel \
+ fftw3-devel libjack-devel libspnav-devel \
+ libjpeg62-devel patch python-devel
+
+ OPENJPEG_USE=true
+ SCHRO_USE=true
+ VORBIS_USE=true
+ THEORA_USE=true
+
+ X264_DEV="x264-devel"
+ check_package_version_ge_SUSE $X264_DEV $X264_VERSION_MIN
+ if [ $? -eq 0 ]; then
+ sudo zypper --non-interactive install --auto-agree-with-licenses $X264_DEV
+ X264_USE=true
+ fi
+
+ XVID_DEV="xvidcore-devel"
+ check_package_SUSE $XVID_DEV
+ if [ $? -eq 0 ]; then
+ sudo zypper --non-interactive install --auto-agree-with-licenses $XVID_DEV
+ XVID_USE=true
+ fi
+
+ VPX_DEV="libvpx-devel"
+ check_package_version_ge_SUSE $VPX_DEV $VPX_VERSION_MIN
+ if [ $? -eq 0 ]; then
+ sudo zypper --non-interactive install --auto-agree-with-licenses $VPX_DEV
+ VPX_USE=true
+ fi
- check_package_version_SUSE python3-devel 3.3.
+ # No mp3 in suse, it seems.
+ MP3LAME_DEV="lame-devel"
+ check_package_SUSE $MP3LAME_DEV
+ if [ $? -eq 0 ]; then
+ sudo zypper --non-interactive install --auto-agree-with-licenses $MP3LAME_DEV
+ MP3LAME_USE=true
+ fi
+
+ check_package_version_match_SUSE python3-devel 3.3.
if [ $? -eq 0 ]; then
sudo zypper --non-interactive install --auto-agree-with-licenses python3-devel
else
compile_Python
fi
- # can not see boost_locale in repo, so let's build own boost
+ # No boost_locale currently available, so let's build own boost.
compile_Boost
- # this libraries are also missing in the repo
+ # No ocio currently available, so let's build own boost.
compile_OCIO
+
+ # No oiio currently available, so let's build own boost.
compile_OIIO
+
+ if $BUILD_OSL; then
+ have_llvm=false
+
+ # Suse llvm package *_$SUCKS$_* (tm) !!!
+# check_package_version_ge_SUSE llvm-devel $LLVM_VERSION_MIN
+# if [ $? -eq 0 ]; then
+# sudo zypper --non-interactive install --auto-agree-with-licenses llvm-devel
+# have_llvm=true
+# LLVM_VERSION_FOUND=`get_package_version_SUSE llvm-devel`
+# fi
+
+ sudo zypper --non-interactive install --auto-agree-with-licenses libffi47-devel
+ compile_LLVM
+ have_llvm=true
+ LLVM_VERSION_FOUND=$LLVM_VERSION
+
+ if $have_llvm; then
+ # XXX No tbb lib!
+ sudo zypper --non-interactive install --auto-agree-with-licenses flex bison git
+ # No package currently!
+ compile_OSL
+ fi
+ fi
+
+ # No ffmpeg currently available, so let's build own boost.
compile_FFmpeg
}
print_info_ffmpeglink_DEB() {
- dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
+ if $ALL_STATIC; then
+ dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
+ else
+ dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
+ fi
}
print_info_ffmpeglink_RPM() {
- rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
+ if $ALL_STATIC; then
+ rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
+ else
+ rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
+ fi
+}
+
+print_info_ffmpeglink_SUSE() {
+ if $ALL_STATIC; then
+ rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.a" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", $0); nlines++ }'
+ else
+ rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
+ fi
}
print_info_ffmpeglink() {
@@ -1043,7 +1311,8 @@ print_info_ffmpeglink() {
_packages="$_packages $OPENJPEG_DEV"
fi
- if $SCHRO_USE; then
+ # XXX At least under Debian, static schro give problem at blender linking time... :/
+ if $SCHRO_USE && ! $ALL_STATIC; then
_packages="$_packages $SCHRO_DEV"
fi
@@ -1051,10 +1320,10 @@ print_info_ffmpeglink() {
print_info_ffmpeglink_DEB
elif [ "$DISTRO" = "RPM" ]; then
print_info_ffmpeglink_RPM
+ elif [ "$DISTRO" = "SUSE" ]; then
+ print_info_ffmpeglink_SUSE
# XXX TODO!
else INFO "<Could not determine additional link libraries needed for ffmpeg, replace this by valid list of libs...>"
-# elif [ "$DISTRO" = "SUSE" ]; then
-# print_info_ffmpeglink_SUSE
fi
}
@@ -1062,15 +1331,25 @@ print_info() {
INFO ""
INFO "If you're using CMake add this to your configuration flags:"
+ if $ALL_STATIC; then
+ INFO " -D WITH_STATIC_LIBS=ON"
+ fi
+
if [ -d $INST/boost ]; then
INFO " -D BOOST_ROOT=$INST/boost"
INFO " -D Boost_NO_SYSTEM_PATHS=ON"
+ elif $ALL_STATIC; then
+ INFO " -D Boost_USE_ICU=ON"
fi
if [ -d $INST/osl ]; then
INFO " -D CYCLES_OSL=$INST/osl"
INFO " -D WITH_CYCLES_OSL=ON"
INFO " -D LLVM_VERSION=$LLVM_VERSION_FOUND"
+ if [ -d $INST/llvm ]; then
+ INFO " -D LLVM_DIRECTORY=$INST/llvm"
+ INFO " -D LLVM_STATIC=ON"
+ fi
fi
if [ -d $INST/ffmpeg ]; then
diff --git a/build_files/buildbot/config/user-config-glibc211-i686.py b/build_files/buildbot/config/user-config-glibc211-i686.py
index 2b1af356773..e5afa2afe13 100644
--- a/build_files/buildbot/config/user-config-glibc211-i686.py
+++ b/build_files/buildbot/config/user-config-glibc211-i686.py
@@ -162,4 +162,4 @@ WITH_BF_OCEANSIM = True
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-lrt']
-BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive']
+BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
diff --git a/build_files/buildbot/config/user-config-glibc211-x86_64.py b/build_files/buildbot/config/user-config-glibc211-x86_64.py
index dbae44af66f..dc901d25a92 100644
--- a/build_files/buildbot/config/user-config-glibc211-x86_64.py
+++ b/build_files/buildbot/config/user-config-glibc211-x86_64.py
@@ -161,4 +161,4 @@ WITH_BF_OCEANSIM = True
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-lrt']
-BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive']
+BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
diff --git a/build_files/buildbot/config/user-config-glibc27-i686.py b/build_files/buildbot/config/user-config-glibc27-i686.py
index c8e144e8a7f..dd3a63d0fd7 100644
--- a/build_files/buildbot/config/user-config-glibc27-i686.py
+++ b/build_files/buildbot/config/user-config-glibc27-i686.py
@@ -147,4 +147,4 @@ WITH_BF_OCEANSIM = True
BF_DEBUG = False
REL_CCFLAGS = ['-O2'] # C & C++
PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32']
-BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive']
+BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
diff --git a/build_files/buildbot/config/user-config-glibc27-x86_64.py b/build_files/buildbot/config/user-config-glibc27-x86_64.py
index 9541908d4ed..d9e50d258bc 100644
--- a/build_files/buildbot/config/user-config-glibc27-x86_64.py
+++ b/build_files/buildbot/config/user-config-glibc27-x86_64.py
@@ -146,4 +146,4 @@ WITH_BF_OCEANSIM = True
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64']
-BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive']
+BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']
diff --git a/build_files/cmake/Modules/FindIcuLinux.cmake b/build_files/cmake/Modules/FindIcuLinux.cmake
new file mode 100644
index 00000000000..e0e5873a4eb
--- /dev/null
+++ b/build_files/cmake/Modules/FindIcuLinux.cmake
@@ -0,0 +1,146 @@
+# - Find static icu libraries
+# Find the native static icu libraries (needed for static boost_locale :/ ).
+# This module defines
+# ICU_LIBRARIES, libraries to link against to use icu.
+# ICU_ROOT_DIR, The base directory to search for icu.
+# This can also be an environment variable.
+# ICU_FOUND, If false, do not try to use icu.
+#
+# also defined, but not for general use are
+# ICU_LIBRARY_xxx, where to find the icu libraries.
+
+#=============================================================================
+# Copyright 2012 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If ICU_ROOT_DIR was defined in the environment, use it.
+IF(NOT ICU_ROOT_DIR AND NOT $ENV{ICU_ROOT_DIR} STREQUAL "")
+ SET(ICU_ROOT_DIR $ENV{ICU_ROOT_DIR})
+ENDIF()
+
+if(Boost_USE_STATIC_LIBS)
+ set(_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
+endif()
+
+SET(_icu_SEARCH_DIRS
+ ${ICU_ROOT_DIR}
+ /usr/local
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+)
+
+# We don't need includes, only libs to link against...
+#FIND_PATH(ICU_INCLUDE_DIR
+# NAMES
+# utf.h
+# HINTS
+# ${_icu_SEARCH_DIRS}
+# PATH_SUFFIXES
+# include/unicode
+#)
+
+FIND_LIBRARY(ICU_LIBRARY_DATA
+ NAMES
+ icudata
+ HINTS
+ ${_icu_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ )
+
+FIND_LIBRARY(ICU_LIBRARY_I18N
+ NAMES
+ icui18n
+ HINTS
+ ${_icu_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ )
+
+FIND_LIBRARY(ICU_LIBRARY_IO
+ NAMES
+ icuio
+ HINTS
+ ${_icu_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ )
+
+FIND_LIBRARY(ICU_LIBRARY_LE
+ NAMES
+ icule
+ HINTS
+ ${_icu_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ )
+
+FIND_LIBRARY(ICU_LIBRARY_LX
+ NAMES
+ iculx
+ HINTS
+ ${_icu_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ )
+
+FIND_LIBRARY(ICU_LIBRARY_TU
+ NAMES
+ icutu
+ HINTS
+ ${_icu_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ )
+
+FIND_LIBRARY(ICU_LIBRARY_UC
+ NAMES
+ icuuc
+ HINTS
+ ${_icu_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ )
+
+# Restore the original find library ordering
+if(Boost_USE_STATIC_LIBS)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set ICU_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Icu DEFAULT_MSG
+ ICU_LIBRARY_DATA
+ ICU_LIBRARY_I18N
+ ICU_LIBRARY_IO
+ ICU_LIBRARY_LE
+ ICU_LIBRARY_LX
+ ICU_LIBRARY_TU
+ ICU_LIBRARY_UC
+)
+
+IF(ICU_FOUND)
+ SET(ICU_LIBRARIES ${ICU_LIBRARY_DATA} ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_IO} ${ICU_LIBRARY_LE} ${ICU_LIBRARY_LX} ${ICU_LIBRARY_TU} ${ICU_LIBRARY_UC})
+ SET(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
+ENDIF(ICU_FOUND)
+
+MARK_AS_ADVANCED(
+ ICU_INCLUDE_DIR
+ ICU_LIBRARY_DATA
+ ICU_LIBRARY_I18N
+ ICU_LIBRARY_IO
+ ICU_LIBRARY_LE
+ ICU_LIBRARY_LX
+ ICU_LIBRARY_TU
+ ICU_LIBRARY_UC
+)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 4f1d34f993c..efa258aa9dc 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -312,6 +312,9 @@ macro(setup_liblinks
endif()
if(WITH_BOOST)
target_link_libraries(${target} ${BOOST_LIBRARIES})
+ if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
+ target_link_libraries(${target} ${ICU_LIBRARIES})
+ endif()
endif()
target_link_libraries(${target} ${JPEG_LIBRARIES})
if(WITH_IMAGE_OPENEXR)
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py
index 3c051dbe242..252a1b1b37e 100644
--- a/build_files/scons/config/darwin-config.py
+++ b/build_files/scons/config/darwin-config.py
@@ -118,16 +118,16 @@ 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.2'
+BF_PYTHON_VERSION = '3.3'
WITH_OSX_STATICPYTHON = True
if WITH_OSX_STATICPYTHON:
- # python 3.2 uses precompiled libraries in bf svn /lib by default
+ # 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}'
+ 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}'
+ 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:
@@ -309,7 +309,7 @@ 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'
+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'
diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py
index 0ffd9ca9cc6..038a9bc421d 100644
--- a/build_files/scons/config/linux-config.py
+++ b/build_files/scons/config/linux-config.py
@@ -298,3 +298,7 @@ BF_INSTALLDIR='../install/linux'
#Link against pthread
PLATFORM_LINKFLAGS = ['-pthread']
+#Fix for LLVM conflict with Mesa llvmpipe
+if WITH_BF_LLVM:
+ PLATFORM_LINKFLAGS += ['-Wl,--version-script=source/creator/blender.map']
+
diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py
index 39031ef27ca..2120938ec71 100644
--- a/build_files/scons/config/win32-vc-config.py
+++ b/build_files/scons/config/win32-vc-config.py
@@ -54,7 +54,7 @@ BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr'
-BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
+BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
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'
@@ -150,28 +150,34 @@ WITH_BF_OPENMP = True
#Cycles
WITH_BF_CYCLES = True
-#OSL
-WITH_BF_CYCLES_OSL = False
+WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = True
-BF_OSL = LIBDIR + '/osl'
+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 oslexec oslquery'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
+BF_OSL_LIB_STATIC = '${BF_OSL_LIBPATH}/oslcomp.lib ${BF_OSL_LIBPATH}/oslexec.lib ${BF_OSL_LIBPATH}/oslquery.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'
+BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/OpenImageIO.lib'
+WITH_BF_STATICOIIO = True
WITH_BF_OCIO = True
BF_OCIO = '${LIBDIR}/opencolorio'
BF_OCIO_INC = '${BF_OCIO}/include'
-BF_OCIO_LIB = 'OpenColorIO'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/OpenColorIO.lib'
+WITH_BF_STATICOCIO = True
WITH_BF_BOOST = True
BF_BOOST = '${LIBDIR}/boost'
diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py
index b4e06655c7e..fdfd792f180 100644
--- a/build_files/scons/config/win64-mingw-config.py
+++ b/build_files/scons/config/win64-mingw-config.py
@@ -113,7 +113,7 @@ BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = False
-WITH_BF_ICONV = True
+WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py
index 2434cb0c63a..15bcdf999bd 100644
--- a/build_files/scons/config/win64-vc-config.py
+++ b/build_files/scons/config/win64-vc-config.py
@@ -50,7 +50,7 @@ BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr'
-BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
+BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
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'
@@ -146,28 +146,34 @@ WITH_BF_OPENMP = True
#Cycles
WITH_BF_CYCLES = True
-#OSL
-WITH_BF_CYCLES_OSL = False
+WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = True
-BF_OSL = LIBDIR + '/osl'
+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 oslexec oslquery'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
+BF_OSL_LIB_STATIC = '${BF_OSL_LIBPATH}/oslcomp.lib ${BF_OSL_LIBPATH}/oslexec.lib ${BF_OSL_LIBPATH}/oslquery.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'
+BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/OpenImageIO.lib'
+WITH_BF_STATICOIIO = True
WITH_BF_OCIO = True
BF_OCIO = '${LIBDIR}/opencolorio'
BF_OCIO_INC = '${BF_OCIO}/include'
-BF_OCIO_LIB = 'OpenColorIO'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/OpenColorIO.lib'
+WITH_BF_STATICOCIO = True
WITH_BF_BOOST = True
BF_BOOST = '${LIBDIR}/boost'
diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst
index 260a86f7c59..acf28706709 100644
--- a/doc/python_api/rst/bge.logic.rst
+++ b/doc/python_api/rst/bge.logic.rst
@@ -254,13 +254,6 @@ General functions
:rtype: list [float], len(getSpectrum()) == 512
-.. function:: stopDSP()
-
- Stops the sound driver using DSP effects.
-
- Only the fmod sound driver supports this.
- DSP can be computationally expensive.
-
.. function:: getMaxLogicFrame()
Gets the maximum number of logic frames per render frame.
@@ -331,6 +324,24 @@ General functions
.. warning: Not implimented yet
+.. function:: getExitKey()
+
+ Gets the key used to exit the game engine
+
+ :return: The key (defaults to :mod:`bge.events.ESCKEY`)
+ :rtype: int
+
+.. function:: setExitKey(key)
+
+ Sets the key used to exit the game engine
+
+ :arg key: A key constant from :mod:`bge.events`
+ :type key: int
+
+.. function:: NextFrame()
+
+ Render next frame (if Python has control)
+
*****************
Utility functions
*****************
@@ -373,6 +384,10 @@ Utility functions
.. function:: PrintGLInfo()
Prints GL Extension Info into the console
+
+.. function:: PrintMemInfo()
+
+ Prints engine statistics into the console
*********
Constants
@@ -401,6 +416,45 @@ Sensor Status
.. data:: KX_SENSOR_ACTIVE
.. data:: KX_SENSOR_JUST_DEACTIVATED
+-------------
+Armature Sensor
+-------------
+
+.. _armaturesensor-type:
+
+See :class:`bge.types.KX_ArmatureSensor.type`
+
+.. data:: KX_ARMSENSOR_STATE_CHANGED
+
+ Detect that the constraint is changing state (active/inactive)
+
+ :value: 0
+
+.. data:: KX_ARMSENSOR_LIN_ERROR_BELOW
+
+ Detect that the constraint linear error is above a threshold
+
+ :value: 1
+
+.. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE
+
+ Detect that the constraint linear error is below a threshold
+
+ :value: 2
+
+.. data:: KX_ARMSENSOR_ROT_ERROR_BELOW
+
+ Detect that the constraint rotation error is above a threshold
+
+ :value: 3
+
+.. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE
+
+ Detect that the constraint rotation error is below a threshold
+
+ :value: 4
+
+
.. _logic-property-sensor:
---------------
@@ -483,6 +537,52 @@ See :class:`bge.types.BL_ActionActuator`
.. data:: KX_ACTIONACT_LOOPEND
.. data:: KX_ACTIONACT_PROPERTY
+---------------
+Armature Actuator
+---------------
+
+ .. _armatureactuator-constants-type:
+
+See :class:`bge.types.BL_ArmatureActuator.type`
+
+.. data:: KX_ACT_ARMATURE_RUN
+
+ Just make sure the armature will be updated on the next graphic frame.
+ This is the only persistent mode of the actuator:
+ it executes automatically once per frame until stopped by a controller
+
+ :value: 0
+
+.. data:: KX_ACT_ARMATURE_ENABLE
+
+ Enable the constraint.
+
+ :value: 1
+
+.. data:: KX_ACT_ARMATURE_DISABLE
+
+ Disable the constraint (runtime constraint values are not updated).
+
+ :value: 2
+
+.. data:: KX_ACT_ARMATURE_SETTARGET
+
+ Change target and subtarget of constraint.
+
+ :value: 3
+
+.. data:: KX_ACT_ARMATURE_SETWEIGHT
+
+ Change weight of constraint (IK only).
+
+ :value: 4
+
+.. data:: KX_ACT_ARMATURE_SETINFLUENCE
+
+ Change influence of constraint.
+
+ :value: 5
+
-------------------
Constraint Actuator
-------------------
@@ -493,31 +593,31 @@ See :class:`bge.types.KX_ConstraintActuator.option`
* Applicable to Distance constraint:
- .. data:: KX_ACT_CONSTRAINT_NORMAL
+.. data:: KX_CONSTRAINTACT_NORMAL
Activate alignment to surface
- .. data:: KX_ACT_CONSTRAINT_DISTANCE
+.. data:: KX_CONSTRAINTACT_DISTANCE
Activate distance control
- .. data:: KX_ACT_CONSTRAINT_LOCAL
+.. data:: KX_CONSTRAINTACT_LOCAL
Direction of the ray is along the local axis
* Applicable to Force field constraint:
- .. data:: KX_ACT_CONSTRAINT_DOROTFH
+.. data:: KX_CONSTRAINTACT_DOROTFH
Force field act on rotation as well
* Applicable to both:
- .. data:: KX_ACT_CONSTRAINT_MATERIAL
+.. data:: KX_CONSTRAINTACT_MATERIAL
Detect material rather than property
- .. data:: KX_ACT_CONSTRAINT_PERMANENT
+.. data:: KX_CONSTRAINTACT_PERMANENT
No deactivation if ray does not hit target
@@ -585,27 +685,27 @@ See :class:`bge.types.KX_ConstraintActuator.limit`
Set orientation of Z axis
-.. data:: KX_ACT_CONSTRAINT_FHNX
+.. data:: KX_CONSTRAINTACT_FHNX
Set force field along negative X axis
-.. data:: KX_ACT_CONSTRAINT_FHNY
+.. data:: KX_CONSTRAINTACT_FHNY
Set force field along negative Y axis
-.. data:: KX_ACT_CONSTRAINT_FHNZ
+.. data:: KX_CONSTRAINTACT_FHNZ
Set force field along negative Z axis
-.. data:: KX_ACT_CONSTRAINT_FHPX
+.. data:: KX_CONSTRAINTACT_FHPX
Set force field along positive X axis
-.. data:: KX_ACT_CONSTRAINT_FHPY
+.. data:: KX_CONSTRAINTACT_FHPY
Set force field along positive Y axis
-.. data:: KX_ACT_CONSTRAINT_FHPZ
+.. data:: KX_CONSTRAINTACT_FHPZ
Set force field along positive Z axis
@@ -708,101 +808,31 @@ See :class:`bge.types.KX_SoundActuator`
.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
:value: 6
-
-
-=======
-Various
-=======
-
-.. _input-status:
-
-------------
-Input Status
-------------
-
-See :class:`bge.types.SCA_PythonKeyboard`, :class:`bge.types.SCA_PythonMouse`, :class:`bge.types.SCA_MouseSensor`, :class:`bge.types.SCA_KeyboardSensor`
-
-.. data:: KX_INPUT_NONE
-.. data:: KX_INPUT_JUST_ACTIVATED
-.. data:: KX_INPUT_ACTIVE
-.. data:: KX_INPUT_JUST_RELEASED
-
--------------
-Mouse Buttons
--------------
-
-See :class:`bge.types.SCA_MouseSensor`
-.. data:: KX_MOUSE_BUT_LEFT
-.. data:: KX_MOUSE_BUT_MIDDLE
-.. data:: KX_MOUSE_BUT_RIGHT
-
-------
-States
-------
+--------------
+Steering Actuator
+--------------
-See :class:`bge.types.KX_StateActuator`
+.. _logic-steering-actuator:
-.. data:: KX_STATE1
-.. data:: KX_STATE2
-.. data:: KX_STATE3
-.. data:: KX_STATE4
-.. data:: KX_STATE5
-.. data:: KX_STATE6
-.. data:: KX_STATE7
-.. data:: KX_STATE8
-.. data:: KX_STATE9
-.. data:: KX_STATE10
-.. data:: KX_STATE11
-.. data:: KX_STATE12
-.. data:: KX_STATE13
-.. data:: KX_STATE14
-.. data:: KX_STATE15
-.. data:: KX_STATE16
-.. data:: KX_STATE17
-.. data:: KX_STATE18
-.. data:: KX_STATE19
-.. data:: KX_STATE20
-.. data:: KX_STATE21
-.. data:: KX_STATE22
-.. data:: KX_STATE23
-.. data:: KX_STATE24
-.. data:: KX_STATE25
-.. data:: KX_STATE26
-.. data:: KX_STATE27
-.. data:: KX_STATE28
-.. data:: KX_STATE29
-.. data:: KX_STATE30
+See :class:`bge.types.KX_SteeringActuator.behavior`
-.. _state-actuator-operation:
+.. data:: KX_STEERING_SEEK
-See :class:`bge.types.KX_StateActuator.operation`
+ :value: 1
-.. data:: KX_STATE_OP_CLR
+.. data:: KX_STEERING_FLEE
- Substract bits to state mask
-
- :value: 0
+ :value: 2
-.. data:: KX_STATE_OP_CPY
+.. data:: KX_STEERING_PATHFOLLOWING
- Copy state mask
-
- :value: 1
-
-.. data:: KX_STATE_OP_NEG
+ :value: 3
- Invert bits to state mask
-
- :value: 2
-
-.. data:: KX_STATE_OP_SET
- Add bits to state mask
-
- :value: 3
-
-.. _Two-D-FilterActuator-mode:
+=======
+Various
+=======
---------
2D Filter
@@ -877,6 +907,227 @@ See :class:`bge.types.KX_StateActuator.operation`
.. data:: RAS_2DFILTER_SOBEL
:value: 7
+
+----------------
+Armature Channel
+----------------
+.. _armaturechannel-constants-rotation-mode:
+
+See :class:`bge.types.BL_ArmatureChannel.rotation_mode`
+
+.. note:
+ euler mode are named as in Blender UI but the actual axis order is reversed
+
+.. data:: ROT_MODE_QUAT
+
+ Use quaternion in rotation attribute to update bone rotation.
+
+ :value: 0
+
+.. data:: ROT_MODE_XYZ
+
+ Use euler_rotation and apply angles on bone's Z, Y, X axis successively.
+
+ :value: 1
+
+.. data:: ROT_MODE_XZY
+
+ Use euler_rotation and apply angles on bone's Y, Z, X axis successively.
+
+ :value: 2
+
+.. data:: ROT_MODE_YXZ
+
+ Use euler_rotation and apply angles on bone's Z, X, Y axis successively.
+
+ :value: 3
+
+.. data:: ROT_MODE_YZX
+
+ Use euler_rotation and apply angles on bone's X, Z, Y axis successively.
+
+ :value: 4
+
+.. data:: ROT_MODE_ZXY
+
+ Use euler_rotation and apply angles on bone's Y, X, Z axis successively.
+
+ :value: 5
+
+.. data:: ROT_MODE_ZYX
+
+ Use euler_rotation and apply angles on bone's X, Y, Z axis successively.
+
+ :value: 6
+
+
+----------------
+Armature Constraint
+----------------
+.. _armatureconstraint-constants-type:
+
+See :class:`bge.types.BL_ArmatureConstraint.type`
+
+.. data:: CONSTRAINT_TYPE_TRACKTO
+.. data:: CONSTRAINT_TYPE_KINEMATIC
+.. data:: CONSTRAINT_TYPE_ROTLIKE
+.. data:: CONSTRAINT_TYPE_LOCLIKE
+.. data:: CONSTRAINT_TYPE_MINMAX
+.. data:: CONSTRAINT_TYPE_SIZELIKE
+.. data:: CONSTRAINT_TYPE_LOCKTRACK
+.. data:: CONSTRAINT_TYPE_STRETCHTO
+.. data:: CONSTRAINT_TYPE_CLAMPTO
+.. data:: CONSTRAINT_TYPE_TRANSFORM
+.. data:: CONSTRAINT_TYPE_DISTLIMIT
+
+.. _armatureconstraint-constants-ik-type:
+
+See :class:`bge.types.BL_ArmatureConstraint.ik_type`
+
+.. data:: CONSTRAINT_IK_COPYPOSE
+
+ constraint is trying to match the position and eventually the rotation of the target.
+
+ :value: 0
+
+.. data:: CONSTRAINT_IK_DISTANCE
+
+ Constraint is maintaining a certain distance to target subject to ik_mode
+
+ :value: 1
+
+.. _armatureconstraint-constants-ik-flag:
+
+See :class:`bge.types.BL_ArmatureConstraint.ik_flag`
+
+.. data:: CONSTRAINT_IK_FLAG_TIP
+
+ Set when the constraint operates on the head of the bone and not the tail
+
+ :value: 1
+
+.. data:: CONSTRAINT_IK_FLAG_ROT
+
+ Set when the constraint tries to match the orientation of the target
+
+ :value: 2
+
+.. data:: CONSTRAINT_IK_FLAG_STRETCH
+
+ Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
+
+ :value: 16
+
+.. data:: CONSTRAINT_IK_FLAG_POS
+
+ Set when the constraint tries to match the position of the target.
+
+ :value: 32
+
+.. _armatureconstraint-constants-ik-mode:
+
+See :class:`bge.types.BL_ArmatureConstraint.ik_mode`
+
+.. data:: CONSTRAINT_IK_MODE_INSIDE
+
+ The constraint tries to keep the bone within ik_dist of target
+
+ :value: 0
+
+.. data:: CONSTRAINT_IK_MODE_OUTSIDE
+
+ The constraint tries to keep the bone outside ik_dist of the target
+
+ :value: 1
+
+.. data:: CONSTRAINT_IK_MODE_ONSURFACE
+
+ The constraint tries to keep the bone exactly at ik_dist of the target.
+
+ :value: 2
+
+.. _input-status:
+
+----------------
+Blender Material
+----------------
+
+.. data:: BL_DST_ALPHA
+.. data:: BL_DST_COLOR
+.. data:: BL_ONE
+.. data:: BL_ONE_MINUS_DST_ALPHA
+.. data:: BL_ONE_MINUS_DST_COLOR
+.. data:: BL_ONE_MINUS_SRC_ALPHA
+.. data:: BL_ONE_MINUS_SRC_COLOR
+.. data:: BL_SRC_ALPHA
+.. data:: BL_SRC_ALPHA_SATURATE
+.. data:: BL_SRC_COLOR
+.. data:: BL_ZERO
+
+------------
+Input Status
+------------
+
+See :class:`bge.types.SCA_PythonKeyboard`, :class:`bge.types.SCA_PythonMouse`, :class:`bge.types.SCA_MouseSensor`, :class:`bge.types.SCA_KeyboardSensor`
+
+.. data:: KX_INPUT_NONE
+.. data:: KX_INPUT_JUST_ACTIVATED
+.. data:: KX_INPUT_ACTIVE
+.. data:: KX_INPUT_JUST_RELEASED
+
+------------
+KX_GameObject
+-----------
+.. _gameobject-playaction-mode:
+
+See :class:`bge.types.KX_GameObject.playAction`
+
+.. data:: KX_ACTION_MODE_PLAY
+
+ Play the action once.
+
+ :value: 0
+
+.. data:: KX_ACTION_MODE_LOOP
+
+ Loop the action (repeat it).
+
+ :value: 1
+
+.. data:: KX_ACTION_MODE_PING_PONG
+
+ Play the action one direct then back the other way when it has completed.
+
+ :value: 2
+
+
+-------------
+Mouse Buttons
+-------------
+
+See :class:`bge.types.SCA_MouseSensor`
+
+.. data:: KX_MOUSE_BUT_LEFT
+.. data:: KX_MOUSE_BUT_MIDDLE
+.. data:: KX_MOUSE_BUT_RIGHT
+
+------------
+Navigation Mesh Draw Modes
+------------
+
+.. _navmesh-draw-mode:
+
+.. data:: RM_WALLS
+
+ Draw only the walls.
+
+.. data:: RM_POLYS
+
+ Draw only polygons.
+
+.. data:: RM_TRIS
+
+ Draw triangle mesh.
------
Shader
@@ -904,18 +1155,69 @@ Shader
.. data:: SHD_TANGENT
-----------------
-Blender Material
-----------------
+------
+States
+------
-.. data:: BL_DST_ALPHA
-.. data:: BL_DST_COLOR
-.. data:: BL_ONE
-.. data:: BL_ONE_MINUS_DST_ALPHA
-.. data:: BL_ONE_MINUS_DST_COLOR
-.. data:: BL_ONE_MINUS_SRC_ALPHA
-.. data:: BL_ONE_MINUS_SRC_COLOR
-.. data:: BL_SRC_ALPHA
-.. data:: BL_SRC_ALPHA_SATURATE
-.. data:: BL_SRC_COLOR
-.. data:: BL_ZERO
+See :class:`bge.types.KX_StateActuator`
+
+.. data:: KX_STATE1
+.. data:: KX_STATE2
+.. data:: KX_STATE3
+.. data:: KX_STATE4
+.. data:: KX_STATE5
+.. data:: KX_STATE6
+.. data:: KX_STATE7
+.. data:: KX_STATE8
+.. data:: KX_STATE9
+.. data:: KX_STATE10
+.. data:: KX_STATE11
+.. data:: KX_STATE12
+.. data:: KX_STATE13
+.. data:: KX_STATE14
+.. data:: KX_STATE15
+.. data:: KX_STATE16
+.. data:: KX_STATE17
+.. data:: KX_STATE18
+.. data:: KX_STATE19
+.. data:: KX_STATE20
+.. data:: KX_STATE21
+.. data:: KX_STATE22
+.. data:: KX_STATE23
+.. data:: KX_STATE24
+.. data:: KX_STATE25
+.. data:: KX_STATE26
+.. data:: KX_STATE27
+.. data:: KX_STATE28
+.. data:: KX_STATE29
+.. data:: KX_STATE30
+
+.. _state-actuator-operation:
+
+See :class:`bge.types.KX_StateActuator.operation`
+
+.. data:: KX_STATE_OP_CLR
+
+ Substract bits to state mask
+
+ :value: 0
+
+.. data:: KX_STATE_OP_CPY
+
+ Copy state mask
+
+ :value: 1
+
+.. data:: KX_STATE_OP_NEG
+
+ Invert bits to state mask
+
+ :value: 2
+
+.. data:: KX_STATE_OP_SET
+
+ Add bits to state mask
+
+ :value: 3
+
+.. _Two-D-FilterActuator-mode:
diff --git a/doc/python_api/rst/bge.types.rst b/doc/python_api/rst/bge.types.rst
index 15d188e0734..f7a63b48f61 100644
--- a/doc/python_api/rst/bge.types.rst
+++ b/doc/python_api/rst/bge.types.rst
@@ -205,6 +205,18 @@ Types
:type: boolean
+ .. attribute:: pos_ticks
+
+ The number of ticks since the last positive pulse (read-only).
+
+ :type: int
+
+ .. attribute:: neg_ticks
+
+ The number of ticks since the last negative pulse (read-only).
+
+ :type: int
+
.. attribute:: status
The status of the sensor (read-only): can be one of :ref:`these constants<sensor-status>`.
@@ -621,6 +633,71 @@ Types
:type: string
+
+.. class:: KX_SteeringActuator(SCA_IActuator)
+
+ Steering Actuator for navigation.
+
+ .. attribute:: behavior
+
+ The steering behavior to use.
+
+ :type: one of :ref:`these constants <logic-steering-actuator>`
+
+ .. attribute:: velocity
+
+ Velocity magnitude
+
+ :type: float
+
+ .. attribute:: acceleration
+
+ Max acceleration
+
+ :type: float
+
+ .. attribute:: turnspeed
+
+ Max turn speed
+
+ :type: float
+
+ .. attribute:: distance
+
+ Relax distance
+
+ :type: float
+
+ .. attribute:: target
+
+ Target object
+
+ :type: :class:`KX_GameObject`
+
+ .. attribute:: navmesh
+
+ Navigation mesh
+
+ :type: :class:`KX_GameObject`
+
+ .. attribute:: selfterminated
+
+ Terminate when target is reached
+
+ :type: boolean
+
+ .. attribute:: enableVisualization
+
+ Enable debug visualization
+
+ :type: boolean
+
+ .. attribute:: pathUpdatePeriod
+
+ Path update period
+
+ :type: int
+
.. class:: CListValue(CPropValue)
This is a list like object used in the game engine internally that behaves similar to a python list in most ways.
@@ -686,6 +763,24 @@ Types
KX_BlenderMaterial
+ .. attribute:: shader
+
+ The materials shader.
+
+ :type: :class:`BL_Shader`
+
+ .. attribute:: blending
+
+ Ints used for pixel blending, (src, dst), matching the setBlending method.
+
+ :type: (integer, integer)
+
+ .. attribute:: material_index
+
+ The material's index.
+
+ :type: integer
+
.. method:: getShader()
Returns the material's shader.
@@ -743,7 +838,13 @@ Types
strength of of the camera following movement.
:type: float
-
+
+ .. attribute:: axis
+
+ The camera axis (0, 1, 2) for positive ``XYZ``, (3, 4, 5) for negative ``XYZ``.
+
+ :type: int
+
.. attribute:: min
minimum distance to the target object maintained by the actuator.
@@ -762,12 +863,6 @@ Types
:type: float
- .. attribute:: useXY
-
- axis this actuator is tracking, True=X, False=Y.
-
- :type: boolean
-
.. attribute:: object
the object this actuator tracks.
@@ -988,7 +1083,7 @@ Types
The object's parent object. (read-only).
:type: :class:`KX_GameObject` or None
-
+
.. attribute:: groupMembers
Returns the list of group members if the object is a group object, otherwise None is returned.
@@ -1100,30 +1195,30 @@ Types
The object's world space transform matrix. 4x4 Matrix.
:type: :class:`mathutils.Matrix`
-
+
.. attribute:: localLinearVelocity
- The object's local linear velocity. [x, y, z]
-
- :type: :class:`mathutils.Vector`
-
+ The object's local linear velocity. [x, y, z]
+
+ :type: :class:`mathutils.Vector`
+
.. attribute:: worldLinearVelocity
The object's world linear velocity. [x, y, z]
-
- :type: :class:`mathutils.Vector`
-
+
+ :type: :class:`mathutils.Vector`
+
.. attribute:: localAngularVelocity
The object's local angular velocity. [x, y, z]
-
- :type: :class:`mathutils.Vector`
-
+
+ :type: :class:`mathutils.Vector`
+
.. attribute:: worldAngularVelocity
The object's world angular velocity. [x, y, z]
-
- :type: :class:`mathutils.Vector`
+
+ :type: :class:`mathutils.Vector`
.. attribute:: timeOffset
@@ -1211,6 +1306,13 @@ Types
:type: :class:`CListValue` of :class:`KX_GameObject`'s
+ .. attribute:: life
+
+ The number of seconds until the object ends, assumes 50fps.
+ (when added with an add object actuator), (read-only).
+
+ :type: float
+
.. method:: endObject()
Delete this object, can be used in place of the EndObject Actuator.
@@ -1653,7 +1755,7 @@ Types
:arg blendin: the amount of blending between this animation and the previous one on this layer
:type blendin: float
:arg play_mode: the play mode
- :type play_mode: KX_ACTION_MODE_PLAY, KX_ACTION_MODE_LOOP, or KX_ACTION_MODE_PING_PONG
+ :type play_mode: one of :ref:`these constants <gameobject-playaction-mode>`
:arg layer_weight: how much of the previous layer to use for blending (0 = add)
:type layer_weight: float
:arg ipo_flags: flags for the old IPO behaviors (force, etc)
@@ -1810,10 +1912,6 @@ Types
:type: list [r, g, b]
- .. attribute:: colour
-
- Synonym for color.
-
.. attribute:: lin_attenuation
The linear component of this light's attenuation. (SPOT and NORMAL lights only).
@@ -1898,11 +1996,6 @@ Types
:type: integer
- .. method:: getNumMaterials()
-
- :return: number of materials associated with this object
- :rtype: integer
-
.. method:: getMaterialName(matid)
Gets the name of the specified material.
@@ -1943,11 +2036,6 @@ Types
:return: a vertex object.
:rtype: :class:`KX_VertexProxy`
- .. method:: getNumPolygons()
-
- :return: The number of polygon in the mesh.
- :rtype: integer
-
.. method:: getPolygon(index)
Gets the specified polygon from the mesh.
@@ -2178,6 +2266,52 @@ Types
:type: list of strings
+
+.. class:: KX_FontObject(KX_GameObject)
+
+ TODO.
+
+
+.. class:: KX_NavMeshObject(KX_GameObject)
+
+ Python interface for using and controlling navigation meshes.
+
+ .. method:: findPath(start, goal)
+
+ Finds the path from start to goal points.
+
+ :arg start: the start point
+ :arg start: 3D Vector
+ :arg goal: the goal point
+ :arg start: 3D Vector
+ :return: a path as a list of points
+ :rtype: list of points
+
+ .. method:: raycast(start, goal)
+
+ Raycast from start to goal points.
+
+ :arg start: the start point
+ :arg start: 3D Vector
+ :arg goal: the goal point
+ :arg start: 3D Vector
+ :return: the hit factor
+ :rtype: float
+
+ .. method:: draw(mode)
+
+ Draws a debug mesh for the navigation mesh.
+
+ :arg mode: the drawing mode (one of :ref:`these constants <navmesh-draw-mode>`)
+ :arg mode: integer
+ :return: None
+
+ .. method:: rebuild()
+
+ Rebuild the navigation mesh.
+
+ :return: None
+
.. class:: KX_ObjectActuator(SCA_IActuator)
The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement,
@@ -2331,49 +2465,6 @@ Types
:type: boolean
-.. class:: KX_PhysicsObjectWrapper(PyObjectPlus)
-
- KX_PhysicsObjectWrapper
-
- .. method:: setActive(active)
-
- Set the object to be active.
-
- :arg active: set to True to be active
- :type active: boolean
-
- .. method:: setAngularVelocity(x, y, z, local)
-
- Set the angular velocity of the object.
-
- :arg x: angular velocity for the x-axis
- :type x: float
-
- :arg y: angular velocity for the y-axis
- :type y: float
-
- :arg z: angular velocity for the z-axis
- :type z: float
-
- :arg local: set to True for local axis
- :type local: boolean
-
- .. method:: setLinearVelocity(x, y, z, local)
-
- Set the linear velocity of the object.
-
- :arg x: linear velocity for the x-axis
- :type x: float
-
- :arg y: linear velocity for the y-axis
- :type y: float
-
- :arg z: linear velocity for the z-axis
- :type z: float
-
- :arg local: set to True for local axis
- :type local: boolean
-
.. class:: KX_PolyProxy(SCA_IObject)
A polygon holds the index of the vertex forming the poylgon.
@@ -2382,7 +2473,7 @@ Types
The polygon attributes are read-only, you need to retrieve the vertex proxy if you want
to change the vertex settings.
- .. attribute:: matname
+ .. attribute:: material_name
The name of polygon material, empty if no material.
@@ -2394,13 +2485,13 @@ Types
:type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
- .. attribute:: texture
+ .. attribute:: texture_name
The texture name of the polygon.
:type: string
- .. attribute:: matid
+ .. attribute:: material_id
The material index of the polygon, use this to retrieve vertex proxy from mesh proxy.
@@ -2631,18 +2722,6 @@ Types
:type: boolean
- .. attribute:: lightlayer
-
- Light layers this material affects.
-
- :type: bitfield.
-
- .. attribute:: triangle
-
- Mesh data with this material is triangles. It's probably not safe to change this.
-
- :type: boolean
-
.. attribute:: diffuse
The diffuse color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
@@ -2908,8 +2987,8 @@ Types
.. method:: instantAddObject()
adds the object without needing to calling SCA_PythonController.activate()
-
- .. note:: Use objectLastCreated to get the newly created object.
+
+ .. note:: Use objectLastCreated to get the newly created object.
.. class:: KX_SCA_DynamicActuator(SCA_IActuator)
@@ -3182,6 +3261,10 @@ Types
Return the value matching key, or the default value if its not found.
:return: The key value or a default.
+ .. method:: drawObstacleSimulation()
+
+ Draw debug visualization of obstacle simulation.
+
.. class:: KX_SceneActuator(SCA_IActuator)
Scene Actuator logic brick.
@@ -3228,17 +3311,17 @@ Types
Sound Actuator.
- The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not requirethe actuator to be activated - they act instantly provided that the actuator has been activated once at least.
+ The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not require the actuator to be activated - they act instantly provided that the actuator has been activated once at least.
- .. attribute:: fileName
+ .. attribute:: volume
- The filename of the sound this actuator plays.
+ The volume (gain) of the sound.
- :type: string
+ :type: float
- .. attribute:: volume
+ .. attribute:: time
- The volume (gain) of the sound.
+ The current position in the audio stream (in seconds).
:type: float
@@ -3248,41 +3331,89 @@ Types
:type: float
- .. attribute:: rollOffFactor
+ .. attribute:: mode
+
+ The operation mode of the actuator. Can be one of :ref:`these constants<logic-sound-actuator>`
+
+ :type: integer
- The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away.
+ .. attribute:: sound
+
+ The sound the actuator should play.
+
+ :type: Audaspace factory
+
+ .. attribute:: is3D
+
+ Whether or not the actuator should be using 3D sound. (read-only)
+
+ :type: boolean
+
+ .. attribute:: volume_maximum
+
+ The maximum gain of the sound, no matter how near it is.
:type: float
- .. attribute:: looping
+ .. attribute:: volume_minimum
- The loop mode of the actuator.
+ The minimum gain of the sound, no matter how far it is away.
- :type: integer
+ :type: float
- .. attribute:: position
+ .. attribute:: distance_reference
- The position of the sound as a list: [x, y, z].
+ The distance where the sound has a gain of 1.0.
- :type: float array
+ :type: float
- .. attribute:: velocity
+ .. attribute:: distance_maximum
- The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z].
+ The maximum distance at which you can hear the sound.
- :type: float array
+ :type: float
- .. attribute:: orientation
+ .. attribute:: attenuation
- The orientation of the sound. When setting the orientation you can also use quaternion [float, float, float, float] or euler angles [float, float, float].
+ The influence factor on volume depending on distance.
- :type: 3x3 matrix [[float]]
+ :type: float
- .. attribute:: mode
+ .. attribute:: cone_angle_inner
- The operation mode of the actuator. Can be one of :ref:`these constants<logic-sound-actuator>`
+ The angle of the inner cone.
- :type: integer
+ :type: float
+
+ .. attribute:: cone_angle_outer
+
+ The angle of the outer cone.
+
+ :type: float
+
+ .. attribute:: cone_volume_outer
+
+ The gain outside the outer cone (the gain in the outer cone will be interpolated between this value and the normal gain in the inner cone).
+
+ :type: float
+
+ .. method:: startSound()
+
+ Starts the sound.
+
+ :return: None
+
+ .. method:: pauseSound()
+
+ Pauses the sound.
+
+ :return: None
+
+ .. method:: stopSound()
+
+ Stops the sound.
+
+ :return: None
.. class:: KX_StateActuator(SCA_IActuator)
@@ -3500,7 +3631,7 @@ Types
Whether or not the character is on the ground. (read-only)
- :type: boolean
+ :type: boolean
.. attribute:: gravity
@@ -3546,10 +3677,6 @@ Types
Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
- .. attribute:: colour
-
- Synonym for color.
-
.. attribute:: x
The x coordinate of the vertex.
@@ -4270,24 +4397,6 @@ Types
:type: integer
- .. method:: setSeed(seed)
-
- Sets the seed of the random number generator.
-
- If the seed is 0, the generator will produce the same value on every call.
-
- :type seed: integer
-
- .. method:: getSeed()
-
- :return: The initial seed of the generator. Equal seeds produce equal random series.
- :rtype: integer
-
- .. method:: getLastDraw()
-
- :return: The last random number generated.
- :rtype: integer
-
.. class:: SCA_XNORController(SCA_IController)
An XNOR controller activates when all linked sensors are the same (activated or inative).
@@ -4355,7 +4464,7 @@ Types
.. attribute:: projection_matrix
This camera's 4x4 projection matrix.
-
+
.. note::
This is the identity matrix prior to rendering the first frame (any Python done on frame 1).
@@ -4608,48 +4717,6 @@ Types
Armature Actuators change constraint condition on armatures.
- .. _armatureactuator-constants-type:
-
- Constants related to :data:`~bge.types.BL_ArmatureActuator.type`
-
- .. data:: KX_ACT_ARMATURE_RUN
-
- Just make sure the armature will be updated on the next graphic frame.
- This is the only persistent mode of the actuator:
- it executes automatically once per frame until stopped by a controller
-
- :value: 0
-
- .. data:: KX_ACT_ARMATURE_ENABLE
-
- Enable the constraint.
-
- :value: 1
-
- .. data:: KX_ACT_ARMATURE_DISABLE
-
- Disable the constraint (runtime constraint values are not updated).
-
- :value: 2
-
- .. data:: KX_ACT_ARMATURE_SETTARGET
-
- Change target and subtarget of constraint.
-
- :value: 3
-
- .. data:: KX_ACT_ARMATURE_SETWEIGHT
-
- Change weight of constraint (IK only).
-
- :value: 4
-
- .. data:: KX_ACT_ARMATURE_SETINFLUENCE
-
- Change influence of constraint.
-
- :value: 5
-
.. attribute:: type
The type of action that the actuator executes when it is active.
@@ -4704,40 +4771,6 @@ Types
Armature sensor detect conditions on armatures.
- .. _armaturesensor-type:
-
- Constants related to :data:`type`
-
- .. data:: KX_ARMSENSOR_STATE_CHANGED
-
- Detect that the constraint is changing state (active/inactive)
-
- :value: 0
-
- .. data:: KX_ARMSENSOR_LIN_ERROR_BELOW
-
- Detect that the constraint linear error is above a threshold
-
- :value: 1
-
- .. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE
-
- Detect that the constraint linear error is below a threshold
-
- :value: 2
-
- .. data:: KX_ARMSENSOR_ROT_ERROR_BELOW
-
- Detect that the constraint rotation error is above a threshold
-
- :value: 3
-
- .. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE
-
- Detect that the constraint rotation error is below a threshold
-
- :value: 4
-
.. attribute:: type
The type of measurement that the sensor make when it is active.
@@ -4772,87 +4805,6 @@ Types
Not all armature constraints are supported in the GE.
- .. _armatureconstraint-constants-type:
-
- Constants related to :data:`type`
-
- .. data:: CONSTRAINT_TYPE_TRACKTO
- .. data:: CONSTRAINT_TYPE_KINEMATIC
- .. data:: CONSTRAINT_TYPE_ROTLIKE
- .. data:: CONSTRAINT_TYPE_LOCLIKE
- .. data:: CONSTRAINT_TYPE_MINMAX
- .. data:: CONSTRAINT_TYPE_SIZELIKE
- .. data:: CONSTRAINT_TYPE_LOCKTRACK
- .. data:: CONSTRAINT_TYPE_STRETCHTO
- .. data:: CONSTRAINT_TYPE_CLAMPTO
- .. data:: CONSTRAINT_TYPE_TRANSFORM
- .. data:: CONSTRAINT_TYPE_DISTLIMIT
-
- .. _armatureconstraint-constants-ik-type:
-
- Constants related to :data:`ik_type`
-
- .. data:: CONSTRAINT_IK_COPYPOSE
-
- constraint is trying to match the position and eventually the rotation of the target.
-
- :value: 0
-
- .. data:: CONSTRAINT_IK_DISTANCE
-
- Constraint is maintaining a certain distance to target subject to ik_mode
-
- :value: 1
-
- .. _armatureconstraint-constants-ik-flag:
-
- Constants related to :data:`ik_flag`
-
- .. data:: CONSTRAINT_IK_FLAG_TIP
-
- Set when the constraint operates on the head of the bone and not the tail
-
- :value: 1
-
- .. data:: CONSTRAINT_IK_FLAG_ROT
-
- Set when the constraint tries to match the orientation of the target
-
- :value: 2
-
- .. data:: CONSTRAINT_IK_FLAG_STRETCH
-
- Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
-
- :value: 16
-
- .. data:: CONSTRAINT_IK_FLAG_POS
-
- Set when the constraint tries to match the position of the target.
-
- :value: 32
-
- .. _armatureconstraint-constants-ik-mode:
-
- Constants related to :data:`ik_mode`
-
- .. data:: CONSTRAINT_IK_MODE_INSIDE
-
- The constraint tries to keep the bone within ik_dist of target
-
- :value: 0
-
- .. data:: CONSTRAINT_IK_MODE_OUTSIDE
-
- The constraint tries to keep the bone outside ik_dist of the target
-
- :value: 1
-
- .. data:: CONSTRAINT_IK_MODE_ONSURFACE
-
- The constraint tries to keep the bone exactly at ik_dist of the target.
-
- :value: 2
.. attribute:: type
@@ -4971,16 +4923,6 @@ Types
Proxy to armature pose channel. Allows to read and set armature pose.
The attributes are identical to RNA attributes, but mostly in read-only mode.
- See :data:`rotation_mode`
-
- .. data:: PCHAN_ROT_QUAT
- .. data:: PCHAN_ROT_XYZ
- .. data:: PCHAN_ROT_XZY
- .. data:: PCHAN_ROT_YXZ
- .. data:: PCHAN_ROT_YZX
- .. data:: PCHAN_ROT_ZXY
- .. data:: PCHAN_ROT_ZYX
-
.. attribute:: name
channel name (=bone name), read-only.
@@ -5114,17 +5056,7 @@ Types
Method of updating the bone rotation, read-write.
- :type: integer
-
- Use the following constants (euler mode are named as in Blender UI but the actual axis order is reversed).
-
- * PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation
- * PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively
- * PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively
- * PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively
- * PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively
- * PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively
- * PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively
+ :type: integer (one of :ref:`these constants <armaturechannel-constants-rotation-mode>`)
.. attribute:: channel_matrix
diff --git a/doc/python_api/rst/bgl.rst b/doc/python_api/rst/bgl.rst
index 9f7817c6fa2..fc4524b1213 100644
--- a/doc/python_api/rst/bgl.rst
+++ b/doc/python_api/rst/bgl.rst
@@ -689,7 +689,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
Return the specified pixel map
- .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetPixelMap.xml>`_
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glGetPixelMap.xml>`_
:type map: Enumerated constant
:arg map: Specifies the name of the pixel map to return.
@@ -701,7 +701,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
Return the polygon stipple pattern
- .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetPolygonStipple.xml>`_
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glGetPolygonStipple.xml>`_
:type mask: :class:`bgl.Buffer` object I{type GL_BYTE}
:arg mask: Returns the stipple pattern. The initial value is all 1's.
@@ -824,13 +824,25 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
Set the current color index
- .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIndex.xml>`_
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glIndex.xml>`_
:type c: :class:`bgl.Buffer` object. Depends on function prototype.
:arg c: Specifies a pointer to a one element array that contains the new value for
the current color index.
+.. function:: glIndexMask(mask):
+
+ Control the writing of individual bits in the color index buffers
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glIndexMask.xml>`_
+
+ :type mask: int
+ :arg mask: Specifies a bit mask to enable and disable the writing of individual bits
+ in the color index buffers.
+ Initially, the mask is all 1's.
+
+
.. function:: glInitNames():
Initialize the name stack
@@ -1510,7 +1522,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
:arg mode: Specifies a symbolic value representing a shading technique.
-.. function:: glStencilFuc(func, ref, mask):
+.. function:: glStencilFunc(func, ref, mask):
Set function and reference value for stencil testing
@@ -1835,7 +1847,238 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
:arg objx, objy, objz: Return the computed object coordinates.
-class Buffer:
+.. function:: glUseProgram(program):
+
+ Installs a program object as part of current rendering state
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glUseProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies the handle of the program object whose executables are to be used as part of current rendering state.
+
+
+.. function:: glValidateProgram(program):
+
+ Validates a program object
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glValidateProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies the handle of the program object to be validated.
+
+
+.. function:: glLinkProgram(program):
+
+ Links a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glLinkProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies the handle of the program object to be linked.
+
+
+.. function:: glActiveTexture(texture):
+
+ Select active texture unit.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glActiveTexture.xml>`_
+
+ :type texture: int
+ :arg texture: Constant in ``GL_TEXTURE0`` 0 - 8
+
+
+.. function:: glAttachShader(program, shader):
+
+ Attaches a shader object to a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glAttachShader.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object to which a shader object will be attached.
+ :type shader: int
+ :arg shader: Specifies the shader object that is to be attached.
+
+
+.. function:: glCompileShader(shader):
+
+ Compiles a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCompileShader.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies the shader object to be compiled.
+
+
+.. function:: glCreateProgram():
+
+ Creates a program object
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCreateProgram.xml>`_
+
+ :rtype: int
+ :return: The new program or zero if an error occurs.
+
+
+.. function:: glCreateShader(shaderType):
+
+ Creates a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCreateShader.xml>`_
+
+ :type shaderType: Specifies the type of shader to be created.
+ Must be one of ``GL_VERTEX_SHADER``,
+ ``GL_TESS_CONTROL_SHADER``,
+ ``GL_TESS_EVALUATION_SHADER``,
+ ``GL_GEOMETRY_SHADER``,
+ or ``GL_FRAGMENT_SHADER``.
+ :arg shaderType:
+ :rtype: int
+ :return: 0 if an error occurs.
+
+
+.. function:: glDeleteProgram(program):
+
+ Deletes a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDeleteProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object to be deleted.
+
+
+.. function:: glDeleteShader(shader):
+
+ Deletes a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDeleteShader.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies the shader object to be deleted.
+
+
+.. function:: glDetachShader(program, shader):
+
+ Detaches a shader object from a program object to which it is attached.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDetachShader.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object from which to detach the shader object.
+ :type shader: int
+ :arg shader: pecifies the program object from which to detach the shader object.
+
+
+.. function:: glGetAttachedShaders(program, maxCount, count, shaders):
+
+ Returns the handles of the shader objects attached to a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetAttachedShaders.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object to be queried.
+ :type maxCount: int
+ :arg maxCount: Specifies the size of the array for storing the returned object names.
+ :type count: :class:`bgl.Buffer` int buffer.
+ :arg count: Returns the number of names actually returned in objects.
+ :type shaders: :class:`bgl.Buffer` int buffer.
+ :arg shaders: Specifies an array that is used to return the names of attached shader objects.
+
+
+.. function:: glGetProgramInfoLog(program, maxLength, length, infoLog):
+
+ Returns the information log for a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetProgramInfoLog.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object whose information log is to be queried.
+ :type maxLength: int
+ :arg maxLength: Specifies the size of the character buffer for storing the returned information log.
+ :type length: :class:`bgl.Buffer` int buffer.
+ :arg length: Returns the length of the string returned in **infoLog** (excluding the null terminator).
+ :type infoLog: :class:`bgl.Buffer` char buffer.
+ :arg infoLog: Specifies an array of characters that is used to return the information log.
+
+
+.. function:: glGetShaderInfoLog(program, maxLength, length, infoLog):
+
+ Returns the information log for a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetShaderInfoLog.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies the shader object whose information log is to be queried.
+ :type maxLength: int
+ :arg maxLength: Specifies the size of the character buffer for storing the returned information log.
+ :type length: :class:`bgl.Buffer` int buffer.
+ :arg length: Returns the length of the string returned in **infoLog** (excluding the null terminator).
+ :type infoLog: :class:`bgl.Buffer` char buffer.
+ :arg infoLog: Specifies an array of characters that is used to return the information log.
+
+
+.. function:: glGetProgramiv(program, pname, params):
+
+ Returns a parameter from a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object to be queried.
+ :type pname: int
+ :arg pname: Specifies the object parameter.
+ :type params: :class:`bgl.Buffer` int buffer.
+ :arg params: Returns the requested object parameter.
+
+
+.. function:: glIsShader(shader):
+
+ Determines if a name corresponds to a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIsShader.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies a potential shader object.
+
+
+.. function:: glIsProgram(program):
+
+ Determines if a name corresponds to a program object
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIsProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies a potential program object.
+
+
+.. function:: glGetShaderSource(shader, bufSize, length, source):
+
+ Returns the source code string from a shader object
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetShaderSource.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies the shader object to be queried.
+ :type bufSize: int
+ :arg bufSize: Specifies the size of the character buffer for storing the returned source code string.
+ :type length: :class:`bgl.Buffer` int buffer.
+ :arg length: Returns the length of the string returned in source (excluding the null terminator).
+ :type source: :class:`bgl.Buffer` char.
+ :arg source: Specifies an array of characters that is used to return the source code string.
+
+
+.. function:: glShaderSource(shader, shader_string):
+
+ Replaces the source code in a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glShaderSource.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies the handle of the shader object whose source code is to be replaced.
+ :type shader_string: string
+ :arg shader_string: The shader string.
+
+
+.. class:: Buffer
The Buffer object is simply a block of memory that is delineated and initialized by the
user. Many OpenGL functions return data to a C-style pointer, however, because this
diff --git a/doc/python_api/rst/gpu.rst b/doc/python_api/rst/gpu.rst
index 68dc30b6143..a225829b3e8 100644
--- a/doc/python_api/rst/gpu.rst
+++ b/doc/python_api/rst/gpu.rst
@@ -262,10 +262,16 @@ The calculation of some of the uniforms is based on matrices available in the sc
.. data:: GPU_DYNAMIC_SAMPLER_2DSHADOW
+ The uniform is an float representing the bumpmap scaling.
+
+ :value: 14
+
+.. data:: GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE
+
The uniform is an integer representing a shadow buffer corresponding to a lamp
casting shadow.
- :value: 14
+ :value: 15
GLSL attribute type
diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cpp
index a15927f881d..c1788cc9422 100644
--- a/extern/libmv/libmv-capi.cpp
+++ b/extern/libmv/libmv-capi.cpp
@@ -192,7 +192,7 @@ static void imageToFloatBuf(const libmv::FloatImage *image, int channels, float
}
#if defined(DUMP_FAILURE) || defined (DUMP_ALWAYS)
-void savePNGImage(png_bytep *row_pointers, int width, int height, int depth, int color_type, char *file_name)
+static void savePNGImage(png_bytep *row_pointers, int width, int height, int depth, int color_type, char *file_name)
{
png_infop info_ptr;
png_structp png_ptr;
@@ -437,6 +437,9 @@ int libmv_trackRegion(const struct libmv_trackRegionOptions *options,
#endif
saveImage("old_patch", old_patch, x1[4], y1[4]);
saveImage("new_patch", new_patch, x2[4], y2[4]);
+
+ if (options->image1_mask)
+ saveImage("mask", image1_mask, x2[4], y2[4]);
}
#endif
diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp
index 61fe7cf254d..0cbd2a0291f 100644
--- a/intern/cycles/blender/blender_camera.cpp
+++ b/intern/cycles/blender/blender_camera.cpp
@@ -56,13 +56,16 @@ struct BlenderCamera {
float sensor_width;
float sensor_height;
+ int full_width;
+ int full_height;
+
BoundBox2D border;
BoundBox2D pano_viewplane;
Transform matrix;
};
-static void blender_camera_init(BlenderCamera *bcam)
+static void blender_camera_init(BlenderCamera *bcam, BL::Scene b_scene)
{
memset(bcam, 0, sizeof(BlenderCamera));
@@ -77,6 +80,12 @@ static void blender_camera_init(BlenderCamera *bcam)
bcam->border.top = 1.0f;
bcam->pano_viewplane.right = 1.0f;
bcam->pano_viewplane.top = 1.0f;
+
+ /* render resolution */
+ BL::RenderSettings r = b_scene.render();
+
+ bcam->full_width = (int)(r.resolution_x()*r.resolution_percentage()/100);
+ bcam->full_height = (int)(r.resolution_y()*r.resolution_percentage()/100);
}
static float blender_camera_focal_distance(BL::Object b_ob, BL::Camera b_camera)
@@ -207,10 +216,9 @@ static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
/* compute x/y aspect and ratio */
float xaspect, yaspect;
-
- /* sensor fitting */
bool horizontal_fit;
+ /* sensor fitting */
if(bcam->sensor_fit == BlenderCamera::AUTO) {
horizontal_fit = (xratio > yratio);
*sensor_size = bcam->sensor_width;
@@ -277,9 +285,35 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
blender_camera_viewplane(bcam, width, height,
&cam->viewplane, &aspectratio, &sensor_size);
- /* sensor */
- cam->sensorwidth = bcam->sensor_width;
- cam->sensorheight = bcam->sensor_height;
+ /* panorama sensor */
+ if (bcam->type == CAMERA_PANORAMA && bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID) {
+ float fit_xratio = bcam->full_width*bcam->pixelaspect.x;
+ float fit_yratio = bcam->full_height*bcam->pixelaspect.y;
+ bool horizontal_fit;
+ float sensor_size;
+
+ if(bcam->sensor_fit == BlenderCamera::AUTO) {
+ horizontal_fit = (fit_xratio > fit_yratio);
+ sensor_size = bcam->sensor_width;
+ }
+ else if(bcam->sensor_fit == BlenderCamera::HORIZONTAL) {
+ horizontal_fit = true;
+ sensor_size = bcam->sensor_width;
+ }
+ else { /* vertical */
+ horizontal_fit = false;
+ sensor_size = bcam->sensor_height;
+ }
+
+ if(horizontal_fit) {
+ cam->sensorwidth = sensor_size;
+ cam->sensorheight = sensor_size * fit_yratio / fit_xratio;
+ }
+ else {
+ cam->sensorwidth = sensor_size * fit_xratio / fit_yratio;
+ cam->sensorheight = sensor_size;
+ }
+ }
/* clipping distances */
cam->nearclip = bcam->nearclip;
@@ -320,7 +354,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
void BlenderSync::sync_camera(BL::Object b_override, int width, int height)
{
BlenderCamera bcam;
- blender_camera_init(&bcam);
+ blender_camera_init(&bcam, b_scene);
/* pixel aspect */
BL::RenderSettings r = b_scene.render();
@@ -435,13 +469,13 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL:
static void blender_camera_view_subset(BL::Scene b_scene, BL::Object b_ob, BL::SpaceView3D b_v3d,
BL::RegionView3D b_rv3d, int width, int height, BoundBox2D *view_box, BoundBox2D *cam_box)
{
- BL::RenderSettings r = b_scene.render();
+// BL::RenderSettings r = b_scene.render(); /* UNUSED */
BoundBox2D cam, view;
float view_aspect, cam_aspect, sensor_size;
/* get viewport viewplane */
BlenderCamera view_bcam;
- blender_camera_init(&view_bcam);
+ blender_camera_init(&view_bcam, b_scene);
blender_camera_from_view(&view_bcam, b_scene, b_v3d, b_rv3d, width, height, true);
blender_camera_viewplane(&view_bcam, width, height,
@@ -449,13 +483,10 @@ static void blender_camera_view_subset(BL::Scene b_scene, BL::Object b_ob, BL::S
/* get camera viewplane */
BlenderCamera cam_bcam;
- blender_camera_init(&cam_bcam);
+ blender_camera_init(&cam_bcam, b_scene);
blender_camera_from_object(&cam_bcam, b_ob, true);
- width = (int)(r.resolution_x()*r.resolution_percentage()/100);
- height = (int)(r.resolution_y()*r.resolution_percentage()/100);
-
- blender_camera_viewplane(&cam_bcam, width, height,
+ blender_camera_viewplane(&cam_bcam, cam_bcam.full_width, cam_bcam.full_height,
&cam, &cam_aspect, &sensor_size);
/* return */
@@ -513,7 +544,7 @@ static void blender_camera_border(BlenderCamera *bcam, BL::Scene b_scene, BL::Sp
void BlenderSync::sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height)
{
BlenderCamera bcam;
- blender_camera_init(&bcam);
+ blender_camera_init(&bcam, b_scene);
blender_camera_from_view(&bcam, b_scene, b_v3d, b_rv3d, width, height);
blender_camera_border(&bcam, b_scene, b_v3d, b_rv3d, width, height);
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 63cf719d010..da06f1d0a38 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -500,8 +500,10 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
BL::Image b_image(b_image_node.image());
ImageTextureNode *image = new ImageTextureNode();
/* todo: handle generated/builtin images */
- if(b_image && b_image.source() != BL::Image::source_MOVIE)
+ if(b_image && b_image.source() != BL::Image::source_MOVIE) {
image->filename = image_user_file_path(b_image_node.image_user(), b_image, b_scene.frame_current());
+ image->animated = b_image_node.image_user().use_auto_refresh();
+ }
image->color_space = ImageTextureNode::color_space_enum[(int)b_image_node.color_space()];
image->projection = ImageTextureNode::projection_enum[(int)b_image_node.projection()];
image->projection_blend = b_image_node.projection_blend();
@@ -513,8 +515,10 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
BL::ShaderNodeTexEnvironment b_env_node(b_node);
BL::Image b_image(b_env_node.image());
EnvironmentTextureNode *env = new EnvironmentTextureNode();
- if(b_image && b_image.source() != BL::Image::source_MOVIE)
+ if(b_image && b_image.source() != BL::Image::source_MOVIE) {
env->filename = image_user_file_path(b_env_node.image_user(), b_image, b_scene.frame_current());
+ env->animated = b_env_node.image_user().use_auto_refresh();
+ }
env->color_space = EnvironmentTextureNode::color_space_enum[(int)b_env_node.color_space()];
env->projection = EnvironmentTextureNode::projection_enum[(int)b_env_node.projection()];
get_tex_mapping(&env->tex_mapping, b_env_node.texture_mapping());
@@ -821,7 +825,7 @@ static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, Sha
/* Sync Materials */
-void BlenderSync::sync_materials()
+void BlenderSync::sync_materials(bool update_all)
{
shader_map.set_default(scene->shaders[scene->default_surface]);
@@ -832,7 +836,7 @@ void BlenderSync::sync_materials()
Shader *shader;
/* test if we need to sync */
- if(shader_map.sync(&shader, *b_mat)) {
+ if(shader_map.sync(&shader, *b_mat) || update_all) {
ShaderGraph *graph = new ShaderGraph();
shader->name = b_mat->name().c_str();
@@ -868,14 +872,14 @@ void BlenderSync::sync_materials()
/* Sync World */
-void BlenderSync::sync_world()
+void BlenderSync::sync_world(bool update_all)
{
Background *background = scene->background;
Background prevbackground = *background;
BL::World b_world = b_scene.world();
- if(world_recalc || b_world.ptr.data != world_map) {
+ if(world_recalc || update_all || b_world.ptr.data != world_map) {
Shader *shader = scene->shaders[scene->default_background];
ShaderGraph *graph = new ShaderGraph();
@@ -922,7 +926,7 @@ void BlenderSync::sync_world()
/* Sync Lamps */
-void BlenderSync::sync_lamps()
+void BlenderSync::sync_lamps(bool update_all)
{
shader_map.set_default(scene->shaders[scene->default_light]);
@@ -933,7 +937,7 @@ void BlenderSync::sync_lamps()
Shader *shader;
/* test if we need to sync */
- if(shader_map.sync(&shader, *b_lamp)) {
+ if(shader_map.sync(&shader, *b_lamp) || update_all) {
ShaderGraph *graph = new ShaderGraph();
/* create nodes */
@@ -972,11 +976,20 @@ void BlenderSync::sync_lamps()
void BlenderSync::sync_shaders()
{
+ /* for auto refresh images */
+ bool auto_refresh_update = false;
+
+ if(preview) {
+ ImageManager *image_manager = scene->image_manager;
+ int frame = b_scene.frame_current();
+ auto_refresh_update = image_manager->set_animation_frame_update(frame);
+ }
+
shader_map.pre_sync();
- sync_world();
- sync_lamps();
- sync_materials();
+ sync_world(auto_refresh_update);
+ sync_lamps(auto_refresh_update);
+ sync_materials(auto_refresh_update);
/* false = don't delete unused shaders, not supported */
shader_map.post_sync(false);
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index 71781bc5459..d3d21fbdf72 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -68,14 +68,14 @@ public:
private:
/* sync */
- void sync_lamps();
- void sync_materials();
+ void sync_lamps(bool update_all);
+ void sync_materials(bool update_all);
void sync_objects(BL::SpaceView3D b_v3d, int motion = 0);
void sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override);
void sync_film();
void sync_integrator();
void sync_view();
- void sync_world();
+ void sync_world(bool update_all);
void sync_render_layers(BL::SpaceView3D b_v3d, const char *layer);
void sync_shaders();
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index c6a2c678bac..1248b42b738 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -189,18 +189,6 @@ vector<DeviceInfo>& Device::available_devices()
{
static vector<DeviceInfo> devices;
static bool devices_init = false;
- static double device_update_time = 0.0;
-
- /* only update device list if we're not actively rendering already, things
- * could go very wrong if a device suddenly becomes (un)available. also do
- * it only every 5 seconds. it not super cpu intensive but don't want to do
- * it on every redraw. */
- if(devices_init) {
- if(!TaskScheduler::active() && (time_dt() > device_update_time + 5.0)) {
- devices.clear();
- devices_init = false;
- }
- }
if(!devices_init) {
#ifdef WITH_CUDA
@@ -224,7 +212,6 @@ vector<DeviceInfo>& Device::available_devices()
#endif
devices_init = true;
- device_update_time = time_dt();
}
return devices;
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index d797c0f09ca..14f8cfa8767 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -60,7 +60,7 @@ public:
return (CUdeviceptr)mem;
}
- const char *cuda_error_string(CUresult result)
+ static const char *cuda_error_string(CUresult result)
{
switch(result) {
case CUDA_SUCCESS: return "No errors";
@@ -915,12 +915,21 @@ Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background)
void device_cuda_info(vector<DeviceInfo>& devices)
{
+ CUresult result;
int count = 0;
- if(cuInit(0) != CUDA_SUCCESS)
+ result = cuInit(0);
+ if(result != CUDA_SUCCESS) {
+ if(result != CUDA_ERROR_NO_DEVICE)
+ fprintf(stderr, "CUDA cuInit: %s\n", CUDADevice::cuda_error_string(result));
return;
- if(cuDeviceGetCount(&count) != CUDA_SUCCESS)
+ }
+
+ result = cuDeviceGetCount(&count);
+ if(result != CUDA_SUCCESS) {
+ fprintf(stderr, "CUDA cuDeviceGetCount: %s\n", CUDADevice::cuda_error_string(result));
return;
+ }
vector<DeviceInfo> display_devices;
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index 1b2fe8c56ee..abc63d99c74 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -229,5 +229,20 @@ __device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, flo
camera_sample_panorama(kg, raster_x, raster_y, lens_u, lens_v, ray);
}
+/* Utilities */
+
+__device_inline float camera_distance(KernelGlobals *kg, float3 P)
+{
+ Transform cameratoworld = kernel_data.cam.cameratoworld;
+ float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
+
+ if(kernel_data.cam.type == CAMERA_ORTHOGRAPHIC) {
+ float3 camD = make_float3(cameratoworld.x.z, cameratoworld.y.z, cameratoworld.z.z);
+ return fabsf(dot((P - camP), camD));
+ }
+ else
+ return len(P - camP);
+}
+
CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h
index 42733d691e0..7f8b611ba14 100644
--- a/intern/cycles/kernel/kernel_passes.h
+++ b/intern/cycles/kernel/kernel_passes.h
@@ -52,9 +52,7 @@ __device_inline void kernel_write_data_passes(KernelGlobals *kg, __global float
if(!(path_flag & PATH_RAY_TRANSPARENT)) {
if(sample == 0) {
if(flag & PASS_DEPTH) {
- Transform tfm = kernel_data.cam.worldtocamera;
- float depth = len(transform_point(&tfm, sd->P));
-
+ float depth = camera_distance(kg, sd->P);
kernel_write_pass_float(buffer + kernel_data.film.pass_depth, sample, depth);
}
if(flag & PASS_OBJECT_ID) {
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index 70a9b372ebc..195291898c6 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -424,7 +424,12 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
/* setup ray */
ray.P = ray_offset(sd.P, (label & LABEL_TRANSMIT)? -sd.Ng: sd.Ng);
ray.D = bsdf_omega_in;
- ray.t = FLT_MAX;
+
+ if(state.bounce == 0)
+ ray.t -= sd.ray_length; /* clipping works through transparent */
+ else
+ ray.t = FLT_MAX;
+
#ifdef __RAY_DIFFERENTIALS__
ray.dP = sd.dP;
ray.dD = bsdf_domega_in;
@@ -887,6 +892,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
path_state_next(kg, &state, LABEL_TRANSPARENT);
ray.P = ray_offset(sd.P, -sd.Ng);
+ ray.t -= sd.ray_length; /* clipping works through transparent */
}
float3 L_sum = path_radiance_sum(kg, &L);
diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h
index f935858f8ba..879160312cf 100644
--- a/intern/cycles/kernel/kernel_shader.h
+++ b/intern/cycles/kernel/kernel_shader.h
@@ -619,7 +619,10 @@ __device float3 shader_bsdf_ao(KernelGlobals *kg, ShaderData *sd, float ao_facto
}
}
- *N = normalize(*N);
+ if(is_zero(*N))
+ *N = sd->N;
+ else
+ *N = normalize(*N);
return eval;
#else
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index d4d88466688..977fb8c4fd4 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -111,6 +111,7 @@ CCL_NAMESPACE_BEGIN
#define __BACKGROUND_MIS__
#define __AO__
#define __CAMERA_MOTION__
+#define __ANISOTROPIC__
#ifndef __KERNEL_CUDA__
#define __OBJECT_MOTION__
@@ -375,7 +376,9 @@ typedef struct ShaderClosure {
float data1;
float3 N;
+#ifdef __ANISOTROPIC__
float3 T;
+#endif
} ShaderClosure;
diff --git a/intern/cycles/kernel/osl/osl_closures.h b/intern/cycles/kernel/osl/osl_closures.h
index 71e9e5ae4fd..2d91b37be7e 100644
--- a/intern/cycles/kernel/osl/osl_closures.h
+++ b/intern/cycles/kernel/osl/osl_closures.h
@@ -66,6 +66,8 @@ void name(RendererServices *, int id, void *data) \
new (data) classname(); \
}
+#define CLOSURE_PREPARE_STATIC(name, classname) static CLOSURE_PREPARE(name, classname)
+
#define TO_VEC3(v) (*(OSL::Vec3 *)&(v))
#define TO_COLOR3(v) (*(OSL::Color3 *)&(v))
#define TO_FLOAT3(v) make_float3(v[0], v[1], v[2])
@@ -77,26 +79,26 @@ public:
ShaderClosure sc;
OSL::Vec3 N, T;
- CBSDFClosure(int scattering) : OSL::ClosurePrimitive(BSDF),
- m_scattering_label(scattering), m_shaderdata_flag(0) { }
- ~CBSDFClosure() { }
+ CBSDFClosure(int scattering) : OSL::ClosurePrimitive(BSDF),
+ m_scattering_label(scattering), m_shaderdata_flag(0) { }
+ ~CBSDFClosure() { }
- int scattering() const { return m_scattering_label; }
- int shaderdata_flag() const { return m_shaderdata_flag; }
+ int scattering() const { return m_scattering_label; }
+ int shaderdata_flag() const { return m_shaderdata_flag; }
ClosureType shaderclosure_type() const { return sc.type; }
- virtual void blur(float roughness) = 0;
- virtual float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float &pdf) const = 0;
- virtual float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float &pdf) const = 0;
+ virtual void blur(float roughness) = 0;
+ virtual float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float &pdf) const = 0;
+ virtual float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float &pdf) const = 0;
- virtual int sample(const float3 &Ng,
- const float3 &omega_out, const float3 &domega_out_dx, const float3 &domega_out_dy,
- float randu, float randv,
- float3 &omega_in, float3 &domega_in_dx, float3 &domega_in_dy,
- float &pdf, float3 &eval) const = 0;
+ virtual int sample(const float3 &Ng,
+ const float3 &omega_out, const float3 &domega_out_dx, const float3 &domega_out_dy,
+ float randu, float randv,
+ float3 &omega_in, float3 &domega_in_dx, float3 &domega_in_dy,
+ float &pdf, float3 &eval) const = 0;
protected:
- int m_scattering_label;
+ int m_scattering_label;
int m_shaderdata_flag;
};
@@ -151,7 +153,7 @@ public: \
} \
}; \
\
-ClosureParam *bsdf_##lower##_params() \
+static ClosureParam *bsdf_##lower##_params() \
{ \
static ClosureParam params[] = {
@@ -164,7 +166,7 @@ ClosureParam *bsdf_##lower##_params() \
return params; \
} \
\
-CLOSURE_PREPARE(bsdf_##lower##_prepare, Upper##Closure)
+CLOSURE_PREPARE_STATIC(bsdf_##lower##_prepare, Upper##Closure)
CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/osl/osl_globals.h b/intern/cycles/kernel/osl/osl_globals.h
index 003e39ca3c3..ce283023c5c 100644
--- a/intern/cycles/kernel/osl/osl_globals.h
+++ b/intern/cycles/kernel/osl/osl_globals.h
@@ -43,6 +43,7 @@ struct OSLGlobals {
/* shading system */
OSL::ShadingSystem *ss;
+ OSL::TextureSystem *ts;
OSLRenderServices *services;
/* shader states */
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index 54cbf49704f..e79c509b144 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -649,6 +649,80 @@ bool OSLRenderServices::has_userdata(ustring name, TypeDesc type, void *renderst
return false; /* never called by OSL */
}
+bool OSLRenderServices::texture(ustring filename, TextureOpt &options,
+ OSL::ShaderGlobals *sg,
+ float s, float t, float dsdx, float dtdx,
+ float dsdy, float dtdy, float *result)
+{
+ OSL::TextureSystem *ts = kernel_globals->osl.ts;
+ bool status = ts->texture(filename, options, s, t, dsdx, dtdx, dsdy, dtdy, result);
+
+ if(!status) {
+ if(options.nchannels == 3 || options.nchannels == 4) {
+ result[0] = 1.0f;
+ result[1] = 0.0f;
+ result[2] = 1.0f;
+
+ if(options.nchannels == 4)
+ result[3] = 1.0f;
+ }
+ }
+
+ return status;
+}
+
+bool OSLRenderServices::texture3d(ustring filename, TextureOpt &options,
+ OSL::ShaderGlobals *sg, const OSL::Vec3 &P,
+ const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy,
+ const OSL::Vec3 &dPdz, float *result)
+{
+ OSL::TextureSystem *ts = kernel_globals->osl.ts;
+ bool status = ts->texture3d(filename, options, P, dPdx, dPdy, dPdz, result);
+
+ if(!status) {
+ if(options.nchannels == 3 || options.nchannels == 4) {
+ result[0] = 1.0f;
+ result[1] = 0.0f;
+ result[2] = 1.0f;
+
+ if(options.nchannels == 4)
+ result[3] = 1.0f;
+ }
+
+ }
+
+ return status;
+}
+
+bool OSLRenderServices::environment(ustring filename, TextureOpt &options,
+ OSL::ShaderGlobals *sg, const OSL::Vec3 &R,
+ const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy, float *result)
+{
+ OSL::TextureSystem *ts = kernel_globals->osl.ts;
+ bool status = ts->environment(filename, options, R, dRdx, dRdy, result);
+
+ if(!status) {
+ if(options.nchannels == 3 || options.nchannels == 4) {
+ result[0] = 1.0f;
+ result[1] = 0.0f;
+ result[2] = 1.0f;
+
+ if(options.nchannels == 4)
+ result[3] = 1.0f;
+ }
+ }
+
+ return status;
+}
+
+bool OSLRenderServices::get_texture_info(ustring filename, int subimage,
+ ustring dataname,
+ TypeDesc datatype, void *data)
+{
+ OSL::TextureSystem *ts = kernel_globals->osl.ts;
+ return ts->get_texture_info(filename, subimage, dataname, datatype, data);
+}
+
int OSLRenderServices::pointcloud_search(OSL::ShaderGlobals *sg, ustring filename, const OSL::Vec3 &center,
float radius, int max_points, bool sort,
size_t *out_indices, float *out_distances, int derivs_offset)
diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h
index ce62eaf8994..b5a7bbae7e5 100644
--- a/intern/cycles/kernel/osl/osl_services.h
+++ b/intern/cycles/kernel/osl/osl_services.h
@@ -84,6 +84,23 @@ public:
bool getmessage(OSL::ShaderGlobals *sg, ustring source, ustring name,
TypeDesc type, void *val, bool derivatives);
+ bool texture(ustring filename, TextureOpt &options,
+ OSL::ShaderGlobals *sg,
+ float s, float t, float dsdx, float dtdx,
+ float dsdy, float dtdy, float *result);
+
+ bool texture3d(ustring filename, TextureOpt &options,
+ OSL::ShaderGlobals *sg, const OSL::Vec3 &P,
+ const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy,
+ const OSL::Vec3 &dPdz, float *result);
+
+ bool environment(ustring filename, TextureOpt &options,
+ OSL::ShaderGlobals *sg, const OSL::Vec3 &R,
+ const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy, float *result);
+
+ bool get_texture_info(ustring filename, int subimage,
+ ustring dataname, TypeDesc datatype, void *data);
+
struct TraceData {
Ray ray;
Intersection isect;
diff --git a/intern/cycles/kernel/shaders/SConscript b/intern/cycles/kernel/shaders/SConscript
index 1d446205d92..36b86d7b4f6 100644
--- a/intern/cycles/kernel/shaders/SConscript
+++ b/intern/cycles/kernel/shaders/SConscript
@@ -13,11 +13,8 @@ oso_files = []
if env['WITH_BF_CYCLES_OSL']:
shaders = env.Clone()
- # osl compiler info
- if env['OURPLATFORM']=='darwin':
- osl_compiler = '../lib/darwin-9.x.universal/osl/bin/oslc' # temporary hack to get the leading "#" away that breaks shadercompile
- else:
- osl_compiler = env['BF_OSL_COMPILER']
+ # osl compiler
+ osl_compiler = File(env.subst(env['BF_OSL_COMPILER'])).abspath
# build directory
root_build_dir = normpath(env['BF_BUILDDIR'])
diff --git a/intern/cycles/kernel/shaders/node_brick_texture.osl b/intern/cycles/kernel/shaders/node_brick_texture.osl
index 478d9457001..b1f2a35789f 100644
--- a/intern/cycles/kernel/shaders/node_brick_texture.osl
+++ b/intern/cycles/kernel/shaders/node_brick_texture.osl
@@ -58,6 +58,8 @@ float brick(point p, float mortar_size, float bias,
}
shader node_brick_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
float Offset = 0.5,
int OffsetFrequency = 2,
float Squash = 1.0,
@@ -74,10 +76,15 @@ shader node_brick_texture(
output float Fac = 0.0,
output color Color = color(0.2, 0.2, 0.2))
{
+ point p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
float tint = 0.0;
color Col = Color1;
- Fac = brick(Vector * Scale, MortarSize, Bias, BrickWidth, RowHeight,
+ Fac = brick(p * Scale, MortarSize, Bias, BrickWidth, RowHeight,
Offset, OffsetFrequency, Squash, SquashFrequency, tint);
if (Fac != 1.0) {
diff --git a/intern/cycles/kernel/shaders/node_brightness.osl b/intern/cycles/kernel/shaders/node_brightness.osl
index 8e9f5c9c796..b263d815566 100644
--- a/intern/cycles/kernel/shaders/node_brightness.osl
+++ b/intern/cycles/kernel/shaders/node_brightness.osl
@@ -20,32 +20,15 @@
shader node_brightness(
color ColorIn = color(0.8, 0.8, 0.8),
- float Brightness = 0.0,
+ float Bright = 0.0,
float Contrast = 0.0,
output color ColorOut = color(0.8, 0.8, 0.8))
{
- float delta = Contrast * (1.0 / 200.0);
- float a = 1.0 - delta * 2.0;
- float b;
+ float a = 1.0 + Contrast;
+ float b = Bright - Contrast*0.5;
- /* input value is a percentage */
- float bright_factor = Brightness / 100.0;
-
- /*
- * The algorithm is by Werner D. Streidt
- * (http://visca.com/ffactory/archives/5-99/msg00021.html)
- * Extracted of OpenCV demhist.c
- */
-
- if (Contrast > 0.0) {
- a = (a < 0.0 ? 1.0 / a : 0.0);
- b = a * (bright_factor - delta);
- }
- else {
- delta *= -1.0;
- b = a * (bright_factor + delta);
- }
-
- ColorOut = a * ColorIn + b;
+ ColorOut[0] = max(a*ColorIn[0] + b, 0.0);
+ ColorOut[1] = max(a*ColorIn[1] + b, 0.0);
+ ColorOut[2] = max(a*ColorIn[2] + b, 0.0);
}
diff --git a/intern/cycles/kernel/shaders/node_checker_texture.osl b/intern/cycles/kernel/shaders/node_checker_texture.osl
index 577caf308ff..eed56f4453a 100644
--- a/intern/cycles/kernel/shaders/node_checker_texture.osl
+++ b/intern/cycles/kernel/shaders/node_checker_texture.osl
@@ -40,6 +40,8 @@ float checker(point p)
}
shader node_checker_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
float Scale = 5.0,
point Vector = P,
color Color1 = color(0.8, 0.8, 0.8),
@@ -47,7 +49,12 @@ shader node_checker_texture(
output float Fac = 0.0,
output color Color = color(0.0, 0.0, 0.0))
{
- Fac = checker(Vector * Scale);
+ point p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
+ Fac = checker(p * Scale);
if (Fac == 1.0) {
Color = Color1;
}
diff --git a/intern/cycles/kernel/shaders/node_environment_texture.osl b/intern/cycles/kernel/shaders/node_environment_texture.osl
index bad62e56ab4..4367f7f4994 100644
--- a/intern/cycles/kernel/shaders/node_environment_texture.osl
+++ b/intern/cycles/kernel/shaders/node_environment_texture.osl
@@ -19,14 +19,52 @@
#include "stdosl.h"
#include "node_color.h"
+vector environment_texture_direction_to_equirectangular(vector dir)
+{
+ float u = -atan2(dir[1], dir[0])/(2.0*M_PI) + 0.5;
+ float v = atan2(dir[2], hypot(dir[0], dir[1]))/M_PI + 0.5;
+
+ return vector(u, v, 0.0);
+}
+
+vector environment_texture_direction_to_mirrorball(vector dir)
+{
+ dir[1] -= 1.0;
+
+ float div = 2.0*sqrt(max(-0.5*dir[1], 0.0));
+ if(div > 0.0)
+ dir /= div;
+
+ float u = 0.5*(dir[0] + 1.0);
+ float v = 0.5*(dir[2] + 1.0);
+
+ return vector(u, v, 0.0);
+}
+
shader node_environment_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
vector Vector = P,
string filename = "",
+ string projection = "Equirectangular",
string color_space = "sRGB",
output color Color = color(0.0, 0.0, 0.0),
output float Alpha = 1.0)
{
- Color = (color)environment(filename, Vector, "alpha", Alpha);
+ vector p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
+ p = normalize(p);
+
+ if (projection == "Equirectangular")
+ p = environment_texture_direction_to_equirectangular(p);
+ else
+ p = environment_texture_direction_to_mirrorball(p);
+
+ /* todo: use environment for better texture filtering of equirectangular */
+ Color = (color)texture(filename, p[0], 1.0 - p[1], "wrap", "periodic", "alpha", Alpha);
if (color_space == "sRGB")
Color = color_srgb_to_scene_linear(Color);
diff --git a/intern/cycles/kernel/shaders/node_gradient_texture.osl b/intern/cycles/kernel/shaders/node_gradient_texture.osl
index ae7cfa51f59..8d862dbad67 100644
--- a/intern/cycles/kernel/shaders/node_gradient_texture.osl
+++ b/intern/cycles/kernel/shaders/node_gradient_texture.osl
@@ -63,12 +63,19 @@ float gradient(point p, string type)
}
shader node_gradient_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
string Type = "Linear",
point Vector = P,
output float Fac = 0.0,
output color Color = color(0.0, 0.0, 0.0))
{
- Fac = gradient(Vector, Type);
+ point p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
+ Fac = gradient(p, Type);
Color = color(Fac, Fac, Fac);
}
diff --git a/intern/cycles/kernel/shaders/node_hsv.osl b/intern/cycles/kernel/shaders/node_hsv.osl
index 8fd7a1612e8..0f4bedfb0f8 100644
--- a/intern/cycles/kernel/shaders/node_hsv.osl
+++ b/intern/cycles/kernel/shaders/node_hsv.osl
@@ -27,7 +27,6 @@ shader node_hsv(
color ColorIn = color(0.0, 0.0, 0.0),
output color ColorOut = color(0.0, 0.0, 0.0))
{
- float t = clamp(Fac, 0.0, 1.0);
color Color = rgb_to_hsv(ColorIn);
// remember: fmod doesn't work for negative numbers
@@ -38,6 +37,6 @@ shader node_hsv(
Color = hsv_to_rgb(Color);
- ColorOut = mix(Color, ColorIn, t);
+ ColorOut = mix(ColorIn, Color, Fac);
}
diff --git a/intern/cycles/kernel/shaders/node_image_texture.osl b/intern/cycles/kernel/shaders/node_image_texture.osl
index 6393605e6b5..53c4aeaeb5f 100644
--- a/intern/cycles/kernel/shaders/node_image_texture.osl
+++ b/intern/cycles/kernel/shaders/node_image_texture.osl
@@ -30,6 +30,8 @@ color image_texture_lookup(string filename, string color_space, float u, float v
}
shader node_image_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
point Vector = P,
string filename = "",
string color_space = "sRGB",
@@ -38,8 +40,13 @@ shader node_image_texture(
output color Color = color(0.0, 0.0, 0.0),
output float Alpha = 1.0)
{
+ point p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
if (projection == "Flat") {
- Color = image_texture_lookup(filename, color_space, Vector[0], Vector[1], Alpha);
+ Color = image_texture_lookup(filename, color_space, p[0], p[1], Alpha);
}
else if (projection == "Box") {
/* object space normal */
@@ -104,15 +111,15 @@ shader node_image_texture(
float tmp_alpha;
if (weight[0] > 0.0) {
- Color += weight[0]*image_texture_lookup(filename, color_space, Vector[1], Vector[2], tmp_alpha);
+ Color += weight[0]*image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha);
Alpha += weight[0]*tmp_alpha;
}
if (weight[1] > 0.0) {
- Color += weight[1]*image_texture_lookup(filename, color_space, Vector[0], Vector[2], tmp_alpha);
+ Color += weight[1]*image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha);
Alpha += weight[1]*tmp_alpha;
}
if (weight[2] > 0.0) {
- Color += weight[2]*image_texture_lookup(filename, color_space, Vector[1], Vector[0], tmp_alpha);
+ Color += weight[2]*image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha);
Alpha += weight[2]*tmp_alpha;
}
}
diff --git a/intern/cycles/kernel/shaders/node_magic_texture.osl b/intern/cycles/kernel/shaders/node_magic_texture.osl
index e464b83bc9e..b81a30499b2 100644
--- a/intern/cycles/kernel/shaders/node_magic_texture.osl
+++ b/intern/cycles/kernel/shaders/node_magic_texture.osl
@@ -93,12 +93,19 @@ color magic(point p, int n, float distortion)
}
shader node_magic_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
int Depth = 2,
float Distortion = 5.0,
float Scale = 5.0,
point Vector = P,
output color Color = color(0.0, 0.0, 0.0))
{
- Color = magic(Vector * Scale, Depth, Distortion);
+ point p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
+ Color = magic(p * Scale, Depth, Distortion);
}
diff --git a/intern/cycles/kernel/shaders/node_musgrave_texture.osl b/intern/cycles/kernel/shaders/node_musgrave_texture.osl
index 71461b8fd79..afdbca27a3f 100644
--- a/intern/cycles/kernel/shaders/node_musgrave_texture.osl
+++ b/intern/cycles/kernel/shaders/node_musgrave_texture.osl
@@ -187,6 +187,8 @@ float noise_musgrave_ridged_multi_fractal(point p, string basis, float H,
/* Shader */
shader node_musgrave_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
string Type = "fBM",
float Dimension = 2.0,
float Lacunarity = 1.0,
@@ -204,7 +206,12 @@ shader node_musgrave_texture(
string Basis = "Perlin";
float intensity = 1.0;
- point p = Vector * Scale;
+ point p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
+ p = p * Scale;
if (Type == "Multifractal")
Fac = intensity * noise_musgrave_multi_fractal(p, Basis, dimension, lacunarity, octaves);
diff --git a/intern/cycles/kernel/shaders/node_noise_texture.osl b/intern/cycles/kernel/shaders/node_noise_texture.osl
index 227b2bf8cea..0a379491781 100644
--- a/intern/cycles/kernel/shaders/node_noise_texture.osl
+++ b/intern/cycles/kernel/shaders/node_noise_texture.osl
@@ -43,6 +43,8 @@ float noise(point p, string basis, float distortion, float detail, float fac, co
}
shader node_noise_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
float Distortion = 0.0,
float Scale = 5.0,
float Detail = 2.0,
@@ -50,7 +52,12 @@ shader node_noise_texture(
output float Fac = 0.0,
output color Color = color(0.2, 0.2, 0.2))
{
+ point p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
string Basis = "Perlin";
- Fac = noise(Vector * Scale, Basis, Distortion, Detail, Fac, Color);
+ Fac = noise(p * Scale, Basis, Distortion, Detail, Fac, Color);
}
diff --git a/intern/cycles/kernel/shaders/node_sky_texture.osl b/intern/cycles/kernel/shaders/node_sky_texture.osl
index 932fb1e2f17..24a63c78458 100644
--- a/intern/cycles/kernel/shaders/node_sky_texture.osl
+++ b/intern/cycles/kernel/shaders/node_sky_texture.osl
@@ -43,9 +43,9 @@ color xyY_to_xyz(float x, float y, float Y)
color xyz_to_rgb(float x, float y, float z)
{
- return color(3.240479 * x + -1.537150 * y + -0.498535 * z,
- -0.969256 * x + 1.875991 * y + 0.041556 * z,
- 0.055648 * x + -0.204043 * y + 1.057311 * z);
+ return color( 3.240479 * x + -1.537150 * y + -0.498535 * z,
+ -0.969256 * x + 1.875991 * y + 0.041556 * z,
+ 0.055648 * x + -0.204043 * y + 1.057311 * z);
}
float sky_angle_between(float thetav, float phiv, float theta, float phi)
@@ -149,14 +149,21 @@ void precompute_sunsky(vector dir, float turbidity, output KernelSunSky sunsky)
}
shader node_sky_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
vector Vector = P,
vector sun_direction = vector(0, 0, 1),
float turbidity = 2.2,
output color Color = color(0.0, 0.0, 0.0))
{
+ vector p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
KernelSunSky sunsky;
precompute_sunsky(sun_direction, turbidity, sunsky);
- Color = sky_xyz_radiance(sunsky, Vector);
+ Color = sky_xyz_radiance(sunsky, p);
}
diff --git a/intern/cycles/kernel/shaders/node_texture_coordinate.osl b/intern/cycles/kernel/shaders/node_texture_coordinate.osl
index 791838dfffe..37460bcfc98 100644
--- a/intern/cycles/kernel/shaders/node_texture_coordinate.osl
+++ b/intern/cycles/kernel/shaders/node_texture_coordinate.osl
@@ -56,7 +56,7 @@ shader node_texture_coordinate(
Camera = transform("camera", P);
Window = transform("NDC", P);
Normal = transform("world", "object", NormalIn);
- Reflection = reflect(I, NormalIn);
+ Reflection = -reflect(I, NormalIn);
}
if (bump_offset == "dx") {
@@ -77,5 +77,7 @@ shader node_texture_coordinate(
Camera += Dy(Camera);
Window += Dy(Window);
}
+
+ Window[2] = 0.0;
}
diff --git a/intern/cycles/kernel/shaders/node_voronoi_texture.osl b/intern/cycles/kernel/shaders/node_voronoi_texture.osl
index a44df00a267..43f8ecc666a 100644
--- a/intern/cycles/kernel/shaders/node_voronoi_texture.osl
+++ b/intern/cycles/kernel/shaders/node_voronoi_texture.osl
@@ -22,17 +22,24 @@
/* Voronoi */
shader node_voronoi_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
string Coloring = "Intensity",
float Scale = 5.0,
point Vector = P,
output float Fac = 0.0,
output color Color = color(0.0, 0.0, 0.0))
{
+ point p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
/* compute distance and point coordinate of 4 nearest neighbours */
float da[4];
point pa[4];
- voronoi(Vector * Scale, "Distance Squared", 1.0, da, pa);
+ voronoi(p * Scale, "Distance Squared", 1.0, da, pa);
/* Colored output */
if (Coloring == "Intensity") {
diff --git a/intern/cycles/kernel/shaders/node_ward_bsdf.osl b/intern/cycles/kernel/shaders/node_ward_bsdf.osl
index e5c6f0ad705..82ce15ab9b6 100644
--- a/intern/cycles/kernel/shaders/node_ward_bsdf.osl
+++ b/intern/cycles/kernel/shaders/node_ward_bsdf.osl
@@ -30,20 +30,20 @@ shader node_ward_bsdf(
/* rotate tangent around normal */
vector T = Tangent;
- if(Rotation != 0.0)
+ if (Rotation != 0.0)
T = rotate(T, Rotation*2.0*M_PI, point(0.0, 0.0, 0.0), Normal);
/* compute roughness */
float RoughnessU, RoughnessV;
float aniso = clamp(Anisotropy, -0.99, 0.99);
- if(aniso < 0.0) {
- RoughnessU = Roughness/(1.0 + aniso);
- RoughnessV = Roughness*(1.0 + aniso);
+ if (aniso < 0.0) {
+ RoughnessU = Roughness / (1.0 + aniso);
+ RoughnessV = Roughness * (1.0 + aniso);
}
else {
- RoughnessU = Roughness*(1.0 - aniso);
- RoughnessV = Roughness/(1.0 - aniso);
+ RoughnessU = Roughness * (1.0 - aniso);
+ RoughnessV = Roughness / (1.0 - aniso);
}
BSDF = Color * ward(Normal, T, RoughnessU, RoughnessV);
diff --git a/intern/cycles/kernel/shaders/node_wave_texture.osl b/intern/cycles/kernel/shaders/node_wave_texture.osl
index 79b8a8885d1..6648cd06278 100644
--- a/intern/cycles/kernel/shaders/node_wave_texture.osl
+++ b/intern/cycles/kernel/shaders/node_wave_texture.osl
@@ -46,6 +46,8 @@ float wave(point p, float scale, string type, float detail, float distortion, fl
}
shader node_wave_texture(
+ int use_mapping = 0,
+ matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
string Type = "Bands",
float Scale = 5.0,
float Distortion = 0.0,
@@ -55,7 +57,12 @@ shader node_wave_texture(
output float Fac = 0.0,
output color Color = color (0.0, 0.0, 0.0))
{
- Fac = wave(Vector, Scale, Type, Detail, Distortion, DetailScale);
+ point p = Vector;
+
+ if (use_mapping)
+ p = transform(mapping, p);
+
+ Fac = wave(p, Scale, Type, Detail, Distortion, DetailScale);
Color = color(Fac, Fac, Fac);
}
diff --git a/intern/cycles/kernel/svm/svm_bsdf.h b/intern/cycles/kernel/svm/svm_bsdf.h
index 373710446e5..07927fe5691 100644
--- a/intern/cycles/kernel/svm/svm_bsdf.h
+++ b/intern/cycles/kernel/svm/svm_bsdf.h
@@ -24,7 +24,7 @@
#include "../closure/bsdf_reflection.h"
#include "../closure/bsdf_refraction.h"
#include "../closure/bsdf_transparent.h"
-#ifdef __DPDU__
+#ifdef __ANISOTROPIC__
#include "../closure/bsdf_ward.h"
#endif
#include "../closure/bsdf_westin.h"
@@ -75,7 +75,7 @@ __device int svm_bsdf_sample(const ShaderData *sd, const ShaderClosure *sc, floa
label = bsdf_microfacet_beckmann_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
break;
-#ifdef __DPDU__
+#ifdef __ANISOTROPIC__
case CLOSURE_BSDF_WARD_ID:
label = bsdf_ward_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
@@ -138,7 +138,7 @@ __device float3 svm_bsdf_eval(const ShaderData *sd, const ShaderClosure *sc, con
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
eval = bsdf_microfacet_beckmann_eval_reflect(sc, sd->I, omega_in, pdf);
break;
-#ifdef __DPDU__
+#ifdef __ANISOTROPIC__
case CLOSURE_BSDF_WARD_ID:
eval = bsdf_ward_eval_reflect(sc, sd->I, omega_in, pdf);
break;
@@ -187,7 +187,7 @@ __device float3 svm_bsdf_eval(const ShaderData *sd, const ShaderClosure *sc, con
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
eval = bsdf_microfacet_beckmann_eval_transmit(sc, sd->I, omega_in, pdf);
break;
-#ifdef __DPDU__
+#ifdef __ANISOTROPIC__
case CLOSURE_BSDF_WARD_ID:
eval = bsdf_ward_eval_transmit(sc, sd->I, omega_in, pdf);
break;
@@ -244,7 +244,7 @@ __device void svm_bsdf_blur(ShaderClosure *sc, float roughness)
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
bsdf_microfacet_beckmann_blur(sc, roughness);
break;
-#ifdef __DPDU__
+#ifdef __ANISOTROPIC__
case CLOSURE_BSDF_WARD_ID:
bsdf_ward_blur(sc, roughness);
break;
diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h
index f378d24463d..a4f8546f62b 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -225,7 +225,6 @@ __device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *st
break;
}
-#ifdef __DPDU__
case CLOSURE_BSDF_WARD_ID: {
#ifdef __CAUSTICS_TRICKS__
if(kernel_data.integrator.no_caustics && (path_flag & PATH_RAY_DIFFUSE))
@@ -233,9 +232,11 @@ __device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *st
#endif
ShaderClosure *sc = svm_node_closure_get(sd);
sc->N = N;
- sc->T = stack_load_float3(stack, data_node.z);
svm_node_closure_set_mix_weight(sc, mix_weight);
+#ifdef __ANISOTROPIC__
+ sc->T = stack_load_float3(stack, data_node.z);
+
/* rotate tangent */
float rotation = stack_load_float(stack, data_node.w);
@@ -256,9 +257,11 @@ __device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *st
}
sd->flag |= bsdf_ward_setup(sc);
+#else
+ sd->flag |= bsdf_diffuse_setup(sc);
+#endif
break;
}
-#endif
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID: {
ShaderClosure *sc = svm_node_closure_get(sd);
sc->N = N;
diff --git a/intern/cycles/kernel/svm/svm_hsv.h b/intern/cycles/kernel/svm/svm_hsv.h
index bce11d62923..26b6141ee3f 100644
--- a/intern/cycles/kernel/svm/svm_hsv.h
+++ b/intern/cycles/kernel/svm/svm_hsv.h
@@ -110,7 +110,7 @@ __device void svm_node_hsv(KernelGlobals *kg, ShaderData *sd, float *stack, uint
color = rgb_to_hsv(color);
- // remember: fmod doesn't work for negative numbers
+ /* remember: fmod doesn't work for negative numbers here */
color.x += hue + 0.5f;
color.x = fmod(color.x, 1.0f);
color.y *= sat;
diff --git a/intern/cycles/kernel/svm/svm_math.h b/intern/cycles/kernel/svm/svm_math.h
index e39c7a4ba6c..db3b8d3f763 100644
--- a/intern/cycles/kernel/svm/svm_math.h
+++ b/intern/cycles/kernel/svm/svm_math.h
@@ -38,6 +38,21 @@ __device float safe_acosf(float a)
return acosf(a);
}
+__device float compatible_powf(float x, float y)
+{
+ /* GPU pow doesn't accept negative x, do manual checks here */
+ if(x < 0.0f) {
+ if(fmod(-y, 2.0f) == 0.0f)
+ return powf(-x, y);
+ else
+ return -powf(-x, y);
+ }
+ else if(x == 0.0f)
+ return 0.0f;
+
+ return powf(x, y);
+}
+
__device float safe_powf(float a, float b)
{
if(b == 0.0f)
@@ -47,7 +62,7 @@ __device float safe_powf(float a, float b)
if(a < 0.0f && b != (int)b)
return 0.0f;
- return powf(a, b);
+ return compatible_powf(a, b);
}
__device float safe_logf(float a, float b)
diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h
index 8ca7dff3970..9f2d3367420 100644
--- a/intern/cycles/kernel/svm/svm_tex_coord.h
+++ b/intern/cycles/kernel/svm/svm_tex_coord.h
@@ -20,17 +20,19 @@ CCL_NAMESPACE_BEGIN
/* Texture Coordinate Node */
-__device_inline float3 svm_background_offset(KernelGlobals *kg)
+__device_inline float3 svm_background_position(KernelGlobals *kg, float3 P)
{
Transform cameratoworld = kernel_data.cam.cameratoworld;
- return make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
+ float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
+
+ return camP + P;
}
__device_inline float3 svm_world_to_ndc(KernelGlobals *kg, ShaderData *sd, float3 P)
{
if(kernel_data.cam.type != CAMERA_PANORAMA) {
if(sd->object == ~0)
- P += svm_background_offset(kg);
+ P = svm_background_position(kg, P);
Transform tfm = kernel_data.cam.worldtondc;
return transform_perspective(&tfm, P);
@@ -78,11 +80,12 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack
if(sd->object != ~0)
data = transform_point(&tfm, sd->P);
else
- data = transform_point(&tfm, sd->P + svm_background_offset(kg));
+ data = transform_point(&tfm, svm_background_position(kg, sd->P));
break;
}
case NODE_TEXCO_WINDOW: {
data = svm_world_to_ndc(kg, sd, sd->P);
+ data.z = 0.0f;
break;
}
case NODE_TEXCO_REFLECTION: {
@@ -135,11 +138,12 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa
if(sd->object != ~0)
data = transform_point(&tfm, sd->P + sd->dP.dx);
else
- data = transform_point(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
+ data = transform_point(&tfm, svm_background_position(kg, sd->P + sd->dP.dx));
break;
}
case NODE_TEXCO_WINDOW: {
data = svm_world_to_ndc(kg, sd, sd->P + sd->dP.dx);
+ data.z = 0.0f;
break;
}
case NODE_TEXCO_REFLECTION: {
@@ -195,11 +199,12 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa
if(sd->object != ~0)
data = transform_point(&tfm, sd->P + sd->dP.dy);
else
- data = transform_point(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
+ data = transform_point(&tfm, svm_background_position(kg, sd->P + sd->dP.dy));
break;
}
case NODE_TEXCO_WINDOW: {
data = svm_world_to_ndc(kg, sd, sd->P + sd->dP.dy);
+ data.z = 0.0f;
break;
}
case NODE_TEXCO_REFLECTION: {
@@ -278,7 +283,7 @@ __device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *stac
N = normalize(sd->N + (N - sd->N)*strength);
}
- stack_store_float3(stack, normal_offset, normalize(N));
+ stack_store_float3(stack, normal_offset, N);
}
__device void svm_node_tangent(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node)
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index 308ebd0794a..32c273c1248 100644
--- a/intern/cycles/render/camera.cpp
+++ b/intern/cycles/render/camera.cpp
@@ -89,13 +89,12 @@ void Camera::update()
Transform ndctoraster = transform_scale(width, height, 1.0f);
/* raster to screen */
- Transform screentoraster = ndctoraster;
-
- screentoraster = ndctoraster *
+ Transform screentondc =
transform_scale(1.0f/(viewplane.right - viewplane.left),
1.0f/(viewplane.top - viewplane.bottom), 1.0f) *
transform_translate(-viewplane.left, -viewplane.bottom, 0.0f);
+ Transform screentoraster = ndctoraster * screentondc;
Transform rastertoscreen = transform_inverse(screentoraster);
/* screen to camera */
@@ -105,14 +104,24 @@ void Camera::update()
screentocamera = transform_inverse(transform_orthographic(nearclip, farclip));
else
screentocamera = transform_identity();
+
+ Transform cameratoscreen = transform_inverse(screentocamera);
rastertocamera = screentocamera * rastertoscreen;
+ cameratoraster = screentoraster * cameratoscreen;
cameratoworld = matrix;
screentoworld = cameratoworld * screentocamera;
rastertoworld = cameratoworld * rastertocamera;
ndctoworld = rastertoworld * ndctoraster;
- worldtoraster = transform_inverse(rastertoworld);
+
+ /* note we recompose matrices instead of taking inverses of the above, this
+ * is needed to avoid inverting near degenerate matrices that happen due to
+ * precision issues with large scenes */
+ worldtocamera = transform_inverse(matrix);
+ worldtoscreen = cameratoscreen * worldtocamera;
+ worldtondc = screentondc * worldtoscreen;
+ worldtoraster = ndctoraster * worldtondc;
/* differentials */
if(type == CAMERA_ORTHOGRAPHIC) {
@@ -160,10 +169,10 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
kcam->rastertoworld = rastertoworld;
kcam->rastertocamera = rastertocamera;
kcam->cameratoworld = cameratoworld;
- kcam->worldtoscreen = transform_inverse(screentoworld);
+ kcam->worldtocamera = worldtocamera;
+ kcam->worldtoscreen = worldtoscreen;
kcam->worldtoraster = worldtoraster;
- kcam->worldtondc = transform_inverse(ndctoworld);
- kcam->worldtocamera = transform_inverse(cameratoworld);
+ kcam->worldtondc = worldtondc;
/* camera motion */
kcam->have_motion = 0;
@@ -181,8 +190,8 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
}
else {
if(use_motion) {
- kcam->motion.pre = transform_inverse(motion.pre * rastertocamera);
- kcam->motion.post = transform_inverse(motion.post * rastertocamera);
+ kcam->motion.pre = cameratoraster * transform_inverse(motion.pre);
+ kcam->motion.post = cameratoraster * transform_inverse(motion.post);
}
else {
kcam->motion.pre = worldtoraster;
diff --git a/intern/cycles/render/camera.h b/intern/cycles/render/camera.h
index 4c2de7b50b8..9696161180d 100644
--- a/intern/cycles/render/camera.h
+++ b/intern/cycles/render/camera.h
@@ -82,9 +82,15 @@ public:
Transform screentoworld;
Transform rastertoworld;
Transform ndctoworld;
- Transform rastertocamera;
Transform cameratoworld;
+
Transform worldtoraster;
+ Transform worldtoscreen;
+ Transform worldtondc;
+ Transform worldtocamera;
+
+ Transform rastertocamera;
+ Transform cameratoraster;;
float3 dx;
float3 dy;
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index f136f08dc2c..230a12f9ff2 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -36,6 +36,7 @@ ImageManager::ImageManager()
need_update = true;
pack_images = false;
osl_texture_system = NULL;
+ animation_frame = 0;
tex_num_images = TEX_NUM_IMAGES;
tex_num_float_images = TEX_NUM_FLOAT_IMAGES;
@@ -67,7 +68,24 @@ void ImageManager::set_extended_image_limits(void)
tex_image_byte_start = TEX_EXTENDED_IMAGE_BYTE_START;
}
-static bool is_float_image(const string& filename)
+bool ImageManager::set_animation_frame_update(int frame)
+{
+ if(frame != animation_frame) {
+ animation_frame = frame;
+
+ for(size_t slot = 0; slot < images.size(); slot++)
+ if(images[slot] && images[slot]->animated)
+ return true;
+
+ for(size_t slot = 0; slot < float_images.size(); slot++)
+ if(float_images[slot] && float_images[slot]->animated)
+ return true;
+ }
+
+ return false;
+}
+
+bool ImageManager::is_float_image(const string& filename)
{
ImageInput *in = ImageInput::create(filename);
bool is_float = false;
@@ -95,7 +113,7 @@ static bool is_float_image(const string& filename)
return is_float;
}
-int ImageManager::add_image(const string& filename, bool& is_float)
+int ImageManager::add_image(const string& filename, bool animated, bool& is_float)
{
Image *img;
size_t slot;
@@ -133,6 +151,7 @@ int ImageManager::add_image(const string& filename, bool& is_float)
img = new Image();
img->filename = filename;
img->need_load = true;
+ img->animated = animated;
img->users = 1;
float_images[slot] = img;
@@ -166,6 +185,7 @@ int ImageManager::add_image(const string& filename, bool& is_float)
img = new Image();
img->filename = filename;
img->need_load = true;
+ img->animated = animated;
img->users = 1;
images[slot] = img;
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 485bfc5cbf5..4d177174971 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -51,16 +51,17 @@ public:
ImageManager();
~ImageManager();
- int add_image(const string& filename, bool& is_float);
+ int add_image(const string& filename, bool animated, bool& is_float);
void remove_image(const string& filename);
+ bool is_float_image(const string& filename);
void device_update(Device *device, DeviceScene *dscene, Progress& progress);
void device_free(Device *device, DeviceScene *dscene);
void set_osl_texture_system(void *texture_system);
void set_pack_images(bool pack_images_);
-
void set_extended_image_limits(void);
+ bool set_animation_frame_update(int frame);
bool need_update;
@@ -69,11 +70,13 @@ private:
int tex_num_float_images;
int tex_image_byte_start;
thread_mutex device_mutex;
+ int animation_frame;
struct Image {
string filename;
bool need_load;
+ bool animated;
int users;
};
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index cdc3b555a51..48a8565ed98 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -100,6 +100,16 @@ void TextureMapping::compile(SVMCompiler& compiler, int offset_in, int offset_ou
}
}
+void TextureMapping::compile(OSLCompiler &compiler)
+{
+ if(!skip()) {
+ Transform tfm = transform_transpose(compute_transform());
+
+ compiler.parameter("mapping", tfm);
+ compiler.parameter("use_mapping", 1);
+ }
+}
+
/* Image Texture */
static ShaderEnum color_space_init()
@@ -130,11 +140,12 @@ ImageTextureNode::ImageTextureNode()
{
image_manager = NULL;
slot = -1;
- is_float = false;
+ is_float = -1;
filename = "";
color_space = ustring("Color");
projection = ustring("Flat");;
projection_blend = 0.0f;
+ animated = false;
add_input("Vector", SHADER_SOCKET_POINT, ShaderInput::TEXTURE_UV);
add_output("Color", SHADER_SOCKET_COLOR);
@@ -152,7 +163,7 @@ ShaderNode *ImageTextureNode::clone() const
ImageTextureNode *node = new ImageTextureNode(*this);
node->image_manager = NULL;
node->slot = -1;
- node->is_float = false;
+ node->is_float = -1;
return node;
}
@@ -163,8 +174,11 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
ShaderOutput *alpha_out = output("Alpha");
image_manager = compiler.image_manager;
- if(slot == -1)
- slot = image_manager->add_image(filename, is_float);
+ if(is_float == -1) {
+ bool is_float_bool;
+ slot = image_manager->add_image(filename, animated, is_float_bool);
+ is_float = (int)is_float_bool;
+ }
if(!color_out->links.empty())
compiler.stack_assign(color_out);
@@ -220,6 +234,11 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
void ImageTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
+ if(is_float == -1)
+ is_float = (int)image_manager->is_float_image(filename);
+
compiler.parameter("filename", filename.c_str());
if(is_float || color_space != "Color")
compiler.parameter("color_space", "Linear");
@@ -250,10 +269,11 @@ EnvironmentTextureNode::EnvironmentTextureNode()
{
image_manager = NULL;
slot = -1;
- is_float = false;
+ is_float = -1;
filename = "";
color_space = ustring("Color");
projection = ustring("Equirectangular");
+ animated = false;
add_input("Vector", SHADER_SOCKET_VECTOR, ShaderInput::POSITION);
add_output("Color", SHADER_SOCKET_COLOR);
@@ -271,7 +291,7 @@ ShaderNode *EnvironmentTextureNode::clone() const
EnvironmentTextureNode *node = new EnvironmentTextureNode(*this);
node->image_manager = NULL;
node->slot = -1;
- node->is_float = false;
+ node->is_float = -1;
return node;
}
@@ -282,8 +302,11 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
ShaderOutput *alpha_out = output("Alpha");
image_manager = compiler.image_manager;
- if(slot == -1)
- slot = image_manager->add_image(filename, is_float);
+ if(slot == -1) {
+ bool is_float_bool;
+ slot = image_manager->add_image(filename, animated, is_float_bool);
+ is_float = (int)is_float_bool;
+ }
if(!color_out->links.empty())
compiler.stack_assign(color_out);
@@ -328,7 +351,13 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
void EnvironmentTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
+ if(is_float == -1)
+ is_float = (int)image_manager->is_float_image(filename);
+
compiler.parameter("filename", filename.c_str());
+ compiler.parameter("projection", projection);
if(is_float || color_space != "Color")
compiler.parameter("color_space", "Linear");
else
@@ -438,6 +467,8 @@ void SkyTextureNode::compile(SVMCompiler& compiler)
void SkyTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
compiler.parameter_vector("sun_direction", sun_direction);
compiler.parameter("turbidity", turbidity);
compiler.add(this, "node_sky_texture");
@@ -501,6 +532,8 @@ void GradientTextureNode::compile(SVMCompiler& compiler)
void GradientTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
compiler.parameter("Type", type);
compiler.add(this, "node_gradient_texture");
}
@@ -559,6 +592,8 @@ void NoiseTextureNode::compile(SVMCompiler& compiler)
void NoiseTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
compiler.add(this, "node_noise_texture");
}
@@ -619,6 +654,8 @@ void VoronoiTextureNode::compile(SVMCompiler& compiler)
void VoronoiTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
compiler.parameter("Coloring", coloring);
compiler.add(this, "node_voronoi_texture");
}
@@ -706,6 +743,8 @@ void MusgraveTextureNode::compile(SVMCompiler& compiler)
void MusgraveTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
compiler.parameter("Type", type);
compiler.add(this, "node_musgrave_texture");
@@ -784,6 +823,8 @@ void WaveTextureNode::compile(SVMCompiler& compiler)
void WaveTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
compiler.parameter("Type", type);
compiler.add(this, "node_wave_texture");
@@ -841,6 +882,8 @@ void MagicTextureNode::compile(SVMCompiler& compiler)
void MagicTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
compiler.parameter("Depth", depth);
compiler.add(this, "node_magic_texture");
}
@@ -897,6 +940,8 @@ void CheckerTextureNode::compile(SVMCompiler& compiler)
void CheckerTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
compiler.add(this, "node_checker_texture");
}
@@ -985,6 +1030,8 @@ void BrickTextureNode::compile(SVMCompiler& compiler)
void BrickTextureNode::compile(OSLCompiler& compiler)
{
+ tex_mapping.compile(compiler);
+
compiler.parameter("Offset", offset);
compiler.parameter("OffsetFrequency", offset_frequency);
compiler.parameter("Squash", squash);
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 27b07769e28..3e89c2286ad 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -36,6 +36,7 @@ public:
Transform compute_transform();
bool skip();
void compile(SVMCompiler& compiler, int offset_in, int offset_out);
+ void compile(OSLCompiler &compiler);
float3 translation;
float3 rotation;
@@ -67,11 +68,12 @@ public:
ImageManager *image_manager;
int slot;
- bool is_float;
+ int is_float;
string filename;
ustring color_space;
ustring projection;
float projection_blend;
+ bool animated;
static ShaderEnum color_space_enum;
static ShaderEnum projection_enum;
@@ -85,10 +87,11 @@ public:
ImageManager *image_manager;
int slot;
- bool is_float;
+ int is_float;
string filename;
ustring color_space;
ustring projection;
+ bool animated;
static ShaderEnum color_space_enum;
static ShaderEnum projection_enum;
diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index 5fbc7932849..c5ecddcfc15 100644
--- a/intern/cycles/render/osl.cpp
+++ b/intern/cycles/render/osl.cpp
@@ -81,13 +81,14 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
if(shader->sample_as_light && shader->has_surface_emission)
scene->light_manager->need_update = true;
- OSLCompiler compiler((void*)this, (void*)ss);
+ OSLCompiler compiler((void*)this, (void*)ss, scene->image_manager);
compiler.background = (shader == scene->shaders[scene->default_background]);
compiler.compile(og, shader);
}
/* setup shader engine */
og->ss = ss;
+ og->ts = ts;
og->services = services;
int background_id = scene->shader_manager->get_shader_id(scene->default_background);
og->background_state = og->surface_state[background_id & SHADER_MASK];
@@ -118,6 +119,7 @@ void OSLShaderManager::device_free(Device *device, DeviceScene *dscene)
/* clear shader engine */
og->use = false;
og->ss = NULL;
+ og->ts = NULL;
og->surface_state.clear();
og->volume_state.clear();
@@ -286,10 +288,11 @@ const char *OSLShaderManager::shader_load_bytecode(const string& hash, const str
/* Graph Compiler */
-OSLCompiler::OSLCompiler(void *manager_, void *shadingsys_)
+OSLCompiler::OSLCompiler(void *manager_, void *shadingsys_, ImageManager *image_manager_)
{
manager = manager_;
shadingsys = shadingsys_;
+ image_manager = image_manager_;
current_type = SHADER_TYPE_SURFACE;
current_shader = NULL;
background = false;
@@ -333,7 +336,7 @@ string OSLCompiler::compatible_name(ShaderNode *node, ShaderOutput *output)
while((i = sname.find(" ")) != string::npos)
sname.replace(i, 1, "");
- /* if output exists with the same name, add "In" suffix */
+ /* if input exists with the same name, add "Out" suffix */
foreach(ShaderInput *input, node->inputs) {
if (strcmp(input->name, output->name)==0) {
sname += "Out";
diff --git a/intern/cycles/render/osl.h b/intern/cycles/render/osl.h
index b4b3f59e02a..17934765155 100644
--- a/intern/cycles/render/osl.h
+++ b/intern/cycles/render/osl.h
@@ -83,7 +83,7 @@ protected:
class OSLCompiler {
public:
- OSLCompiler(void *manager, void *shadingsys);
+ OSLCompiler(void *manager, void *shadingsys, ImageManager *image_manager);
void compile(OSLGlobals *og, Shader *shader);
void add(ShaderNode *node, const char *name, bool isfilepath = false);
@@ -110,6 +110,7 @@ public:
ShaderType output_type() { return current_type; }
bool background;
+ ImageManager *image_manager;
private:
string id(ShaderNode *node);
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index dc249984499..73904eac41d 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -487,7 +487,39 @@ void SVMCompiler::generate_closure(ShaderNode *node, set<ShaderNode*>& done)
}
}
-void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& done, uint in_offset)
+void SVMCompiler::count_closure_users(ShaderNode *node, map<ShaderNode*, MultiClosureData>& closure_data)
+{
+ /* here we count the number of times each closure node is used, so that
+ * the last time we encounter it we can run the actually code with the
+ * weights from all other places added together */
+
+ if(node->name == ustring("mix_closure") || node->name == ustring("add_closure")) {
+ ShaderInput *cl1in = node->input("Closure1");
+ ShaderInput *cl2in = node->input("Closure2");
+
+ if(cl1in->link)
+ count_closure_users(cl1in->link->parent, closure_data);
+ if(cl2in->link)
+ count_closure_users(cl2in->link->parent, closure_data);
+ }
+ else {
+ MultiClosureData data;
+
+ if(closure_data.find(node) == closure_data.end()) {
+ data.stack_offset = SVM_STACK_INVALID;
+ data.users = 1;
+ }
+ else {
+ data = closure_data[node];
+ data.users++;
+ }
+
+ closure_data[node] = data;
+ }
+}
+
+void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& done,
+ map<ShaderNode*, MultiClosureData>& closure_data, uint in_offset)
{
/* todo: the weaks point here is that unlike the single closure sampling
* we will evaluate all nodes even if they are used as input for closures
@@ -524,21 +556,37 @@ void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& don
out2_offset = in_offset;
}
- if(cl1in->link) {
- generate_multi_closure(cl1in->link->parent, done, out1_offset);
-
- if(fin)
- stack_clear_offset(SHADER_SOCKET_FLOAT, out1_offset);
- }
+ if(cl1in->link)
+ generate_multi_closure(cl1in->link->parent, done, closure_data, out1_offset);
- if(cl2in->link) {
- generate_multi_closure(cl2in->link->parent, done, out2_offset);
+ if(cl2in->link)
+ generate_multi_closure(cl2in->link->parent, done, closure_data, out2_offset);
- if(fin)
- stack_clear_offset(SHADER_SOCKET_FLOAT, out2_offset);
- }
+ if(in_offset != SVM_STACK_INVALID)
+ stack_clear_offset(SHADER_SOCKET_FLOAT, in_offset);
}
else {
+ MultiClosureData data = closure_data[node];
+
+ if(data.stack_offset == SVM_STACK_INVALID) {
+ /* first time using closure, use stack position for weight */
+ data.stack_offset = in_offset;
+ }
+ else {
+ /* not first time using, add weights together */
+ add_node(NODE_MATH, NODE_MATH_ADD, data.stack_offset, in_offset);
+ add_node(NODE_MATH, data.stack_offset);
+
+ stack_clear_offset(SHADER_SOCKET_FLOAT, in_offset);
+ }
+
+ data.users--;
+ closure_data[node] = data;
+
+ /* still users coming? skip generating closure code */
+ if(data.users > 0)
+ return;
+
/* execute dependencies for closure */
foreach(ShaderInput *in, node->inputs) {
if(!node_skip_input(node, in) && in->link) {
@@ -548,7 +596,7 @@ void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& don
}
}
- mix_weight_offset = in_offset;
+ mix_weight_offset = data.stack_offset;
/* compile closure itself */
node->compile(*this);
@@ -563,6 +611,9 @@ void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& don
current_shader->has_surface_transparent = true;
/* end node is added outside of this */
+
+ if(data.stack_offset != SVM_STACK_INVALID)
+ stack_clear_offset(SHADER_SOCKET_FLOAT, data.stack_offset);
}
}
@@ -634,8 +685,12 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
if(generate) {
set<ShaderNode*> done;
- if(use_multi_closure)
- generate_multi_closure(clin->link->parent, done, SVM_STACK_INVALID);
+ if(use_multi_closure) {
+ map<ShaderNode*, MultiClosureData> closure_data;
+
+ count_closure_users(clin->link->parent, closure_data);
+ generate_multi_closure(clin->link->parent, done, closure_data, SVM_STACK_INVALID);
+ }
else
generate_closure(clin->link->parent, done);
}
diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h
index 0db68f400fc..c7b66d97289 100644
--- a/intern/cycles/render/svm.h
+++ b/intern/cycles/render/svm.h
@@ -81,6 +81,7 @@ public:
bool background;
protected:
+ /* stack */
struct Stack {
Stack() { memset(users, 0, sizeof(users)); }
Stack(const Stack& other) { memcpy(users, other.users, sizeof(users)); }
@@ -123,11 +124,22 @@ protected:
bool node_skip_input(ShaderNode *node, ShaderInput *input);
+ /* single closure */
void find_dependencies(set<ShaderNode*>& dependencies, const set<ShaderNode*>& done, ShaderInput *input);
void generate_svm_nodes(const set<ShaderNode*>& nodes, set<ShaderNode*>& done);
void generate_closure(ShaderNode *node, set<ShaderNode*>& done);
- void generate_multi_closure(ShaderNode *node, set<ShaderNode*>& done, uint in_offset);
+ /* multi closure */
+ struct MultiClosureData {
+ int stack_offset;
+ int users;
+ };
+
+ void generate_multi_closure(ShaderNode *node, set<ShaderNode*>& done,
+ map<ShaderNode*,MultiClosureData>& closure_data, uint in_offset);
+ void count_closure_users(ShaderNode *node, map<ShaderNode*, MultiClosureData>& closure_data);
+
+ /* compile */
void compile_type(Shader *shader, ShaderGraph *graph, ShaderType type);
vector<int4> svm_nodes;
diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h
index a0cdf1761ad..6dd1c6c71e8 100644
--- a/intern/cycles/util/util_boundbox.h
+++ b/intern/cycles/util/util_boundbox.h
@@ -182,6 +182,16 @@ public:
bottom == other.bottom && top == other.top);
}
+ float width()
+ {
+ return right - left;
+ }
+
+ float height()
+ {
+ return top - bottom;
+ }
+
BoundBox2D operator*(float f) const
{
BoundBox2D result;
diff --git a/intern/elbeem/intern/ntl_geometryobject.cpp b/intern/elbeem/intern/ntl_geometryobject.cpp
index 4f640253f0f..1e08cb96a95 100644
--- a/intern/elbeem/intern/ntl_geometryobject.cpp
+++ b/intern/elbeem/intern/ntl_geometryobject.cpp
@@ -787,7 +787,7 @@ ntlVec3Gfx ntlGeometryObject::getTranslation(double t) {
}
/*! get active flag time t*/
float ntlGeometryObject::getGeoActive(double t) {
- float act = mcGeoActive.get(t); // if <= 0.0 -> off
+ float act = (mcGeoActive.get(t) >= 1.) ? 1.0 : 0.0;
return act;
}
diff --git a/intern/elbeem/intern/ntl_world.cpp b/intern/elbeem/intern/ntl_world.cpp
index 0b36f724985..dcc81dbe5cb 100644
--- a/intern/elbeem/intern/ntl_world.cpp
+++ b/intern/elbeem/intern/ntl_world.cpp
@@ -143,6 +143,7 @@ void ntlWorld::initDefaults()
mFirstSim = 1;
mSingleStepDebug = false;
mFrameCnt = 0;
+ mSimFrameCnt = 0;
mpOpenGLRenderer = NULL;
/* create scene storage */
@@ -406,7 +407,6 @@ int ntlWorld::advanceSims(int framenum)
}
for(size_t i=0;i<mpSims->size();i++) { (*mpSims)[i]->setFrameNum(framenum); }
- double targetTime = mSimulationTime + (*mpSims)[mFirstSim]->getFrameTime(framenum);
// time stopped? nothing else to do...
if( (*mpSims)[mFirstSim]->getFrameTime(framenum) <= 0.0 ){
@@ -416,6 +416,13 @@ int ntlWorld::advanceSims(int framenum)
(*mpSims)[mFirstSim]->checkCallerStatus(FLUIDSIM_CBSTATUS_STEP, 0);
}
+ // Prevent bug [#29186] Object contribute to fluid sim animation start earlier than keyframe
+ // Was: double targetTime = mSimulationTime + (*mpSims)[mFirstSim]->getFrameTime(framenum); - DG
+ double totalTime = 0.0, targetTime = 0.0;
+ for(size_t i = 0; i < mSimFrameCnt; i++)
+ totalTime += (*mpSims)[mFirstSim]->getFrameTime(framenum);
+ targetTime = totalTime + (*mpSims)[mFirstSim]->getFrameTime(framenum);
+
int gstate = 0;
myTime_t advsstart = getTime();
@@ -461,6 +468,8 @@ int ntlWorld::advanceSims(int framenum)
sim->prepareVisualization();
}
+ mSimFrameCnt++;
+
return 0;
}
diff --git a/intern/elbeem/intern/ntl_world.h b/intern/elbeem/intern/ntl_world.h
index 3c5958477d4..c207904cf75 100644
--- a/intern/elbeem/intern/ntl_world.h
+++ b/intern/elbeem/intern/ntl_world.h
@@ -115,6 +115,9 @@ class ntlWorld
/*! count no. of frame for viz render */
int mFrameCnt;
+
+ /*! count no. of frame for correct sim time */
+ int mSimFrameCnt;
};
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 08f982ffd3f..9162b7ce4e0 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -282,9 +282,6 @@ protected:
/** Raised window is not yet known by the window manager, so delay application become active event handling */
bool m_needDelayedApplicationBecomeActiveEventProcessing;
- /** Mouse buttons state */
- GHOST_TUns32 m_pressedMouseButtons;
-
/** State of the modifiers. */
GHOST_TUns32 m_modifierMask;
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 628b0d038f9..16edb4af575 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -551,7 +551,6 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
char *rstring = NULL;
m_modifierMask =0;
- m_pressedMouseButtons =0;
m_isGestureInProgress = false;
m_cursorDelta_x=0;
m_cursorDelta_y=0;
@@ -577,8 +576,10 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
sysctl( mib, 2, rstring, &len, NULL, 0 );
//Hack on MacBook revision, as multitouch avail. function missing
+ //MacbookAir or MacBook version >= 5 (retina is MacBookPro10,1)
if (strstr(rstring,"MacBookAir") ||
- (strstr(rstring,"MacBook") && (rstring[strlen(rstring)-3]>='5') && (rstring[strlen(rstring)-3]<='9')))
+ (strstr(rstring,"MacBook") && (rstring[strlen(rstring)-3]>='5') && (rstring[strlen(rstring)-3]<='9')) ||
+ (strstr(rstring,"MacBook") && (rstring[strlen(rstring)-4]>='1') && (rstring[strlen(rstring)-4]<='9')))
m_hasMultiTouchTrackpad = true;
else m_hasMultiTouchTrackpad = false;
@@ -848,12 +849,14 @@ GHOST_TSuccess GHOST_SystemCocoa::getModifierKeys(GHOST_ModifierKeys& keys) cons
GHOST_TSuccess GHOST_SystemCocoa::getButtons(GHOST_Buttons& buttons) const
{
+ UInt32 button_state = GetCurrentEventButtonState();
+
buttons.clear();
- buttons.set(GHOST_kButtonMaskLeft, m_pressedMouseButtons & GHOST_kButtonMaskLeft);
- buttons.set(GHOST_kButtonMaskRight, m_pressedMouseButtons & GHOST_kButtonMaskRight);
- buttons.set(GHOST_kButtonMaskMiddle, m_pressedMouseButtons & GHOST_kButtonMaskMiddle);
- buttons.set(GHOST_kButtonMaskButton4, m_pressedMouseButtons & GHOST_kButtonMaskButton4);
- buttons.set(GHOST_kButtonMaskButton5, m_pressedMouseButtons & GHOST_kButtonMaskButton5);
+ buttons.set(GHOST_kButtonMaskLeft, button_state & (1 << 0));
+ buttons.set(GHOST_kButtonMaskRight, button_state & (1 << 1));
+ buttons.set(GHOST_kButtonMaskMiddle, button_state & (1 << 2));
+ buttons.set(GHOST_kButtonMaskButton4, button_state & (1 << 3));
+ buttons.set(GHOST_kButtonMaskButton5, button_state & (1 << 4));
return GHOST_kSuccess;
}
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index dd1930a241b..156bc86869a 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -1265,6 +1265,10 @@ activateDrawingContext()
{
if (m_context != NULL) {
glXMakeCurrent(m_display, m_window, m_context);
+ /* Disable AA by default */
+ if (m_numOfAASamples > 0) {
+ glDisable(GL_MULTISAMPLE_ARB);
+ }
return GHOST_kSuccess;
}
return GHOST_kFailure;
diff --git a/intern/iksolver/intern/IK_QJacobianSolver.cpp b/intern/iksolver/intern/IK_QJacobianSolver.cpp
index 43d177d0651..75f51f566c9 100644
--- a/intern/iksolver/intern/IK_QJacobianSolver.cpp
+++ b/intern/iksolver/intern/IK_QJacobianSolver.cpp
@@ -377,7 +377,7 @@ bool IK_QJacobianSolver::Solve(
norm = maxnorm;
// check for convergence
- if (norm < 1e-3) {
+ if (norm < 1e-3 && iterations > 10) {
solved = true;
break;
}
diff --git a/intern/locale/CMakeLists.txt b/intern/locale/CMakeLists.txt
index f3356bcda49..3187639c844 100644
--- a/intern/locale/CMakeLists.txt
+++ b/intern/locale/CMakeLists.txt
@@ -39,6 +39,7 @@ if(WITH_INTERNATIONAL)
${BOOST_INCLUDE_DIR}
)
add_definitions(-DWITH_INTERNATIONAL)
+ add_definitions(${BOOST_DEFINITIONS})
endif()
blender_add_lib(bf_intern_locale "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/locale/boost_locale_wrapper.cpp b/intern/locale/boost_locale_wrapper.cpp
index ec2976f19b9..939c66bad13 100644
--- a/intern/locale/boost_locale_wrapper.cpp
+++ b/intern/locale/boost_locale_wrapper.cpp
@@ -26,6 +26,7 @@
*
*/
+#include <stdio.h>
#include <boost/locale.hpp>
#include "boost_locale_wrapper.h"
@@ -54,13 +55,39 @@ void bl_locale_set(const char *locale)
// Specify location of dictionaries.
gen.add_messages_path(messages_path);
gen.add_messages_domain(default_domain);
- //gen.set_default_messages_domain(default_domain);
+ //gen.set_default_messages_domain(default_domain);
if (locale && locale[0]) {
std::locale::global(gen(locale));
}
else {
+#if defined (__APPLE__)
+ // workaround to get osx system locale from user defaults
+ FILE* fp;
+ std::string locale_osx = "";
+ char result[16];
+ int result_len = 0;
+
+ fp = popen("defaults read .GlobalPreferences AppleLocale", "r");
+
+ if(fp) {
+ result_len = fread(result, 1, sizeof(result) - 1, fp);
+
+ if(result_len > 0) {
+ result[result_len-1] = '\0'; // \0 terminate and remove \n
+ locale_osx = std::string(result) + std::string(".UTF-8");
+ }
+
+ pclose(fp);
+ }
+
+ if(locale_osx == "")
+ fprintf(stderr, "Locale set: failed to read AppleLocale read from defaults\n");
+
+ std::locale::global(gen(locale_osx.c_str()));
+#else
std::locale::global(gen(""));
+#endif
}
// Note: boost always uses "C" LC_NUMERIC by default!
}
diff --git a/intern/memutil/MEM_CacheLimiter.h b/intern/memutil/MEM_CacheLimiter.h
index cfff5d10e4f..daf66dc05b1 100644
--- a/intern/memutil/MEM_CacheLimiter.h
+++ b/intern/memutil/MEM_CacheLimiter.h
@@ -247,8 +247,10 @@ private:
if (!elem->can_destroy())
continue;
- /* by default 0 means higherst priority element */
- int priority = -(queue.size() - i - 1);
+ /* by default 0 means highest priority element */
+ /* casting a size type to int is questionable,
+ but unlikely to cause problems */
+ int priority = -((int)(queue.size()) - i - 1);
priority = getItemPriority(elem->get()->get_data(), priority);
if (priority < best_match_priority || best_match_elem == NULL) {
diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc
index 49fc44d1e12..2d73d2ff56b 100644
--- a/intern/opencolorio/ocio_impl.cc
+++ b/intern/opencolorio/ocio_impl.cc
@@ -48,7 +48,7 @@ using namespace OCIO_NAMESPACE;
#endif
#define MEM_NEW(type) new(MEM_mallocN(sizeof(type), __func__)) type()
-#define MEM_DELETE(what, type) if(what) { (what)->~type(); MEM_freeN(what); } (void)0
+#define MEM_DELETE(what, type) if(what) { ((type*)(what))->~type(); MEM_freeN(what); } (void)0
static void OCIO_reportError(const char *err)
{
@@ -421,8 +421,7 @@ void OCIOImpl::processorApplyRGBA_predivide(OCIO_ConstProcessorRcPtr *processor,
void OCIOImpl::processorRelease(OCIO_ConstProcessorRcPtr *p)
{
- p->~OCIO_ConstProcessorRcPtr();
- MEM_freeN(p);
+ MEM_DELETE(p, ConstProcessorRcPtr);
}
const char *OCIOImpl::colorSpaceGetName(OCIO_ConstColorSpaceRcPtr *cs)
diff --git a/intern/opennl/CMakeLists.txt b/intern/opennl/CMakeLists.txt
index b7a24839e38..754036de101 100644
--- a/intern/opennl/CMakeLists.txt
+++ b/intern/opennl/CMakeLists.txt
@@ -28,7 +28,11 @@ remove_strict_flags()
# remove debug flag here since this is not a blender maintained library
# and debug gives a lot of prints on UV unwrapping. developers can enable if they need to.
-add_definitions(-UDEBUG)
+if(MSVC)
+ remove_definitions(-DDEBUG)
+else()
+ add_definitions(-UDEBUG)
+endif()
# quiet compiler warnings about undefined defines
diff --git a/release/datafiles/blender_icons.png b/release/datafiles/blender_icons.png
index 257de8ae3c8..e09d7062780 100644
--- a/release/datafiles/blender_icons.png
+++ b/release/datafiles/blender_icons.png
Binary files differ
diff --git a/release/datafiles/startup.blend b/release/datafiles/startup.blend
index f8d722a0d91..3d31f9cb758 100644
--- a/release/datafiles/startup.blend
+++ b/release/datafiles/startup.blend
Binary files differ
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index f61d14eda20..c7414e84046 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -114,6 +114,9 @@ DOMAIN = "blender"
# File type (ext) to parse.
PYGETTEXT_ALLOWED_EXTS = {".c", ".cpp", ".cxx", ".hpp", ".hxx", ".h"}
+# Max number of contexts into a BLF_I18N_MSGID_MULTI_CTXT macro...
+PYGETTEXT_MAX_MULTI_CTXT = 16
+
# Where to search contexts definitions, relative to SOURCE_DIR (defined below).
PYGETTEXT_CONTEXTS_DEFSRC = os.path.join("source", "blender", "blenfont",
"BLF_translation.h")
@@ -149,7 +152,10 @@ _str_whole_re = (
# End of loop.
"))*"
)
-_ctxt_re = r"(?P<ctxt_raw>(?:" + _str_whole_re.format(_="_ctxt") + r")|(?:[A-Z_0-9]+))"
+_ctxt_re_gen = lambda uid : r"(?P<ctxt_raw{uid}>(?:".format(uid=uid) + \
+ _str_whole_re.format(_="_ctxt{uid}".format(uid=uid)) + \
+ r")|(?:[A-Z_0-9]+))"
+_ctxt_re = _ctxt_re_gen("")
_msg_re = r"(?P<msg_raw>" + _str_whole_re.format(_="_msg") + r")"
PYGETTEXT_KEYWORDS = (() +
tuple((r"{}\(\s*" + _msg_re + r"\s*\)").format(it)
@@ -165,7 +171,11 @@ PYGETTEXT_KEYWORDS = (() +
for it in ("BMO_error_raise",)) +
tuple(("{}\\((?:[^\"',]+,)\\s*" + _msg_re + r"\s*(?:\)|,)").format(it)
- for it in ("modifier_setError",))
+ for it in ("modifier_setError",)) +
+
+ tuple((r"{}\(\s*" + _msg_re + r"\s*,\s*(?:" + \
+ r"\s*,\s*)?(?:".join(_ctxt_re_gen(i) for i in range(PYGETTEXT_MAX_MULTI_CTXT)) + r")?\s*\)").format(it)
+ for it in ("BLF_I18N_MSGID_MULTI_CTXT",))
)
ESCAPE_RE = (
diff --git a/release/scripts/modules/bl_i18n_utils/update_pot.py b/release/scripts/modules/bl_i18n_utils/update_pot.py
index 51197b86678..ecb5d837a09 100755
--- a/release/scripts/modules/bl_i18n_utils/update_pot.py
+++ b/release/scripts/modules/bl_i18n_utils/update_pot.py
@@ -52,6 +52,7 @@ SRC_POTFILES = settings.FILE_NAME_SRC_POTFILES
CONTEXT_DEFAULT = settings.CONTEXT_DEFAULT
PYGETTEXT_ALLOWED_EXTS = settings.PYGETTEXT_ALLOWED_EXTS
+PYGETTEXT_MAX_MULTI_CTXT = settings.PYGETTEXT_MAX_MULTI_CTXT
SVN_EXECUTABLE = settings.SVN_EXECUTABLE
@@ -79,6 +80,31 @@ clean_str = lambda s: "".join(m.group("clean") for m in _clean_str(s))
def check_file(path, rel_path, messages):
+ def process_entry(ctxt, msg):
+ # Context.
+ if ctxt:
+ if ctxt in CONTEXTS:
+ ctxt = CONTEXTS[ctxt]
+ elif '"' in ctxt or "'" in ctxt:
+ ctxt = clean_str(ctxt)
+ else:
+ print("WARNING: raw context “{}” couldn’t be resolved!"
+ "".format(ctxt))
+ ctxt = CONTEXT_DEFAULT
+ else:
+ ctxt = CONTEXT_DEFAULT
+ # Message.
+ if msg:
+ if '"' in msg or "'" in msg:
+ msg = clean_str(msg)
+ else:
+ print("WARNING: raw message “{}” couldn’t be resolved!"
+ "".format(msg))
+ msg = ""
+ else:
+ msg = ""
+ return (ctxt, msg)
+
with open(path, encoding="utf-8") as f:
f = f.read()
for srch in pygettexts:
@@ -86,34 +112,23 @@ def check_file(path, rel_path, messages):
line = pos = 0
while m:
d = m.groupdict()
- # Context.
- ctxt = d.get("ctxt_raw")
- if ctxt:
- if ctxt in CONTEXTS:
- ctxt = CONTEXTS[ctxt]
- elif '"' in ctxt or "'" in ctxt:
- ctxt = clean_str(ctxt)
- else:
- print("WARNING: raw context “{}” couldn’t be resolved!"
- "".format(ctxt))
- ctxt = CONTEXT_DEFAULT
- else:
- ctxt = CONTEXT_DEFAULT
- # Message.
- msg = d.get("msg_raw")
- if msg:
- if '"' in msg or "'" in msg:
- msg = clean_str(msg)
- else:
- print("WARNING: raw message “{}” couldn’t be resolved!"
- "".format(msg))
- msg = ""
- else:
- msg = ""
# Line.
line += f[pos:m.start()].count('\n')
- # And we are done for this item!
- messages.setdefault((ctxt, msg), []).append(":".join((rel_path, str(line))))
+ msg = d.get("msg_raw")
+ # First, try the "multi-contexts" stuff!
+ ctxts = tuple(d.get("ctxt_raw{}".format(i)) for i in range(PYGETTEXT_MAX_MULTI_CTXT))
+ if ctxts[0]:
+ for ctxt in ctxts:
+ if not ctxt:
+ break
+ ctxt, _msg = process_entry(ctxt, msg)
+ # And we are done for this item!
+ messages.setdefault((ctxt, _msg), []).append(":".join((rel_path, str(line))))
+ else:
+ ctxt = d.get("ctxt_raw")
+ ctxt, msg = process_entry(ctxt, msg)
+ # And we are done for this item!
+ messages.setdefault((ctxt, msg), []).append(":".join((rel_path, str(line))))
pos = m.end()
line += f[m.start():pos].count('\n')
m = srch(f, pos)
@@ -138,12 +153,12 @@ def py_xgettext(messages):
rel_path = os.path.relpath(path, SOURCE_DIR)
if rel_path in forbidden:
continue
- elif rel_path in forced:
- forced.remove(rel_path)
- check_file(path, rel_path, messages)
- for path in forced:
+ elif rel_path not in forced:
+ forced.add(rel_path)
+ for rel_path in sorted(forced):
+ path = os.path.join(SOURCE_DIR, rel_path)
if os.path.exists(path):
- check_file(os.path.join(SOURCE_DIR, path), path, messages)
+ check_file(path, rel_path, messages)
# Spell checking!
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
index 4e90f2e8585..9e449f325d6 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -665,15 +665,60 @@ class TransformsToDeltasAnim(Operator):
return (obs is not None)
def execute(self, context):
+ # map from standard transform paths to "new" transform paths
+ STANDARD_TO_DELTA_PATHS = {
+ "location" : "delta_location",
+ "rotation_euler" : "delta_rotation_euler",
+ "rotation_quaternion" : "delta_rotation_quaternion",
+ #"rotation_axis_angle" : "delta_rotation_axis_angle",
+ "scale" : "delta_scale"
+ }
+ DELTA_PATHS = STANDARD_TO_DELTA_PATHS.values()
+
+ # try to apply on each selected object
+ success = False
for obj in context.selected_editable_objects:
- # get animation data
adt = obj.animation_data
if (adt is None) or (adt.action is None):
self.report({'WARNING'},
"No animation data to convert on object: %r" %
obj.name)
continue
-
+
+ # first pass over F-Curves: ensure that we don't have conflicting
+ # transforms already (e.g. if this was applied already) [#29110]
+ existingFCurves = {}
+ for fcu in adt.action.fcurves:
+ # get "delta" path - i.e. the final paths which may clash
+ path = fcu.data_path
+ if path in STANDARD_TO_DELTA_PATHS:
+ # to be converted - conflicts may exist...
+ dpath = STANDARD_TO_DELTA_PATHS[path]
+ elif path in DELTA_PATHS:
+ # already delta - check for conflicts...
+ dpath = path
+ else:
+ # non-transform - ignore
+ continue
+
+ # a delta path like this for the same index shouldn't
+ # exist already, otherwise we've got a conflict
+ if dpath in existingFCurves:
+ # ensure that this index hasn't occurred before
+ if fcu.array_index in existingFCurves[dpath]:
+ # conflict
+ self.report({'ERROR'},
+ "Object '%r' already has '%r' F-Curve(s). Remove these before trying again" %
+ (obj.name, dpath))
+ return {'CANCELLED'}
+ else:
+ # no conflict here
+ existingFCurves[dpath] += [fcu.array_index]
+ else:
+ # no conflict yet
+ existingFCurves[dpath] = [fcu.array_index]
+
+
# if F-Curve uses standard transform path
# just append "delta_" to this path
for fcu in adt.action.fcurves:
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index 50c34be1414..845beb0f862 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -239,7 +239,7 @@ class DATA_PT_ghost(ArmatureButtonsPanel, Panel):
class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
- bl_label = "iTaSC parameters"
+ bl_label = "Inverse Kinematics"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py
index 1441c642d51..fdaee6b7cde 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -244,7 +244,6 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel):
pchan = ob.pose.bones[bone.name]
row = layout.row()
- row.prop(ob.pose, "ik_solver")
active = pchan.is_in_ik_chain
diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index 5f6036c8945..25cecc90c70 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -142,8 +142,12 @@ class DATA_PT_camera(CameraButtonsPanel, Panel):
if cam.sensor_fit == 'AUTO':
col.prop(cam, "sensor_width", text="Size")
else:
- col.prop(cam, "sensor_width", text="Width")
- col.prop(cam, "sensor_height", text="Height")
+ sub = col.column()
+ sub.active = cam.sensor_fit == 'HORIZONTAL'
+ sub.prop(cam, "sensor_width", text="Width")
+ sub = col.column()
+ sub.active = cam.sensor_fit == 'VERTICAL'
+ sub.prop(cam, "sensor_height", text="Height")
col = split.column(align=True)
col.prop(cam, "sensor_fit", text="")
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index ea8ffbe6c9f..62461d800f6 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1029,5 +1029,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.prop(md, "use_y_symmetry")
col.prop(md, "use_z_symmetry")
+ def TRIANGULATE(self, layout, ob, md):
+ layout.prop(md, "use_beauty")
+
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)
diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py
index 3fa63bac13c..eb0929895f8 100644
--- a/release/scripts/startup/bl_ui/properties_object_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_object_constraint.py
@@ -134,7 +134,7 @@ class ConstraintButtonsPanel():
layout.prop(con, "ik_type")
getattr(self, 'IK_' + con.ik_type)(context, layout, con)
else:
- # Legacy IK constraint
+ # Standard IK constraint
self.target_template(layout, con)
layout.prop(con, "pole_target")
@@ -151,17 +151,27 @@ class ConstraintButtonsPanel():
col.prop(con, "iterations")
col.prop(con, "chain_count")
- col.label(text="Weight:")
- col.prop(con, "weight", text="Position", slider=True)
- sub = col.column()
- sub.active = con.use_rotation
- sub.prop(con, "orient_weight", text="Rotation", slider=True)
-
col = split.column()
col.prop(con, "use_tail")
col.prop(con, "use_stretch")
- col.separator()
- col.prop(con, "use_rotation")
+
+ layout.label(text="Weight:")
+
+ split = layout.split()
+ col = split.column()
+ row = col.row(align=True)
+ row.prop(con, "use_location", text="")
+ sub = row.row()
+ sub.active = con.use_location
+ sub.prop(con, "weight", text="Position", slider=True)
+
+ col = split.column()
+ row = col.row(align=True)
+ row.prop(con, "use_rotation", text="")
+ sub = row.row()
+ sub.active = con.use_rotation
+ sub.prop(con, "orient_weight", text="Rotation", slider=True)
+
def IK_COPY_POSE(self, context, layout, con):
self.target_template(layout, con)
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index a81553a8257..5535070c1c4 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -241,9 +241,9 @@ class DOPESHEET_MT_channel(Menu):
layout.operator("anim.channels_delete")
layout.separator()
- layout.operator("anim.channels_setting_toggle")
- layout.operator("anim.channels_setting_enable")
- layout.operator("anim.channels_setting_disable")
+ layout.operator_menu_enum("anim.channels_setting_toggle", "type")
+ layout.operator_menu_enum("anim.channels_setting_enable", "type")
+ layout.operator_menu_enum("anim.channels_setting_disable", "type")
layout.separator()
layout.operator("anim.channels_editable_toggle")
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py
index e89bd78a84f..4cb6538458f 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -161,9 +161,9 @@ class GRAPH_MT_channel(Menu):
layout.operator("anim.channels_delete")
layout.separator()
- layout.operator("anim.channels_setting_toggle")
- layout.operator("anim.channels_setting_enable")
- layout.operator("anim.channels_setting_disable")
+ layout.operator_menu_enum("anim.channels_setting_toggle", "type")
+ layout.operator_menu_enum("anim.channels_setting_enable", "type")
+ layout.operator_menu_enum("anim.channels_setting_disable", "type")
layout.separator()
layout.operator("anim.channels_editable_toggle")
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index c0f2d3c361b..662d5526a37 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -373,7 +373,7 @@ class INFO_MT_help(Menu):
layout = self.layout
layout.operator("wm.url_open", text="Manual", icon='HELP').url = "http://wiki.blender.org/index.php/Doc:2.6/Manual"
- layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://www.blender.org/development/release-logs/blender-264"
+ layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://www.blender.org/development/release-logs/blender-265"
layout.separator()
layout.operator("wm.url_open", text="Blender Website", icon='URL').url = "http://www.blender.org"
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index ad4074d9744..fdfd43157c7 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -707,8 +707,6 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
layout.template_ID(strip, "scene")
scene = strip.scene
- if scene:
- layout.prop(scene.render, "use_sequencer")
layout.label(text="Camera Override")
layout.template_ID(strip, "scene_camera")
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py
index a64f8aa4aed..fa8752c21be 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -137,9 +137,6 @@ class TEXT_PT_find(Panel):
row.operator("text.replace_set_selected", text="", icon='TEXT')
col.operator("text.replace")
- # mark
- layout.operator("text.mark_all")
-
# settings
layout.prop(st, "use_match_case")
row = layout.row()
@@ -216,17 +213,6 @@ class TEXT_MT_edit_select(Menu):
layout.operator("text.select_line")
-class TEXT_MT_edit_markers(Menu):
- bl_label = "Markers"
-
- def draw(self, context):
- layout = self.layout
-
- layout.operator("text.markers_clear")
- layout.operator("text.next_marker")
- layout.operator("text.previous_marker")
-
-
class TEXT_MT_format(Menu):
bl_label = "Format"
@@ -290,7 +276,6 @@ class TEXT_MT_edit(Menu):
layout.separator()
layout.menu("TEXT_MT_edit_select")
- layout.menu("TEXT_MT_edit_markers")
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 1a66d67bce5..0bb25e98456 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -442,8 +442,6 @@ class USERPREF_PT_system(Panel):
col.label(text="Anisotropic Filtering")
col.prop(system, "anisotropic_filter", text="")
col.prop(system, "use_vertex_buffer_objects")
- # Anti-aliasing is disabled as it breaks border/lasso select
- #~ col.prop(system, "use_antialiasing")
col.label(text="Window Draw Method:")
col.prop(system, "window_draw_method", text="")
col.prop(system, "multi_sample", text="")
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 77c0cc7a463..689cd635606 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -1843,8 +1843,8 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
layout.separator()
- layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
- layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction = 'CCW'
+ layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
+ layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").use_ccw = True
layout.separator()
@@ -1898,13 +1898,13 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
layout.separator()
- layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
+ layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
layout.separator()
- layout.operator_menu_enum("mesh.uvs_rotate", "direction")
+ layout.operator("mesh.uvs_rotate")
layout.operator("mesh.uvs_reverse")
- layout.operator_menu_enum("mesh.colors_rotate", "direction")
+ layout.operator("mesh.colors_rotate")
layout.operator("mesh.colors_reverse")
diff --git a/release/scripts/templates/script_stub.py b/release/scripts/templates/script_stub.py
index 3b3212892d5..143c7c5104a 100644
--- a/release/scripts/templates/script_stub.py
+++ b/release/scripts/templates/script_stub.py
@@ -8,4 +8,5 @@ import os
filename = "my_script.py"
filepath = os.path.join(os.path.dirname(bpy.data.filepath), filename)
-exec(compile(open(filepath).read(), filepath, 'exec'))
+global_namespace = {"__file__": filepath, "__name__": "__main__"}
+exec(compile(open(filepath).read(), filepath, 'exec'), global_namespace)
diff --git a/release/text/readme.html b/release/text/readme.html
index 40ea9035835..414a7d8e744 100644
--- a/release/text/readme.html
+++ b/release/text/readme.html
@@ -12,18 +12,18 @@
</style>
</head>
<body>
-<p class="title"><b>Blender 2.64</b></p>
+<p class="title"><b>Blender 2.65</b></p>
<p><br></p>
<p class="header"><b>About</b></p>
<p class="body">Welcome to Blender, the free, open source 3D application for modeling, animation, rendering, compositing, video editing and game creation. Blender is available for Linux, Mac OS X, Windows and FreeBSD and has a large world-wide community.</p>
<p class="body">Blender can be used freely for any purpose, including commercial use and distribution. It's free and open-source software, released under the GNU GPL licence. The entire source code is available on our website.</p>
<p class="body">For more information, visit <a href="http://www.blender.org">blender.org</a>.</p>
<p><br></p>
-<p class="header"><b>2.64</b></p>
-<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.64. This release is the fifth official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features. <a href="http://www.blender.org/development/release-logs/blender-264/">More information about this release</a>.</p>
+<p class="header"><b>2.65</b></p>
+<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.65. This release is the sixth official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features. <a href="http://www.blender.org/development/release-logs/blender-265/">More information about this release</a>.</p>
<p><br></p>
<p class="header"><b>Bugs</b></p>
-<p class="body">Although Blender 2.64 is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
+<p class="body">Although Blender 2.65 is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
<p><br></p>
<p class="header"><b>Package Contents</b></p>
<p class="body">The downloaded Blender package includes:</p>
@@ -47,7 +47,7 @@
<p class="header"><b>Links</b></p>
<p class="body">Users:</p>
<p class="body"> General information <a href="http://www.blender.org">www.blender.org</a> <br>
- Full release log <a href="http://www.blender.org/development/release-logs/blender-264/">www.blender.org/development/release-logs/blender-264/</a><br>
+ Full release log <a href="http://www.blender.org/development/release-logs/blender-265/">www.blender.org/development/release-logs/blender-265/</a><br>
Tutorials <a href="http://www.blender.org/education-help/">www.blender.org/education-help/</a> <br>
Manual <a href="http://wiki.blender.org/index.php/Doc:2.6/Manual">wiki.blender.org/index.php/Doc:2.6/Manual</a><br>
User Forum <a href="http://www.blenderartists.org">www.blenderartists.org</a><br>
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index d0b5d824bb3..8eb40384044 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -73,6 +73,7 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
/* The "translation-marker" macro. */
#define N_(msgid) msgid
#define CTX_N_(context, msgid) msgid
+
/* Those macros should be used everywhere in UI code. */
#ifdef WITH_INTERNATIONAL
/* #define _(msgid) BLF_gettext(msgid) */
@@ -84,10 +85,17 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
/* #define _(msgid) msgid */
#define IFACE_(msgid) msgid
#define TIP_(msgid) msgid
- #define CTX_IFACE_(context, msgid) msgid
- #define CTX_TIP_(context, msgid) msgid
+ #define CTX_IFACE_(context, msgid) ((void)context, msgid)
+ #define CTX_TIP_(context, msgid) ((void)context, msgid)
#endif
+/* Helper macro, when we want to define a same msgid for multiple msgctxt...
+ * Does nothing in C, but is "parsed" by our i18n py tools.
+ * XXX Currently limited to at most 16 contexts at most
+ * (but you can call it several times with the same msgid, should you need more contexts!).
+ */
+#define BLF_I18N_MSGID_MULTI_CTXT(msgid, ...)
+
/******************************************************************************
* All i18n contexts must be defined here.
* This is a nice way to be sure not to use a context twice for different
@@ -100,8 +108,40 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
/* Default context for operator names/labels. */
#define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
-/* Audio disambiguation context. */
-#define BLF_I18NCONTEXT_AUDIO "Audio"
-
+/* ID-types contexts. */
+/* WARNING! Keep it in sync with idtypes in blenkernel/intern/idcode.c */
+#define BLF_I18NCONTEXT_ID_ACTION "Action"
+#define BLF_I18NCONTEXT_ID_ARMATURE "Armature"
+#define BLF_I18NCONTEXT_ID_BRUSH "Brush"
+#define BLF_I18NCONTEXT_ID_CAMERA "Camera"
+#define BLF_I18NCONTEXT_ID_CURVE "Curve"
+#define BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE "FreestyleLineStyle"
+#define BLF_I18NCONTEXT_ID_GPENCIL "GPencil"
+#define BLF_I18NCONTEXT_ID_GROUP "Group"
+#define BLF_I18NCONTEXT_ID_ID "ID"
+#define BLF_I18NCONTEXT_ID_IMAGE "Image"
+/*#define BLF_I18NCONTEXT_ID_IPO "Ipo"*/ /* Deprecated */
+#define BLF_I18NCONTEXT_ID_SHAPEKEY "Key"
+#define BLF_I18NCONTEXT_ID_LAMP "Lamp"
+#define BLF_I18NCONTEXT_ID_LIBRARY "Library"
+#define BLF_I18NCONTEXT_ID_LATTICE "Lattice"
+#define BLF_I18NCONTEXT_ID_MATERIAL "Material"
+#define BLF_I18NCONTEXT_ID_METABALL "Metaball"
+#define BLF_I18NCONTEXT_ID_MESH "Mesh"
+#define BLF_I18NCONTEXT_ID_NODETREE "NodeTree"
+#define BLF_I18NCONTEXT_ID_OBJECT "Object"
+#define BLF_I18NCONTEXT_ID_PARTICLESETTINGS "ParticleSettings"
+#define BLF_I18NCONTEXT_ID_SCENE "Scene"
+#define BLF_I18NCONTEXT_ID_SCREEN "Screen"
+#define BLF_I18NCONTEXT_ID_SEQUENCE "Sequence"
+#define BLF_I18NCONTEXT_ID_SPEAKER "Speaker"
+#define BLF_I18NCONTEXT_ID_SOUND "Sound"
+#define BLF_I18NCONTEXT_ID_TEXTURE "Texture"
+#define BLF_I18NCONTEXT_ID_TEXT "Text"
+#define BLF_I18NCONTEXT_ID_VFONT "VFont"
+#define BLF_I18NCONTEXT_ID_WORLD "World"
+#define BLF_I18NCONTEXT_ID_WINDOWMANAGER "WindowManager"
+#define BLF_I18NCONTEXT_ID_MOVIECLIP "MovieClip"
+#define BLF_I18NCONTEXT_ID_MASK "Mask"
#endif /* __BLF_TRANSLATION_H__ */
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index aaf88e4924d..accac8694a9 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -100,14 +100,6 @@ void txt_move_lines (struct Text *text, const int direction);
void txt_duplicate_line (struct Text *text);
int setcurr_tab_spaces (struct Text *text, int space);
-void txt_add_marker (struct Text *text, struct TextLine *line, int start, int end, const unsigned char color[4], int group, int flags);
-short txt_clear_marker_region (struct Text *text, struct TextLine *line, int start, int end, int group, int flags);
-short txt_clear_markers (struct Text *text, int group, int flags);
-struct TextMarker *txt_find_marker (struct Text *text, struct TextLine *line, int curs, int group, int flags);
-struct TextMarker *txt_find_marker_region (struct Text *text, struct TextLine *line, int start, int end, int group, int flags);
-struct TextMarker *txt_prev_marker (struct Text *text, struct TextMarker *marker);
-struct TextMarker *txt_next_marker (struct Text *text, struct TextMarker *marker);
-
/* utility functions, could be moved somewhere more generic but are python/text related */
int text_check_bracket(const char ch);
int text_check_delim(const char ch);
@@ -161,10 +153,6 @@ enum {
#define UNDO_DUPLICATE 040
-/* Marker flags */
-#define TMARK_TEMP 0x01 /* Remove on non-editing events, don't save */
-#define TMARK_EDITALL 0x02 /* Edit all markers of the same group as one */
-
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index cca425a63d8..3736395313d 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -2167,6 +2167,8 @@ static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask,
/* weight paint and face select need original indices because of selection buffer drawing */
int needMapping = (ob == obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_TEXTURE_PAINT)));
+ BLI_assert(ob->type == OB_MESH);
+
clear_mesh_caches(ob);
mesh_calc_modifiers(scene, ob, NULL, &ob->derivedDeform,
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index e95451252d0..dd27cc70ba3 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -512,7 +512,7 @@ const char *BKE_pose_ikparam_get_name(bPose *pose)
{
if (pose) {
switch (pose->iksolver) {
- case IKSOLVER_LEGACY:
+ case IKSOLVER_STANDARD:
return NULL;
case IKSOLVER_ITASC:
return "bItasc";
@@ -587,7 +587,7 @@ void BKE_pose_ikparam_init(bPose *pose)
BKE_pose_itasc_init(itasc);
pose->ikparam = itasc;
break;
- case IKSOLVER_LEGACY:
+ case IKSOLVER_STANDARD:
default:
pose->ikparam = NULL;
break;
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index b3cbc1f2b16..1970df54339 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1822,8 +1822,15 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
*/
/* only happens on reload file, but violates depsgraph still... fix! */
- if ((cu->path == NULL) || (cu->path->data == NULL))
+ if (ELEM(NULL, cu->path, cu->path->data)) {
BKE_displist_make_curveTypes(scene, ikData->tar, 0);
+
+ /* path building may fail in EditMode after removing verts [#33268]*/
+ if (ELEM(NULL, cu->path, cu->path->data)) {
+ /* BLI_assert(cu->path != NULL); */
+ return;
+ }
+ }
}
/* find the root bone and the chain of bones from the root to the tip
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 3ade51d13eb..9b1720787ed 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -2516,7 +2516,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
EdgeHashIterator *ehi;
MPoly *mp = cddm->mpoly;
MLoop *ml;
- MEdge *med;
+ MEdge *med, *origmed;
EdgeHash *eh = BLI_edgehash_new();
int v1, v2;
int *eindex;
@@ -2549,6 +2549,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
CustomData_add_layer(&edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
CustomData_add_layer(&edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
+ origmed = cddm->medge;
med = CustomData_get_layer(&edgeData, CD_MEDGE);
index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
@@ -2559,8 +2560,14 @@ void CDDM_calc_edges(DerivedMesh *dm)
BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
j = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
- med->flag = ME_EDGEDRAW | ME_EDGERENDER;
- *index = j == 0 ? ORIGINDEX_NONE : eindex[j - 1];
+ if (j == 0) {
+ med->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ *index = ORIGINDEX_NONE;
+ }
+ else {
+ med->flag = ME_EDGEDRAW | ME_EDGERENDER | origmed[j - 1].flag;
+ *index = eindex[j - 1];
+ }
BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(i));
}
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index b488e683947..4641a02265a 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -198,8 +198,10 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3
w3[0] = 1.0f - w1[0] - w2[0];
}
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdouble-promotion"
+#ifdef __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdouble-promotion"
+#endif
DO_INLINE void collision_interpolateOnTriangle ( float to[3], float v1[3], float v2[3], float v3[3], double w1, double w2, double w3 )
{
@@ -371,7 +373,9 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
return result;
}
-#pragma GCC diagnostic pop
+#ifdef __GNUC__
+# pragma GCC diagnostic pop
+#endif
//Determines collisions on overlap, collisions are written to collpair[i] and collision+number_collision_found is returned
static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 89d728c0419..bb3836e3c08 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -86,11 +86,13 @@
#include "RE_shader_ext.h"
#ifdef _OPENMP
-#include <omp.h>
+# include <omp.h>
#endif
/* could enable at some point but for now there are far too many conversions */
-#pragma GCC diagnostic ignored "-Wdouble-promotion"
+#ifdef __GNUC__
+# pragma GCC diagnostic ignored "-Wdouble-promotion"
+#endif
/* precalculated gaussian factors for 5x super sampling */
static float gaussianFactors[5] = {0.996849f,
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index 828f752eaa5..75c22d06042 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -47,40 +47,41 @@ typedef struct {
} IDType;
/* plural need to match rna_main.c's MainCollectionDef */
+/* WARNING! Keep it in sync with i18n contexts in BLF_translation.h */
static IDType idtypes[] = {
- { ID_AC, "Action", "actions", IDTYPE_FLAGS_ISLINKABLE},
- { ID_AR, "Armature", "armatures", IDTYPE_FLAGS_ISLINKABLE},
- { ID_BR, "Brush", "brushes", IDTYPE_FLAGS_ISLINKABLE},
- { ID_CA, "Camera", "cameras", IDTYPE_FLAGS_ISLINKABLE},
- { ID_CU, "Curve", "curves", IDTYPE_FLAGS_ISLINKABLE},
- { ID_GD, "GPencil", "grease_pencil", IDTYPE_FLAGS_ISLINKABLE}, /* rename gpencil */
- { ID_GR, "Group", "groups", IDTYPE_FLAGS_ISLINKABLE},
- { ID_ID, "ID", "ids", 0}, /* plural is fake */
- { ID_IM, "Image", "images", IDTYPE_FLAGS_ISLINKABLE},
- { ID_IP, "Ipo", "ipos", IDTYPE_FLAGS_ISLINKABLE}, /* deprecated */
- { ID_KE, "Key", "shape_keys", 0},
- { ID_LA, "Lamp", "lamps", IDTYPE_FLAGS_ISLINKABLE},
- { ID_LI, "Library", "libraries", 0},
- { ID_LS, "FreestyleLineStyle", "linestyles", IDTYPE_FLAGS_ISLINKABLE},
- { ID_LT, "Lattice", "lattices", IDTYPE_FLAGS_ISLINKABLE},
- { ID_MA, "Material", "materials", IDTYPE_FLAGS_ISLINKABLE},
- { ID_MB, "Metaball", "metaballs", IDTYPE_FLAGS_ISLINKABLE},
- { ID_ME, "Mesh", "meshes", IDTYPE_FLAGS_ISLINKABLE},
- { ID_NT, "NodeTree", "node_groups", IDTYPE_FLAGS_ISLINKABLE},
- { ID_OB, "Object", "objects", IDTYPE_FLAGS_ISLINKABLE},
- { ID_PA, "ParticleSettings", "particles", 0},
- { ID_SCE, "Scene", "scenes", IDTYPE_FLAGS_ISLINKABLE},
- { ID_SCR, "Screen", "screens", 0},
- { ID_SEQ, "Sequence", "sequences", 0}, /* not actually ID data */
- { ID_SPK, "Speaker", "speakers", IDTYPE_FLAGS_ISLINKABLE},
- { ID_SO, "Sound", "sounds", IDTYPE_FLAGS_ISLINKABLE},
- { ID_TE, "Texture", "textures", IDTYPE_FLAGS_ISLINKABLE},
- { ID_TXT, "Text", "texts", IDTYPE_FLAGS_ISLINKABLE},
- { ID_VF, "VFont", "fonts", IDTYPE_FLAGS_ISLINKABLE},
- { ID_WO, "World", "worlds", IDTYPE_FLAGS_ISLINKABLE},
- { ID_WM, "WindowManager", "window_managers", 0},
- { ID_MC, "MovieClip", "movieclips", IDTYPE_FLAGS_ISLINKABLE},
- { ID_MSK, "Mask", "masks", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_AC, "Action", "actions", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_AR, "Armature", "armatures", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_BR, "Brush", "brushes", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_CA, "Camera", "cameras", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_CU, "Curve", "curves", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_GD, "GPencil", "grease_pencil", IDTYPE_FLAGS_ISLINKABLE }, /* rename gpencil */
+ { ID_GR, "Group", "groups", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_ID, "ID", "ids", 0 }, /* plural is fake */
+ { ID_IM, "Image", "images", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_IP, "Ipo", "ipos", IDTYPE_FLAGS_ISLINKABLE }, /* deprecated */
+ { ID_KE, "Key", "shape_keys", 0 },
+ { ID_LA, "Lamp", "lamps", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_LI, "Library", "libraries", 0 },
+ { ID_LS, "FreestyleLineStyle", "linestyles", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_LT, "Lattice", "lattices", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_MA, "Material", "materials", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_MB, "Metaball", "metaballs", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_MC, "MovieClip", "movieclips", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_ME, "Mesh", "meshes", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_MSK, "Mask", "masks", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_NT, "NodeTree", "node_groups", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_OB, "Object", "objects", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_PA, "ParticleSettings", "particles", 0 },
+ { ID_SCE, "Scene", "scenes", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_SCR, "Screen", "screens", 0 },
+ { ID_SEQ, "Sequence", "sequences", 0 }, /* not actually ID data */
+ { ID_SPK, "Speaker", "speakers", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_SO, "Sound", "sounds", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_TE, "Texture", "textures", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_TXT, "Text", "texts", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_VF, "VFont", "fonts", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_WO, "World", "worlds", IDTYPE_FLAGS_ISLINKABLE },
+ { ID_WM, "WindowManager", "window_managers", 0 },
};
static int nidtypes = sizeof(idtypes) / sizeof(idtypes[0]);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index d98c2bc2f8b..e4b9edacc7e 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2920,7 +2920,20 @@ void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
/* checks whether there's an image buffer for given image and user */
int BKE_image_has_ibuf(Image *ima, ImageUser *iuser)
{
- ImBuf *ibuf = image_get_ibuf_threadsafe(ima, iuser, NULL, NULL);
+ ImBuf *ibuf;
+
+ /* quick reject tests */
+ if (ima == NULL)
+ return FALSE;
+
+ if (iuser) {
+ if (iuser->ok == 0)
+ return FALSE;
+ }
+ else if (ima->ok == 0)
+ return FALSE;
+
+ ibuf = image_get_ibuf_threadsafe(ima, iuser, NULL, NULL);
if (!ibuf) {
BLI_spin_lock(&image_spin);
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 469881020c1..0b7fdaa7c1d 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -139,6 +139,9 @@ static ImBuf *prepare_effect_imbufs(SeqRenderData context, ImBuf *ibuf1, ImBuf *
IMB_rect_from_float(ibuf3);
}
+ if (out->rect_float)
+ IMB_colormanagement_assign_float_colorspace(out, context.scene->sequencer_colorspace_settings.name);
+
return out;
}
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 547ca96e10a..e023a3e20ae 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -2338,11 +2338,13 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
*/
const short is_rendering = G.is_rendering;
+ const short is_background = G.background;
const int do_seq_gl = G.is_rendering ?
0 /* (context.scene->r.seq_flag & R_SEQ_GL_REND) */ :
(context.scene->r.seq_flag & R_SEQ_GL_PREV);
int do_seq;
int have_seq = FALSE;
+ int have_comp = FALSE;
Scene *scene;
int is_thread_main = BLI_thread_is_main();
@@ -2355,6 +2357,7 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
frame = scene->r.sfra + nr + seq->anim_startofs;
have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first;
+ have_comp = (scene->r.scemode & R_DOCOMP) && scene->use_nodes && scene->nodetree;
oldcfra = scene->r.cfra;
scene->r.cfra = frame;
@@ -2367,7 +2370,7 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
camera = scene->camera;
}
- if (have_seq == FALSE && camera == NULL) {
+ if (have_comp == FALSE && camera == NULL) {
scene->r.cfra = oldcfra;
return NULL;
}
@@ -2407,11 +2410,15 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
*
* disable rendered preview for sequencer while rendering -- it's very much possible
* that preview render will went into conflict with final render
+ *
+ * When rendering from command line renderer is called from main thread, in this
+ * case it's always safe to render scene here
*/
- if (!is_thread_main || is_rendering == FALSE) {
+ if (!is_thread_main || is_rendering == FALSE || is_background) {
if (re == NULL)
re = RE_NewRender(scene->id.name);
+ BKE_scene_update_for_newframe(context.bmain, scene, scene->lay);
RE_BlenderFrame(re, context.bmain, scene, NULL, camera, scene->lay, frame, FALSE);
/* restore previous state after it was toggled on & off by RE_BlenderFrame */
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index d166592424d..e6339d07e66 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -96,17 +96,6 @@
* If the user moves the cursor the st containing that cursor should
* be popped ... other st's retain their own top location.
*
- * Markers
- * --
- * The mrk->flags define the behavior and relationships between markers. The
- * upper two bytes are used to hold a group ID, the lower two are normal flags. If
- * TMARK_EDITALL is set the group ID defines which other markers should be edited.
- *
- * The mrk->clr field is used to visually group markers where the flags may not
- * match. A template system, for example, may allow editing of repeating tokens
- * (in one group) but include other marked positions (in another group) all in the
- * same template with the same color.
- *
* Undo
* --
* Undo/Redo works by storing
@@ -174,7 +163,6 @@ void BKE_text_free(Text *text)
}
BLI_freelistN(&text->lines);
- BLI_freelistN(&text->markers);
if (text->name) MEM_freeN(text->name);
MEM_freeN(text->undo_buf);
@@ -202,7 +190,6 @@ Text *BKE_text_add(const char *name)
ta->flags |= TXT_TABSTOSPACES;
ta->lines.first = ta->lines.last = NULL;
- ta->markers.first = ta->markers.last = NULL;
tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline");
tmp->line = (char *) MEM_mallocN(1, "textline_string");
@@ -398,7 +385,6 @@ Text *BKE_text_load(const char *file, const char *relpath)
ta->id.us = 1;
ta->lines.first = ta->lines.last = NULL;
- ta->markers.first = ta->markers.last = NULL;
ta->curl = ta->sell = NULL;
if ((U.flag & USER_TXT_TABSTOSPACES_DISABLE) == 0)
@@ -495,7 +481,6 @@ Text *BKE_text_copy(Text *ta)
tan->flags = ta->flags | TXT_ISDIRTY;
tan->lines.first = tan->lines.last = NULL;
- tan->markers.first = tan->markers.last = NULL;
tan->curl = tan->sell = NULL;
tan->nlines = ta->nlines;
@@ -1150,9 +1135,7 @@ int txt_has_sel(Text *text)
static void txt_delete_sel(Text *text)
{
TextLine *tmpl;
- TextMarker *mrk;
char *buf;
- int move, lineno;
if (!text) return;
if (!text->curl) return;
@@ -1169,28 +1152,6 @@ static void txt_delete_sel(Text *text)
}
buf = MEM_mallocN(text->curc + (text->sell->len - text->selc) + 1, "textline_string");
-
- if (text->curl != text->sell) {
- txt_clear_marker_region(text, text->curl, text->curc, text->curl->len, 0, 0);
- move = txt_get_span(text->curl, text->sell);
- }
- else {
- mrk = txt_find_marker_region(text, text->curl, text->curc, text->selc, 0, 0);
- if (mrk && (mrk->start > text->curc || mrk->end < text->selc))
- txt_clear_marker_region(text, text->curl, text->curc, text->selc, 0, 0);
- move = 0;
- }
-
- mrk = txt_find_marker_region(text, text->sell, text->selc - 1, text->sell->len, 0, 0);
- if (mrk) {
- lineno = mrk->lineno;
- do {
- mrk->lineno -= move;
- if (mrk->start > text->curc) mrk->start -= text->selc - text->curc;
- mrk->end -= text->selc - text->curc;
- mrk = mrk->next;
- } while (mrk && mrk->lineno == lineno);
- }
strncpy(buf, text->curl->line, text->curc);
strcpy(buf + text->curc, text->sell->line + text->selc);
@@ -1419,19 +1380,9 @@ char *txt_sel_to_buf(Text *text)
return buf;
}
-static void txt_shift_markers(Text *text, int lineno, int count)
-{
- TextMarker *marker;
-
- for (marker = text->markers.first; marker; marker = marker->next)
- if (marker->lineno >= lineno) {
- marker->lineno += count;
- }
-}
-
void txt_insert_buf(Text *text, const char *in_buffer)
{
- int l = 0, u, len, lineno = -1, count = 0;
+ int l = 0, u, len;
size_t i = 0, j;
TextLine *add;
char *buffer;
@@ -1458,9 +1409,6 @@ void txt_insert_buf(Text *text, const char *in_buffer)
else { undoing = u; MEM_freeN(buffer); return; }
i++;
- /* Read as many full lines as we can */
- lineno = txt_get_span(text->lines.first, text->curl);
-
while (i < len) {
l = 0;
@@ -1472,14 +1420,8 @@ void txt_insert_buf(Text *text, const char *in_buffer)
add = txt_new_linen(buffer + (i - l), l);
BLI_insertlinkbefore(&text->lines, text->curl, add);
i++;
- count++;
}
else {
- if (count) {
- txt_shift_markers(text, lineno, count);
- count = 0;
- }
-
for (j = i - l; j < i && j < len; )
txt_add_raw_char(text, BLI_str_utf8_as_unicode_step(buffer, &j));
break;
@@ -1488,10 +1430,6 @@ void txt_insert_buf(Text *text, const char *in_buffer)
MEM_freeN(buffer);
- if (count) {
- txt_shift_markers(text, lineno, count);
- }
-
undoing = u;
}
@@ -2324,31 +2262,13 @@ void txt_do_redo(Text *text)
void txt_split_curline(Text *text)
{
TextLine *ins;
- TextMarker *mrk;
char *left, *right;
- int lineno = -1;
if (!text) return;
if (!text->curl) return;
txt_delete_sel(text);
- /* Move markers */
-
- lineno = txt_get_span(text->lines.first, text->curl);
- mrk = text->markers.first;
- while (mrk) {
- if (mrk->lineno == lineno && mrk->start > text->curc) {
- mrk->lineno++;
- mrk->start -= text->curc;
- mrk->end -= text->curc;
- }
- else if (mrk->lineno > lineno) {
- mrk->lineno++;
- }
- mrk = mrk->next;
- }
-
/* Make the two half strings */
left = MEM_mallocN(text->curc + 1, "textline_string");
@@ -2385,25 +2305,9 @@ void txt_split_curline(Text *text)
static void txt_delete_line(Text *text, TextLine *line)
{
- TextMarker *mrk = NULL, *nxt;
-
if (!text) return;
if (!text->curl) return;
- /* warning, this can be _slow_ when deleting many lines! */
- if ((mrk = text->markers.first)) {
- int lineno = txt_get_span(text->lines.first, line);
- mrk = text->markers.first;
- while (mrk) {
- nxt = mrk->next;
- if (mrk->lineno == lineno)
- BLI_freelinkN(&text->markers, mrk);
- else if (mrk->lineno > lineno)
- mrk->lineno--;
- mrk = nxt;
- }
- }
-
BLI_remlink(&text->lines, line);
if (line->line) MEM_freeN(line->line);
@@ -2418,27 +2322,11 @@ static void txt_delete_line(Text *text, TextLine *line)
static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb)
{
char *tmp;
- TextMarker *mrk = NULL;
if (!text) return;
if (!linea || !lineb) return;
- mrk = txt_find_marker_region(text, lineb, 0, lineb->len, 0, 0);
- if (mrk) {
- int lineno;
- lineno = mrk->lineno;
- do {
- mrk->lineno--;
- mrk->start += linea->len;
- mrk->end += linea->len;
- mrk = mrk->next;
- } while (mrk && mrk->lineno == lineno);
- }
-#if 0 /* UNUSED */
- if (lineno == -1)
- lineno = txt_get_span(text->lines.first, lineb);
-#endif
tmp = MEM_mallocN(linea->len + lineb->len + 1, "textline_string");
@@ -2492,27 +2380,7 @@ void txt_delete_char(Text *text)
}
else { /* Just deleting a char */
size_t c_len = 0;
- TextMarker *mrk;
c = BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &c_len);
-
- mrk = txt_find_marker_region(text, text->curl, text->curc - c_len, text->curl->len, 0, 0);
- if (mrk) {
- int lineno = mrk->lineno;
- if (mrk->end == text->curc) {
- if ((mrk->flags & TMARK_TEMP) && !(mrk->flags & TMARK_EDITALL)) {
- txt_clear_markers(text, mrk->group, TMARK_TEMP);
- }
- else {
- BLI_freelinkN(&text->markers, mrk);
- }
- return;
- }
- do {
- if (mrk->start > text->curc) mrk->start -= c_len;
- mrk->end -= c_len;
- mrk = mrk->next;
- } while (mrk && mrk->lineno == lineno);
- }
memmove(text->curl->line + text->curc, text->curl->line + text->curc + c_len, text->curl->len - text->curc - c_len + 1);
@@ -2556,28 +2424,8 @@ void txt_backspace_char(Text *text)
}
else { /* Just backspacing a char */
size_t c_len = 0;
- TextMarker *mrk;
char *prev = BLI_str_prev_char_utf8(text->curl->line + text->curc);
c = BLI_str_utf8_as_unicode_and_size(prev, &c_len);
-
- mrk = txt_find_marker_region(text, text->curl, text->curc - c_len, text->curl->len, 0, 0);
- if (mrk) {
- int lineno = mrk->lineno;
- if (mrk->start == text->curc) {
- if ((mrk->flags & TMARK_TEMP) && !(mrk->flags & TMARK_EDITALL)) {
- txt_clear_markers(text, mrk->group, TMARK_TEMP);
- }
- else {
- BLI_freelinkN(&text->markers, mrk);
- }
- return;
- }
- do {
- if (mrk->start > text->curc - c_len) mrk->start -= c_len;
- mrk->end -= c_len;
- mrk = mrk->next;
- } while (mrk && mrk->lineno == lineno);
- }
/* source and destination overlap, don't use memcpy() */
memmove(text->curl->line + text->curc - c_len,
@@ -2619,9 +2467,7 @@ static void txt_convert_tab_to_spaces(Text *text)
static int txt_add_char_intern(Text *text, unsigned int add, int replace_tabs)
{
- int lineno;
char *tmp, ch[BLI_UTF8_MAX];
- TextMarker *mrk;
size_t add_len;
if (!text) return 0;
@@ -2643,15 +2489,6 @@ static int txt_add_char_intern(Text *text, unsigned int add, int replace_tabs)
if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, add);
add_len = BLI_str_utf8_from_unicode(add, ch);
- mrk = txt_find_marker_region(text, text->curl, text->curc - 1, text->curl->len, 0, 0);
- if (mrk) {
- lineno = mrk->lineno;
- do {
- if (mrk->start > text->curc) mrk->start += add_len;
- mrk->end += add_len;
- mrk = mrk->next;
- } while (mrk && mrk->lineno == lineno);
- }
tmp = MEM_mallocN(text->curl->len + add_len + 1, "textline_string");
@@ -2698,10 +2535,7 @@ int txt_replace_char(Text *text, unsigned int add)
/* If text is selected or we're at the end of the line just use txt_add_char */
if (text->curc == text->curl->len || txt_has_sel(text) || add == '\n') {
- int i = txt_add_char(text, add);
- TextMarker *mrk = txt_find_marker(text, text->curl, text->curc, 0, 0);
- if (mrk) BLI_freelinkN(&text->markers, mrk);
- return i;
+ return txt_add_char(text, add);
}
del = BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &del_size);
@@ -3039,157 +2873,6 @@ int setcurr_tab_spaces(Text *text, int space)
return i;
}
-/*********************************/
-/* Text marker utility functions */
-/*********************************/
-
-/* Creates and adds a marker to the list maintaining sorted order */
-void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsigned char color[4], int group, int flags)
-{
- TextMarker *tmp, *marker;
-
- marker = MEM_mallocN(sizeof(TextMarker), "text_marker");
-
- marker->lineno = txt_get_span(text->lines.first, line);
- marker->start = MIN2(start, end);
- marker->end = MAX2(start, end);
- marker->group = group;
- marker->flags = flags;
-
- marker->color[0] = color[0];
- marker->color[1] = color[1];
- marker->color[2] = color[2];
- marker->color[3] = color[3];
-
- for (tmp = text->markers.last; tmp; tmp = tmp->prev)
- if (tmp->lineno < marker->lineno || (tmp->lineno == marker->lineno && tmp->start < marker->start))
- break;
-
- if (tmp) BLI_insertlinkafter(&text->markers, tmp, marker);
- else BLI_addhead(&text->markers, marker);
-}
-
-/* Returns the first matching marker on the specified line between two points.
- * If the group or flags fields are non-zero the returned flag must be in the
- * specified group and have at least the specified flags set. */
-TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags)
-{
- TextMarker *marker, *next;
- int lineno = txt_get_span(text->lines.first, line);
-
- for (marker = text->markers.first; marker; marker = next) {
- next = marker->next;
-
- if (group && marker->group != group) continue;
- else if ((marker->flags & flags) != flags) continue;
- else if (marker->lineno < lineno) continue;
- else if (marker->lineno > lineno) break;
-
- if ((marker->start == marker->end && start <= marker->start && marker->start <= end) ||
- (marker->start < end && marker->end > start))
- {
- return marker;
- }
- }
- return NULL;
-}
-
-/* Clears all markers on the specified line between two points. If the group or
- * flags fields are non-zero the returned flag must be in the specified group
- * and have at least the specified flags set. */
-short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, int group, int flags)
-{
- TextMarker *marker, *next;
- int lineno = txt_get_span(text->lines.first, line);
- short cleared = 0;
-
- for (marker = text->markers.first; marker; marker = next) {
- next = marker->next;
-
- if (group && marker->group != group) continue;
- else if ((marker->flags & flags) != flags) continue;
- else if (marker->lineno < lineno) continue;
- else if (marker->lineno > lineno) break;
-
- if ((marker->start == marker->end && start <= marker->start && marker->start <= end) ||
- (marker->start < end && marker->end > start))
- {
- BLI_freelinkN(&text->markers, marker);
- cleared = 1;
- }
- }
- return cleared;
-}
-
-/* Clears all markers in the specified group (if given) with at least the
- * specified flags set. Useful for clearing temporary markers (group = 0,
- * flags = TMARK_TEMP) */
-short txt_clear_markers(Text *text, int group, int flags)
-{
- TextMarker *marker, *next;
- short cleared = 0;
-
- for (marker = text->markers.first; marker; marker = next) {
- next = marker->next;
-
- if ((!group || marker->group == group) &&
- (marker->flags & flags) == flags)
- {
- BLI_freelinkN(&text->markers, marker);
- cleared = 1;
- }
- }
- return cleared;
-}
-
-/* Finds the marker at the specified line and cursor position with at least the
- * specified flags set in the given group (if non-zero). */
-TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int flags)
-{
- TextMarker *marker;
- int lineno = txt_get_span(text->lines.first, line);
-
- for (marker = text->markers.first; marker; marker = marker->next) {
- if (group && marker->group != group) continue;
- else if ((marker->flags & flags) != flags) continue;
- else if (marker->lineno < lineno) continue;
- else if (marker->lineno > lineno) break;
-
- if (marker->start <= curs && curs <= marker->end)
- return marker;
- }
- return NULL;
-}
-
-/* Finds the previous marker in the same group. If no other is found, the same
- * marker will be returned */
-TextMarker *txt_prev_marker(Text *text, TextMarker *marker)
-{
- TextMarker *tmp = marker;
- while (tmp) {
- if (tmp->prev) tmp = tmp->prev;
- else tmp = text->markers.last;
- if (tmp->group == marker->group)
- return tmp;
- }
- return NULL; /* Only if (marker == NULL) */
-}
-
-/* Finds the next marker in the same group. If no other is found, the same
- * marker will be returned */
-TextMarker *txt_next_marker(Text *text, TextMarker *marker)
-{
- TextMarker *tmp = marker;
- while (tmp) {
- if (tmp->next) tmp = tmp->next;
- else tmp = text->markers.first;
- if (tmp->group == marker->group)
- return tmp;
- }
- return NULL; /* Only if (marker == NULL) */
-}
-
-
/*******************************/
/* Character utility functions */
/*******************************/
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index da9c919c109..0f861a7ed37 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -111,6 +111,11 @@ static void delete_picture(AVFrame *f)
}
}
+static int use_float_audio_buffer(int codec_id)
+{
+ return codec_id == CODEC_ID_AAC || codec_id == CODEC_ID_AC3 || codec_id == CODEC_ID_VORBIS;
+}
+
#ifdef WITH_AUDASPACE
static int write_audio_frame(void)
{
@@ -599,12 +604,14 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
/* Prepare an audio stream for the output file */
-static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContext *of)
+static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContext *of, char *error, int error_size)
{
AVStream *st;
AVCodecContext *c;
AVCodec *codec;
+ error[0] = '\0';
+
st = av_new_stream(of, 1);
if (!st) return NULL;
@@ -616,6 +623,10 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
c->bit_rate = ffmpeg_audio_bitrate * 1000;
c->sample_fmt = AV_SAMPLE_FMT_S16;
c->channels = rd->ffcodecdata.audio_channels;
+ if (use_float_audio_buffer(codec_id)) {
+ c->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
+ c->sample_fmt = AV_SAMPLE_FMT_FLT;
+ }
codec = avcodec_find_encoder(c->codec_id);
if (!codec) {
//XXX error("Couldn't find a valid audio codec");
@@ -626,6 +637,7 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
if (avcodec_open(c, codec) < 0) {
//XXX error("Couldn't initialize audio codec");
+ BLI_strncpy(error, IMB_ffmpeg_last_error(), error_size);
return NULL;
}
@@ -646,7 +658,12 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
audio_output_buffer = (uint8_t *) av_malloc(audio_outbuf_size);
- audio_input_buffer = (uint8_t *) av_malloc(audio_input_samples * c->channels * sizeof(int16_t));
+ if (use_float_audio_buffer(codec_id)) {
+ audio_input_buffer = (uint8_t *) av_malloc(audio_input_samples * c->channels * sizeof(float));
+ }
+ else {
+ audio_input_buffer = (uint8_t *) av_malloc(audio_input_samples * c->channels * sizeof(int16_t));
+ }
audio_time = 0.0f;
@@ -801,9 +818,12 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
}
if (ffmpeg_audio_codec != CODEC_ID_NONE) {
- audio_stream = alloc_audio_stream(rd, fmt->audio_codec, of);
+ audio_stream = alloc_audio_stream(rd, fmt->audio_codec, of, error, sizeof(error));
if (!audio_stream) {
- BKE_report(reports, RPT_ERROR, "Error initializing audio stream");
+ if (error[0])
+ BKE_report(reports, RPT_ERROR, error);
+ else
+ BKE_report(reports, RPT_ERROR, "Error initializing audio stream");
av_dict_free(&opts);
return 0;
}
@@ -943,7 +963,12 @@ int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty,
AVCodecContext *c = audio_stream->codec;
AUD_DeviceSpecs specs;
specs.channels = c->channels;
- specs.format = AUD_FORMAT_S16;
+ if (use_float_audio_buffer(c->codec_id)) {
+ specs.format = AUD_FORMAT_FLOAT32;
+ }
+ else {
+ specs.format = AUD_FORMAT_S16;
+ }
specs.rate = rd->ffcodecdata.audio_mixrate;
audio_mixdown_device = sound_mixdown(scene, specs, rd->sfra, rd->ffcodecdata.audio_volume);
#ifdef FFMPEG_CODEC_TIME_BASE
diff --git a/source/blender/blenlib/BLI_endian_switch_inline.h b/source/blender/blenlib/BLI_endian_switch_inline.h
index 4bc6d3828b9..358206f1177 100644
--- a/source/blender/blenlib/BLI_endian_switch_inline.h
+++ b/source/blender/blenlib/BLI_endian_switch_inline.h
@@ -38,41 +38,43 @@
/* *** 16 *** */
BLI_INLINE void BLI_endian_switch_int16(short *val)
{
- short tval = *val;
- *val = (tval >> 8) |
- (tval << 8);
-
+ BLI_endian_switch_uint16((unsigned short *)val);
}
BLI_INLINE void BLI_endian_switch_uint16(unsigned short *val)
{
- BLI_endian_switch_int16((short *)val);
+ unsigned short tval = *val;
+ *val = (tval >> 8) |
+ (tval << 8);
}
/* *** 32 *** */
BLI_INLINE void BLI_endian_switch_int32(int *val)
{
- int tval = *val;
+ BLI_endian_switch_uint32((unsigned int *)val);
+}
+BLI_INLINE void BLI_endian_switch_uint32(unsigned int *val)
+{
+ unsigned int tval = *val;
*val = ((tval >> 24)) |
((tval << 8) & 0x00ff0000) |
((tval >> 8) & 0x0000ff00) |
((tval << 24));
-
-}
-BLI_INLINE void BLI_endian_switch_uint32(unsigned int *val)
-{
- BLI_endian_switch_int32((int *)val);
}
BLI_INLINE void BLI_endian_switch_float(float *val)
{
- BLI_endian_switch_int32((int *)val);
+ BLI_endian_switch_uint32((unsigned int *)val);
}
/* *** 64 *** */
BLI_INLINE void BLI_endian_switch_int64(int64_t *val)
{
- int64_t tval = *val;
+ BLI_endian_switch_uint64((uint64_t *)val);
+}
+BLI_INLINE void BLI_endian_switch_uint64(uint64_t *val)
+{
+ uint64_t tval = *val;
*val = ((tval >> 56)) |
((tval << 40) & 0x00ff000000000000ll) |
((tval << 24) & 0x0000ff0000000000ll) |
@@ -82,13 +84,9 @@ BLI_INLINE void BLI_endian_switch_int64(int64_t *val)
((tval >> 40) & 0x000000000000ff00ll) |
((tval << 56));
}
-BLI_INLINE void BLI_endian_switch_uint64(uint64_t *val)
-{
- BLI_endian_switch_int64((int64_t *)val);
-}
BLI_INLINE void BLI_endian_switch_double(double *val)
{
- BLI_endian_switch_int64((int64_t *)val);
+ BLI_endian_switch_uint64((uint64_t *)val);
}
#endif /* __BLI_ENDIAN_SWITCH_INLINE_H__ */
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index c26e6cd15b3..7eac1425a5c 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -71,7 +71,7 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val);
void *BLI_ghash_lookup(GHash *gh, const void *key);
int BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
void *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp);
-int BLI_ghash_haskey(GHash *gh, void *key);
+int BLI_ghash_haskey(GHash *gh, const void *key);
int BLI_ghash_size(GHash *gh);
/* *** */
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 2b513cbec41..69d6478e0e2 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -170,7 +170,7 @@
} (void)0
#endif
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
#include "intern/math_base_inline.c"
#endif
@@ -203,7 +203,7 @@ MINLINE int is_power_of_2_i(int n);
MINLINE int power_of_2_max_i(int n);
MINLINE int power_of_2_min_i(int n);
-MINLINE float shell_angle_to_dist(float angle);
+MINLINE float shell_angle_to_dist(const float angle);
#if (defined(WIN32) || defined(WIN64)) && !defined(FREE_WINDOWS)
extern double copysign(double x, double y);
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index 7c8bf88943d..c71463da61d 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -121,7 +121,7 @@ MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3]
void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power);
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
#include "intern/math_color_inline.c"
#endif
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 509927e589c..cfd163d4e57 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -36,7 +36,7 @@ extern "C" {
#include "BLI_math_inline.h"
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
#include "intern/math_geom_inline.c"
#endif
diff --git a/source/blender/blenlib/BLI_math_inline.h b/source/blender/blenlib/BLI_math_inline.h
index ce43d5fb941..6dad44644f2 100644
--- a/source/blender/blenlib/BLI_math_inline.h
+++ b/source/blender/blenlib/BLI_math_inline.h
@@ -35,9 +35,10 @@ extern "C" {
#endif
/* add platform/compiler checks here if it is not supported */
-#define __BLI_MATH_INLINE_H__
+/* all platforms support forcing inline so this is always enabled */
+#define BLI_MATH_DO_INLINE 1
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
# ifdef _MSC_VER
# define MINLINE static __forceinline
# define MALWAYS_INLINE MINLINE
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 5f80d1e52d7..f4572afec84 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -36,7 +36,7 @@ extern "C" {
#include "BLI_math_inline.h"
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
#include "intern/math_vector_inline.c"
#endif
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index cd3a934d816..7be636fe150 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -175,3 +175,9 @@ if(WIN32)
endif()
blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}")
+
+if(MSVC)
+ # Quiet warning about inline math library files that do not export symbols.
+ # (normally you'd exclude from project, but we still want to see the files in MSVC)
+ set_target_properties(bf_blenlib PROPERTIES STATIC_LIBRARY_FLAGS /ignore:4221)
+endif()
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 0cae9bab531..c4094920c2a 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -178,7 +178,7 @@ void *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp)
return NULL;
}
-int BLI_ghash_haskey(GHash *gh, void *key)
+int BLI_ghash_haskey(GHash *gh, const void *key)
{
unsigned int hash = gh->hashfp(key) % gh->nbuckets;
Entry *e;
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 8dccded64d1..b9866f9c6e6 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -27,6 +27,8 @@
* \ingroup bli
*/
+#ifndef __MATH_BASE_INLINE_C__
+#define __MATH_BASE_INLINE_C__
#include <float.h>
#include <stdio.h>
@@ -35,9 +37,6 @@
#include "BLI_math.h"
-#ifndef __MATH_BASE_INLINE_C__
-#define __MATH_BASE_INLINE_C__
-
/* A few small defines. Keep'em local! */
#define SMALL_NUMBER 1.e-8f
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c
index 01585c93bc8..ba9770e1bd1 100644
--- a/source/blender/blenlib/intern/math_geom_inline.c
+++ b/source/blender/blenlib/intern/math_geom_inline.c
@@ -27,11 +27,12 @@
* \ingroup bli
*/
+#ifndef __MATH_GEOM_INLINE_C__
+#define __MATH_GEOM_INLINE_C__
#include "BLI_math.h"
-#ifndef __MATH_GEOM_INLINE_C__
-#define __MATH_GEOM_INLINE_C__
+#include <string.h>
/****************************** Spherical Harmonics **************************/
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 191b0e16025..3ede8636aa5 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -27,12 +27,11 @@
* \ingroup bli
*/
-
-#include "BLI_math.h"
-
#ifndef __MATH_VECTOR_INLINE_C__
#define __MATH_VECTOR_INLINE_C__
+#include "BLI_math.h"
+
/********************************** Init *************************************/
MINLINE void zero_v2(float r[2])
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index ff589764287..14e0dc2f049 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -56,7 +56,7 @@ char *BLI_strdup(const char *str)
return BLI_strdupn(str, strlen(str));
}
-char *BLI_strdupcat(const char *str1, const char *str2)
+char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2)
{
size_t len;
char *n;
@@ -69,7 +69,7 @@ char *BLI_strdupcat(const char *str1, const char *str2)
return n;
}
-char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy)
+char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
{
size_t srclen = strlen(src);
size_t cpylen = (srclen > (maxncpy - 1)) ? (maxncpy - 1) : srclen;
@@ -81,7 +81,7 @@ char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy)
return dst;
}
-size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg)
+size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg)
{
size_t n;
@@ -97,7 +97,7 @@ size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg
return n;
}
-size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...)
+size_t BLI_snprintf(char *__restrict buffer, size_t count, const char *__restrict format, ...)
{
size_t n;
va_list arg;
@@ -109,7 +109,7 @@ size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...)
return n;
}
-char *BLI_sprintfN(const char *format, ...)
+char *BLI_sprintfN(const char *__restrict format, ...)
{
DynStr *ds;
va_list arg;
@@ -133,7 +133,7 @@ char *BLI_sprintfN(const char *format, ...)
* TODO: support more fancy string escaping. current code is primitive
* this basically is an ascii version of PyUnicode_EncodeUnicodeEscape()
* which is a useful reference. */
-size_t BLI_strescape(char *dst, const char *src, const size_t maxncpy)
+size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
{
size_t len = 0;
@@ -186,7 +186,7 @@ escape_finish:
*
* TODO, return the offset and a length so as to avoid doing an allocation.
*/
-char *BLI_str_quoted_substrN(const char *str, const char *prefix)
+char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix)
{
size_t prefixLen = strlen(prefix);
char *startMatch, *endMatch;
@@ -207,7 +207,7 @@ char *BLI_str_quoted_substrN(const char *str, const char *prefix)
/* A rather wasteful string-replacement utility, though this shall do for now...
* Feel free to replace this with an even safe + nicer alternative */
-char *BLI_replacestr(char *str, const char *oldText, const char *newText)
+char *BLI_replacestr(char *__restrict str, const char *__restrict oldText, const char *__restrict newText)
{
DynStr *ds = NULL;
size_t lenOld = strlen(oldText);
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index e80f96ee0fe..16a5f03095d 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -184,7 +184,7 @@ static const size_t utf8_skip_data[256] = {
*dst = '\0'; \
} (void)0
-char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
+char *BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy)
{
char *dst_r = dst;
@@ -196,7 +196,7 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
return dst_r;
}
-char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)
+char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy)
{
while (*dst && maxncpy > 0) {
dst++;
@@ -213,7 +213,7 @@ char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)
/* --------------------------------------------------------------------------*/
/* wchar_t / utf8 functions */
-size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxncpy)
+size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxncpy)
{
size_t len = 0;
@@ -289,7 +289,7 @@ size_t BLI_strnlen_utf8(const char *start, const size_t maxlen)
return len;
}
-size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size_t maxncpy)
+size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__restrict src_c, const size_t maxncpy)
{
int len = 0;
@@ -419,7 +419,7 @@ unsigned int BLI_str_utf8_as_unicode(const char *p)
}
/* variant that increments the length */
-unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index)
+unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index)
{
int i, mask = 0, len;
unsigned int result;
@@ -435,7 +435,7 @@ unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index)
/* another variant that steps over the index,
* note, currently this also falls back to latin1 for text drawing. */
-unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index)
+unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index)
{
int i, mask = 0, len;
unsigned int result;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 90fd6cad93c..b9e23f60881 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2984,7 +2984,6 @@ static void direct_link_text(FileData *fd, Text *text)
#endif
link_list(fd, &text->lines);
- link_list(fd, &text->markers);
text->curl = newdataadr(fd, text->curl);
text->sell = newdataadr(fd, text->sell);
@@ -8502,11 +8501,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (scene = main->scene.first; scene; scene = scene->id.next) {
if (scene->r.tilex == 0 || scene->r.tiley == 1) {
- /* scene could be set for panoramic rendering, so clamp with the
- * lowest possible tile size value
- */
- scene->r.tilex = max_ii(scene->r.xsch * scene->r.size / scene->r.xparts / 100, 8);
- scene->r.tiley = max_ii(scene->r.ysch * scene->r.size / scene->r.yparts / 100, 8);
+ if (scene->r.xparts && scene->r.yparts) {
+ /* scene could be set for panoramic rendering, so clamp with the
+ * lowest possible tile size value
+ */
+ scene->r.tilex = max_ii(scene->r.xsch * scene->r.size / scene->r.xparts / 100, 8);
+ scene->r.tiley = max_ii(scene->r.ysch * scene->r.size / scene->r.yparts / 100, 8);
+ }
+ else {
+ /* happens when mixing using current trunk and previous release */
+ scene->r.tilex = scene->r.tiley = 64;
+ }
}
}
}
@@ -8556,10 +8561,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
Object *ob;
for (ob = main->object.first; ob; ob = ob->id.next) {
- if (ob->step_height == 0.0) {
- ob->step_height = 0.150;
- ob->jump_speed = 10.0;
- ob->fall_speed = 55.0;
+ if (ob->step_height == 0.0f) {
+ ob->step_height = 0.15f;
+ ob->jump_speed = 10.0f;
+ ob->fall_speed = 55.0f;
}
}
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 7c022c6f45a..5cfbf809d04 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2620,7 +2620,6 @@ static void write_texts(WriteData *wd, ListBase *idbase)
{
Text *text;
TextLine *tmp;
- TextMarker *mrk;
text= idbase->first;
while (text) {
@@ -2644,13 +2643,6 @@ static void write_texts(WriteData *wd, ListBase *idbase)
writedata(wd, DATA, tmp->len+1, tmp->line);
tmp= tmp->next;
}
-
- /* write markers */
- mrk= text->markers.first;
- while (mrk) {
- writestruct(wd, DATA, "TextMarker", 1, mrk);
- mrk= mrk->next;
- }
}
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index ba600cfe6bd..eabbf6f87cd 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -99,7 +99,7 @@ BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFa
if (nodouble) {
/* check if face exists or overlaps */
- is_overlap = BM_face_exists(bm, verts, len, &f);
+ is_overlap = BM_face_exists(verts, len, &f);
}
/* make new face */
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index d4539050147..03094873e25 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -134,7 +134,7 @@ BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example,
e->v1 = v1;
e->v2 = v2;
- BM_elem_flag_enable(e, BM_ELEM_SMOOTH);
+ BM_elem_flag_enable(e, BM_ELEM_SMOOTH | BM_ELEM_DRAW);
CustomData_bmesh_set_default(&bm->edata, &e->head.data);
@@ -311,7 +311,7 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
if (nodouble) {
/* Check if face already exists */
- overlap = BM_face_exists(bm, verts, len, &f);
+ overlap = BM_face_exists(verts, len, &f);
if (overlap) {
return f;
}
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 062c47dc686..ba5e7569c31 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -92,6 +92,14 @@ void BM_mesh_elem_toolflags_ensure(BMesh *bm)
}
}
+void BM_mesh_elem_toolflags_clear(BMesh *bm)
+{
+ if (bm->toolflagpool) {
+ BLI_mempool_destroy(bm->toolflagpool);
+ bm->toolflagpool = NULL;
+ }
+}
+
/**
* \brief BMesh Make Mesh
*
@@ -171,9 +179,7 @@ void BM_mesh_data_free(BMesh *bm)
BLI_mempool_destroy(bm->fpool);
/* destroy flag pool */
- if (bm->toolflagpool) {
- BLI_mempool_destroy(bm->toolflagpool);
- }
+ BM_mesh_elem_toolflags_clear(bm);
#ifdef USE_BMESH_HOLES
BLI_mempool_destroy(bm->looplistpool);
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index 0dcd3fc2f01..b592f863cd1 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -30,6 +30,7 @@
struct BMAllocTemplate;
void BM_mesh_elem_toolflags_ensure(BMesh *bm);
+void BM_mesh_elem_toolflags_clear(BMesh *bm);
BMesh *BM_mesh_create(struct BMAllocTemplate *allocsize);
void BM_mesh_free(BMesh *bm);
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index c5941a6c637..ec07eb5d9f7 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -47,9 +47,9 @@
* "in" (e.g. edgefacein). for three-type slots, use geom.
*
* for output slots, for single-type geometry slots, use the type name plus "out",
- * (e.g. vertout), for double-type slots, use the two type names plus "out",
- * (e.g. vertfaceout), for three-type slots, use geom. note that you can also
- * use more esohteric names (e.g. skirtout) so long as the comment next to the
+ * (e.g. verts.out), for double-type slots, use the two type names plus "out",
+ * (e.g. vertfaces.out), for three-type slots, use geom. note that you can also
+ * use more esohteric names (e.g. geom_skirt.out) so long as the comment next to the
* slot definition tells you what types of elements are in it.
*
*/
@@ -82,7 +82,7 @@
* would be extracted from comments
* next to them, e.g.
*
- * {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, //output slot, boundary region
+ * {BMO_OP_SLOT_ELEMENT_BUF, "geom.out"}, //output slot, boundary region
*
* the doc generator would automatically detect the presence of "output slot"
* and flag the slot as an output. the same happens for "input slot". also
@@ -99,16 +99,18 @@
*/
static BMOpDefine bmo_smooth_vert_def = {
"smooth_vert",
- {{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
- {BMO_OP_SLOT_BOOL, "mirror_clip_x"}, /* set vertices close to the x axis before the operation to 0 */
- {BMO_OP_SLOT_BOOL, "mirror_clip_y"}, /* set vertices close to the y axis before the operation to 0 */
- {BMO_OP_SLOT_BOOL, "mirror_clip_z"}, /* set vertices close to the z axis before the operation to 0 */
- {BMO_OP_SLOT_FLT, "clipdist"}, /* clipping threshod for the above three slots */
- {BMO_OP_SLOT_BOOL, "use_axis_x"}, /* smooth vertices along X axis */
- {BMO_OP_SLOT_BOOL, "use_axis_y"}, /* smooth vertices along Y axis */
- {BMO_OP_SLOT_BOOL, "use_axis_z"}, /* smooth vertices along Z axis */
- {0} /* null-terminating sentinel */,
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
+ {BMO_OP_SLOT_BOOL, "mirror_clip_x"}, /* set vertices close to the x axis before the operation to 0 */
+ {BMO_OP_SLOT_BOOL, "mirror_clip_y"}, /* set vertices close to the y axis before the operation to 0 */
+ {BMO_OP_SLOT_BOOL, "mirror_clip_z"}, /* set vertices close to the z axis before the operation to 0 */
+ {BMO_OP_SLOT_FLT, "clip_dist"}, /* clipping threshod for the above three slots */
+ {BMO_OP_SLOT_BOOL, "use_axis_x"}, /* smooth vertices along X axis */
+ {BMO_OP_SLOT_BOOL, "use_axis_y"}, /* smooth vertices along Y axis */
+ {BMO_OP_SLOT_BOOL, "use_axis_z"}, /* smooth vertices along Z axis */
+ {0},
},
+ {{0}}, /* no output */
bmo_smooth_vert_exec,
0
};
@@ -120,15 +122,17 @@ static BMOpDefine bmo_smooth_vert_def = {
*/
static BMOpDefine bmo_smooth_laplacian_vert_def = {
"smooth_laplacian_vert",
- {{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices
- {BMO_OP_SLOT_FLT, "lambda"}, //lambda param
- {BMO_OP_SLOT_FLT, "lambda_border"}, //lambda param in border
- {BMO_OP_SLOT_BOOL, "use_x"}, //Smooth object along X axis
- {BMO_OP_SLOT_BOOL, "use_y"}, //Smooth object along Y axis
- {BMO_OP_SLOT_BOOL, "use_z"}, //Smooth object along Z axis
- {BMO_OP_SLOT_BOOL, "volume_preservation"}, //Apply volume preservation after smooth
- {0} /* null-terminating sentinel */,
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
+ {BMO_OP_SLOT_FLT, "lambda"}, /* lambda param */
+ {BMO_OP_SLOT_FLT, "lambda_border"}, /* lambda param in border */
+ {BMO_OP_SLOT_BOOL, "use_x"}, /* Smooth object along X axis */
+ {BMO_OP_SLOT_BOOL, "use_y"}, /* Smooth object along Y axis */
+ {BMO_OP_SLOT_BOOL, "use_z"}, /* Smooth object along Z axis */
+ {BMO_OP_SLOT_BOOL, "preserve_volume"}, /* Apply volume preservation after smooth */
+ {0},
},
+ {{0}}, /* no output */
bmo_smooth_laplacian_vert_exec,
0
};
@@ -141,10 +145,12 @@ static BMOpDefine bmo_smooth_laplacian_vert_def = {
static BMOpDefine bmo_recalc_face_normals_def = {
"recalc_face_normals",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
- {BMO_OP_SLOT_BOOL, "do_flip"}, /* internal flag, used by bmesh_rationalize_normals */
- {0} /* null-terminating sentinel */,
+ {BMO_OP_SLOT_BOOL, "use_flip"}, /* internal flag, used by bmesh_rationalize_normals */
+ {0},
},
+ {{0}}, /* no output */
bmo_recalc_face_normals_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
};
@@ -154,18 +160,22 @@ static BMOpDefine bmo_recalc_face_normals_def = {
*
* used to implement the select more/less tools.
* this puts some geometry surrounding regions of
- * geometry in geom into geomout.
+ * geometry in geom into geom.out.
*
- * if usefaces is 0 then geomout spits out verts and edges,
+ * if usefaces is 0 then geom.out spits out verts and edges,
* otherwise it spits out faces.
*/
static BMOpDefine bmo_region_extend_def = {
"region_extend",
- {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry */
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* output slot, computed boundary geometry. */
- {BMO_OP_SLOT_BOOL, "constrict"}, /* find boundary inside the regions, not outside. */
- {BMO_OP_SLOT_BOOL, "use_faces"}, /* extend from faces instead of edges */
- {0} /* null-terminating sentinel */,
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry */
+ {BMO_OP_SLOT_BOOL, "use_constrict"}, /* find boundary inside the regions, not outside. */
+ {BMO_OP_SLOT_BOOL, "use_faces"}, /* extend from faces instead of edges */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom.out"}, /* output slot, computed boundary geometry. */
+ {0},
},
bmo_region_extend_exec,
0
@@ -179,10 +189,14 @@ static BMOpDefine bmo_region_extend_def = {
*/
static BMOpDefine bmo_rotate_edges_def = {
"rotate_edges",
- {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
- {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* newly spun edges */
- {BMO_OP_SLOT_BOOL, "ccw"}, /* rotate edge counter-clockwise if true, othewise clockwise */
- {0} /* null-terminating sentinel */,
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
+ {BMO_OP_SLOT_BOOL, "use_ccw"}, /* rotate edge counter-clockwise if true, othewise clockwise */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges.out"}, /* newly spun edges */
+ {0},
},
bmo_rotate_edges_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
@@ -196,9 +210,11 @@ static BMOpDefine bmo_rotate_edges_def = {
*/
static BMOpDefine bmo_reverse_faces_def = {
"reverse_faces",
- {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
- {0} /* null-terminating sentinel */,
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+ {0},
},
+ {{0}}, /* no output */
bmo_reverse_faces_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
};
@@ -211,10 +227,14 @@ static BMOpDefine bmo_reverse_faces_def = {
*/
static BMOpDefine bmo_bisect_edges_def = {
"bisect_edges",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
- {BMO_OP_SLOT_INT, "numcuts"}, /* number of cuts */
- {BMO_OP_SLOT_ELEMENT_BUF, "outsplit"}, /* newly created vertices and edges */
- {0} /* null-terminating sentinel */,
+ {BMO_OP_SLOT_INT, "cuts"}, /* number of cuts */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom_split.out"}, /* newly created vertices and edges */
+ {0},
},
bmo_bisect_edges_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
@@ -224,20 +244,25 @@ static BMOpDefine bmo_bisect_edges_def = {
* Mirror
*
* Mirrors geometry along an axis. The resulting geometry is welded on using
- * mergedist. Pairs of original/mirrored vertices are welded using the mergedist
+ * merge_dist. Pairs of original/mirrored vertices are welded using the merge_dist
* parameter (which defines the minimum distance for welding to happen).
*/
static BMOpDefine bmo_mirror_def = {
"mirror",
- {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry */
- {BMO_OP_SLOT_MAT, "mat"}, /* matrix defining the mirror transformation */
- {BMO_OP_SLOT_FLT, "mergedist"}, /* maximum distance for merging. does no merging if 0. */
- {BMO_OP_SLOT_ELEMENT_BUF, "newout"}, /* output geometry, mirrored */
- {BMO_OP_SLOT_INT, "axis"}, /* the axis to use, 0, 1, or 2 for x, y, z */
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry */
+ {BMO_OP_SLOT_MAT, "mat"}, /* matrix defining the mirror transformation */
+ {BMO_OP_SLOT_FLT, "merge_dist"}, /* maximum distance for merging. does no merging if 0. */
+ {BMO_OP_SLOT_INT, "axis"}, /* the axis to use, 0, 1, or 2 for x, y, z */
{BMO_OP_SLOT_BOOL, "mirror_u"}, /* mirror UVs across the u axis */
{BMO_OP_SLOT_BOOL, "mirror_v"}, /* mirror UVs across the v axis */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom.out"}, /* output geometry, mirrored */
+ {0},
+ },
bmo_mirror_exec,
0,
};
@@ -253,11 +278,16 @@ static BMOpDefine bmo_mirror_def = {
*/
static BMOpDefine bmo_find_doubles_def = {
"find_doubles",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
{BMO_OP_SLOT_ELEMENT_BUF, "keep_verts"}, /* list of verts to keep */
{BMO_OP_SLOT_FLT, "dist"}, /* minimum distance */
- {BMO_OP_SLOT_MAPPING, "targetmapout"},
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_MAPPING, "targetmap.out"},
+ {0},
+ },
bmo_find_doubles_exec,
0,
};
@@ -270,9 +300,12 @@ static BMOpDefine bmo_find_doubles_def = {
*/
static BMOpDefine bmo_remove_doubles_def = {
"remove_doubles",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input verts */
{BMO_OP_SLOT_FLT, "dist"}, /* minimum distance */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_remove_doubles_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
};
@@ -286,9 +319,12 @@ static BMOpDefine bmo_remove_doubles_def = {
*/
static BMOpDefine bmo_automerge_def = {
"automerge",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input verts */
{BMO_OP_SLOT_FLT, "dist"}, /* minimum distance */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_automerge_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
};
@@ -300,8 +336,11 @@ static BMOpDefine bmo_automerge_def = {
*/
static BMOpDefine bmo_collapse_def = {
"collapse",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_collapse_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
};
@@ -314,9 +353,12 @@ static BMOpDefine bmo_collapse_def = {
*/
static BMOpDefine bmo_pointmerge_facedata_def = {
"pointmerge_facedata",
- {{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertice */
- {BMO_OP_SLOT_ELEMENT_BUF, "snapv"}, /* snap verte */
- {0, /* null-terminating sentinel */}},
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
+ {BMO_OP_SLOT_ELEMENT_BUF, "snapv"}, /* snap vertex */
+ {0},
+ },
+ {{0}}, /* no output */
bmo_pointmerge_facedata_exec,
0,
};
@@ -330,8 +372,11 @@ static BMOpDefine bmo_pointmerge_facedata_def = {
*/
static BMOpDefine bmo_average_vert_facedata_def = {
"average_vert_facedata",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertice */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_average_vert_facedata_exec,
0,
};
@@ -343,9 +388,12 @@ static BMOpDefine bmo_average_vert_facedata_def = {
*/
static BMOpDefine bmo_pointmerge_def = {
"pointmerge",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertice */
{BMO_OP_SLOT_VEC, "merge_co"},
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_pointmerge_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
};
@@ -357,8 +405,11 @@ static BMOpDefine bmo_pointmerge_def = {
*/
static BMOpDefine bmo_collapse_uvs_def = {
"collapse_uvs",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_collapse_uvs_exec,
0,
};
@@ -372,8 +423,11 @@ static BMOpDefine bmo_collapse_uvs_def = {
*/
static BMOpDefine bmo_weld_verts_def = {
"weld_verts",
+ /* slots_in */
{{BMO_OP_SLOT_MAPPING, "targetmap"}, /* maps welded vertices to verts they should weld to */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_weld_verts_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
};
@@ -386,9 +440,14 @@ static BMOpDefine bmo_weld_verts_def = {
*/
static BMOpDefine bmo_create_vert_def = {
"create_vert",
+ /* slots_in */
{{BMO_OP_SLOT_VEC, "co"}, /* the coordinate of the new vert */
- {BMO_OP_SLOT_ELEMENT_BUF, "newvertout"}, /* the new vert */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "vert.out"}, /* the new vert */
+ {0},
+ },
bmo_create_vert_exec,
0,
};
@@ -401,14 +460,19 @@ static BMOpDefine bmo_create_vert_def = {
*/
static BMOpDefine bmo_join_triangles_def = {
"join_triangles",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input geometry. */
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* joined faces */
{BMO_OP_SLOT_BOOL, "cmp_sharp"},
{BMO_OP_SLOT_BOOL, "cmp_uvs"},
{BMO_OP_SLOT_BOOL, "cmp_vcols"},
{BMO_OP_SLOT_BOOL, "cmp_materials"},
{BMO_OP_SLOT_FLT, "limit"},
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces.out"}, /* joined faces */
+ {0},
+ },
bmo_join_triangles_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
};
@@ -426,13 +490,18 @@ static BMOpDefine bmo_join_triangles_def = {
*/
static BMOpDefine bmo_contextual_create_def = {
"contextual_create",
- {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry. */
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* newly-made face(s) */
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry. */
+ {BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */
+ {BMO_OP_SLOT_BOOL, "use_smooth"}, /* smooth to use */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces.out"}, /* newly-made face(s) */
/* note, this is for stand-alone edges only, not edges which are apart of newly created faces */
- {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* newly-made edge(s) */
- {BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */
- {BMO_OP_SLOT_BOOL, "use_smooth"}, /* material to use */
- {0, /* null-terminating sentinel */}},
+ {BMO_OP_SLOT_ELEMENT_BUF, "edges.out"}, /* newly-made edge(s) */
+ {0},
+ },
bmo_contextual_create_exec,
BMO_OP_FLAG_UNTAN_MULTIRES,
};
@@ -442,27 +511,37 @@ static BMOpDefine bmo_contextual_create_def = {
*/
static BMOpDefine bmo_bridge_loops_def = {
"bridge_loops",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */
{BMO_OP_SLOT_BOOL, "use_merge"},
{BMO_OP_SLOT_FLT, "merge_factor"},
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces.out"}, /* new faces */
+ {0},
+ },
bmo_bridge_loops_exec,
0,
};
static BMOpDefine bmo_edgenet_fill_def = {
"edgenet_fill",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
{BMO_OP_SLOT_MAPPING, "restrict"}, /* restricts edges to groups. maps edges to integer */
{BMO_OP_SLOT_BOOL, "use_restrict"},
{BMO_OP_SLOT_BOOL, "use_fill_check"},
- {BMO_OP_SLOT_ELEMENT_BUF, "excludefaces"}, /* list of faces to ignore for manifold check */
- {BMO_OP_SLOT_MAPPING, "faceout_groupmap"}, /* maps new faces to the group numbers they came fro */
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */
+ {BMO_OP_SLOT_ELEMENT_BUF, "exclude_faces"}, /* list of faces to ignore for manifold check */
{BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */
{BMO_OP_SLOT_BOOL, "use_smooth"}, /* material to use */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_MAPPING, "face_groupmap.out"}, /* maps new faces to the group numbers they came from */
+ {BMO_OP_SLOT_ELEMENT_BUF, "faces.out"}, /* new face */
+ {0},
+ },
bmo_edgenet_fill_exec,
0,
};
@@ -479,9 +558,14 @@ static BMOpDefine bmo_edgenet_fill_def = {
*/
static BMOpDefine bmo_edgenet_prepare_def = {
"edgenet_prepare",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
- {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* new edges */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges.out"}, /* new edges */
+ {0},
+ },
bmo_edgenet_prepare,
0,
};
@@ -494,10 +578,13 @@ static BMOpDefine bmo_edgenet_prepare_def = {
*/
static BMOpDefine bmo_rotate_def = {
"rotate",
+ /* slots_in */
{{BMO_OP_SLOT_VEC, "cent"}, /* center of rotation */
{BMO_OP_SLOT_MAT, "mat"}, /* matrix defining rotation */
{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_rotate_exec,
0,
};
@@ -510,9 +597,12 @@ static BMOpDefine bmo_rotate_def = {
*/
static BMOpDefine bmo_translate_def = {
"translate",
+ /* slots_in */
{{BMO_OP_SLOT_VEC, "vec"}, /* translation offset */
{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_translate_exec,
0,
};
@@ -524,9 +614,12 @@ static BMOpDefine bmo_translate_def = {
*/
static BMOpDefine bmo_scale_def = {
"scale",
+ /* slots_in */
{{BMO_OP_SLOT_VEC, "vec"}, /* scale factor */
{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_scale_exec,
0,
};
@@ -540,9 +633,12 @@ static BMOpDefine bmo_scale_def = {
*/
static BMOpDefine bmo_transform_def = {
"transform",
+ /* slots_in */
{{BMO_OP_SLOT_MAT, "mat"}, /* transform matrix */
{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_transform_exec,
0,
};
@@ -555,9 +651,12 @@ static BMOpDefine bmo_transform_def = {
*/
static BMOpDefine bmo_object_load_bmesh_def = {
"object_load_bmesh",
+ /* slots_in */
{{BMO_OP_SLOT_PTR, "scene"},
{BMO_OP_SLOT_PTR, "object"},
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_object_load_bmesh_exec,
0,
};
@@ -570,10 +669,13 @@ static BMOpDefine bmo_object_load_bmesh_def = {
*/
static BMOpDefine bmo_bmesh_to_mesh_def = {
"bmesh_to_mesh",
+ /* slots_in */
{{BMO_OP_SLOT_PTR, "mesh"}, /* pointer to a mesh structure to fill in */
{BMO_OP_SLOT_PTR, "object"}, /* pointer to an object structure */
- {BMO_OP_SLOT_BOOL, "notessellation"}, /* don't calculate mfaces */
- {0, /* null-terminating sentinel */}},
+ {BMO_OP_SLOT_BOOL, "skip_tessface"}, /* don't calculate mfaces */
+ {0},
+ },
+ {{0}}, /* no output */
bmo_bmesh_to_mesh_exec,
0,
};
@@ -586,10 +688,13 @@ static BMOpDefine bmo_bmesh_to_mesh_def = {
*/
static BMOpDefine bmo_mesh_to_bmesh_def = {
"mesh_to_bmesh",
+ /* slots_in */
{{BMO_OP_SLOT_PTR, "mesh"}, /* pointer to a Mesh structure */
{BMO_OP_SLOT_PTR, "object"}, /* pointer to an Object structure */
- {BMO_OP_SLOT_BOOL, "set_shapekey"}, /* load active shapekey coordinates into verts */
- {0, /* null-terminating sentinel */}},
+ {BMO_OP_SLOT_BOOL, "use_shapekey"}, /* load active shapekey coordinates into verts */
+ {0},
+ },
+ {{0}}, /* no output */
bmo_mesh_to_bmesh_exec,
0
};
@@ -601,10 +706,15 @@ static BMOpDefine bmo_mesh_to_bmesh_def = {
*/
static BMOpDefine bmo_extrude_discrete_faces_def = {
"extrude_discrete_faces",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
- {BMO_OP_SLOT_ELEMENT_BUF, "skirtout"}, /* output skirt geometry, faces and edges */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces.out"}, /* output faces */
+ {BMO_OP_SLOT_ELEMENT_BUF, "geom_skirt.out"}, /* output skirt geometry, faces and edges */
+ {0},
+ },
bmo_extrude_discrete_faces_exec,
0
};
@@ -617,9 +727,14 @@ static BMOpDefine bmo_extrude_discrete_faces_def = {
*/
static BMOpDefine bmo_extrude_edge_only_def = {
"extrude_edge_only",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input vertices */
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* output geometry */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom.out"}, /* output geometry */
+ {0},
+ },
bmo_extrude_edge_only_exec,
0
};
@@ -631,125 +746,171 @@ static BMOpDefine bmo_extrude_edge_only_def = {
*/
static BMOpDefine bmo_extrude_vert_indiv_def = {
"extrude_vert_indiv",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
- {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* output wire edges */
- {BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges.out"}, /* output wire edges */
+ {BMO_OP_SLOT_ELEMENT_BUF, "verts.out"}, /* output vertices */
+ {0},
+ },
bmo_extrude_vert_indiv_exec,
0
};
static BMOpDefine bmo_connect_verts_def = {
"connect_verts",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"},
- {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges.out"},
+ {0},
+ },
bmo_connect_verts_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
static BMOpDefine bmo_extrude_face_region_def = {
"extrude_face_region",
- {{BMO_OP_SLOT_ELEMENT_BUF, "edgefacein"},
- {BMO_OP_SLOT_MAPPING, "exclude"},
- {BMO_OP_SLOT_BOOL, "alwayskeeporig"},
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
- {0} /* null-terminating sentinel */},
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* edges and faces */
+ {BMO_OP_SLOT_MAPPING, "edges_exclude"},
+ {BMO_OP_SLOT_BOOL, "use_keep_orig"}, /* keep original geometry */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom.out"},
+ {0},
+ },
bmo_extrude_face_region_exec,
0
};
static BMOpDefine bmo_dissolve_verts_def = {
"dissolve_verts",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_dissolve_verts_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
static BMOpDefine bmo_dissolve_edges_def = {
"dissolve_edges",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
- {BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
{BMO_OP_SLOT_BOOL, "use_verts"}, /* dissolve verts left between only 2 edges. */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "region.out"},
+ {0},
+ },
bmo_dissolve_edges_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
static BMOpDefine bmo_dissolve_edge_loop_def = {
"dissolve_edge_loop",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
- {BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "region.out"},
+ {0},
+ },
bmo_dissolve_edgeloop_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
static BMOpDefine bmo_dissolve_faces_def = {
"dissolve_faces",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
- {BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
{BMO_OP_SLOT_BOOL, "use_verts"}, /* dissolve verts left between only 2 edges. */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "region.out"},
+ {0},
+ },
bmo_dissolve_faces_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
static BMOpDefine bmo_dissolve_limit_def = {
"dissolve_limit",
+ /* slots_in */
{{BMO_OP_SLOT_FLT, "angle_limit"}, /* total rotation angle (degrees) */
{BMO_OP_SLOT_BOOL, "use_dissolve_boundaries"},
{BMO_OP_SLOT_ELEMENT_BUF, "verts"},
{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_dissolve_limit_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
static BMOpDefine bmo_triangulate_def = {
"triangulate",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
- {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"},
- {BMO_OP_SLOT_MAPPING, "facemap"},
{BMO_OP_SLOT_BOOL, "use_beauty"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges.out"},
+ {BMO_OP_SLOT_ELEMENT_BUF, "faces.out"},
+ {BMO_OP_SLOT_MAPPING, "facemap.out"},
+ {0},
+ },
bmo_triangulate_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
static BMOpDefine bmo_unsubdivide_def = {
"unsubdivide",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
{BMO_OP_SLOT_INT, "iterations"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_unsubdivide_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
static BMOpDefine bmo_subdivide_edges_def = {
"subdivide_edges",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
{BMO_OP_SLOT_FLT, "smooth"},
{BMO_OP_SLOT_FLT, "fractal"},
{BMO_OP_SLOT_FLT, "along_normal"},
- {BMO_OP_SLOT_INT, "numcuts"},
+ {BMO_OP_SLOT_INT, "cuts"},
{BMO_OP_SLOT_INT, "seed"},
{BMO_OP_SLOT_MAPPING, "custompatterns"},
{BMO_OP_SLOT_MAPPING, "edgepercents"},
- /* these next three can have multiple types of elements in them */
- {BMO_OP_SLOT_ELEMENT_BUF, "outinner"},
- {BMO_OP_SLOT_ELEMENT_BUF, "outsplit"},
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* contains all output geometr */
-
- {BMO_OP_SLOT_INT, "quadcornertype"}, /* quad corner type, see bmesh_operators.h */
+ {BMO_OP_SLOT_INT, "quad_corner_type"}, /* quad corner type, see bmesh_operators.h */
{BMO_OP_SLOT_BOOL, "use_gridfill"}, /* fill in fully-selected faces with a grid */
{BMO_OP_SLOT_BOOL, "use_singleedge"}, /* tessellate the case of one edge selected in a quad or triangle */
{BMO_OP_SLOT_BOOL, "use_sphere"}, /* for making new primitives only */
-
- {0} /* null-terminating sentinel */,
+ {0},
+ },
+ /* slots_out */
+ {/* these next three can have multiple types of elements in them */
+ {BMO_OP_SLOT_ELEMENT_BUF, "geom_inner.out"},
+ {BMO_OP_SLOT_ELEMENT_BUF, "geom_split.out"},
+ {BMO_OP_SLOT_ELEMENT_BUF, "geom.out"}, /* contains all output geometr */
+ {0},
},
bmo_subdivide_edges_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
@@ -757,38 +918,51 @@ static BMOpDefine bmo_subdivide_edges_def = {
static BMOpDefine bmo_delete_def = {
"delete",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
{BMO_OP_SLOT_INT, "context"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ {{0}}, /* no output */
bmo_delete_exec,
0
};
static BMOpDefine bmo_duplicate_def = {
"duplicate",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
- {BMO_OP_SLOT_ELEMENT_BUF, "origout"},
- {BMO_OP_SLOT_ELEMENT_BUF, "newout"},
+ {BMO_OP_SLOT_PTR, "dest"}, /* destination bmesh, if NULL will use current on */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom_orig.out"},
+ {BMO_OP_SLOT_ELEMENT_BUF, "geom.out"},
/* facemap maps from source faces to dupe
* faces, and from dupe faces to source faces */
- {BMO_OP_SLOT_MAPPING, "facemap"},
- {BMO_OP_SLOT_MAPPING, "boundarymap"},
- {BMO_OP_SLOT_MAPPING, "isovertmap"},
- {BMO_OP_SLOT_PTR, "dest"}, /* destination bmesh, if NULL will use current on */
- {0} /* null-terminating sentinel */},
+ {BMO_OP_SLOT_MAPPING, "facemap.out"},
+ {BMO_OP_SLOT_MAPPING, "boundarymap.out"},
+ {BMO_OP_SLOT_MAPPING, "isovertmap.out"},
+ {0},
+ },
bmo_duplicate_exec,
0
};
static BMOpDefine bmo_split_def = {
"split",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
- {BMO_OP_SLOT_MAPPING, "boundarymap"},
- {BMO_OP_SLOT_MAPPING, "isovertmap"},
- {BMO_OP_SLOT_PTR, "dest"}, /* destination bmesh, if NULL will use current on */
- {BMO_OP_SLOT_BOOL, "use_only_faces"}, /* when enabled. don't duplicate loose verts/edges */
- {0} /* null-terminating sentinel */},
+ {BMO_OP_SLOT_PTR, "dest"}, /* destination bmesh, if NULL will use current one */
+ {BMO_OP_SLOT_BOOL, "use_only_faces"}, /* when enabled. don't duplicate loose verts/edges */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom.out"},
+ {BMO_OP_SLOT_MAPPING, "boundarymap.out"},
+ {BMO_OP_SLOT_MAPPING, "isovertmap.out"},
+ {0},
+ },
bmo_split_exec,
0
};
@@ -801,15 +975,20 @@ static BMOpDefine bmo_split_def = {
*/
static BMOpDefine bmo_spin_def = {
"spin",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
- {BMO_OP_SLOT_ELEMENT_BUF, "lastout"}, /* result of last step */
- {BMO_OP_SLOT_VEC, "cent"}, /* rotation center */
- {BMO_OP_SLOT_VEC, "axis"}, /* rotation axis */
- {BMO_OP_SLOT_VEC, "dvec"}, /* translation delta per step */
- {BMO_OP_SLOT_FLT, "ang"}, /* total rotation angle (degrees) */
- {BMO_OP_SLOT_INT, "steps"}, /* number of steps */
- {BMO_OP_SLOT_BOOL, "do_dupli"}, /* duplicate or extrude? */
- {0} /* null-terminating sentinel */},
+ {BMO_OP_SLOT_VEC, "cent"}, /* rotation center */
+ {BMO_OP_SLOT_VEC, "axis"}, /* rotation axis */
+ {BMO_OP_SLOT_VEC, "dvec"}, /* translation delta per step */
+ {BMO_OP_SLOT_FLT, "angle"}, /* total rotation angle (degrees) */
+ {BMO_OP_SLOT_INT, "steps"}, /* number of steps */
+ {BMO_OP_SLOT_BOOL, "use_duplicate"}, /* duplicate or extrude? */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom_last.out"}, /* result of last step */
+ {0},
+ },
bmo_spin_exec,
0
};
@@ -822,12 +1001,17 @@ static BMOpDefine bmo_spin_def = {
*/
static BMOpDefine bmo_similar_faces_def = {
"similar_faces",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
{BMO_OP_SLOT_INT, "type"}, /* type of selection */
{BMO_OP_SLOT_FLT, "thresh"}, /* threshold of selection */
{BMO_OP_SLOT_INT, "compare"}, /* comparison method */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces.out"}, /* output faces */
+ {0},
+ },
bmo_similar_faces_exec,
0
};
@@ -839,12 +1023,17 @@ static BMOpDefine bmo_similar_faces_def = {
*/
static BMOpDefine bmo_similar_edges_def = {
"similar_edges",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
- {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* output edges */
{BMO_OP_SLOT_INT, "type"}, /* type of selection */
{BMO_OP_SLOT_FLT, "thresh"}, /* threshold of selection */
{BMO_OP_SLOT_INT, "compare"}, /* comparison method */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges.out"}, /* output edges */
+ {0},
+ },
bmo_similar_edges_exec,
0
};
@@ -856,12 +1045,17 @@ static BMOpDefine bmo_similar_edges_def = {
*/
static BMOpDefine bmo_similar_verts_def = {
"similar_verts",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
- {BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
{BMO_OP_SLOT_INT, "type"}, /* type of selection */
{BMO_OP_SLOT_FLT, "thresh"}, /* threshold of selection */
{BMO_OP_SLOT_INT, "compare"}, /* comparison method */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts.out"}, /* output vertices */
+ {0},
+ },
bmo_similar_verts_exec,
0
};
@@ -872,9 +1066,13 @@ static BMOpDefine bmo_similar_verts_def = {
*/
static BMOpDefine bmo_rotate_uvs_def = {
"rotate_uvs",
- {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
- {BMO_OP_SLOT_INT, "dir"}, /* direction */
- {0} /* null-terminating sentinel */},
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+ {BMO_OP_SLOT_BOOL, "use_ccw"}, /* rotate counter-clockwise if true, othewise clockwise */
+ {0},
+ },
+ /* slots_out */
+ {{0}}, /* no output */
bmo_rotate_uvs_exec,
0
};
@@ -885,8 +1083,11 @@ static BMOpDefine bmo_rotate_uvs_def = {
*/
static BMOpDefine bmo_reverse_uvs_def = {
"reverse_uvs",
- {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
- {0} /* null-terminating sentinel */},
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+ {0},
+ },
+ {{0}}, /* no output */
bmo_reverse_uvs_exec,
0
};
@@ -897,9 +1098,12 @@ static BMOpDefine bmo_reverse_uvs_def = {
*/
static BMOpDefine bmo_rotate_colors_def = {
"rotate_colors",
- {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
- {BMO_OP_SLOT_INT, "dir"}, /* direction */
- {0} /* null-terminating sentinel */},
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+ {BMO_OP_SLOT_BOOL, "use_ccw"}, /* rotate counter-clockwise if true, othewise clockwise */
+ {0},
+ },
+ {{0}}, /* no output */
bmo_rotate_colors_exec,
0
};
@@ -910,8 +1114,11 @@ static BMOpDefine bmo_rotate_colors_def = {
*/
static BMOpDefine bmo_reverse_colors_def = {
"reverse_colors",
- {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
- {0} /* null-terminating sentinel */},
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+ {0},
+ },
+ {{0}}, /* no output */
bmo_reverse_colors_exec,
0
};
@@ -923,11 +1130,16 @@ static BMOpDefine bmo_reverse_colors_def = {
*/
static BMOpDefine bmo_shortest_path_def = {
"shortest_path",
- {{BMO_OP_SLOT_ELEMENT_BUF, "startv"}, /* start vertex */
- {BMO_OP_SLOT_ELEMENT_BUF, "endv"}, /* end vertex */
- {BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
- {BMO_OP_SLOT_INT, "type"}, /* type of selection */
- {0} /* null-terminating sentinel */},
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "startv"}, /* start vertex */
+ {BMO_OP_SLOT_ELEMENT_BUF, "endv"}, /* end vertex */
+ {BMO_OP_SLOT_INT, "type"}, /* type of selection */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts.out"}, /* output vertices */
+ {0},
+ },
bmo_shortest_path_exec,
0
};
@@ -939,12 +1151,17 @@ static BMOpDefine bmo_shortest_path_def = {
*/
static BMOpDefine bmo_split_edges_def = {
"split_edges",
- {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
- {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* old output disconnected edges */
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
/* needed for vertex rip so we can rip only half an edge at a boundary wich would otherwise split off */
- {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* optional tag verts, use to have greater control of splits */
+ {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* optional tag verts, use to have greater control of splits */
{BMO_OP_SLOT_BOOL, "use_verts"}, /* use 'verts' for splitting, else just find verts to split from edges */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges.out"}, /* old output disconnected edges */
+ {0},
+ },
bmo_split_edges_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
@@ -956,12 +1173,17 @@ static BMOpDefine bmo_split_edges_def = {
*/
static BMOpDefine bmo_create_grid_def = {
"create_grid",
- {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
- {BMO_OP_SLOT_INT, "xsegments"}, /* number of x segments */
- {BMO_OP_SLOT_INT, "ysegments"}, /* number of y segments */
- {BMO_OP_SLOT_FLT, "size"}, /* size of the grid */
- {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
- {0, /* null-terminating sentinel */}},
+ /* slots_in */
+ {{BMO_OP_SLOT_INT, "x_segments"}, /* number of x segments */
+ {BMO_OP_SLOT_INT, "y_segments"}, /* number of y segments */
+ {BMO_OP_SLOT_FLT, "size"}, /* size of the grid */
+ {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts.out"}, /* output verts */
+ {0},
+ },
bmo_create_grid_exec,
0,
};
@@ -973,12 +1195,17 @@ static BMOpDefine bmo_create_grid_def = {
*/
static BMOpDefine bmo_create_uvsphere_def = {
"create_uvsphere",
- {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
- {BMO_OP_SLOT_INT, "segments"}, /* number of u segments */
- {BMO_OP_SLOT_INT, "revolutions"}, /* number of v segment */
+ /* slots_in */
+ {{BMO_OP_SLOT_INT, "u_segments"}, /* number of u segments */
+ {BMO_OP_SLOT_INT, "v_segments"}, /* number of v segment */
{BMO_OP_SLOT_FLT, "diameter"}, /* diameter */
- {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
- {0, /* null-terminating sentinel */}},
+ {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts.out"}, /* output verts */
+ {0},
+ },
bmo_create_uvsphere_exec,
0,
};
@@ -990,11 +1217,16 @@ static BMOpDefine bmo_create_uvsphere_def = {
*/
static BMOpDefine bmo_create_icosphere_def = {
"create_icosphere",
- {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
- {BMO_OP_SLOT_INT, "subdivisions"}, /* how many times to recursively subdivide the sphere */
+ /* slots_in */
+ {{BMO_OP_SLOT_INT, "subdivisions"}, /* how many times to recursively subdivide the sphere */
{BMO_OP_SLOT_FLT, "diameter"}, /* diameter */
{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
- {0, /* null-terminating sentinel */}},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts.out"}, /* output verts */
+ {0},
+ },
bmo_create_icosphere_exec,
0,
};
@@ -1006,9 +1238,14 @@ static BMOpDefine bmo_create_icosphere_def = {
*/
static BMOpDefine bmo_create_monkey_def = {
"create_monkey",
- {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
- {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
- {0, /* null-terminating sentinel */}},
+ /* slots_in */
+ {{BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts.out"}, /* output verts */
+ {0},
+ },
bmo_create_monkey_exec,
0,
};
@@ -1020,15 +1257,20 @@ static BMOpDefine bmo_create_monkey_def = {
*/
static BMOpDefine bmo_create_cone_def = {
"create_cone",
- {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
- {BMO_OP_SLOT_BOOL, "cap_ends"}, /* wheter or not to fill in the ends with faces */
- {BMO_OP_SLOT_BOOL, "cap_tris"}, /* fill ends with triangles instead of ngons */
+ /* slots_in */
+ {{BMO_OP_SLOT_BOOL, "cap_ends"}, /* wheter or not to fill in the ends with faces */
+ {BMO_OP_SLOT_BOOL, "cap_tris"}, /* fill ends with triangles instead of ngons */
{BMO_OP_SLOT_INT, "segments"},
- {BMO_OP_SLOT_FLT, "diameter1"}, /* diameter of one end */
- {BMO_OP_SLOT_FLT, "diameter2"}, /* diameter of the opposite */
- {BMO_OP_SLOT_FLT, "depth"}, /* distance between ends */
- {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
- {0, /* null-terminating sentinel */}},
+ {BMO_OP_SLOT_FLT, "diameter1"}, /* diameter of one end */
+ {BMO_OP_SLOT_FLT, "diameter2"}, /* diameter of the opposite */
+ {BMO_OP_SLOT_FLT, "depth"}, /* distance between ends */
+ {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts.out"}, /* output verts */
+ {0},
+ },
bmo_create_cone_exec,
0,
};
@@ -1038,13 +1280,18 @@ static BMOpDefine bmo_create_cone_def = {
*/
static BMOpDefine bmo_create_circle_def = {
"create_circle",
- {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
- {BMO_OP_SLOT_BOOL, "cap_ends"}, /* wheter or not to fill in the ends with faces */
- {BMO_OP_SLOT_BOOL, "cap_tris"}, /* fill ends with triangles instead of ngons */
+ /* slots_in */
+ {{BMO_OP_SLOT_BOOL, "cap_ends"}, /* wheter or not to fill in the ends with faces */
+ {BMO_OP_SLOT_BOOL, "cap_tris"}, /* fill ends with triangles instead of ngons */
{BMO_OP_SLOT_INT, "segments"},
- {BMO_OP_SLOT_FLT, "diameter"}, /* diameter of one end */
- {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
- {0, /* null-terminating sentinel */}},
+ {BMO_OP_SLOT_FLT, "diameter"}, /* diameter of one end */
+ {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts.out"}, /* output verts */
+ {0},
+ },
bmo_create_circle_exec,
0,
};
@@ -1056,15 +1303,19 @@ static BMOpDefine bmo_create_circle_def = {
*/
static BMOpDefine bmo_create_cube_def = {
"create_cube",
- {{BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output verts */
- {BMO_OP_SLOT_FLT, "size"}, /* size of the cube */
- {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with-- */
- {0, /* null-terminating sentinel */}},
+ /* slots_in */
+ {{BMO_OP_SLOT_FLT, "size"}, /* size of the cube */
+ {BMO_OP_SLOT_MAT, "mat"}, /* matrix to multiply the new geometry with */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts.out"}, /* output verts */
+ {0},
+ },
bmo_create_cube_exec,
0,
};
-#define NEW_BEVEL 1
/*
* Bevel
*
@@ -1072,12 +1323,17 @@ static BMOpDefine bmo_create_cube_def = {
*/
static BMOpDefine bmo_bevel_def = {
"bevel",
-#ifdef NEW_BEVEL
- {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input edges and vertices */
- {BMO_OP_SLOT_FLT, "offset"}, /* amount to offset beveled edge */
- {BMO_OP_SLOT_INT, "segments"}, /* number of segments in bevel */
- {0} /* null-terminating sentinel */},
-#else
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input edges and vertices */
+ {BMO_OP_SLOT_FLT, "offset"}, /* amount to offset beveled edge */
+ {BMO_OP_SLOT_INT, "segments"}, /* number of segments in bevel */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces.out"}, /* output faces */
+ {0},
+ },
+#if 0 /* old bevel*/
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input edges and vertices */
{BMO_OP_SLOT_ELEMENT_BUF, "face_spans"}, /* new geometry */
{BMO_OP_SLOT_ELEMENT_BUF, "face_holes"}, /* new geometry */
@@ -1087,7 +1343,8 @@ static BMOpDefine bmo_bevel_def = {
* modifier uses this. We could do this as another float setting */
{BMO_OP_SLOT_INT, "lengthlayer"}, /* which PROP_FLT layer to us */
{BMO_OP_SLOT_FLT, "percent"}, /* percentage to expand beveled edge */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
#endif
bmo_bevel_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
@@ -1100,10 +1357,15 @@ static BMOpDefine bmo_bevel_def = {
*/
static BMOpDefine bmo_beautify_fill_def = {
"beautify_fill",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
{BMO_OP_SLOT_ELEMENT_BUF, "constrain_edges"}, /* edges that can't be flipped */
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* new flipped faces and edges */
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom.out"}, /* new flipped faces and edges */
+ {0},
+ },
bmo_beautify_fill_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
@@ -1115,9 +1377,14 @@ static BMOpDefine bmo_beautify_fill_def = {
*/
static BMOpDefine bmo_triangle_fill_def = {
"triangle_fill",
- {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* new faces and edges */
- {0} /* null-terminating sentinel */},
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom.out"}, /* new faces and edges */
+ {0},
+ },
bmo_triangle_fill_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
@@ -1129,10 +1396,15 @@ static BMOpDefine bmo_triangle_fill_def = {
*/
static BMOpDefine bmo_solidify_def = {
"solidify",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
{BMO_OP_SLOT_FLT, "thickness"},
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
- {0}},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom.out"},
+ {0},
+ },
bmo_solidify_face_region_exec,
0
};
@@ -1144,15 +1416,20 @@ static BMOpDefine bmo_solidify_def = {
*/
static BMOpDefine bmo_inset_def = {
"inset",
- {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
+ /* slots_in */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
{BMO_OP_SLOT_BOOL, "use_boundary"},
{BMO_OP_SLOT_BOOL, "use_even_offset"},
{BMO_OP_SLOT_BOOL, "use_relative_offset"},
{BMO_OP_SLOT_FLT, "thickness"},
{BMO_OP_SLOT_FLT, "depth"},
{BMO_OP_SLOT_BOOL, "use_outset"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces.out"}, /* output faces */
+ {0},
+ },
bmo_inset_exec,
0
};
@@ -1164,15 +1441,20 @@ static BMOpDefine bmo_inset_def = {
*/
static BMOpDefine bmo_wireframe_def = {
"wireframe",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
{BMO_OP_SLOT_BOOL, "use_boundary"},
{BMO_OP_SLOT_BOOL, "use_even_offset"},
{BMO_OP_SLOT_BOOL, "use_crease"},
{BMO_OP_SLOT_FLT, "thickness"},
{BMO_OP_SLOT_BOOL, "use_relative_offset"},
{BMO_OP_SLOT_FLT, "depth"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces.out"}, /* output faces */
+ {0},
+ },
bmo_wireframe_exec,
0
};
@@ -1184,11 +1466,16 @@ static BMOpDefine bmo_wireframe_def = {
*/
static BMOpDefine bmo_slide_vert_def = {
"slide_vert",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "vert"},
{BMO_OP_SLOT_ELEMENT_BUF, "edge"},
- {BMO_OP_SLOT_ELEMENT_BUF, "vertout"},
{BMO_OP_SLOT_FLT, "distance_t"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts.out"},
+ {0},
+ },
bmo_slide_vert_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
};
@@ -1202,7 +1489,7 @@ static BMOpDefine bmo_slide_vert_def = {
* If 'use_existing_faces' is true, the hull will not output triangles
* that are covered by a pre-existing face.
*
- * All hull vertices, faces, and edges are added to 'geomout'. Any
+ * All hull vertices, faces, and edges are added to 'geom.out'. Any
* input elements that end up inside the hull (i.e. are not used by an
* output face) are added to the 'interior_geom' slot. The
* 'unused_geom' slot will contain all interior geometry that is
@@ -1211,15 +1498,18 @@ static BMOpDefine bmo_slide_vert_def = {
*/
static BMOpDefine bmo_convex_hull_def = {
"convex_hull",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "input"},
{BMO_OP_SLOT_BOOL, "use_existing_faces"},
-
- /* Outputs */
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
- {BMO_OP_SLOT_ELEMENT_BUF, "interior_geom"},
- {BMO_OP_SLOT_ELEMENT_BUF, "unused_geom"},
- {BMO_OP_SLOT_ELEMENT_BUF, "holes_geom"},
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom.out"},
+ {BMO_OP_SLOT_ELEMENT_BUF, "geom_interior.out"},
+ {BMO_OP_SLOT_ELEMENT_BUF, "geom_unused.out"},
+ {BMO_OP_SLOT_ELEMENT_BUF, "geom_holes.out"},
+ {0},
+ },
bmo_convex_hull_exec,
0
};
@@ -1233,17 +1523,19 @@ static BMOpDefine bmo_convex_hull_def = {
* the "direction" slot. The edges and faces that cross the plane of
* symmetry are split as needed to enforce symmetry.
*
- * All new vertices, edges, and faces are added to the "geomout" slot.
+ * All new vertices, edges, and faces are added to the "geom.out" slot.
*/
static BMOpDefine bmo_symmetrize_def = {
"symmetrize",
+ /* slots_in */
{{BMO_OP_SLOT_ELEMENT_BUF, "input"},
{BMO_OP_SLOT_INT, "direction"},
-
- /* Outputs */
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
-
- {0} /* null-terminating sentinel */},
+ {0},
+ },
+ /* slots_out */
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom.out"},
+ {0},
+ },
bmo_symmetrize_exec,
0
};
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index 671cfbbc55e..b87e023e63a 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -116,30 +116,45 @@ enum {
* for when your defining an operator with BMOpDefine.*/
typedef struct BMOpSlot {
+ const char *slot_name; /* pointer to BMOpDefine.slot_args */
int slot_type;
int len;
- int flag;
- int index; /* index within slot array */
+// int flag; /* UNUSED */
+// int index; /* index within slot array */ /* UNUSED */
union {
int i;
float f;
void *p;
float vec[3];
- void *buf;
+ void **buf;
GHash *ghash;
} data;
} BMOpSlot;
-#define BMO_OP_MAX_SLOTS 16 /* way more than probably needed */
+/* mainly for use outside bmesh internal code */
+#define BMO_SLOT_AS_BOOL(slot) ((slot)->data.i)
+#define BMO_SLOT_AS_INT(slot) ((slot)->data.i)
+#define BMO_SLOT_AS_FLOAT(slot) ((slot)->data.f)
+#define BMO_SLOT_AS_VECTOR(slot) ((slot)->data.vec)
+#define BMO_SLOT_AS_MATRIX(slot ) ((float (*)[4])((slot)->data.p))
+#define BMO_SLOT_AS_BUFFER(slot ) ((slot)->data.buf)
+#define BMO_SLOT_AS_GHASH(slot ) ((slot)->data.ghash)
+
+#define BMO_ASSERT_SLOT_IN_OP(slot, op) \
+ BLI_assert(((slot >= (op)->slots_in) && (slot < &(op)->slots_in[BMO_OP_MAX_SLOTS])) || \
+ ((slot >= (op)->slots_out) && (slot < &(op)->slots_out[BMO_OP_MAX_SLOTS])))
+
+/* way more than probably needed, compiler complains if limit hit */
+#define BMO_OP_MAX_SLOTS 16
typedef struct BMOperator {
+ struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS];
+ struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS];
+ void (*exec)(BMesh *bm, struct BMOperator *op);
+ struct MemArena *arena;
int type;
- int slot_type;
int type_flag;
int flag; /* runtime options */
- struct BMOpSlot slot_args[BMO_OP_MAX_SLOTS];
- void (*exec)(BMesh *bm, struct BMOperator *op);
- struct MemArena *arena;
} BMOperator;
enum {
@@ -156,8 +171,9 @@ typedef struct BMOSlotType {
} BMOSlotType;
typedef struct BMOpDefine {
- const char *name;
- BMOSlotType slot_types[BMO_OP_MAX_SLOTS];
+ const char *opname;
+ BMOSlotType slot_types_in[BMO_OP_MAX_SLOTS];
+ BMOSlotType slot_types_out[BMO_OP_MAX_SLOTS];
void (*exec)(BMesh *bm, BMOperator *op);
int type_flag;
} BMOpDefine;
@@ -245,15 +261,22 @@ int BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...
int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, va_list vlist);
/* test whether a named slot exists */
-int BMO_slot_exists(BMOperator *op, const char *slot_name);
+int BMO_slot_exists(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
/* get a pointer to a slot. this may be removed layer on from the public API. */
-BMOpSlot *BMO_slot_get(BMOperator *op, const char *slot_name);
+BMOpSlot *BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
/* copies the data of a slot from one operator to another. src and dst are the
* source/destination slot codes, respectively. */
-void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op,
- const char *src, const char *dst);
+#define BMO_slot_copy(op_src, slots_src, slot_name_src, \
+ op_dst, slots_dst, slot_name_dst) \
+ _bmo_slot_copy((op_src)->slots_src, slot_name_src, \
+ (op_dst)->slots_dst, slot_name_dst, \
+ (op_dst)->arena)
+
+void _bmo_slot_copy(BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
+ BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
+ struct MemArena *arena_dst);
/* del "context" slot values, used for operator too */
enum {
@@ -279,13 +302,13 @@ typedef enum {
void BMO_op_flag_enable(BMesh *bm, BMOperator *op, const int op_flag);
void BMO_op_flag_disable(BMesh *bm, BMOperator *op, const int op_flag);
-void BMO_slot_float_set(BMOperator *op, const char *slot_name, const float f);
-float BMO_slot_float_get(BMOperator *op, const char *slot_name);
-void BMO_slot_int_set(BMOperator *op, const char *slot_name, const int i);
-int BMO_slot_int_get(BMOperator *op, const char *slot_name);
-void BMO_slot_bool_set(BMOperator *op, const char *slot_name, const int i);
-int BMO_slot_bool_get(BMOperator *op, const char *slot_name);
-void *BMO_slot_as_arrayN(BMOperator *op, const char *slot_name, int *len);
+void BMO_slot_float_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float f);
+float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+void BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i);
+int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i);
+int BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+void *BMO_slot_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, int *len);
/* don't pass in arrays that are supposed to map to elements this way.
@@ -293,69 +316,81 @@ void *BMO_slot_as_arrayN(BMOperator *op, const char *slot_name, int *len);
* so, e.g. passing in list of floats per element in another slot is bad.
* passing in, e.g. pointer to an editmesh for the conversion operator is fine
* though. */
-void BMO_slot_ptr_set(BMOperator *op, const char *slot_name, void *p);
-void *BMO_slot_ptr_get(BMOperator *op, const char *slot_name);
-void BMO_slot_vec_set(BMOperator *op, const char *slot_name, const float vec[3]);
-void BMO_slot_vec_get(BMOperator *op, const char *slot_name, float r_vec[3]);
+void BMO_slot_ptr_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, void *p);
+void *BMO_slot_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+void BMO_slot_vec_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float vec[3]);
+void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_vec[3]);
/* only supports square mats */
/* size must be 3 or 4; this api is meant only for transformation matrices.
* note that internally the matrix is stored in 4x4 form, and it's safe to
* call whichever BMO_Get_MatXXX function you want. */
-void BMO_slot_mat_set(BMOperator *op, const char *slot_name, const float *mat, int size);
-void BMO_slot_mat4_get(BMOperator *op, const char *slot_name, float r_mat[4][4]);
-void BMO_slot_mat3_set(BMOperator *op, const char *slot_name, float r_mat[3][3]);
+void BMO_slot_mat_set(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float *mat, int size);
+void BMO_slot_mat4_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[4][4]);
+void BMO_slot_mat3_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[3][3]);
void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *op, const char htype, const short oflag);
/* copies the values from another slot to the end of the output slot */
-void BMO_slot_buffer_append(BMOperator *output_op, const char *output_op_slot,
- BMOperator *other_op, const char *other_op_slot);
+#define BMO_slot_buffer_append(op_src, slots_src, slot_name_src, \
+ op_dst, slots_dst, slot_name_dst) \
+ _bmo_slot_buffer_append((op_src)->slots_src, slot_name_src, \
+ (op_dst)->slots_dst, slot_name_dst, \
+ (op_dst)->arena)
+void _bmo_slot_buffer_append(BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
+ BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
+ struct MemArena *arena_dst);
/* puts every element of type 'type' (which is a bitmask) with tool
* flag 'flag', into a slot. */
-void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
/* puts every element of type 'type' (which is a bitmask) without tool
* flag 'flag', into a slot. */
-void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
/* tool-flags all elements inside an element slot array with flag flag. */
-void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_flag_enable(BMesh *bm,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
/* clears tool-flag flag from all elements inside a slot array. */
-void BMO_slot_buffer_flag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_flag_disable(BMesh *bm,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag);
/* tool-flags all elements inside an element slot array with flag flag. */
-void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_hflag_enable(BMesh *bm,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const char do_flush);
/* clears tool-flag flag from all elements inside a slot array. */
-void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_hflag_disable(BMesh *bm,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const char do_flush);
/* puts every element of type 'type' (which is a bitmask) with header
* flag 'flag', into a slot. note: ignores hidden elements
* (e.g. elements with header flag BM_ELEM_HIDDEN set).*/
void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op,
- const char *slot_name,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag);
/* puts every element of type 'type' (which is a bitmask) without
* header flag 'flag', into a slot. note: ignores hidden elements
* (e.g. elements with header flag BM_ELEM_HIDDEN set).*/
void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op,
- const char *slot_name,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag);
/* counts number of elements inside a slot array. */
-int BMO_slot_buffer_count(BMesh *bm, BMOperator *op, const char *slot_name);
-int BMO_slot_map_count(BMesh *bm, BMOperator *op, const char *slot_name);
+int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
+int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
-void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name,
- void *element, void *data, int len);
+void BMO_slot_map_insert(BMOperator *op, BMOpSlot *slot,
+ const void *element, void *data, int len);
/* Counts the number of edges with tool flag toolflag around
*/
@@ -363,13 +398,14 @@ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag);
/* flags all elements in a mapping. note that the mapping must only have
* bmesh elements in it.*/
-void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slot_name,
- const char hflag, const short oflag);
+void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
+ const char *slot_name, const char hflag, const short oflag);
-void *BMO_slot_buffer_alloc(BMOperator *op, const char *slot_name, const int len);
+void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
+ const char *slot_name, const int len);
-void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name,
- const char htype);
+void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
+ const char *slot_name, const char htype);
/* this part of the API is used to iterate over element buffer or
* mapping slots.
@@ -412,10 +448,11 @@ typedef struct BMOIter {
char restrictmask; /* bitwise '&' with BMHeader.htype */
} BMOIter;
-void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slot_name);
+void *BMO_slot_buffer_elem_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name);
-void *BMO_iter_new(BMOIter *iter, BMesh *bm, BMOperator *op,
- const char *slot_name, const char restrictmask);
+void *BMO_iter_new(BMOIter *iter,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
+ const char restrictmask);
void *BMO_iter_step(BMOIter *iter);
/* returns a pointer to the key value when iterating over mappings.
@@ -428,8 +465,8 @@ void *BMO_iter_map_value_p(BMOIter *iter);
/* use this for float mappings */
float BMO_iter_map_value_f(BMOIter *iter);
-#define BMO_ITER(ele, iter, bm, op, slot_name, restrict) \
- for (ele = BMO_iter_new(iter, bm, op, slot_name, restrict); ele; ele = BMO_iter_step(iter))
+#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag) \
+ for (ele = BMO_iter_new(iter, slot_args, slot_name, restrict_flag); ele; ele = BMO_iter_step(iter))
/******************* Inlined Functions********************/
typedef void (*opexec)(BMesh *bm, BMOperator *op);
diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
index 16c2b8b0505..b405ecc1841 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api_inline.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
@@ -69,16 +69,16 @@ BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const shor
oflags[bm->stackdepth - 1].f ^= oflag;
}
-BLI_INLINE void BMO_slot_map_int_insert(BMesh *bm, BMOperator *op, const char *slot_name,
+BLI_INLINE void BMO_slot_map_int_insert(BMOperator *op, BMOpSlot *slot,
void *element, int val)
{
- BMO_slot_map_insert(bm, op, slot_name, element, &val, sizeof(int));
+ BMO_slot_map_insert(op, slot, element, &val, sizeof(int));
}
-BLI_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char *slot_name,
+BLI_INLINE void BMO_slot_map_float_insert(BMOperator *op, BMOpSlot *slot,
void *element, float val)
{
- BMO_slot_map_insert(bm, op, slot_name, element, &val, sizeof(float));
+ BMO_slot_map_insert(op, slot, element, &val, sizeof(float));
}
@@ -87,62 +87,62 @@ BLI_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char
* do NOT use these for non-operator-api-allocated memory! instead
* use BMO_slot_map_data_get and BMO_slot_map_insert, which copies the data. */
-BLI_INLINE void BMO_slot_map_ptr_insert(BMesh *bm, BMOperator *op, const char *slot_name,
- void *element, void *val)
+BLI_INLINE void BMO_slot_map_ptr_insert(BMOperator *op, BMOpSlot *slot,
+ const void *element, void *val)
{
- BMO_slot_map_insert(bm, op, slot_name, element, &val, sizeof(void *));
+ BMO_slot_map_insert(op, slot, element, &val, sizeof(void *));
}
-BLI_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name, void *element)
+BLI_INLINE int BMO_slot_map_contains(BMOpSlot *slot, const void *element)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
/* sanity check */
- if (!slot->data.ghash) return 0;
+ if (UNLIKELY(slot->data.ghash == NULL)) {
+ return 0;
+ }
return BLI_ghash_haskey(slot->data.ghash, element);
}
-BLI_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name,
- void *element)
+BLI_INLINE void *BMO_slot_map_data_get(BMOpSlot *slot, const void *element)
{
BMOElemMapping *mapping;
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
/* sanity check */
- if (!slot->data.ghash) return NULL;
+ if (UNLIKELY(slot->data.ghash == NULL)) {
+ return NULL;
+ }
mapping = (BMOElemMapping *)BLI_ghash_lookup(slot->data.ghash, element);
- if (!mapping) return NULL;
+ if (!mapping) {
+ return NULL;
+ }
return mapping + 1;
}
-BLI_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *slot_name,
- void *element)
+BLI_INLINE float BMO_slot_map_float_get(BMOpSlot *slot, const void *element)
{
- float *val = (float *) BMO_slot_map_data_get(bm, op, slot_name, element);
+ float *val = (float *) BMO_slot_map_data_get(slot, element);
if (val) return *val;
return 0.0f;
}
-BLI_INLINE int BMO_slot_map_int_get(BMesh *bm, BMOperator *op, const char *slot_name,
- void *element)
+BLI_INLINE int BMO_slot_map_int_get(BMOpSlot *slot, const void *element)
{
- int *val = (int *) BMO_slot_map_data_get(bm, op, slot_name, element);
+ int *val = (int *) BMO_slot_map_data_get(slot, element);
if (val) return *val;
return 0;
}
-BLI_INLINE void *BMO_slot_map_ptr_get(BMesh *bm, BMOperator *op, const char *slot_name,
- void *element)
+BLI_INLINE void *BMO_slot_map_ptr_get(BMOpSlot *slot, const void *element)
{
- void **val = (void **) BMO_slot_map_data_get(bm, op, slot_name, element);
+ void **val = (void **) BMO_slot_map_data_get(slot, element);
if (val) return *val;
return NULL;
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 8f38e1c9ba2..157837a13c0 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -45,8 +45,8 @@
static void bmo_flag_layer_alloc(BMesh *bm);
static void bmo_flag_layer_free(BMesh *bm);
static void bmo_flag_layer_clear(BMesh *bm);
-static int bmo_name_to_slotcode(BMOpDefine *def, const char *name);
-static int bmo_name_to_slotcode_check(BMOpDefine *def, const char *name);
+static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
+static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
static int bmo_opname_to_opcode(const char *opname);
static const char *bmo_error_messages[] = {
@@ -80,7 +80,7 @@ const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = {
};
/* Dummy slot so there is something to return when slot name lookup fails */
-static BMOpSlot BMOpEmptySlot = {0};
+// static BMOpSlot BMOpEmptySlot = {0};
void BMO_op_flag_enable(BMesh *UNUSED(bm), BMOperator *op, const int op_flag)
{
@@ -125,6 +125,18 @@ void BMO_pop(BMesh *bm)
bm->stackdepth--;
}
+
+/* use for both slot_types_in and slot_types_out */
+static void bmo_op_slots_init(BMOSlotType *slot_types, BMOpSlot *slot_args)
+{
+ unsigned int i;
+ for (i = 0; slot_types[i].type; i++) {
+ slot_args[i].slot_name = slot_types[i].name;
+ slot_args[i].slot_type = slot_types[i].type;
+ // slot_args[i].index = i; // UNUSED
+ }
+}
+
/**
* \brief BMESH OPSTACK INIT OP
*
@@ -132,7 +144,7 @@ void BMO_pop(BMesh *bm)
*/
void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
{
- int i, opcode = bmo_opname_to_opcode(opname);
+ int opcode = bmo_opname_to_opcode(opname);
#ifdef DEBUG
BM_ELEM_INDEX_VALIDATE(bm, "pre bmo", opname);
@@ -150,10 +162,8 @@ void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
op->flag = flag;
/* initialize the operator slot types */
- for (i = 0; opdefines[opcode]->slot_types[i].type; i++) {
- op->slot_args[i].slot_type = opdefines[opcode]->slot_types[i].type;
- op->slot_args[i].index = i;
- }
+ bmo_op_slots_init(opdefines[opcode]->slot_types_in, op->slots_in);
+ bmo_op_slots_init(opdefines[opcode]->slot_types_out, op->slots_out);
/* callback */
op->exec = opdefines[opcode]->exec;
@@ -189,6 +199,20 @@ void BMO_op_exec(BMesh *bm, BMOperator *op)
BMO_pop(bm);
}
+static void bmo_op_slots_free(BMOSlotType *slot_types, BMOpSlot *slot_args)
+{
+ BMOpSlot *slot;
+ unsigned int i;
+ for (i = 0; slot_types[i].type; i++) {
+ slot = &slot_args[i];
+ if (slot->slot_type == BMO_OP_SLOT_MAPPING) {
+ if (slot->data.ghash) {
+ BLI_ghash_free(slot->data.ghash, NULL, NULL);
+ }
+ }
+ }
+}
+
/**
* \brief BMESH OPSTACK FINISH OP
*
@@ -196,21 +220,13 @@ void BMO_op_exec(BMesh *bm, BMOperator *op)
*/
void BMO_op_finish(BMesh *bm, BMOperator *op)
{
- BMOpSlot *slot;
- int i;
-
- for (i = 0; opdefines[op->type]->slot_types[i].type; i++) {
- slot = &op->slot_args[i];
- if (slot->slot_type == BMO_OP_SLOT_MAPPING) {
- if (slot->data.ghash)
- BLI_ghash_free(slot->data.ghash, NULL, NULL);
- }
- }
+ bmo_op_slots_free(opdefines[op->type]->slot_types_in, op->slots_in);
+ bmo_op_slots_free(opdefines[op->type]->slot_types_out, op->slots_out);
BLI_memarena_free(op->arena);
#ifdef DEBUG
- BM_ELEM_INDEX_VALIDATE(bm, "post bmo", opdefines[op->type]->name);
+ BM_ELEM_INDEX_VALIDATE(bm, "post bmo", opdefines[op->type]->opname);
#else
(void)bm;
#endif
@@ -221,9 +237,9 @@ void BMO_op_finish(BMesh *bm, BMOperator *op)
*
* \return Success if the slot if found.
*/
-int BMO_slot_exists(BMOperator *op, const char *slot_name)
+int BMO_slot_exists(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
{
- int slot_code = bmo_name_to_slotcode(opdefines[op->type], slot_name);
+ int slot_code = bmo_name_to_slotcode(slot_args, identifier);
return (slot_code >= 0);
}
@@ -232,73 +248,78 @@ int BMO_slot_exists(BMOperator *op, const char *slot_name)
*
* Returns a pointer to the slot of type 'slot_code'
*/
-BMOpSlot *BMO_slot_get(BMOperator *op, const char *slot_name)
+BMOpSlot *BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
{
- int slot_code = bmo_name_to_slotcode_check(opdefines[op->type], slot_name);
+ int slot_code = bmo_name_to_slotcode_check(slot_args, identifier);
- if (slot_code < 0) {
- return &BMOpEmptySlot;
+ if (UNLIKELY(slot_code < 0)) {
+ //return &BMOpEmptySlot;
+ BLI_assert(0);
+ NULL; /* better crash */
}
- return &(op->slot_args[slot_code]);
+ return &slot_args[slot_code];
}
/**
* \brief BMESH OPSTACK COPY SLOT
*
+ * define used.
* Copies data from one slot to another.
*/
-void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, const char *src, const char *dst)
+void _bmo_slot_copy(BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
+ BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
+ struct MemArena *arena_dst)
{
- BMOpSlot *source_slot = BMO_slot_get(source_op, src);
- BMOpSlot *dest_slot = BMO_slot_get(dest_op, dst);
+ BMOpSlot *slot_src = BMO_slot_get(slot_args_src, slot_name_src);
+ BMOpSlot *slot_dst = BMO_slot_get(slot_args_dst, slot_name_dst);
- if (source_slot == dest_slot)
+ if (slot_src == slot_dst)
return;
- if (source_slot->slot_type != dest_slot->slot_type) {
- /* possibly assert here? */
+ BLI_assert(slot_src->slot_type == slot_dst->slot_type);
+ if (slot_src->slot_type != slot_dst->slot_type) {
return;
}
- if (dest_slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF) {
+ if (slot_dst->slot_type == BMO_OP_SLOT_ELEMENT_BUF) {
/* do buffer copy */
- dest_slot->data.buf = NULL;
- dest_slot->len = source_slot->len;
- if (dest_slot->len) {
- const int slot_alloc_size = BMO_OPSLOT_TYPEINFO[dest_slot->slot_type] * dest_slot->len;
- dest_slot->data.buf = BLI_memarena_alloc(dest_op->arena, slot_alloc_size);
- memcpy(dest_slot->data.buf, source_slot->data.buf, slot_alloc_size);
+ slot_dst->data.buf = NULL;
+ slot_dst->len = slot_src->len;
+ if (slot_dst->len) {
+ const int slot_alloc_size = BMO_OPSLOT_TYPEINFO[slot_dst->slot_type] * slot_dst->len;
+ slot_dst->data.buf = BLI_memarena_alloc(arena_dst, slot_alloc_size);
+ memcpy(slot_dst->data.buf, slot_src->data.buf, slot_alloc_size);
}
}
- else if (dest_slot->slot_type == BMO_OP_SLOT_MAPPING) {
+ else if (slot_dst->slot_type == BMO_OP_SLOT_MAPPING) {
GHashIterator it;
BMOElemMapping *srcmap, *dstmap;
/* sanity check */
- if (!source_slot->data.ghash) {
+ if (!slot_src->data.ghash) {
return;
}
- if (!dest_slot->data.ghash) {
- dest_slot->data.ghash = BLI_ghash_ptr_new("bmesh operator 2");
+ if (!slot_dst->data.ghash) {
+ slot_dst->data.ghash = BLI_ghash_ptr_new("bmesh operator 2");
}
- BLI_ghashIterator_init(&it, source_slot->data.ghash);
- for ( ; (srcmap = BLI_ghashIterator_getValue(&it));
- BLI_ghashIterator_step(&it))
+ for (BLI_ghashIterator_init(&it, slot_src->data.ghash);
+ (srcmap = BLI_ghashIterator_getValue(&it));
+ BLI_ghashIterator_step(&it))
{
- dstmap = BLI_memarena_alloc(dest_op->arena, sizeof(*dstmap) + srcmap->len);
+ dstmap = BLI_memarena_alloc(arena_dst, sizeof(*dstmap) + srcmap->len);
dstmap->element = srcmap->element;
dstmap->len = srcmap->len;
memcpy(dstmap + 1, srcmap + 1, srcmap->len);
- BLI_ghash_insert(dest_slot->data.ghash, dstmap->element, dstmap);
+ BLI_ghash_insert(slot_dst->data.ghash, dstmap->element, dstmap);
}
}
else {
- dest_slot->data = source_slot->data;
+ slot_dst->data = slot_src->data;
}
}
@@ -308,9 +329,9 @@ void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, const char *src,
* Sets the value of a slot depending on it's type
*/
-void BMO_slot_float_set(BMOperator *op, const char *slot_name, const float f)
+void BMO_slot_float_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float f)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_FLT);
if (!(slot->slot_type == BMO_OP_SLOT_FLT))
return;
@@ -318,9 +339,9 @@ void BMO_slot_float_set(BMOperator *op, const char *slot_name, const float f)
slot->data.f = f;
}
-void BMO_slot_int_set(BMOperator *op, const char *slot_name, const int i)
+void BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_INT);
if (!(slot->slot_type == BMO_OP_SLOT_INT))
return;
@@ -328,9 +349,9 @@ void BMO_slot_int_set(BMOperator *op, const char *slot_name, const int i)
slot->data.i = i;
}
-void BMO_slot_bool_set(BMOperator *op, const char *slot_name, const int i)
+void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_BOOL);
if (!(slot->slot_type == BMO_OP_SLOT_BOOL))
return;
@@ -339,9 +360,9 @@ void BMO_slot_bool_set(BMOperator *op, const char *slot_name, const int i)
}
/* only supports square mats */
-void BMO_slot_mat_set(BMOperator *op, const char *slot_name, const float *mat, int size)
+void BMO_slot_mat_set(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float *mat, int size)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
if (!(slot->slot_type == BMO_OP_SLOT_MAT))
return;
@@ -362,39 +383,39 @@ void BMO_slot_mat_set(BMOperator *op, const char *slot_name, const float *mat, i
}
}
-void BMO_slot_mat4_get(BMOperator *op, const char *slot_name, float r_mat[4][4])
+void BMO_slot_mat4_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[4][4])
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
if (!(slot->slot_type == BMO_OP_SLOT_MAT))
return;
if (slot->data.p) {
- copy_m4_m4(r_mat, (float (*)[4])slot->data.p);
+ copy_m4_m4(r_mat, BMO_SLOT_AS_MATRIX(slot));
}
else {
unit_m4(r_mat);
}
}
-void BMO_slot_mat3_set(BMOperator *op, const char *slot_name, float r_mat[3][3])
+void BMO_slot_mat3_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[3][3])
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
if (!(slot->slot_type == BMO_OP_SLOT_MAT))
return;
if (slot->data.p) {
- copy_m3_m4(r_mat, slot->data.p);
+ copy_m3_m4(r_mat, BMO_SLOT_AS_MATRIX(slot));
}
else {
unit_m3(r_mat);
}
}
-void BMO_slot_ptr_set(BMOperator *op, const char *slot_name, void *p)
+void BMO_slot_ptr_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, void *p)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_PTR);
if (!(slot->slot_type == BMO_OP_SLOT_PTR))
return;
@@ -402,9 +423,9 @@ void BMO_slot_ptr_set(BMOperator *op, const char *slot_name, void *p)
slot->data.p = p;
}
-void BMO_slot_vec_set(BMOperator *op, const char *slot_name, const float vec[3])
+void BMO_slot_vec_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const float vec[3])
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_VEC);
if (!(slot->slot_type == BMO_OP_SLOT_VEC))
return;
@@ -413,9 +434,9 @@ void BMO_slot_vec_set(BMOperator *op, const char *slot_name, const float vec[3])
}
-float BMO_slot_float_get(BMOperator *op, const char *slot_name)
+float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_FLT);
if (!(slot->slot_type == BMO_OP_SLOT_FLT))
return 0.0f;
@@ -423,9 +444,9 @@ float BMO_slot_float_get(BMOperator *op, const char *slot_name)
return slot->data.f;
}
-int BMO_slot_int_get(BMOperator *op, const char *slot_name)
+int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_INT);
if (!(slot->slot_type == BMO_OP_SLOT_INT))
return 0;
@@ -433,9 +454,9 @@ int BMO_slot_int_get(BMOperator *op, const char *slot_name)
return slot->data.i;
}
-int BMO_slot_bool_get(BMOperator *op, const char *slot_name)
+int BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_BOOL);
if (!(slot->slot_type == BMO_OP_SLOT_BOOL))
return 0;
@@ -444,23 +465,23 @@ int BMO_slot_bool_get(BMOperator *op, const char *slot_name)
}
/* if you want a copy of the elem buffer */
-void *BMO_slot_as_arrayN(BMOperator *op, const char *slot_name, int *len)
+void *BMO_slot_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, int *len)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
void *ret;
/* could add support for mapping type */
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
- ret = MEM_mallocN(sizeof(void *) * slot->len, __func__);
- memcpy(ret, slot->data.buf, sizeof(void *) * slot->len);
+ ret = MEM_mallocN(sizeof(void **) * slot->len, __func__);
+ memcpy(ret, slot->data.buf, sizeof(void **) * slot->len);
*len = slot->len;
return ret;
}
-void *BMO_slot_ptr_get(BMOperator *op, const char *slot_name)
+void *BMO_slot_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_PTR);
if (!(slot->slot_type == BMO_OP_SLOT_PTR))
return NULL;
@@ -468,9 +489,9 @@ void *BMO_slot_ptr_get(BMOperator *op, const char *slot_name)
return slot->data.p;
}
-void BMO_slot_vec_get(BMOperator *op, const char *slot_name, float r_vec[3])
+void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_vec[3])
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_VEC);
if (!(slot->slot_type == BMO_OP_SLOT_VEC))
return;
@@ -546,9 +567,9 @@ void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char hty
}
}
-int BMO_slot_buffer_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name)
+int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
/* check if its actually a buffer */
@@ -558,9 +579,9 @@ int BMO_slot_buffer_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_na
return slot->len;
}
-int BMO_slot_map_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name)
+int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
/* check if its actually a buffer */
@@ -573,12 +594,12 @@ int BMO_slot_map_count(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name)
/* inserts a key/value mapping into a mapping slot. note that it copies the
* value, it doesn't store a reference to it. */
-void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slot_name,
- void *element, void *data, int len)
+void BMO_slot_map_insert(BMOperator *op, BMOpSlot *slot,
+ const void *element, void *data, int len)
{
BMOElemMapping *mapping;
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
+ BMO_ASSERT_SLOT_IN_OP(slot, op);
mapping = (BMOElemMapping *) BLI_memarena_alloc(op->arena, sizeof(*mapping) + len);
@@ -590,7 +611,7 @@ void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slot_nam
slot->data.ghash = BLI_ghash_ptr_new("bmesh slot map hash");
}
- BLI_ghash_insert(slot->data.ghash, element, mapping);
+ BLI_ghash_insert(slot->data.ghash, (void *)element, mapping);
}
#if 0
@@ -636,11 +657,11 @@ void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slot_code, int totadd)
}
#endif
-void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
GHashIterator it;
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BMElemF *ele_f;
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAPPING);
@@ -656,18 +677,22 @@ void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slot_name,
}
}
-void *BMO_slot_buffer_alloc(BMOperator *op, const char *slot_name, const int len)
+void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int len)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
- BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
/* check if its actually a buffer */
if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
return NULL;
slot->len = len;
- if (len)
+ if (len) {
slot->data.buf = BLI_memarena_alloc(op->arena, BMO_OPSLOT_TYPEINFO[slot->slot_type] * len);
+ }
+ else {
+ slot->data.buf = NULL;
+ }
+
return slot->data.buf;
}
@@ -676,9 +701,10 @@ void *BMO_slot_buffer_alloc(BMOperator *op, const char *slot_name, const int len
*
* Copies all elements of a certain type into an operator slot.
*/
-void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name, const char htype)
+void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
+ const char *slot_name, const char htype)
{
- BMOpSlot *output = BMO_slot_get(op, slot_name);
+ BMOpSlot *output = BMO_slot_get(slot_args, slot_name);
int totelement = 0, i = 0;
if (htype & BM_VERT) totelement += bm->totvert;
@@ -689,27 +715,27 @@ void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name,
BMIter iter;
BMHeader *ele;
- BMO_slot_buffer_alloc(op, slot_name, totelement);
+ BMO_slot_buffer_alloc(op, slot_args, slot_name, totelement);
/* TODO - collapse these loops into one */
if (htype & BM_VERT) {
BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
- ((BMHeader **)output->data.p)[i] = ele;
+ output->data.buf[i] = ele;
i++;
}
}
if (htype & BM_EDGE) {
BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
- ((BMHeader **)output->data.p)[i] = ele;
+ output->data.buf[i] = ele;
i++;
}
}
if (htype & BM_FACE) {
BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
- ((BMHeader **)output->data.p)[i] = ele;
+ output->data.buf[i] = ele;
i++;
}
}
@@ -722,11 +748,11 @@ void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slot_name,
* Copies elements of a certain type, which have a certain header flag
* enabled/disabled into a slot for an operator.
*/
-static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *slot_name,
+static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag,
const short test_for_enabled)
{
- BMOpSlot *output = BMO_slot_get(op, slot_name);
+ BMOpSlot *output = BMO_slot_get(slot_args, slot_name);
int totelement = 0, i = 0;
const int respecthide = (op->flag & BMO_FLAG_RESPECT_HIDE) != 0;
@@ -741,7 +767,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
BMIter iter;
BMElem *ele;
- BMO_slot_buffer_alloc(op, slot_name, totelement);
+ BMO_slot_buffer_alloc(op, slot_args, slot_name, totelement);
/* TODO - collapse these loops into one */
@@ -750,7 +776,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
if ((!respecthide || !BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) &&
BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
{
- ((BMElem **)output->data.p)[i] = ele;
+ output->data.buf[i] = ele;
i++;
}
}
@@ -761,7 +787,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
if ((!respecthide || !BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) &&
BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
{
- ((BMElem **)output->data.p)[i] = ele;
+ output->data.buf[i] = ele;
i++;
}
}
@@ -772,7 +798,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
if ((!respecthide || !BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) &&
BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
{
- ((BMElem **)output->data.p)[i] = ele;
+ output->data.buf[i] = ele;
i++;
}
}
@@ -783,46 +809,51 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
}
}
-void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag)
{
- bmo_slot_buffer_from_hflag(bm, op, slot_name, htype, hflag, TRUE);
+ bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, TRUE);
}
-void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag)
{
- bmo_slot_buffer_from_hflag(bm, op, slot_name, htype, hflag, FALSE);
+ bmo_slot_buffer_from_hflag(bm, op, slot_args, slot_name, htype, hflag, FALSE);
}
/**
* Copies the values from another slot to the end of the output slot.
*/
-void BMO_slot_buffer_append(BMOperator *output_op, const char *output_slot_name,
- BMOperator *other_op, const char *other_slot_name)
+void _bmo_slot_buffer_append(BMOpSlot slot_args_dst[BMO_OP_MAX_SLOTS], const char *slot_name_dst,
+ BMOpSlot slot_args_src[BMO_OP_MAX_SLOTS], const char *slot_name_src,
+ struct MemArena *arena_dst)
{
- BMOpSlot *output_slot = BMO_slot_get(output_op, output_slot_name);
- BMOpSlot *other_slot = BMO_slot_get(other_op, other_slot_name);
+ BMOpSlot *slot_dst = BMO_slot_get(slot_args_dst, slot_name_dst);
+ BMOpSlot *slot_src = BMO_slot_get(slot_args_src, slot_name_src);
- BLI_assert(output_slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF &&
- other_slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+ BLI_assert(slot_dst->slot_type == BMO_OP_SLOT_ELEMENT_BUF &&
+ slot_src->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
- if (output_slot->len == 0) {
+ if (slot_dst->len == 0) {
/* output slot is empty, copy rather than append */
- BMO_slot_copy(other_op, output_op, other_slot_name, output_slot_name);
+ _bmo_slot_copy(slot_args_src, slot_name_src,
+ slot_args_dst, slot_name_dst,
+ arena_dst);
}
- else if (other_slot->len != 0) {
- int elem_size = BMO_OPSLOT_TYPEINFO[output_slot->slot_type];
- int alloc_size = elem_size * (output_slot->len + other_slot->len);
+ else if (slot_src->len != 0) {
+ int elem_size = BMO_OPSLOT_TYPEINFO[slot_dst->slot_type];
+ int alloc_size = elem_size * (slot_dst->len + slot_src->len);
/* allocate new buffer */
- void *buf = BLI_memarena_alloc(output_op->arena, alloc_size);
+ void *buf = BLI_memarena_alloc(arena_dst, alloc_size);
/* copy slot data */
- memcpy(buf, output_slot->data.buf, elem_size * output_slot->len);
- memcpy(((char *)buf) + elem_size * output_slot->len, other_slot->data.buf, elem_size * other_slot->len);
+ memcpy(buf, slot_dst->data.buf, elem_size * slot_dst->len);
+ memcpy(((char *)buf) + elem_size * slot_dst->len, slot_src->data.buf, elem_size * slot_src->len);
- output_slot->data.buf = buf;
- output_slot->len += other_slot->len;
+ slot_dst->data.buf = buf;
+ slot_dst->len += slot_src->len;
}
}
@@ -832,13 +863,15 @@ void BMO_slot_buffer_append(BMOperator *output_op, const char *output_slot_name,
* Copies elements of a certain type, which have a certain flag set
* into an output slot for an operator.
*/
-static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag,
const short test_for_enabled)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
int totelement, i = 0;
+ BLI_assert(op->slots_in == slot_args || op->slots_out == slot_args);
BLI_assert(ELEM(TRUE, FALSE, test_for_enabled));
if (test_for_enabled)
@@ -853,9 +886,9 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo
BMHeader *ele;
BMHeader **ele_array;
- BMO_slot_buffer_alloc(op, slot_name, totelement);
+ BMO_slot_buffer_alloc(op, slot_args, slot_name, totelement);
- ele_array = (BMHeader **)slot->data.p;
+ ele_array = (BMHeader **)slot->data.buf;
/* TODO - collapse these loops into one */
@@ -891,16 +924,18 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, const char *slo
}
}
-void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
- bmo_slot_buffer_from_flag(bm, op, slot_name, htype, oflag, TRUE);
+ bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, TRUE);
}
-void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
- bmo_slot_buffer_from_flag(bm, op, slot_name, htype, oflag, FALSE);
+ bmo_slot_buffer_from_flag(bm, op, slot_args, slot_name, htype, oflag, FALSE);
}
/**
@@ -909,11 +944,12 @@ void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, const char *s
* Header Flags elements in a slots buffer, automatically
* using the selection API where appropriate.
*/
-void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_hflag_enable(BMesh *bm,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const char do_flush)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
- BMElem **data = slot->data.p;
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
+ BMElem **data = (BMElem **)slot->data.buf;
int i;
const char do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
const char do_flush_hide = (do_flush && (hflag & BM_ELEM_HIDDEN));
@@ -942,11 +978,12 @@ void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOperator *op, const char *slot_na
* Removes flags from elements in a slots buffer, automatically
* using the selection API where appropriate.
*/
-void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_hflag_disable(BMesh *bm,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const char hflag, const char do_flush)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
- BMElem **data = slot->data.p;
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
+ BMElem **data = (BMElem **)slot->data.buf;
int i;
const char do_flush_select = (do_flush && (hflag & BM_ELEM_SELECT));
const char do_flush_hide = (do_flush && (hflag & BM_ELEM_HIDDEN));
@@ -993,10 +1030,11 @@ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag)
*
* Flags elements in a slots buffer
*/
-void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_flag_enable(BMesh *bm,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BMHeader **data = slot->data.p;
int i;
@@ -1015,11 +1053,12 @@ void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slot_nam
*
* Removes flags from elements in a slots buffer
*/
-void BMO_slot_buffer_flag_disable(BMesh *bm, BMOperator *op, const char *slot_name,
+void BMO_slot_buffer_flag_disable(BMesh *bm,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
const char htype, const short oflag)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
- BMHeader **data = slot->data.p;
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
+ BMHeader **data = (BMHeader **)slot->data.buf;
int i;
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
@@ -1171,14 +1210,14 @@ static void bmo_flag_layer_clear(BMesh *bm)
bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE);
}
-void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slot_name)
+void *BMO_slot_buffer_elem_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
return NULL;
- return slot->data.buf ? *(void **)slot->data.buf : NULL;
+ return slot->data.buf ? *slot->data.buf : NULL;
}
/**
@@ -1187,10 +1226,11 @@ void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slot_name)
* \param restrictmask restricts the iteration to certain element types
* (e.g. combination of BM_VERT, BM_EDGE, BM_FACE), if iterating
* over an element buffer (not a mapping). */
-void *BMO_iter_new(BMOIter *iter, BMesh *UNUSED(bm), BMOperator *op,
- const char *slot_name, const char restrictmask)
+void *BMO_iter_new(BMOIter *iter,
+ BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name,
+ const char restrictmask)
{
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
memset(iter, 0, sizeof(BMOIter));
@@ -1219,13 +1259,13 @@ void *BMO_iter_step(BMOIter *iter)
return NULL;
}
- h = ((void **)iter->slot->data.buf)[iter->cur++];
+ h = iter->slot->data.buf[iter->cur++];
while (!(iter->restrictmask & h->htype)) {
if (iter->cur >= iter->slot->len) {
return NULL;
}
- h = ((void **)iter->slot->data.buf)[iter->cur++];
+ h = iter->slot->data.buf[iter->cur++];
}
return h;
@@ -1324,24 +1364,26 @@ int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op)
#define NEXT_CHAR(fmt) ((fmt)[0] != 0 ? (fmt)[1] : 0)
-static int bmo_name_to_slotcode(BMOpDefine *def, const char *name)
+static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
{
- int i;
+ int i = 0;
- for (i = 0; def->slot_types[i].type; i++) {
- if (!strncmp(name, def->slot_types[i].name, MAX_SLOTNAME)) {
+ while (slot_args->slot_name) {
+ if (strncmp(identifier, slot_args->slot_name, MAX_SLOTNAME) == 0) {
return i;
}
+ slot_args++;
+ i++;
}
return -1;
}
-static int bmo_name_to_slotcode_check(BMOpDefine *def, const char *name)
+static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
{
- int i = bmo_name_to_slotcode(def, name);
+ int i = bmo_name_to_slotcode(slot_args, identifier);
if (i < 0) {
- fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, name);
+ fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, identifier);
}
return i;
@@ -1352,12 +1394,12 @@ static int bmo_opname_to_opcode(const char *opname)
int i;
for (i = 0; i < bmesh_total_ops; i++) {
- if (!strcmp(opname, opdefines[i]->name)) {
+ if (!strcmp(opname, opdefines[i]->opname)) {
return i;
}
}
- fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
+ fprintf(stderr, "%s: could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
return -1;
}
@@ -1367,6 +1409,8 @@ static int bmo_opname_to_opcode(const char *opname)
* i - int
* b - boolean (same as int but 1/0 only)
* f - float
+ * s - slot_in
+ * S - slot_out
* hv - header flagged verts (hflag)
* he - header flagged edges (hflag)
* hf - header flagged faces (hflag)
@@ -1380,7 +1424,7 @@ static int bmo_opname_to_opcode(const char *opname)
int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, va_list vlist)
{
- BMOpDefine *def;
+// BMOpDefine *def;
char *opname, *ofmt, *fmt;
char slot_name[64] = {0};
int i /*, n = strlen(fmt) */, stop /*, slot_code = -1 */, type, state;
@@ -1419,7 +1463,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
}
BMO_op_init(bm, op, flag, opname);
- def = opdefines[i];
+// def = opdefines[i];
i = 0;
state = 1; /* 0: not inside slot_code name, 1: inside slot_code name */
@@ -1442,7 +1486,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
fmt[i] = 0;
- if (bmo_name_to_slotcode_check(def, fmt) < 0) {
+ if (bmo_name_to_slotcode_check(op->slots_in, fmt) < 0) {
GOTO_ERROR("name to slot code check failed");
}
@@ -1468,47 +1512,57 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
else if (c == '4') size = 4;
else GOTO_ERROR("matrix size was not 3 or 4");
- BMO_slot_mat_set(op, slot_name, va_arg(vlist, void *), size);
+ BMO_slot_mat_set(op, op->slots_in, slot_name, va_arg(vlist, void *), size);
state = 1;
break;
}
case 'v':
{
- BMO_slot_vec_set(op, slot_name, va_arg(vlist, float *));
+ BMO_slot_vec_set(op->slots_in, slot_name, va_arg(vlist, float *));
state = 1;
break;
}
case 'e':
{
BMHeader *ele = va_arg(vlist, void *);
- BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ BMOpSlot *slot = BMO_slot_get(op->slots_in, slot_name);
slot->data.buf = BLI_memarena_alloc(op->arena, sizeof(void *) * 4);
slot->len = 1;
- *((void **)slot->data.buf) = ele;
+ *slot->data.buf = ele;
state = 1;
break;
}
case 's':
+ case 'S':
{
- BMOperator *op2 = va_arg(vlist, void *);
- const char *slot_name2 = va_arg(vlist, char *);
+ BMOperator *op_other = va_arg(vlist, void *);
+ const char *slot_name_other = va_arg(vlist, char *);
- BMO_slot_copy(op2, op, slot_name2, slot_name);
+ if (*fmt == 's') {
+ BLI_assert(bmo_name_to_slotcode_check(op_other->slots_in, slot_name_other) != -1);
+ BMO_slot_copy(op_other, slots_in, slot_name_other,
+ op, slots_in, slot_name);
+ }
+ else {
+ BLI_assert(bmo_name_to_slotcode_check(op_other->slots_out, slot_name_other) != -1);
+ BMO_slot_copy(op_other, slots_out, slot_name_other,
+ op, slots_in, slot_name);
+ }
state = 1;
break;
}
case 'i':
- BMO_slot_int_set(op, slot_name, va_arg(vlist, int));
+ BMO_slot_int_set(op->slots_in, slot_name, va_arg(vlist, int));
state = 1;
break;
case 'b':
- BMO_slot_bool_set(op, slot_name, va_arg(vlist, int));
+ BMO_slot_bool_set(op->slots_in, slot_name, va_arg(vlist, int));
state = 1;
break;
case 'p':
- BMO_slot_ptr_set(op, slot_name, va_arg(vlist, void *));
+ BMO_slot_ptr_set(op->slots_in, slot_name, va_arg(vlist, void *));
state = 1;
break;
case 'f':
@@ -1519,7 +1573,7 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
type = *fmt;
if (NEXT_CHAR(fmt) == ' ' || NEXT_CHAR(fmt) == '\0') {
- BMO_slot_float_set(op, slot_name, va_arg(vlist, double));
+ BMO_slot_float_set(op->slots_in, slot_name, va_arg(vlist, double));
}
else {
htype = 0;
@@ -1541,19 +1595,19 @@ int BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt, v
}
if (type == 'h') {
- BMO_slot_buffer_from_enabled_hflag(bm, op, slot_name, htype, va_arg(vlist, int));
+ BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
}
else if (type == 'H') {
- BMO_slot_buffer_from_disabled_hflag(bm, op, slot_name, htype, va_arg(vlist, int));
+ BMO_slot_buffer_from_disabled_hflag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
}
else if (type == 'a') {
- BMO_slot_buffer_from_all(bm, op, slot_name, htype);
+ BMO_slot_buffer_from_all(bm, op, op->slots_in, slot_name, htype);
}
else if (type == 'f') {
- BMO_slot_buffer_from_enabled_flag(bm, op, slot_name, htype, va_arg(vlist, int));
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
}
else if (type == 'F') {
- BMO_slot_buffer_from_disabled_flag(bm, op, slot_name, htype, va_arg(vlist, int));
+ BMO_slot_buffer_from_disabled_flag(bm, op, op->slots_in, slot_name, htype, va_arg(vlist, int));
}
}
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index 79b8c450fd9..1c62a038f34 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -90,11 +90,6 @@ enum {
OPUVC_AXIS_Y
};
-enum {
- DIRECTION_CW = 1,
- DIRECTION_CCW
-};
-
/* vertex path selection values */
enum {
VPATH_SELECT_EDGE_LENGTH = 0,
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 35213c83097..2e0471863d4 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -677,6 +677,7 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, floa
BMLoop *l_first;
const float cos_threshold = 0.9f;
+ const float bias = 1.0f + 1e-6f;
if (f->len == 4) {
BMLoop *larr[4];
@@ -691,7 +692,7 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, floa
/* pick 0/1 based on best lenth */
/* XXX Can't only rely on such test, also must check we do not get (too much) degenerated triangles!!! */
i = (((len_squared_v3v3(larr[0]->v->co, larr[2]->v->co) >
- len_squared_v3v3(larr[1]->v->co, larr[3]->v->co))) != use_beauty);
+ len_squared_v3v3(larr[1]->v->co, larr[3]->v->co) * bias)) != use_beauty);
i4 = (i + 3) % 4;
/* Check produced tris aren’t too flat/narrow...
* Probably not the best test, but is quite efficient and should at least avoid null-area faces! */
diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h
index a5eb7e63505..850e81ba3ac 100644
--- a/source/blender/bmesh/intern/bmesh_private.h
+++ b/source/blender/bmesh/intern/bmesh_private.h
@@ -56,11 +56,16 @@ int bmesh_elem_check(void *element, const char htype);
int bmesh_radial_length(BMLoop *l);
int bmesh_disk_count(BMVert *v);
-/* NOTE: ensure different parts of the API do not conflict
+/**
+ * Internal BMHeader.api_flag
+ * \note Ensure different parts of the API do not conflict
* on using these internal flags!*/
-#define _FLAG_JF 1 /* join faces */
-#define _FLAG_MF 2 /* make face */
-#define _FLAG_MV 2 /* make face, vertex */
+enum {
+ _FLAG_JF = (1 << 0), /* join faces */
+ _FLAG_MF = (1 << 1), /* make face */
+ _FLAG_MV = (1 << 1), /* make face, vertex */
+ _FLAG_OVERLAP = (1 << 2) /* general overlap flag */
+};
#define BM_ELEM_API_FLAG_ENABLE(element, f) ((element)->head.api_flag |= (f))
#define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->head.api_flag &= ~(f))
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index cae9b5b3b83..ec2e90591cc 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -39,8 +39,6 @@
#include "bmesh.h"
#include "intern/bmesh_private.h"
-#define BM_OVERLAP (1 << 13)
-
/**
* Returns whether or not a given vertex is
* is part of a given edge.
@@ -240,7 +238,7 @@ int BM_vert_in_face(BMFace *f, BMVert *v)
* Compares the number of vertices in an array
* that appear in a given face
*/
-int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
+int BM_verts_in_face(BMFace *f, BMVert **varr, int len)
{
BMLoop *l_iter, *l_first;
@@ -251,7 +249,7 @@ int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
int i, count = 0;
for (i = 0; i < len; i++) {
- BMO_elem_flag_enable(bm, varr[i], BM_OVERLAP);
+ BM_ELEM_API_FLAG_ENABLE(varr[i], _FLAG_OVERLAP);
}
#ifdef USE_BMESH_HOLES
@@ -266,14 +264,16 @@ int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
#endif
do {
- if (BMO_elem_flag_test(bm, l_iter->v, BM_OVERLAP)) {
+ if (BM_ELEM_API_FLAG_TEST(l_iter->v, _FLAG_OVERLAP)) {
count++;
}
} while ((l_iter = l_iter->next) != l_first);
}
- for (i = 0; i < len; i++) BMO_elem_flag_disable(bm, varr[i], BM_OVERLAP);
+ for (i = 0; i < len; i++) {
+ BM_ELEM_API_FLAG_DISABLE(varr[i], _FLAG_OVERLAP);
+ }
return count;
}
@@ -1217,7 +1217,7 @@ BMEdge *BM_edge_find_double(BMEdge *e)
* \returns TRUE for overlap
*
*/
-int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlapface)
+int BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_overlapface)
{
BMIter viter;
BMFace *f;
@@ -1225,7 +1225,7 @@ int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlap
for (i = 0; i < len; i++) {
BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) {
- amount = BM_verts_in_face(bm, f, varr, len);
+ amount = BM_verts_in_face(f, varr, len);
if (amount >= len) {
if (r_overlapface) {
*r_overlapface = f;
@@ -1247,7 +1247,7 @@ int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlap
* there is a face with exactly those vertices
* (and only those vertices).
*/
-int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface)
+int BM_face_exists(BMVert **varr, int len, BMFace **r_existface)
{
BMIter viter;
BMFace *f;
@@ -1255,7 +1255,7 @@ int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface)
for (i = 0; i < len; i++) {
BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) {
- amount = BM_verts_in_face(bm, f, varr, len);
+ amount = BM_verts_in_face(f, varr, len);
if (amount == len && amount == f->len) {
if (r_existface) {
*r_existface = f;
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h
index 7bb456df8e8..d97faebf021 100644
--- a/source/blender/bmesh/intern/bmesh_queries.h
+++ b/source/blender/bmesh/intern/bmesh_queries.h
@@ -28,7 +28,7 @@
*/
int BM_vert_in_face(BMFace *f, BMVert *v);
-int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len);
+int BM_verts_in_face(BMFace *f, BMVert **varr, int len);
int BM_edge_in_face(BMFace *f, BMEdge *e);
int BM_edge_in_loop(BMEdge *e, BMLoop *l);
@@ -77,9 +77,9 @@ BMLoop *BM_face_find_longest_loop(BMFace *f);
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
BMEdge *BM_edge_find_double(BMEdge *e);
-int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_existface);
+int BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_existface);
-int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface);
+int BM_face_exists(BMVert **varr, int len, BMFace **r_existface);
int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len);
int BM_face_exists_multi_edge(BMEdge **earr, int len);
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index 049b923315b..126d0f46119 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -20,7 +20,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/operators/bmesh_bevel.c
+/** \file blender/bmesh/operators/bmo_bevel.c
* \ingroup bmesh
*/
@@ -32,27 +32,30 @@
void bmo_bevel_exec(BMesh *bm, BMOperator *op)
{
- const float offset = BMO_slot_float_get(op, "offset");
- const int seg = BMO_slot_int_get(op, "segments");
+ const float offset = BMO_slot_float_get(op->slots_in, "offset");
+ const int seg = BMO_slot_int_get(op->slots_in, "segments");
if (offset > 0) {
BMOIter siter;
BMEdge *e;
BMVert *v;
- /* first flush 'geom' into flags, this makes it possible to check connected data */
- BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE, BM_ELEM_TAG, FALSE);
+ /* first flush 'geom' into flags, this makes it possible to check connected data,
+ * BM_FACE is cleared so we can put newly created faces into a bmesh slot. */
+ BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
BM_elem_flag_enable(v, BM_ELEM_TAG);
}
- BMO_ITER (e, &siter, bm, op, "geom", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "geom", BM_EDGE) {
if (BM_edge_is_manifold(e)) {
BM_elem_flag_enable(e, BM_ELEM_TAG);
}
}
BM_mesh_bevel(bm, offset, seg);
+
+ 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_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index ebd848ff8b2..b7bb57bb19d 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -52,7 +52,7 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(verts_pair);
int i;
- BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_INPUT);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_INPUT);
for (f = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); f; f = BM_iter_step(&iter)) {
BLI_array_empty(loops_split);
@@ -117,7 +117,7 @@ void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_OUT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_OUT);
BLI_array_free(loops_split);
BLI_array_free(verts_pair);
@@ -219,12 +219,12 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
int c = 0, cl1 = 0, cl2 = 0;
/* merge-bridge support */
- const int use_merge = BMO_slot_bool_get(op, "use_merge");
- const float merge_factor = BMO_slot_float_get(op, "merge_factor");
+ const int use_merge = BMO_slot_bool_get(op->slots_in, "use_merge");
+ const float merge_factor = BMO_slot_float_get(op->slots_in, "merge_factor");
- BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
if (!BMO_elem_flag_test(bm, e, EDGE_DONE)) {
BMVert *v, *ov;
/* BMEdge *e2, *e3, *oe = e; */ /* UNUSED */
@@ -523,7 +523,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_OUT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_OUT);
cleanup:
BLI_array_free(ee1);
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index 49a2f959063..987aa8cdf99 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -741,7 +741,10 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
BMVert *startv;
BMVert *endv;
EPathNode *node;
- int i, use_restrict = BMO_slot_bool_get(op, "use_restrict");
+ int i;
+ const int use_restrict = BMO_slot_bool_get(op->slots_in, "use_restrict");
+ BMOpSlot *slot_restrict = BMO_slot_get(op->slots_in, "restrict");
+
startv = edata[BM_elem_index_get(edge)].ftag ? edge->v2 : edge->v1;
endv = edata[BM_elem_index_get(edge)].ftag ? edge->v1 : edge->v2;
@@ -769,7 +772,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
verts[i] = node->v;
}
- if (BM_face_exists(bm, verts, i, &f)) {
+ if (BM_face_exists(verts, i, &f)) {
if (!BMO_elem_flag_test(bm, f, FACE_IGNORE)) {
BLI_ghash_remove(gh, endv, NULL, NULL);
continue;
@@ -806,12 +809,13 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
continue;
}
- if (use_restrict && BMO_slot_map_contains(bm, op, "restrict", e)) {
- int group = BMO_slot_map_int_get(bm, op, "restrict", e);
-
- if (!(group & path->group)) {
- v2 = NULL;
- continue;
+ if (use_restrict) {
+ int *group = (int *)BMO_slot_map_data_get(slot_restrict, e);
+ if (group) {
+ if (!(*group & path->group)) {
+ v2 = NULL;
+ continue;
+ }
}
}
@@ -895,12 +899,14 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
BMEdge **edges = NULL;
PathBase *pathbase;
BLI_array_declare(edges);
- int use_restrict = BMO_slot_bool_get(op, "use_restrict");
- int use_fill_check = BMO_slot_bool_get(op, "use_fill_check");
- const short mat_nr = BMO_slot_int_get(op, "mat_nr");
- const short use_smooth = BMO_slot_bool_get(op, "use_smooth");
+ int use_restrict = BMO_slot_bool_get(op->slots_in, "use_restrict");
+ int use_fill_check = BMO_slot_bool_get(op->slots_in, "use_fill_check");
+ const short mat_nr = BMO_slot_int_get(op->slots_in, "mat_nr");
+ const short use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
int i, j, group = 0;
unsigned int winding[2]; /* accumulte winding directions for each edge which has a face */
+ BMOpSlot *slot_restrict = BMO_slot_get(op->slots_in, "restrict");
+ BMOpSlot *slot_face_groupmap_out = BMO_slot_get(op->slots_out, "face_groupmap.out");
if (!bm->totvert || !bm->totedge)
return;
@@ -910,8 +916,8 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
edata = MEM_callocN(sizeof(EdgeData) * bm->totedge, "EdgeData");
vdata = MEM_callocN(sizeof(VertData) * bm->totvert, "VertData");
- BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
- BMO_slot_buffer_flag_enable(bm, op, "excludefaces", BM_FACE, FACE_IGNORE);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "exclude_faces", BM_FACE, FACE_IGNORE);
BM_mesh_elem_index_ensure(bm, BM_VERT);
@@ -932,14 +938,14 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
bm->elem_index_dirty &= ~BM_EDGE;
init_rotsys(bm, edata, vdata);
-
+
while (1) {
edge = NULL;
group = 0;
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
/* if restrict is on, only start on faces in the restrict map */
- if (use_restrict && !BMO_slot_map_contains(bm, op, "restrict", e))
+ if (use_restrict && !BMO_slot_map_contains(slot_restrict, e))
continue;
if (edata[BM_elem_index_get(e)].tag < 2) {
@@ -948,7 +954,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
if (use_restrict) {
int i = 0, j = 0, gi = 0;
- group = BMO_slot_map_int_get(bm, op, "restrict", e);
+ group = BMO_slot_map_int_get(slot_restrict, e);
for (i = 0; i < 30; i++) {
if (group & (1 << i)) {
@@ -1055,7 +1061,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
}
if (use_restrict) {
- BMO_slot_map_int_insert(bm, op, "faceout_groupmap", f, path->group);
+ BMO_slot_map_int_insert(op, slot_face_groupmap_out, f, path->group);
}
}
}
@@ -1063,7 +1069,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
edge_free_path(pathbase, path);
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_NEW);
BLI_array_free(edges);
BLI_array_free(verts);
@@ -1103,11 +1109,11 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
int ok = 1;
int i, count;
- BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
/* validate that each edge has at most one other tagged edge in the
* disk cycle around each of it's vertices */
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
for (i = 0; i < 2; i++) {
count = BMO_vert_edge_flags_count(bm, i ? e->v2 : e->v1, EDGE_MARK);
if (count > 2) {
@@ -1129,7 +1135,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
/* find connected loops within the input edge */
count = 0;
while (1) {
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
if (!BMO_elem_flag_test(bm, e, EDGE_VIS)) {
if (BMO_vert_edge_flags_count(bm, e->v1, EDGE_MARK) == 1 ||
BMO_vert_edge_flags_count(bm, e->v2, EDGE_MARK) == 1)
@@ -1260,7 +1266,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, ELE_NEW);
BLI_array_free(edges1);
BLI_array_free(edges2);
@@ -1280,11 +1286,11 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMEdge *e;
BMFace *f;
int totv = 0, tote = 0, totf = 0, amount;
- const short mat_nr = BMO_slot_int_get(op, "mat_nr");
- const short use_smooth = BMO_slot_bool_get(op, "use_smooth");
+ const short mat_nr = BMO_slot_int_get(op->slots_in, "mat_nr");
+ const short use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
/* count number of each element type we were passe */
- BMO_ITER (h, &oiter, bm, op, "geom", BM_VERT | BM_EDGE | BM_FACE) {
+ BMO_ITER (h, &oiter, op->slots_in, "geom", BM_VERT | BM_EDGE | BM_FACE) {
switch (h->htype) {
case BM_VERT: totv++; break;
case BM_EDGE: tote++; break;
@@ -1318,7 +1324,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
int ok = TRUE;
- BMO_ITER (v, &oiter, bm, op, "geom", BM_VERT) {
+ BMO_ITER (v, &oiter, op->slots_in, "geom", BM_VERT) {
/* count how many flagged edges this vertex uses */
int tot_edges = 0;
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
@@ -1366,7 +1372,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
/* call edgenet prepare op so additional face creation cases wore */
BMO_op_initf(bm, &op2, op->flag, "edgenet_prepare edges=%fe", ELE_NEW);
BMO_op_exec(bm, &op2);
- BMO_slot_buffer_flag_enable(bm, &op2, "edgeout", BM_EDGE, ELE_NEW);
+ BMO_slot_buffer_flag_enable(bm, op2.slots_out, "edges.out", BM_EDGE, ELE_NEW);
BMO_op_finish(bm, &op2);
BMO_op_initf(bm, &op2, op->flag,
@@ -1376,8 +1382,9 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &op2);
/* return if edge net create did something */
- if (BMO_slot_buffer_count(bm, &op2, "faceout")) {
- BMO_slot_copy(&op2, op, "faceout", "faceout");
+ if (BMO_slot_buffer_count(op2.slots_out, "faces.out")) {
+ BMO_slot_copy(&op2, slots_out, "faces.out",
+ op, slots_out, "faces.out");
BMO_op_finish(bm, &op2);
return;
}
@@ -1389,8 +1396,9 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &op2);
/* if we dissolved anything, then return */
- if (BMO_slot_buffer_count(bm, &op2, "regionout")) {
- BMO_slot_copy(&op2, op, "regionout", "faceout");
+ if (BMO_slot_buffer_count(op2.slots_out, "region.out")) {
+ BMO_slot_copy(&op2, slots_out, "region.out",
+ op, slots_out, "faces.out");
BMO_op_finish(bm, &op2);
return;
}
@@ -1414,7 +1422,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
/* create edge */
e = BM_edge_create(bm, verts[0], verts[1], NULL, TRUE);
BMO_elem_flag_enable(bm, e, ELE_OUT);
- BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_OUT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, ELE_OUT);
}
else if (0) { /* nice feature but perhaps it should be a different tool? */
@@ -1460,7 +1468,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
}
}
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_OUT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, ELE_OUT);
/* done creating edges */
}
else if (amount > 2) {
@@ -1470,7 +1478,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
BMVert **vert_arr = MEM_mallocN(sizeof(BMVert **) * totv, __func__);
int i = 0;
- BMO_ITER (v, &oiter, bm, op, "geom", BM_VERT) {
+ BMO_ITER (v, &oiter, op->slots_in, "geom", BM_VERT) {
vert_arr[i] = v;
i++;
}
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 9addb1b1657..7c3bcd60daa 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -85,7 +85,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
BMWalker regwalker;
int i;
- int use_verts = BMO_slot_bool_get(op, "use_verts");
+ int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
if (use_verts) {
/* tag verts that start out with only 2 edges,
@@ -98,10 +98,10 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_flag_enable(bm, op, "faces", BM_FACE, FACE_MARK);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_MARK);
/* collect region */
- BMO_ITER (f, &oiter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
if (!BMO_elem_flag_test(bm, f, FACE_MARK)) {
continue;
@@ -184,7 +184,7 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
goto cleanup;
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "regionout", BM_FACE, FACE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "region.out", BM_FACE, FACE_NEW);
cleanup:
/* free/cleanup */
@@ -208,7 +208,7 @@ void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op)
int i;
- BMO_ITER (e, &oiter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &oiter, op->slots_in, "edges", BM_EDGE) {
if (BM_edge_face_pair(e, &fa, &fb)) {
BMO_elem_flag_enable(bm, e->v1, VERT_MARK);
BMO_elem_flag_enable(bm, e->v2, VERT_MARK);
@@ -237,7 +237,7 @@ void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op)
//BMO_op_initf(bm, &fop, "dissolve_faces faces=%ff", FACE_MARK);
//BMO_op_exec(bm, &fop);
- //BMO_slot_copy(op, &fop, "regionout", "regionout");
+ //BMO_slot_copy(op, &fop, "region.out", "region.out");
//BMO_op_finish(bm, &fop);
}
@@ -254,7 +254,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
BMIter viter;
BMVert *v;
- int use_verts = BMO_slot_bool_get(op, "use_verts");
+ int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
if (use_verts) {
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
@@ -262,7 +262,7 @@ void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_ITER (e, &eiter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &eiter, op->slots_in, "edges", BM_EDGE) {
BMFace *fa, *fb;
if (BM_edge_face_pair(e, &fa, &fb)) {
@@ -338,7 +338,7 @@ void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
BMFace *f;
/* int i; */
- BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_MARK);
for (v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); v; v = BM_iter_step(&iter)) {
if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
@@ -479,13 +479,13 @@ void dummy_exec(BMesh *bm, BMOperator *op)
/* Limited Dissolve */
void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
{
- BMOpSlot *einput = BMO_slot_get(op, "edges");
- BMOpSlot *vinput = BMO_slot_get(op, "verts");
+ BMOpSlot *einput = BMO_slot_get(op->slots_in, "edges");
+ BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
const float angle_max = (float)M_PI / 2.0f;
- const float angle_limit = min_ff(angle_max, BMO_slot_float_get(op, "angle_limit"));
- const int do_dissolve_boundaries = BMO_slot_bool_get(op, "use_dissolve_boundaries");
+ const float angle_limit = min_ff(angle_max, BMO_slot_float_get(op->slots_in, "angle_limit"));
+ const int do_dissolve_boundaries = BMO_slot_bool_get(op->slots_in, "use_dissolve_boundaries");
BM_mesh_decimate_dissolve_ex(bm, angle_limit, do_dissolve_boundaries,
- vinput->data.p, vinput->len,
- einput->data.p, einput->len);
+ (BMVert **)BMO_SLOT_AS_BUFFER(vinput), vinput->len,
+ (BMEdge **)BMO_SLOT_AS_BUFFER(einput), einput->len);
}
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
index aa502203b50..c4f6c821320 100644
--- a/source/blender/bmesh/operators/bmo_dupe.c
+++ b/source/blender/bmesh/operators/bmo_dupe.c
@@ -68,7 +68,9 @@ static BMVert *copy_vertex(BMesh *source_mesh, BMVert *source_vertex, BMesh *tar
*
* Copy an existing edge from one bmesh to another.
*/
-static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
+static BMEdge *copy_edge(BMOperator *op,
+ BMOpSlot *slot_boundarymap_out,
+ BMesh *source_mesh,
BMEdge *source_edge, BMesh *target_mesh,
GHash *vhash, GHash *ehash)
{
@@ -102,7 +104,7 @@ static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
if (rlen < 2) {
/* not sure what non-manifold cases of greater then three
* radial should do. */
- BMO_slot_map_ptr_insert(source_mesh, op, "boundarymap",
+ BMO_slot_map_ptr_insert(op, slot_boundarymap_out,
source_edge, target_edge);
}
@@ -124,7 +126,9 @@ static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
* Copy an existing face from one bmesh to another.
*/
-static BMFace *copy_face(BMOperator *op, BMesh *source_mesh,
+static BMFace *copy_face(BMOperator *op,
+ BMOpSlot *slot_facemap_out,
+ BMesh *source_mesh,
BMFace *source_face, BMesh *target_mesh,
BMVert **vtar, BMEdge **edar, GHash *vhash, GHash *ehash)
{
@@ -151,11 +155,11 @@ static BMFace *copy_face(BMOperator *op, BMesh *source_mesh,
vtar[i] = BLI_ghash_lookup(vhash, source_loop->v);
edar[i] = BLI_ghash_lookup(ehash, source_loop->e);
}
-
+
/* create new face */
target_face = BM_face_create(target_mesh, vtar, edar, source_face->len, FALSE);
- BMO_slot_map_ptr_insert(source_mesh, op, "facemap", source_face, target_face);
- BMO_slot_map_ptr_insert(source_mesh, op, "facemap", target_face, source_face);
+ BMO_slot_map_ptr_insert(op, slot_facemap_out, source_face, target_face);
+ BMO_slot_map_ptr_insert(op, slot_facemap_out, target_face, source_face);
BM_elem_attrs_copy(source_mesh, target_mesh, source_face, target_face);
@@ -181,7 +185,7 @@ static BMFace *copy_face(BMOperator *op, BMesh *source_mesh,
* Internal Copy function.
*/
-static void bmo_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
+static void bmo_mesh_copy(BMOperator *op, BMesh *bm_src, BMesh *bm_dst)
{
BMVert *v = NULL, *v2;
@@ -196,22 +200,26 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
BMIter viter, eiter, fiter;
GHash *vhash, *ehash;
+ BMOpSlot *slot_boundarymap_out = BMO_slot_get(op->slots_out, "boundarymap.out");
+ BMOpSlot *slot_facemap_out = BMO_slot_get(op->slots_out, "facemap.out");
+ BMOpSlot *slot_isovertmap_out = BMO_slot_get(op->slots_out, "isovertmap.out");
+
/* initialize pointer hashes */
vhash = BLI_ghash_ptr_new("bmesh dupeops v");
ehash = BLI_ghash_ptr_new("bmesh dupeops e");
/* duplicate flagged vertices */
- BM_ITER_MESH (v, &viter, source, BM_VERTS_OF_MESH) {
- if (BMO_elem_flag_test(source, v, DUPE_INPUT) &&
- !BMO_elem_flag_test(source, v, DUPE_DONE))
+ BM_ITER_MESH (v, &viter, bm_src, BM_VERTS_OF_MESH) {
+ if (BMO_elem_flag_test(bm_src, v, DUPE_INPUT) &&
+ !BMO_elem_flag_test(bm_src, v, DUPE_DONE))
{
BMIter iter;
int isolated = 1;
- v2 = copy_vertex(source, v, target, vhash);
+ v2 = copy_vertex(bm_src, v, bm_dst, vhash);
BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
- if (BMO_elem_flag_test(source, f, DUPE_INPUT)) {
+ if (BMO_elem_flag_test(bm_src, f, DUPE_INPUT)) {
isolated = 0;
break;
}
@@ -219,7 +227,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
if (isolated) {
BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
- if (BMO_elem_flag_test(source, e, DUPE_INPUT)) {
+ if (BMO_elem_flag_test(bm_src, e, DUPE_INPUT)) {
isolated = 0;
break;
}
@@ -227,49 +235,49 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
}
if (isolated) {
- BMO_slot_map_ptr_insert(source, op, "isovertmap", v, v2);
+ BMO_slot_map_ptr_insert(op, slot_isovertmap_out, v, v2);
}
- BMO_elem_flag_enable(source, v, DUPE_DONE);
+ BMO_elem_flag_enable(bm_src, v, DUPE_DONE);
}
}
/* now we dupe all the edges */
- BM_ITER_MESH (e, &eiter, source, BM_EDGES_OF_MESH) {
- if (BMO_elem_flag_test(source, e, DUPE_INPUT) &&
- !BMO_elem_flag_test(source, e, DUPE_DONE))
+ BM_ITER_MESH (e, &eiter, bm_src, BM_EDGES_OF_MESH) {
+ if (BMO_elem_flag_test(bm_src, e, DUPE_INPUT) &&
+ !BMO_elem_flag_test(bm_src, e, DUPE_DONE))
{
/* make sure that verts are copied */
- if (!BMO_elem_flag_test(source, e->v1, DUPE_DONE)) {
- copy_vertex(source, e->v1, target, vhash);
- BMO_elem_flag_enable(source, e->v1, DUPE_DONE);
+ if (!BMO_elem_flag_test(bm_src, e->v1, DUPE_DONE)) {
+ copy_vertex(bm_src, e->v1, bm_dst, vhash);
+ BMO_elem_flag_enable(bm_src, e->v1, DUPE_DONE);
}
- if (!BMO_elem_flag_test(source, e->v2, DUPE_DONE)) {
- copy_vertex(source, e->v2, target, vhash);
- BMO_elem_flag_enable(source, e->v2, DUPE_DONE);
+ if (!BMO_elem_flag_test(bm_src, e->v2, DUPE_DONE)) {
+ copy_vertex(bm_src, e->v2, bm_dst, vhash);
+ BMO_elem_flag_enable(bm_src, e->v2, DUPE_DONE);
}
/* now copy the actual edge */
- copy_edge(op, source, e, target, vhash, ehash);
- BMO_elem_flag_enable(source, e, DUPE_DONE);
+ copy_edge(op, slot_boundarymap_out, bm_src, e, bm_dst, vhash, ehash);
+ BMO_elem_flag_enable(bm_src, e, DUPE_DONE);
}
}
/* first we dupe all flagged faces and their elements from source */
- BM_ITER_MESH (f, &fiter, source, BM_FACES_OF_MESH) {
- if (BMO_elem_flag_test(source, f, DUPE_INPUT)) {
+ BM_ITER_MESH (f, &fiter, bm_src, BM_FACES_OF_MESH) {
+ if (BMO_elem_flag_test(bm_src, f, DUPE_INPUT)) {
/* vertex pass */
BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) {
- if (!BMO_elem_flag_test(source, v, DUPE_DONE)) {
- copy_vertex(source, v, target, vhash);
- BMO_elem_flag_enable(source, v, DUPE_DONE);
+ if (!BMO_elem_flag_test(bm_src, v, DUPE_DONE)) {
+ copy_vertex(bm_src, v, bm_dst, vhash);
+ BMO_elem_flag_enable(bm_src, v, DUPE_DONE);
}
}
/* edge pass */
BM_ITER_ELEM (e, &eiter, f, BM_EDGES_OF_FACE) {
- if (!BMO_elem_flag_test(source, e, DUPE_DONE)) {
- copy_edge(op, source, e, target, vhash, ehash);
- BMO_elem_flag_enable(source, e, DUPE_DONE);
+ if (!BMO_elem_flag_test(bm_src, e, DUPE_DONE)) {
+ copy_edge(op, slot_boundarymap_out, bm_src, e, bm_dst, vhash, ehash);
+ BMO_elem_flag_enable(bm_src, e, DUPE_DONE);
}
}
@@ -280,8 +288,8 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
BLI_array_grow_items(vtar, f->len);
BLI_array_grow_items(edar, f->len);
- copy_face(op, source, f, target, vtar, edar, vhash, ehash);
- BMO_elem_flag_enable(source, f, DUPE_DONE);
+ copy_face(op, slot_facemap_out, bm_src, f, bm_dst, vtar, edar, vhash, ehash);
+ BMO_elem_flag_enable(bm_src, f, DUPE_DONE);
}
}
@@ -317,23 +325,24 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *source, BMesh *target)
void bmo_duplicate_exec(BMesh *bm, BMOperator *op)
{
BMOperator *dupeop = op;
- BMesh *bm2 = BMO_slot_ptr_get(op, "dest");
+ BMesh *bm2 = BMO_slot_ptr_get(op->slots_in, "dest");
if (!bm2)
bm2 = bm;
/* flag input */
- BMO_slot_buffer_flag_enable(bm, dupeop, "geom", BM_ALL, DUPE_INPUT);
+ BMO_slot_buffer_flag_enable(bm, dupeop->slots_in, "geom", BM_ALL, DUPE_INPUT);
/* use the internal copy function */
bmo_mesh_copy(dupeop, bm, bm2);
/* Output */
/* First copy the input buffers to output buffers - original data */
- BMO_slot_copy(dupeop, dupeop, "geom", "origout");
+ BMO_slot_copy(dupeop, slots_in, "geom",
+ dupeop, slots_out, "geom_orig.out");
/* Now alloc the new output buffers */
- BMO_slot_buffer_from_enabled_flag(bm, dupeop, "newout", BM_ALL, DUPE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, dupeop, dupeop->slots_out, "geom.out", BM_ALL, DUPE_NEW);
}
#if 0 /* UNUSED */
@@ -378,16 +387,17 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
BMOperator *splitop = op;
BMOperator dupeop;
BMOperator delop;
- const short use_only_faces = BMO_slot_bool_get(op, "use_only_faces");
+ const short use_only_faces = BMO_slot_bool_get(op->slots_in, "use_only_faces");
/* initialize our sub-operator */
BMO_op_init(bm, &dupeop, op->flag, "duplicate");
BMO_op_init(bm, &delop, op->flag, "delete");
- BMO_slot_copy(splitop, &dupeop, "geom", "geom");
+ BMO_slot_copy(splitop, slots_in, "geom",
+ &dupeop, slots_in, "geom");
BMO_op_exec(bm, &dupeop);
- BMO_slot_buffer_flag_enable(bm, splitop, "geom", BM_ALL, SPLIT_INPUT);
+ BMO_slot_buffer_flag_enable(bm, splitop->slots_in, "geom", BM_ALL, SPLIT_INPUT);
if (use_only_faces) {
BMVert *v;
@@ -427,16 +437,22 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
}
/* connect outputs of dupe to delete, exluding keep geometry */
- BMO_slot_int_set(&delop, "context", DEL_FACES);
- BMO_slot_buffer_from_enabled_flag(bm, &delop, "geom", BM_ALL, SPLIT_INPUT);
+ BMO_slot_int_set(delop.slots_in, "context", DEL_FACES);
+ BMO_slot_buffer_from_enabled_flag(bm, &delop, delop.slots_in, "geom", BM_ALL, SPLIT_INPUT);
BMO_op_exec(bm, &delop);
/* now we make our outputs by copying the dupe output */
- BMO_slot_copy(&dupeop, splitop, "newout", "geomout");
- BMO_slot_copy(&dupeop, splitop, "boundarymap", "boundarymap");
- BMO_slot_copy(&dupeop, splitop, "isovertmap", "isovertmap");
-
+ BMO_slot_copy(&dupeop, slots_out, "geom.out",
+ splitop, slots_out, "geom.out");
+
+ BMO_slot_copy(&dupeop, slots_out, "boundarymap.out",
+ splitop, slots_out, "boundarymap.out");
+
+ BMO_slot_copy(&dupeop, slots_out, "isovertmap.out",
+ splitop, slots_out, "isovertmap.out");
+
+
/* cleanup */
BMO_op_finish(bm, &delop);
BMO_op_finish(bm, &dupeop);
@@ -450,9 +466,9 @@ void bmo_delete_exec(BMesh *bm, BMOperator *op)
BMOperator *delop = op;
/* Mark Buffer */
- BMO_slot_buffer_flag_enable(bm, delop, "geom", BM_ALL, DEL_INPUT);
+ BMO_slot_buffer_flag_enable(bm, delop->slots_in, "geom", BM_ALL, DEL_INPUT);
- BMO_remove_tagged_context(bm, DEL_INPUT, BMO_slot_int_get(op, "context"));
+ BMO_remove_tagged_context(bm, DEL_INPUT, BMO_slot_int_get(op->slots_in, "context"));
#undef DEL_INPUT
}
@@ -473,44 +489,47 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
float phi;
int steps, do_dupli, a, usedvec;
- BMO_slot_vec_get(op, "cent", cent);
- BMO_slot_vec_get(op, "axis", axis);
+ BMO_slot_vec_get(op->slots_in, "cent", cent);
+ BMO_slot_vec_get(op->slots_in, "axis", axis);
normalize_v3(axis);
- BMO_slot_vec_get(op, "dvec", dvec);
+ BMO_slot_vec_get(op->slots_in, "dvec", dvec);
usedvec = !is_zero_v3(dvec);
- steps = BMO_slot_int_get(op, "steps");
- phi = BMO_slot_float_get(op, "ang") * DEG2RADF(1.0f) / steps;
- do_dupli = BMO_slot_bool_get(op, "do_dupli");
+ steps = BMO_slot_int_get(op->slots_in, "steps");
+ phi = BMO_slot_float_get(op->slots_in, "angle") * DEG2RADF(1.0f) / steps;
+ do_dupli = BMO_slot_bool_get(op->slots_in, "use_duplicate");
axis_angle_to_mat3(rmat, axis, phi);
- BMO_slot_copy(op, op, "geom", "lastout");
+ BMO_slot_copy(op, slots_in, "geom",
+ op, slots_out, "geom_last.out");
for (a = 0; a < steps; a++) {
if (do_dupli) {
- BMO_op_initf(bm, &dupop, op->flag, "duplicate geom=%s", op, "lastout");
+ BMO_op_initf(bm, &dupop, op->flag, "duplicate geom=%S", op, "geom_last.out");
BMO_op_exec(bm, &dupop);
BMO_op_callf(bm, op->flag,
- "rotate cent=%v mat=%m3 verts=%s",
- cent, rmat, &dupop, "newout");
- BMO_slot_copy(&dupop, op, "newout", "lastout");
+ "rotate cent=%v mat=%m3 verts=%S",
+ cent, rmat, &dupop, "geom.out");
+ BMO_slot_copy(&dupop, slots_out, "geom.out",
+ op, slots_out, "geom_last.out");
BMO_op_finish(bm, &dupop);
}
else {
- BMO_op_initf(bm, &extop, op->flag, "extrude_face_region edgefacein=%s",
- op, "lastout");
+ BMO_op_initf(bm, &extop, op->flag, "extrude_face_region geom=%S",
+ op, "geom_last.out");
BMO_op_exec(bm, &extop);
BMO_op_callf(bm, op->flag,
- "rotate cent=%v mat=%m3 verts=%s",
- cent, rmat, &extop, "geomout");
- BMO_slot_copy(&extop, op, "geomout", "lastout");
+ "rotate cent=%v mat=%m3 verts=%S",
+ cent, rmat, &extop, "geom.out");
+ BMO_slot_copy(&extop, slots_out, "geom.out",
+ op, slots_out, "geom_last.out");
BMO_op_finish(bm, &extop);
}
if (usedvec) {
mul_m3_v3(rmat, dvec);
BMO_op_callf(bm, op->flag,
- "translate vec=%v verts=%s",
- dvec, op, "lastout");
+ "translate vec=%v verts=%S",
+ dvec, op, "geom_last.out");
}
}
}
diff --git a/source/blender/bmesh/operators/bmo_edgesplit.c b/source/blender/bmesh/operators/bmo_edgesplit.c
index 1f6689ed06c..9e9e4b8c962 100644
--- a/source/blender/bmesh/operators/bmo_edgesplit.c
+++ b/source/blender/bmesh/operators/bmo_edgesplit.c
@@ -81,14 +81,14 @@ static void bm_edgesplit_validate_seams(BMesh *bm, BMOperator *op)
/* single marked edges unconnected to any other marked edges
* are illegal, go through and unmark them */
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
/* lame, but we don't want the count to exceed 255,
* so just count to 2, its all we need */
unsigned char *vt;
vt = &vtouch[BM_elem_index_get(e->v1)]; if (*vt < 2) (*vt)++;
vt = &vtouch[BM_elem_index_get(e->v2)]; if (*vt < 2) (*vt)++;
}
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
if (vtouch[BM_elem_index_get(e->v1)] == 1 &&
vtouch[BM_elem_index_get(e->v2)] == 1)
{
@@ -104,13 +104,13 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
{
BMOIter siter;
BMEdge *e;
- const int use_verts = BMO_slot_bool_get(op, "use_verts");
+ const int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
- BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_SEAM);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_SEAM);
if (use_verts) {
/* this slows down the operation but its ok because the modifier doesn't use */
- BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_SEAM);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_SEAM);
/* prevent one edge having both verts unflagged
* we could alternately disable these edges, either way its a corner case.
@@ -118,7 +118,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
* This is needed so we don't split off the edge but then none of its verts which
* would leave a duplicate edge.
*/
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
if (UNLIKELY((BMO_elem_flag_test(bm, e->v1, VERT_SEAM) == FALSE &&
(BMO_elem_flag_test(bm, e->v2, VERT_SEAM) == FALSE))))
{
@@ -130,7 +130,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
bm_edgesplit_validate_seams(bm, op);
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
if (BMO_elem_flag_test(bm, e, EDGE_SEAM)) {
/* this flag gets copied so we can be sure duplicate edges get it too (important) */
BM_elem_flag_enable(e, BM_ELEM_INTERNAL_TAG);
@@ -146,7 +146,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
}
if (use_verts) {
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
if (BMO_elem_flag_test(bm, e->v1, VERT_SEAM) == FALSE) {
BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
}
@@ -156,7 +156,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
if (BMO_elem_flag_test(bm, e, EDGE_SEAM)) {
if (BM_elem_flag_test(e->v1, BM_ELEM_TAG)) {
BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
@@ -169,5 +169,5 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_enabled_hflag(bm, op, "edgeout", BM_EDGE, BM_ELEM_INTERNAL_TAG);
+ BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_INTERNAL_TAG);
}
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index 71048e18335..6a9d9c1e48b 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -60,7 +60,7 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(edges);
int i;
- BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
BLI_array_empty(edges);
BLI_array_grow_items(edges, f->len);
@@ -122,7 +122,7 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
BMO_op_callf(bm, op->flag,
"delete geom=%ff context=%i",
EXT_DEL, DEL_ONLYFACES);
- BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, EXT_KEEP);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, EXT_KEEP);
}
/**
@@ -181,7 +181,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
BMFace *f;
BMEdge *e, *e_new;
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
BMO_elem_flag_enable(bm, e, EXT_INPUT);
BMO_elem_flag_enable(bm, e->v1, EXT_INPUT);
BMO_elem_flag_enable(bm, e->v2, EXT_INPUT);
@@ -193,12 +193,12 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
/* disable root flag on all new skin nodes */
if (CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN)) {
BMVert *v;
- BMO_ITER(v, &siter, bm, &dupeop, "newout", BM_VERT) {
+ BMO_ITER(v, &siter, dupeop.slots_out, "geom.out", BM_VERT) {
bm_extrude_disable_skin_root(bm, v);
}
}
- for (e = BMO_iter_new(&siter, bm, &dupeop, "boundarymap", 0); e; e = BMO_iter_step(&siter)) {
+ for (e = BMO_iter_new(&siter, dupeop.slots_out, "boundarymap.out", 0); e; e = BMO_iter_step(&siter)) {
BMVert *f_verts[4];
e_new = *(BMEdge **)BMO_iter_map_value(&siter);
@@ -230,7 +230,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
BMO_op_finish(bm, &dupeop);
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, EXT_KEEP);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL, EXT_KEEP);
}
void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
@@ -240,7 +240,7 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
BMEdge *e;
const int has_vskin = CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN);
- for (v = BMO_iter_new(&siter, bm, op, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) {
+ for (v = BMO_iter_new(&siter, op->slots_in, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) {
dupev = BM_vert_create(bm, v->co, v);
if (has_vskin)
bm_extrude_disable_skin_root(bm, v);
@@ -251,8 +251,8 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, dupev, EXT_KEEP);
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, EXT_KEEP);
- BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EXT_KEEP);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, EXT_KEEP);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EXT_KEEP);
}
void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
@@ -264,15 +264,17 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
BMVert *v, *v2;
BMFace *f;
int found, fwd, delorig = FALSE;
+ BMOpSlot *slot_facemap_out;
+ BMOpSlot *slot_edges_exclude;
/* initialize our sub-operators */
BMO_op_init(bm, &dupeop, op->flag, "duplicate");
- BMO_slot_buffer_flag_enable(bm, op, "edgefacein", BM_EDGE | BM_FACE, EXT_INPUT);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "geom", BM_EDGE | BM_FACE, EXT_INPUT);
/* if one flagged face is bordered by an un-flagged face, then we delete
* original geometry unless caller explicitly asked to keep it. */
- if (!BMO_slot_bool_get(op, "alwayskeeporig")) {
+ if (!BMO_slot_bool_get(op->slots_in, "use_keep_orig")) {
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
int edge_face_tot;
@@ -339,18 +341,21 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
EXT_DEL, DEL_ONLYTAGGED);
}
- BMO_slot_copy(op, &dupeop, "edgefacein", "geom");
+ BMO_slot_copy(op, slots_in, "geom",
+ &dupeop, slots_in, "geom");
BMO_op_exec(bm, &dupeop);
/* disable root flag on all new skin nodes */
if (CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN)) {
- BMO_ITER(v, &siter, bm, &dupeop, "newout", BM_VERT) {
+ BMO_ITER(v, &siter, dupeop.slots_out, "geom.out", BM_VERT) {
bm_extrude_disable_skin_root(bm, v);
}
}
- if (bm->act_face && BMO_elem_flag_test(bm, bm->act_face, EXT_INPUT))
- bm->act_face = BMO_slot_map_ptr_get(bm, &dupeop, "facemap", bm->act_face);
+ slot_facemap_out = BMO_slot_get(dupeop.slots_out, "facemap.out");
+ if (bm->act_face && BMO_elem_flag_test(bm, bm->act_face, EXT_INPUT)) {
+ bm->act_face = BMO_slot_map_ptr_get(slot_facemap_out, bm->act_face);
+ }
if (delorig) {
BMO_op_exec(bm, &delop);
@@ -365,13 +370,15 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_copy(&dupeop, op, "newout", "geomout");
+ BMO_slot_copy(&dupeop, slots_out, "geom.out",
+ op, slots_out, "geom.out");
- for (e = BMO_iter_new(&siter, bm, &dupeop, "boundarymap", 0); e; e = BMO_iter_step(&siter)) {
+ slot_edges_exclude = BMO_slot_get(op->slots_in, "edges_exclude");
+ for (e = BMO_iter_new(&siter, dupeop.slots_out, "boundarymap.out", 0); e; e = BMO_iter_step(&siter)) {
BMVert *f_verts[4];
/* this should always be wire, so this is mainly a speedup to avoid map lookup */
- if (BM_edge_is_wire(e) && BMO_slot_map_contains(bm, op, "exclude", e)) {
+ if (BM_edge_is_wire(e) && BMO_slot_map_contains(slot_edges_exclude, e)) {
BMVert *v1 = e->v1, *v2 = e->v2;
/* The original edge was excluded,
@@ -421,7 +428,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
}
/* link isolated vert */
- for (v = BMO_iter_new(&siter, bm, &dupeop, "isovertmap", 0); v; v = BMO_iter_step(&siter)) {
+ for (v = BMO_iter_new(&siter, dupeop.slots_out, "isovertmap.out", 0); v; v = BMO_iter_step(&siter)) {
v2 = *((void **)BMO_iter_map_value(&siter));
BM_edge_create(bm, v, v2, v->e, TRUE);
}
@@ -647,25 +654,28 @@ void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op)
BMOperator reverseop;
float thickness;
- thickness = BMO_slot_float_get(op, "thickness");
+ thickness = BMO_slot_float_get(op->slots_in, "thickness");
/* Flip original faces (so the shell is extruded inward) */
BMO_op_init(bm, &reverseop, op->flag, "reverse_faces");
- BMO_slot_copy(op, &reverseop, "geom", "faces");
+ BMO_slot_copy(op, slots_in, "geom",
+ &reverseop, slots_in, "faces");
BMO_op_exec(bm, &reverseop);
BMO_op_finish(bm, &reverseop);
/* Extrude the region */
- BMO_op_initf(bm, &extrudeop, op->flag, "extrude_face_region alwayskeeporig=%b", TRUE);
- BMO_slot_copy(op, &extrudeop, "geom", "edgefacein");
+ BMO_op_initf(bm, &extrudeop, op->flag, "extrude_face_region use_keep_orig=%b", TRUE);
+ BMO_slot_copy(op, slots_in, "geom",
+ &extrudeop, slots_in, "geom");
BMO_op_exec(bm, &extrudeop);
/* Push the verts of the extruded faces inward to create thickness */
- BMO_slot_buffer_flag_enable(bm, &extrudeop, "geomout", BM_FACE, FACE_MARK);
+ BMO_slot_buffer_flag_enable(bm, extrudeop.slots_out, "geom.out", BM_FACE, FACE_MARK);
calc_solidify_normals(bm);
solidify_add_thickness(bm, thickness);
- BMO_slot_copy(&extrudeop, op, "geomout", "geomout");
+ BMO_slot_copy(&extrudeop, slots_out, "geom.out",
+ op, slots_out, "geom.out");
BMO_op_finish(bm, &extrudeop);
}
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c
index 80bdf9de7ed..117f65ae4ea 100644
--- a/source/blender/bmesh/operators/bmo_hull.c
+++ b/source/blender/bmesh/operators/bmo_hull.c
@@ -119,7 +119,7 @@ static void hull_output_triangles(BMesh *bm, GHash *hull_triangles)
};
BMFace *f, *example = NULL;
- if (BM_face_exists(bm, t->v, 3, &f)) {
+ if (BM_face_exists(t->v, 3, &f)) {
/* If the operator is run with "use_existing_faces"
* disabled, but an output face in the hull is the
* same as a face in the existing mesh, it should not
@@ -139,17 +139,17 @@ static void hull_output_triangles(BMesh *bm, GHash *hull_triangles)
f = BM_face_create_quad_tri_v(bm, t->v, 3, example, TRUE);
BM_face_copy_shared(bm, f);
}
- /* Mark face for 'geomout' slot and select */
+ /* Mark face for 'geom.out' slot and select */
BMO_elem_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM);
BM_face_select_set(bm, f, TRUE);
- /* Mark edges for 'geomout' slot */
+ /* Mark edges for 'geom.out' slot */
for (i = 0; i < 3; i++) {
BMO_elem_flag_enable(bm, edges[i], HULL_FLAG_OUTPUT_GEOM);
}
}
else {
- /* Mark input edges for 'geomout' slot */
+ /* Mark input edges for 'geom.out' slot */
for (i = 0; i < 3; i++) {
const int next = (i == 2 ? 0 : i + 1);
BMEdge *e = BM_edge_exists(t->v[i], t->v[next]);
@@ -161,7 +161,7 @@ static void hull_output_triangles(BMesh *bm, GHash *hull_triangles)
}
}
- /* Mark verts for 'geomout' slot */
+ /* Mark verts for 'geom.out' slot */
for (i = 0; i < 3; i++) {
BMO_elem_flag_enable(bm, t->v[i], HULL_FLAG_OUTPUT_GEOM);
}
@@ -304,14 +304,14 @@ static void hull_mark_interior_elements(BMesh *bm, BMOperator *op,
BMOIter oiter;
/* Check for interior edges too */
- BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
+ BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
if (!hull_final_edges_lookup(final_edges, e->v1, e->v2))
BMO_elem_flag_enable(bm, e, HULL_FLAG_INTERIOR_ELE);
}
/* Mark all input faces as interior, some may be unmarked in
* hull_remove_overlapping() */
- BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
+ BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
BMO_elem_flag_enable(bm, f, HULL_FLAG_INTERIOR_ELE);
}
}
@@ -328,7 +328,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
* interior (i.e. were already part of the input, but not part of
* the hull), but that aren't also used by elements outside the
* input set */
- BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
+ BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
if (BMO_elem_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) {
int del = TRUE;
@@ -351,7 +351,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
}
}
- BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
+ BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
if (BMO_elem_flag_test(bm, e, HULL_FLAG_INTERIOR_ELE)) {
int del = TRUE;
@@ -367,7 +367,7 @@ static void hull_tag_unused(BMesh *bm, BMOperator *op)
}
}
- BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
+ BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
if (BMO_elem_flag_test(bm, f, HULL_FLAG_INTERIOR_ELE))
BMO_elem_flag_enable(bm, f, HULL_FLAG_DEL);
}
@@ -382,7 +382,7 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
/* Unmark any hole faces if they are isolated or part of a
* border */
- BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
+ BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
if (BMO_elem_flag_test(bm, f, HULL_FLAG_HOLE)) {
BM_ITER_ELEM (e, &iter, f, BM_EDGES_OF_FACE) {
if (BM_edge_is_boundary(e)) {
@@ -395,7 +395,7 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
/* Mark edges too if all adjacent faces are holes and the edge is
* not already isolated */
- BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
+ BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
int hole = TRUE;
int any_faces = FALSE;
@@ -412,20 +412,20 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op)
}
}
-static int hull_input_vert_count(BMesh *bm, BMOperator *op)
+static int hull_input_vert_count(BMOperator *op)
{
BMOIter oiter;
BMVert *v;
int count = 0;
- BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
+ BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
count++;
}
return count;
}
-static BMVert **hull_input_verts_copy(BMesh *bm, BMOperator *op,
+static BMVert **hull_input_verts_copy(BMOperator *op,
const int num_input_verts)
{
BMOIter oiter;
@@ -434,7 +434,7 @@ static BMVert **hull_input_verts_copy(BMesh *bm, BMOperator *op,
num_input_verts, AT);
int i = 0;
- BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
+ BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
input_verts[i++] = v;
}
@@ -492,9 +492,9 @@ static void hull_from_bullet(BMesh *bm, BMOperator *op,
plConvexHull hull;
int i, count = 0;
- const int num_input_verts = hull_input_vert_count(bm, op);
+ const int num_input_verts = hull_input_vert_count(op);
- input_verts = hull_input_verts_copy(bm, op, num_input_verts);
+ input_verts = hull_input_verts_copy(op, num_input_verts);
coords = hull_verts_for_bullet(input_verts, num_input_verts);
hull = plConvexHullCompute(coords, num_input_verts);
@@ -535,13 +535,13 @@ static void hull_from_bullet(BMesh *bm, BMOperator *op,
}
/* Check that there are at least three vertices in the input */
-static int hull_num_input_verts_is_ok(BMesh *bm, BMOperator *op)
+static int hull_num_input_verts_is_ok(BMOperator *op)
{
BMOIter oiter;
BMVert *v;
int partial_num_verts = 0;
- BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
+ BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
partial_num_verts++;
if (partial_num_verts >= 3)
break;
@@ -559,14 +559,14 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
GHash *hull_triangles;
/* Verify that at least three verts in the input */
- if (!hull_num_input_verts_is_ok(bm, op)) {
+ if (!hull_num_input_verts_is_ok(op)) {
BMO_error_raise(bm, op, BMERR_CONVEX_HULL_FAILED,
"Requires at least three vertices");
return;
}
/* Tag input elements */
- BMO_ITER (ele, &oiter, bm, op, "input", BM_ALL) {
+ BMO_ITER (ele, &oiter, op->slots_in, "input", BM_ALL) {
BMO_elem_flag_enable(bm, ele, HULL_FLAG_INPUT);
/* Mark all vertices as interior to begin with */
@@ -584,7 +584,7 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
hull_mark_interior_elements(bm, op, final_edges);
/* Remove hull triangles covered by an existing face */
- if (BMO_slot_bool_get(op, "use_existing_faces")) {
+ if (BMO_slot_bool_get(op->slots_in, "use_existing_faces")) {
hull_remove_overlapping(bm, hull_triangles, final_edges);
hull_tag_holes(bm, op);
@@ -603,23 +603,23 @@ void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
/* Output slot of input elements that ended up inside the hull
* rather than part of it */
- BMO_slot_buffer_from_enabled_flag(bm, op, "interior_geom", BM_ALL,
- HULL_FLAG_INTERIOR_ELE);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_interior.out",
+ BM_ALL, HULL_FLAG_INTERIOR_ELE);
/* Output slot of input elements that ended up inside the hull and
* are are unused by other geometry. */
- BMO_slot_buffer_from_enabled_flag(bm, op, "unused_geom", BM_ALL,
- HULL_FLAG_DEL);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_unused.out",
+ BM_ALL, HULL_FLAG_DEL);
/* Output slot of faces and edges that were in the input and on
* the hull (useful for cases like bridging where you want to
* delete some input geometry) */
- BMO_slot_buffer_from_enabled_flag(bm, op, "holes_geom", BM_ALL,
- HULL_FLAG_HOLE);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_holes.out",
+ BM_ALL, HULL_FLAG_HOLE);
/* Output slot of all hull vertices, faces, and edges */
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL,
- HULL_FLAG_OUTPUT_GEOM);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out",
+ BM_ALL, HULL_FLAG_OUTPUT_GEOM);
}
#endif /* WITH_BULLET */
diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c
index 132d7050b31..9abf129a529 100644
--- a/source/blender/bmesh/operators/bmo_inset.c
+++ b/source/blender/bmesh/operators/bmo_inset.c
@@ -92,13 +92,13 @@ static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
void bmo_inset_exec(BMesh *bm, BMOperator *op)
{
- const int use_outset = BMO_slot_bool_get(op, "use_outset");
- const int use_boundary = BMO_slot_bool_get(op, "use_boundary") && (use_outset == FALSE);
- const int use_even_offset = BMO_slot_bool_get(op, "use_even_offset");
+ const int use_outset = BMO_slot_bool_get(op->slots_in, "use_outset");
+ const int use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary") && (use_outset == FALSE);
+ const int use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
const int use_even_boundry = use_even_offset; /* could make own option */
- const int use_relative_offset = BMO_slot_bool_get(op, "use_relative_offset");
- const float thickness = BMO_slot_float_get(op, "thickness");
- const float depth = BMO_slot_float_get(op, "depth");
+ const int use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
+ const float thickness = BMO_slot_float_get(op->slots_in, "thickness");
+ const float depth = BMO_slot_float_get(op->slots_in, "depth");
int edge_info_len = 0;
@@ -113,11 +113,11 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
if (use_outset == FALSE) {
BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_slot_buffer_hflag_enable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+ BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
}
else {
BM_mesh_elem_hflag_enable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_slot_buffer_hflag_disable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+ BMO_slot_buffer_hflag_disable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
}
/* first count all inset edges we will split */
@@ -477,11 +477,48 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
/* copy for loop data, otherwise UV's and vcols are no good.
* tiny speedup here we could be more clever and copy from known adjacent data
* also - we could attempt to interpolate the loop data, this would be much slower but more useful too */
+#if 0
+ /* don't use this because face boundaries have no adjacent loops and won't be filled in.
+ * instead copy from the opposite side with the code below */
BM_face_copy_shared(bm, f);
+#else
+ {
+ /* 2 inner loops on the edge between the new face and the original */
+ BMLoop *l_a;
+ BMLoop *l_b;
+ BMLoop *l_a_other;
+ BMLoop *l_b_other;
+
+ l_a = BM_FACE_FIRST_LOOP(f);
+ l_b = l_a->next;
+
+ /* we know this side has a radial_next because of the order of created verts in the quad */
+ l_a_other = BM_edge_other_loop(l_a->e, l_a);
+ l_b_other = BM_edge_other_loop(l_a->e, l_b);
+ BM_elem_attrs_copy(bm, bm, l_a_other, l_a);
+ BM_elem_attrs_copy(bm, bm, l_b_other, l_b);
+
+ /* step around to the opposite side of the quad - warning, this may have no other edges! */
+ l_a = l_a->next->next;
+ l_b = l_a->next;
+ if (!BM_edge_is_boundary(l_a->e)) {
+ /* same as above */
+ l_a_other = BM_edge_other_loop(l_a->e, l_a);
+ l_b_other = BM_edge_other_loop(l_a->e, l_b);
+ BM_elem_attrs_copy(bm, bm, l_a_other, l_a);
+ BM_elem_attrs_copy(bm, bm, l_b_other, l_b);
+ }
+ else { /* boundary edges have no useful data to copy from, use opposite side of face */
+ /* swap a<->b intentionally */
+ BM_elem_attrs_copy(bm, bm, l_a_other, l_b);
+ BM_elem_attrs_copy(bm, bm, l_b_other, l_a);
+ }
+ }
+#endif
}
/* we could flag new edges/verts too, is it useful? */
- BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, ELE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_NEW);
/* cheap feature to add depth to the inset */
if (depth != 0.0f) {
@@ -514,7 +551,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE);
/* tag face verts */
- BMO_ITER (f, &oiter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) {
BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) {
BM_elem_flag_enable(v, BM_ELEM_TAG);
}
diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c
index 3dbc0d0a5eb..1e18a83a0a0 100644
--- a/source/blender/bmesh/operators/bmo_join_triangles.c
+++ b/source/blender/bmesh/operators/bmo_join_triangles.c
@@ -204,16 +204,16 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
BMEdge *e;
BLI_array_declare(jedges);
JoinEdge *jedges = NULL;
- int do_sharp = BMO_slot_bool_get(op, "cmp_sharp");
- int do_uv = BMO_slot_bool_get(op, "cmp_uvs");
+ int do_sharp = BMO_slot_bool_get(op->slots_in, "cmp_sharp");
+ int do_uv = BMO_slot_bool_get(op->slots_in, "cmp_uvs");
int do_tf = do_uv; /* texture face, make make its own option eventually */
- int do_vcol = BMO_slot_bool_get(op, "cmp_vcols");
- int do_mat = BMO_slot_bool_get(op, "cmp_materials");
- float limit = BMO_slot_float_get(op, "limit");
+ int do_vcol = BMO_slot_bool_get(op->slots_in, "cmp_vcols");
+ int do_mat = BMO_slot_bool_get(op->slots_in, "cmp_materials");
+ float limit = BMO_slot_float_get(op->slots_in, "limit");
int i, totedge;
/* flag all edges of all input face */
- BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
BMO_elem_flag_enable(bm, f, FACE_INPUT);
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
BMO_elem_flag_enable(bm, l->e, EDGE_MARK);
diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c
index c4b988ae82d..4b897a24c8a 100644
--- a/source/blender/bmesh/operators/bmo_mesh_conv.c
+++ b/source/blender/bmesh/operators/bmo_mesh_conv.c
@@ -53,9 +53,9 @@
void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
{
- Object *ob = BMO_slot_ptr_get(op, "object");
- Mesh *me = BMO_slot_ptr_get(op, "mesh");
- int set_key = BMO_slot_bool_get(op, "set_shapekey");
+ Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
+ Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
+ int set_key = BMO_slot_bool_get(op->slots_in, "use_shapekey");
BM_mesh_bm_from_me(bm, me, set_key, ob->shapenr);
@@ -66,20 +66,20 @@ void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
{
- Object *ob = BMO_slot_ptr_get(op, "object");
+ Object *ob = BMO_slot_ptr_get(op->slots_in, "object");
/* Scene *scene = BMO_slot_ptr_get(op, "scene"); */
Mesh *me = ob->data;
BMO_op_callf(bm, op->flag,
- "bmesh_to_mesh mesh=%p object=%p notessellation=%b",
+ "bmesh_to_mesh mesh=%p object=%p skip_tessface=%b",
me, ob, TRUE);
}
void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
{
- Mesh *me = BMO_slot_ptr_get(op, "mesh");
+ Mesh *me = BMO_slot_ptr_get(op->slots_in, "mesh");
/* Object *ob = BMO_slot_ptr_get(op, "object"); */
- int dotess = !BMO_slot_bool_get(op, "notessellation");
+ int dotess = !BMO_slot_bool_get(op->slots_in, "skip_tessface");
BM_mesh_bm_to_me(bm, me, dotess);
}
diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c
index 937601712b0..01bce976ec0 100644
--- a/source/blender/bmesh/operators/bmo_mirror.c
+++ b/source/blender/bmesh/operators/bmo_mirror.c
@@ -50,27 +50,28 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
float mtx[4][4];
float imtx[4][4];
float scale[3] = {1.0f, 1.0f, 1.0f};
- float dist = BMO_slot_float_get(op, "mergedist");
+ float dist = BMO_slot_float_get(op->slots_in, "merge_dist");
int i, ototvert /*, ototedge */;
- int axis = BMO_slot_int_get(op, "axis");
- int mirroru = BMO_slot_bool_get(op, "mirror_u");
- int mirrorv = BMO_slot_bool_get(op, "mirror_v");
+ int axis = BMO_slot_int_get(op->slots_in, "axis");
+ int mirroru = BMO_slot_bool_get(op->slots_in, "mirror_u");
+ int mirrorv = BMO_slot_bool_get(op->slots_in, "mirror_v");
+ BMOpSlot *slot_targetmap;
ototvert = bm->totvert;
/* ototedge = bm->totedge; */ /* UNUSED */
- BMO_slot_mat4_get(op, "mat", mtx);
+ BMO_slot_mat4_get(op->slots_in, "mat", mtx);
invert_m4_m4(imtx, mtx);
BMO_op_initf(bm, &dupeop, op->flag, "duplicate geom=%s", op, "geom");
BMO_op_exec(bm, &dupeop);
- BMO_slot_buffer_flag_enable(bm, &dupeop, "newout", BM_ALL, ELE_NEW);
+ BMO_slot_buffer_flag_enable(bm, dupeop.slots_out, "geom.out", BM_ALL, ELE_NEW);
/* create old -> new mappin */
i = 0;
/* v2 = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); */ /* UNUSED */
- BMO_ITER (v, &siter, bm, &dupeop, "newout", BM_VERT) {
+ BMO_ITER (v, &siter, dupeop.slots_out, "geom.out", BM_VERT) {
BLI_array_grow_one(vmap);
vmap[i] = v;
/* v2 = BM_iter_step(&iter); */ /* UNUSED */
@@ -86,10 +87,12 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
BMO_op_init(bm, &weldop, op->flag, "weld_verts");
+ slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
+
v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
for (i = 0; i < ototvert; i++) {
if (fabsf(v->co[axis]) <= dist) {
- BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", vmap[i], v);
+ BMO_slot_map_ptr_insert(&weldop, slot_targetmap, vmap[i], v);
}
v = BM_iter_step(&iter);
}
@@ -101,7 +104,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
int totlayer;
BMIter liter;
- BMO_ITER (f, &siter, bm, &dupeop, "newout", BM_FACE) {
+ BMO_ITER (f, &siter, dupeop.slots_out, "geom.out", BM_FACE) {
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
totlayer = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV);
for (i = 0; i < totlayer; i++) {
@@ -120,7 +123,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
BMO_op_finish(bm, &weldop);
BMO_op_finish(bm, &dupeop);
- BMO_slot_buffer_from_enabled_flag(bm, op, "newout", BM_ALL, ELE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL, ELE_NEW);
BLI_array_free(vmap);
BLI_array_free(emap);
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index d7b163cb760..71f63bbaf28 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -227,16 +227,17 @@ static signed char monkeyf[250][4] = {
void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
{
+ const float dia = BMO_slot_float_get(op->slots_in, "size");
+ const int tot = max_ii(2, BMO_slot_int_get(op->slots_in, "x_segments"));
+ const int seg = max_ii(2, BMO_slot_int_get(op->slots_in, "y_segments"));
+
BMOperator bmop, prevop;
BMVert *eve, *preveve;
BMEdge *e;
- float vec[3], mat[4][4], phi, phid, dia = BMO_slot_float_get(op, "size");
- int a, tot = BMO_slot_int_get(op, "xsegments"), seg = BMO_slot_int_get(op, "ysegments");
-
- if (tot < 2) tot = 2;
- if (seg < 2) seg = 2;
+ float vec[3], mat[4][4], phi, phid;
+ int a;
- BMO_slot_mat4_get(op, "mat", mat);
+ BMO_slot_mat4_get(op->slots_in, "mat", mat);
/* one segment first: the X axis */
phi = 1.0f;
@@ -267,39 +268,43 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
for (a = 0; a < seg - 1; a++) {
if (a) {
- BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%s", &prevop, "geomout");
+ BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%S", &prevop, "geom.out");
BMO_op_exec(bm, &bmop);
BMO_op_finish(bm, &prevop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK);
}
else {
BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%fe", EDGE_ORIG);
BMO_op_exec(bm, &bmop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK);
}
- BMO_op_callf(bm, op->flag, "translate vec=%v verts=%s", vec, &bmop, "geomout");
+ BMO_op_callf(bm, op->flag, "translate vec=%v verts=%S", vec, &bmop, "geom.out");
prevop = bmop;
}
if (a)
BMO_op_finish(bm, &bmop);
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
}
void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
{
+ const float dia = BMO_slot_float_get(op->slots_in, "diameter");
+ const int seg = BMO_slot_int_get(op->slots_in, "u_segments");
+ const int tot = BMO_slot_int_get(op->slots_in, "v_segments");
+
BMOperator bmop, prevop;
BMVert *eve, *preveve;
BMEdge *e;
BMIter iter;
float vec[3], mat[4][4], cmat[3][3], phi, q[4];
- float phid, dia = BMO_slot_float_get(op, "diameter");
- int a, seg = BMO_slot_int_get(op, "segments"), tot = BMO_slot_int_get(op, "revolutions");
+ float phid;
+ int a;
- BMO_slot_mat4_get(op, "mat", mat);
+ BMO_slot_mat4_get(op->slots_in, "mat", mat);
phid = 2.0f * (float)M_PI / tot;
/* phi = 0.25f * (float)M_PI; */ /* UNUSED */
@@ -333,7 +338,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
for (a = 0; a < seg; a++) {
if (a) {
- BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%s", &prevop, "geomout");
+ BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%S", &prevop, "geom.out");
BMO_op_exec(bm, &bmop);
BMO_op_finish(bm, &prevop);
}
@@ -342,8 +347,8 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
BMO_op_exec(bm, &bmop);
}
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
- BMO_op_callf(bm, op->flag, "rotate cent=%v mat=%m3 verts=%s", vec, cmat, &bmop, "geomout");
+ BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK);
+ BMO_op_callf(bm, op->flag, "rotate cent=%v mat=%m3 verts=%S", vec, cmat, &bmop, "geom.out");
prevop = bmop;
}
@@ -375,30 +380,33 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
}
void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
{
+ const float dia = BMO_slot_float_get(op->slots_in, "diameter");
+ const float dia_div = dia / 200.0f;
+ const int subdiv = BMO_slot_int_get(op->slots_in, "subdivisions");
+
BMVert *eva[12];
BMVert *v;
BMIter liter;
BMIter viter;
BMLoop *l;
float vec[3], mat[4][4] /* , phi, phid */;
- float dia = BMO_slot_float_get(op, "diameter");
- int a, subdiv = BMO_slot_int_get(op, "subdivisions");
+ int a;
- BMO_slot_mat4_get(op, "mat", mat);
+ BMO_slot_mat4_get(op->slots_in, "mat", mat);
/* phid = 2.0f * (float)M_PI / subdiv; */ /* UNUSED */
/* phi = 0.25f * (float)M_PI; */ /* UNUSED */
- dia /= 200.0f;
+
for (a = 0; a < 12; a++) {
- vec[0] = dia * icovert[a][0];
- vec[1] = dia * icovert[a][1];
- vec[2] = dia * icovert[a][2];
+ vec[0] = dia_div * icovert[a][0];
+ vec[1] = dia_div * icovert[a][1];
+ vec[2] = dia_div * icovert[a][2];
eva[a] = BM_vert_create(bm, vec, NULL);
BMO_elem_flag_enable(bm, eva[a], VERT_MARK);
@@ -421,22 +429,20 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, eftemp, FACE_MARK);
}
- dia *= 200.0f;
-
if (subdiv > 1) {
BMOperator bmop;
BMO_op_initf(bm, &bmop, op->flag,
"subdivide_edges edges=%fe "
"smooth=%f "
- "numcuts=%i "
+ "cuts=%i "
"use_gridfill=%b use_sphere=%b",
EDGE_MARK, dia, (1 << (subdiv - 1)) - 1,
TRUE, TRUE);
BMO_op_exec(bm, &bmop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_EDGE, EDGE_MARK);
+ BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_EDGE, EDGE_MARK);
BMO_op_finish(bm, &bmop);
}
@@ -447,7 +453,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
}
void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
@@ -457,7 +463,7 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
float mat[4][4];
int i;
- BMO_slot_mat4_get(op, "mat", mat);
+ BMO_slot_mat4_get(op->slots_in, "mat", mat);
for (i = 0; i < monkeynv; i++) {
float v[3];
@@ -494,24 +500,25 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
MEM_freeN(tv);
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
}
void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
{
+ const float dia = BMO_slot_float_get(op->slots_in, "diameter");
+ const int segs = BMO_slot_int_get(op->slots_in, "segments");
+ const int cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
+ const int cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
+
BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL;
float vec[3], mat[4][4], phi, phid;
- float dia = BMO_slot_float_get(op, "diameter");
- int segs = BMO_slot_int_get(op, "segments");
- int cap_ends = BMO_slot_bool_get(op, "cap_ends");
- int cap_tris = BMO_slot_bool_get(op, "cap_tris");
int a;
if (!segs)
return;
- BMO_slot_mat4_get(op, "mat", mat);
+ BMO_slot_mat4_get(op->slots_in, "mat", mat);
phid = 2.0f * (float)M_PI / segs;
phi = 0;
@@ -566,25 +573,25 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW);
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
}
void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
{
BMVert *v1, *v2, *lastv1 = NULL, *lastv2 = NULL, *cent1, *cent2, *firstv1, *firstv2;
float vec[3], mat[4][4], phi, phid;
- float dia1 = BMO_slot_float_get(op, "diameter1");
- float dia2 = BMO_slot_float_get(op, "diameter2");
- float depth = BMO_slot_float_get(op, "depth");
- int segs = BMO_slot_int_get(op, "segments");
- int cap_ends = BMO_slot_bool_get(op, "cap_ends");
- int cap_tris = BMO_slot_bool_get(op, "cap_tris");
+ float dia1 = BMO_slot_float_get(op->slots_in, "diameter1");
+ float dia2 = BMO_slot_float_get(op->slots_in, "diameter2");
+ float depth = BMO_slot_float_get(op->slots_in, "depth");
+ int segs = BMO_slot_int_get(op->slots_in, "segments");
+ int cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
+ int cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
int a;
if (!segs)
return;
- BMO_slot_mat4_get(op, "mat", mat);
+ BMO_slot_mat4_get(op->slots_in, "mat", mat);
phid = 2.0f * (float)M_PI / segs;
phi = 0;
@@ -662,15 +669,15 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, FALSE);
BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, 0.000001);
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
}
void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
{
BMVert *v1, *v2, *v3, *v4, *v5, *v6, *v7, *v8;
- float vec[3], mat[4][4], off = BMO_slot_float_get(op, "size") / 2.0f;
+ float vec[3], mat[4][4], off = BMO_slot_float_get(op->slots_in, "size") / 2.0f;
- BMO_slot_mat4_get(op, "mat", mat);
+ BMO_slot_mat4_get(op->slots_in, "mat", mat);
if (!off) off = 0.5f;
@@ -740,5 +747,5 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
BM_face_create_quad_tri(bm, v1, v2, v3, v4, NULL, FALSE);
BM_face_create_quad_tri(bm, v8, v7, v6, v5, NULL, FALSE);
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
}
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index ea6cd747037..45e678b96bb 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -36,7 +36,7 @@
#include "intern/bmesh_operators_private.h" /* own include */
-static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op)
+static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op, BMOpSlot *slot_targetmap)
{
BMIter liter;
BMLoop *l;
@@ -44,7 +44,7 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op)
int split = FALSE;
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
- v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", l->v);
+ v2 = BMO_slot_map_ptr_get(slot_targetmap, l->v);
/* ok: if v2 is NULL (e.g. not in the map) then it's
* a target vert, otherwise it's a double */
if ((v2 && BM_vert_in_face(f, v2)) &&
@@ -61,8 +61,8 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op)
BMLoop *nl;
BMFace *f2 = BM_face_split(bm, f, doub, v2, &nl, NULL, FALSE);
- remdoubles_splitface(f, bm, op);
- remdoubles_splitface(f2, bm, op);
+ remdoubles_splitface(f, bm, op, slot_targetmap);
+ remdoubles_splitface(f2, bm, op, slot_targetmap);
}
}
@@ -106,10 +106,11 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(loops);
BMFace *f, *f2;
int a, b;
+ BMOpSlot *slot_targetmap = BMO_slot_get(op->slots_in, "targetmap");
/* mark merge verts for deletion */
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
- if ((v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v))) {
+ if ((v2 = BMO_slot_map_ptr_get(slot_targetmap, v))) {
BMO_elem_flag_enable(bm, v, ELE_DEL);
/* merge the vertex flags, else we get randomly selected/unselected verts */
@@ -120,13 +121,13 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
/* check if any faces are getting their own corners merged
* together, split face if so */
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
- remdoubles_splitface(f, bm, op);
+ remdoubles_splitface(f, bm, op, slot_targetmap);
}
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BMO_elem_flag_test(bm, e->v1, ELE_DEL) || BMO_elem_flag_test(bm, e->v2, ELE_DEL)) {
- v = BMO_slot_map_ptr_get(bm, op, "targetmap", e->v1);
- v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", e->v2);
+ v = BMO_slot_map_ptr_get(slot_targetmap, e->v1);
+ v2 = BMO_slot_map_ptr_get(slot_targetmap, e->v2);
if (!v) v = e->v1;
if (!v2) v2 = e->v2;
@@ -174,10 +175,10 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
v = l->v;
v2 = l->next->v;
if (BMO_elem_flag_test(bm, v, ELE_DEL)) {
- v = BMO_slot_map_ptr_get(bm, op, "targetmap", v);
+ v = BMO_slot_map_ptr_get(slot_targetmap, v);
}
if (BMO_elem_flag_test(bm, v2, ELE_DEL)) {
- v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v2);
+ v2 = BMO_slot_map_ptr_get(slot_targetmap, v2);
}
e2 = v != v2 ? BM_edge_exists(v, v2) : NULL;
@@ -207,10 +208,10 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
v2 = loops[1]->v;
if (BMO_elem_flag_test(bm, v, ELE_DEL)) {
- v = BMO_slot_map_ptr_get(bm, op, "targetmap", v);
+ v = BMO_slot_map_ptr_get(slot_targetmap, v);
}
if (BMO_elem_flag_test(bm, v2, ELE_DEL)) {
- v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v2);
+ v2 = BMO_slot_map_ptr_get(slot_targetmap, v2);
}
f2 = BM_face_create_ngon(bm, v, v2, edges, a, TRUE);
@@ -262,7 +263,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
float fac;
int i, tot;
- snapv = BMO_iter_new(&siter, bm, op, "snapv", BM_VERT);
+ snapv = BMO_iter_new(&siter, op->slots_in, "snapv", BM_VERT);
tot = BM_vert_face_count(snapv);
if (!tot)
@@ -290,7 +291,7 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
if (l == firstl) {
continue;
@@ -318,7 +319,7 @@ void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op)
type = bm->ldata.layers[i].type;
CustomData_data_initminmax(type, &min, &max);
- BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
block = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
CustomData_data_dominmax(type, block, &min, &max);
@@ -329,7 +330,7 @@ void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op)
CustomData_data_multiply(type, &max, 0.5f);
CustomData_data_add(type, &min, &max);
- BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
block = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
CustomData_data_copy_value(type, &min, block);
@@ -344,19 +345,22 @@ void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
BMOIter siter;
BMVert *v, *snapv = NULL;
float vec[3];
+ BMOpSlot *slot_targetmap;
- BMO_slot_vec_get(op, "merge_co", vec);
+ BMO_slot_vec_get(op->slots_in, "merge_co", vec);
//BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges");
BMO_op_init(bm, &weldop, op->flag, "weld_verts");
-
- BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+
+ slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
+
+ BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
if (!snapv) {
snapv = v;
copy_v3_v3(snapv->co, vec);
}
else {
- BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", v, snapv);
+ BMO_slot_map_ptr_insert(&weldop, slot_targetmap, v, snapv);
}
}
@@ -373,11 +377,13 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(edges);
float min[3], max[3], center[3];
int i, tot;
+ BMOpSlot *slot_targetmap;
BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges");
BMO_op_init(bm, &weldop, op->flag, "weld_verts");
+ slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
- BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
BMW_init(&walker, bm, BMW_SHELL,
BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP,
@@ -408,9 +414,9 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
copy_v3_v3(edges[i]->v2->co, center);
if (edges[i]->v1 != edges[0]->v1)
- BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", edges[i]->v1, edges[0]->v1);
+ BMO_slot_map_ptr_insert(&weldop, slot_targetmap, edges[i]->v1, edges[0]->v1);
if (edges[i]->v2 != edges[0]->v1)
- BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", edges[i]->v2, edges[0]->v1);
+ BMO_slot_map_ptr_insert(&weldop, slot_targetmap, edges[i]->v2, edges[0]->v1);
}
}
@@ -436,7 +442,7 @@ static void bmo_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer)
/* clear all short flags */
BMO_mesh_flag_disable_all(bm, op, BM_ALL, (1 << 16) - 1);
- BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
BMW_init(&walker, bm, BMW_LOOPDATA_ISLAND,
BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP,
@@ -486,31 +492,32 @@ void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op)
}
}
-static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, const char *targetmapname)
+static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op,
+ BMOperator *optarget, BMOpSlot *optarget_slot)
{
BMVert **verts;
int verts_len;
int i, j, keepvert = 0;
- const float dist = BMO_slot_float_get(op, "dist");
+ const float dist = BMO_slot_float_get(op->slots_in, "dist");
const float dist3 = dist * 3.0f;
/* Test whether keep_verts arg exists and is non-empty */
- if (BMO_slot_exists(op, "keep_verts")) {
+ if (BMO_slot_exists(op->slots_in, "keep_verts")) {
BMOIter oiter;
- keepvert = BMO_iter_new(&oiter, bm, op, "keep_verts", BM_VERT) != NULL;
+ keepvert = BMO_iter_new(&oiter, op->slots_in, "keep_verts", BM_VERT) != NULL;
}
/* get the verts as an array we can sort */
- verts = BMO_slot_as_arrayN(op, "verts", &verts_len);
+ verts = BMO_slot_as_arrayN(op->slots_in, "verts", &verts_len);
/* sort by vertex coordinates added together */
qsort(verts, verts_len, sizeof(BMVert *), vergaverco);
/* Flag keep_verts */
if (keepvert) {
- BMO_slot_buffer_flag_enable(bm, op, "keep_verts", BM_VERT, VERT_KEEP);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "keep_verts", BM_VERT, VERT_KEEP);
}
for (i = 0; i < verts_len; i++) {
@@ -547,7 +554,7 @@ static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op, BMOperator *opt
BMO_elem_flag_enable(bm, v_other, VERT_DOUBLE);
BMO_elem_flag_enable(bm, v_check, VERT_TARGET);
- BMO_slot_map_ptr_insert(bm, optarget, targetmapname, v_other, v_check);
+ BMO_slot_map_ptr_insert(optarget, optarget_slot, v_other, v_check);
}
}
}
@@ -558,9 +565,12 @@ static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op, BMOperator *opt
void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op)
{
BMOperator weldop;
+ BMOpSlot *slot_targetmap;
BMO_op_init(bm, &weldop, op->flag, "weld_verts");
- bmesh_find_doubles_common(bm, op, &weldop, "targetmap");
+ slot_targetmap = BMO_slot_get(weldop.slots_in, "targetmap");
+ bmesh_find_doubles_common(bm, op,
+ &weldop, slot_targetmap);
BMO_op_exec(bm, &weldop);
BMO_op_finish(bm, &weldop);
}
@@ -568,7 +578,10 @@ void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op)
void bmo_find_doubles_exec(BMesh *bm, BMOperator *op)
{
- bmesh_find_doubles_common(bm, op, op, "targetmapout");
+ BMOpSlot *slot_targetmap_out;
+ slot_targetmap_out = BMO_slot_get(op->slots_out, "targetmap.out");
+ bmesh_find_doubles_common(bm, op,
+ op, slot_targetmap_out);
}
void bmo_automerge_exec(BMesh *bm, BMOperator *op)
@@ -580,7 +593,7 @@ void bmo_automerge_exec(BMesh *bm, BMOperator *op)
/* The "verts" input sent to this op is the set of verts that
* can be merged away into any other verts. Mark all other verts
* as VERT_KEEP. */
- BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_IN);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "verts", BM_VERT, VERT_IN);
BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
if (!BMO_elem_flag_test(bm, v, VERT_IN)) {
BMO_elem_flag_enable(bm, v, VERT_KEEP);
@@ -590,12 +603,14 @@ void bmo_automerge_exec(BMesh *bm, BMOperator *op)
/* Search for doubles among all vertices, but only merge non-VERT_KEEP
* vertices into VERT_KEEP vertices. */
BMO_op_initf(bm, &findop, op->flag, "find_doubles verts=%av keep_verts=%fv", VERT_KEEP);
- BMO_slot_copy(op, &findop, "dist", "dist");
+ BMO_slot_copy(op, slots_in, "dist",
+ &findop, slots_in, "dist");
BMO_op_exec(bm, &findop);
/* weld the vertices */
BMO_op_init(bm, &weldop, op->flag, "weld_verts");
- BMO_slot_copy(&findop, &weldop, "targetmapout", "targetmap");
+ BMO_slot_copy(&findop, slots_out, "targetmap.out",
+ &weldop, slots_in, "targetmap");
BMO_op_exec(bm, &weldop);
BMO_op_finish(bm, &findop);
diff --git a/source/blender/bmesh/operators/bmo_similar.c b/source/blender/bmesh/operators/bmo_similar.c
index 0954cfafb38..74f77d538bd 100644
--- a/source/blender/bmesh/operators/bmo_similar.c
+++ b/source/blender/bmesh/operators/bmo_similar.c
@@ -103,10 +103,10 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
SimSel_FaceExt *f_ext = NULL;
int *indices = NULL;
float t_no[3]; /* temporary normal */
- const int type = BMO_slot_int_get(op, "type");
- const float thresh = BMO_slot_float_get(op, "thresh");
+ const int type = BMO_slot_int_get(op->slots_in, "type");
+ const float thresh = BMO_slot_float_get(op->slots_in, "thresh");
const float thresh_radians = thresh * (float)M_PI;
- const int compare = BMO_slot_int_get(op, "compare");
+ const int compare = BMO_slot_int_get(op->slots_in, "compare");
/* initial_elem - other_elem */
float delta_fl;
@@ -121,7 +121,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
* so the overall complexity will be less than $O(mn)$ where is the total number of selected faces,
* and n is the total number of faces
*/
- BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
if (!BMO_elem_flag_test(bm, fs, FACE_MARK)) { /* is this really needed ? */
BMO_elem_flag_enable(bm, fs, FACE_MARK);
num_sels++;
@@ -262,7 +262,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
MEM_freeN(indices);
/* transfer all marked faces to the output slot */
- BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_MARK);
#undef FACE_MARK
}
@@ -305,9 +305,9 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
float angle;
int num_sels = 0, num_total = 0;
- const int type = BMO_slot_int_get(op, "type");
- const float thresh = BMO_slot_float_get(op, "thresh");
- const int compare = BMO_slot_int_get(op, "compare");
+ const int type = BMO_slot_int_get(op->slots_in, "type");
+ const float thresh = BMO_slot_float_get(op->slots_in, "thresh");
+ const int compare = BMO_slot_int_get(op->slots_in, "compare");
/* initial_elem - other_elem */
float delta_fl;
@@ -330,7 +330,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
num_total = BM_mesh_elem_count(bm, BM_EDGE);
/* iterate through all selected edges and mark them */
- BMO_ITER (es, &es_iter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (es, &es_iter, op->slots_in, "edges", BM_EDGE) {
BMO_elem_flag_enable(bm, es, EDGE_MARK);
num_sels++;
}
@@ -486,7 +486,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
MEM_freeN(indices);
/* transfer all marked edges to the output slot */
- BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_MARK);
#undef EDGE_MARK
}
@@ -519,10 +519,10 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
SimSel_VertExt *v_ext = NULL;
int *indices = NULL;
int num_total = 0, num_sels = 0, i = 0, idx = 0;
- const int type = BMO_slot_int_get(op, "type");
- const float thresh = BMO_slot_float_get(op, "thresh");
+ const int type = BMO_slot_int_get(op->slots_in, "type");
+ const float thresh = BMO_slot_float_get(op->slots_in, "thresh");
const float thresh_radians = thresh * (float)M_PI;
- const int compare = BMO_slot_int_get(op, "compare");
+ const int compare = BMO_slot_int_get(op->slots_in, "compare");
/* initial_elem - other_elem */
// float delta_fl;
@@ -531,7 +531,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
num_total = BM_mesh_elem_count(bm, BM_VERT);
/* iterate through all selected edges and mark them */
- BMO_ITER (vs, &vs_iter, bm, op, "verts", BM_VERT) {
+ BMO_ITER (vs, &vs_iter, op->slots_in, "verts", BM_VERT) {
BMO_elem_flag_enable(bm, vs, VERT_MARK);
num_sels++;
}
@@ -620,7 +620,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op)
MEM_freeN(indices);
MEM_freeN(v_ext);
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
#undef VERT_MARK
}
diff --git a/source/blender/bmesh/operators/bmo_slide.c b/source/blender/bmesh/operators/bmo_slide.c
index 6db76119205..9dde2461364 100644
--- a/source/blender/bmesh/operators/bmo_slide.c
+++ b/source/blender/bmesh/operators/bmo_slide.c
@@ -53,10 +53,10 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
int selected_edges = 0;
/* Get slide amount */
- const float distance_t = BMO_slot_float_get(op, "distance_t");
+ const float distance_t = BMO_slot_float_get(op->slots_in, "distance_t");
/* Get start vertex */
- vertex = BMO_iter_new(&oiter, bm, op, "vert", BM_VERT);
+ vertex = BMO_iter_new(&oiter, op->slots_in, "vert", BM_VERT);
if (!vertex) {
@@ -68,7 +68,7 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
}
/* Count selected edges */
- BMO_ITER (h, &oiter, bm, op, "edge", BM_VERT | BM_EDGE) {
+ BMO_ITER (h, &oiter, op->slots_in, "edge", BM_VERT | BM_EDGE) {
switch (h->htype) {
case BM_EDGE:
selected_edges++;
@@ -108,7 +108,7 @@ void bmo_slide_vert_exec(BMesh *bm, BMOperator *op)
}
/* Return the new edge. The same previously marked with VERT_MARK */
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
return;
}
diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
index 362123e412d..4137c31961c 100644
--- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c
+++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
@@ -78,8 +78,8 @@ static void delete_laplacian_system(LaplacianSystem *sys);
static void delete_void_pointer(void *data);
static void fill_laplacian_matrix(LaplacianSystem *sys);
static void memset_laplacian_system(LaplacianSystem *sys, int val);
-static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez, int volumepreservation);
-static void volume_preservation(BMesh *bm, BMOperator *op, float vini, float vend, int usex, int usey, int usez);
+static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez, int preserve_volume);
+static void volume_preservation(BMOperator *op, float vini, float vend, int usex, int usey, int usez);
static void delete_void_pointer(void *data)
{
@@ -455,7 +455,7 @@ static float compute_volume(BMesh *bm)
return fabs(vol);
}
-static void volume_preservation(BMesh *bm, BMOperator *op, float vini, float vend, int usex, int usey, int usez)
+static void volume_preservation(BMOperator *op, float vini, float vend, int usex, int usey, int usez)
{
float beta;
BMOIter siter;
@@ -463,9 +463,9 @@ static void volume_preservation(BMesh *bm, BMOperator *op, float vini, float ven
if (vend != 0.0f) {
beta = pow(vini / vend, 1.0f / 3.0f);
- BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
if (usex) {
- v->co[0] *= beta;
+ v->co[0] *= beta;
}
if (usey) {
v->co[1] *= beta;
@@ -478,7 +478,7 @@ static void volume_preservation(BMesh *bm, BMOperator *op, float vini, float ven
}
}
-static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez, int volumepreservation)
+static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez, int preserve_volume)
{
int m_vertex_id;
float leni, lene;
@@ -509,10 +509,10 @@ static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez
}
}
- if (volumepreservation) {
+ if (preserve_volume) {
vini = compute_volume(sys->bm);
}
- BMO_ITER (v, &siter, sys->bm, sys->op, "verts", BM_VERT) {
+ BMO_ITER (v, &siter, sys->op->slots_in, "verts", BM_VERT) {
m_vertex_id = BM_elem_index_get(v);
if (sys->zerola[m_vertex_id] == 0) {
if (usex) {
@@ -526,9 +526,9 @@ static void validate_solution(LaplacianSystem *sys, int usex, int usey, int usez
}
}
}
- if (volumepreservation) {
+ if (preserve_volume) {
vend = compute_volume(sys->bm);
- volume_preservation(sys->bm, sys->op, vini, vend, usex, usey, usez);
+ volume_preservation(sys->op, vini, vend, usex, usey, usez);
}
}
@@ -537,7 +537,7 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
{
int i;
int m_vertex_id;
- int usex, usey, usez, volumepreservation;
+ int usex, usey, usez, preserve_volume;
float lambda, lambda_border;
float w;
BMOIter siter;
@@ -552,13 +552,13 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
memset_laplacian_system(sys, 0);
BM_mesh_elem_index_ensure(bm, BM_VERT);
- lambda = BMO_slot_float_get(op, "lambda");
- lambda_border = BMO_slot_float_get(op, "lambda_border");
+ lambda = BMO_slot_float_get(op->slots_in, "lambda");
+ lambda_border = BMO_slot_float_get(op->slots_in, "lambda_border");
sys->min_area = 0.00001f;
- usex = BMO_slot_bool_get(op, "use_x");
- usey = BMO_slot_bool_get(op, "use_y");
- usez = BMO_slot_bool_get(op, "use_z");
- volumepreservation = BMO_slot_bool_get(op, "volume_preservation");
+ usex = BMO_slot_bool_get(op->slots_in, "use_x");
+ usey = BMO_slot_bool_get(op->slots_in, "use_y");
+ usez = BMO_slot_bool_get(op->slots_in, "use_z");
+ preserve_volume = BMO_slot_bool_get(op->slots_in, "preserve_volume");
nlNewContext();
@@ -573,7 +573,7 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
for (i = 0; i < bm->totvert; i++) {
nlLockVariable(i);
}
- BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
m_vertex_id = BM_elem_index_get(v);
nlUnlockVariable(m_vertex_id);
nlSetVariable(0, m_vertex_id, v->co[0]);
@@ -583,7 +583,7 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
nlBegin(NL_MATRIX);
init_laplacian_matrix(sys);
- BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
m_vertex_id = BM_elem_index_get(v);
nlRightHandSideAdd(0, m_vertex_id, v->co[0]);
nlRightHandSideAdd(1, m_vertex_id, v->co[1]);
@@ -612,7 +612,7 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
nlEnd(NL_SYSTEM);
if (nlSolveAdvanced(NULL, NL_TRUE) ) {
- validate_solution(sys, usex, usey, usez, volumepreservation);
+ validate_solution(sys, usex, usey, usez, preserve_volume);
}
delete_laplacian_system(sys);
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index b2f6761b1bc..f9b6611c88b 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -225,8 +225,9 @@ static BMVert *subdivideedgenum(BMesh *bm, BMEdge *edge, BMEdge *oedge,
BMVert *ev;
float percent, percent2 = 0.0f;
- if (BMO_elem_flag_test(bm, edge, EDGE_PERCENT) && totpoint == 1)
- percent = BMO_slot_map_float_get(bm, params->op, "edgepercents", edge);
+ if (BMO_elem_flag_test(bm, edge, EDGE_PERCENT) && totpoint == 1) {
+ percent = BMO_slot_map_float_get(params->slot_edgepercents, edge);
+ }
else {
percent = 1.0f / (float)(totpoint + 1 - curpoint);
percent2 = (float)(curpoint + 1) / (float)(totpoint + 1);
@@ -717,18 +718,18 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
int use_sphere, cornertype, use_singleedge, use_gridfill;
int skey, seed, i, j, matched, a, b, numcuts, totesel;
- BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, SUBD_SPLIT);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT);
- numcuts = BMO_slot_int_get(op, "numcuts");
- seed = BMO_slot_int_get(op, "seed");
- smooth = BMO_slot_float_get(op, "smooth");
- fractal = BMO_slot_float_get(op, "fractal");
- along_normal = BMO_slot_float_get(op, "along_normal");
- cornertype = BMO_slot_int_get(op, "quadcornertype");
-
- use_singleedge = BMO_slot_bool_get(op, "use_singleedge");
- use_gridfill = BMO_slot_bool_get(op, "use_gridfill");
- use_sphere = BMO_slot_bool_get(op, "use_sphere");
+ numcuts = BMO_slot_int_get(op->slots_in, "cuts");
+ seed = BMO_slot_int_get(op->slots_in, "seed");
+ smooth = BMO_slot_float_get(op->slots_in, "smooth");
+ fractal = BMO_slot_float_get(op->slots_in, "fractal");
+ along_normal = BMO_slot_float_get(op->slots_in, "along_normal");
+ cornertype = BMO_slot_int_get(op->slots_in, "quad_corner_type");
+
+ use_singleedge = BMO_slot_bool_get(op->slots_in, "use_singleedge");
+ use_gridfill = BMO_slot_bool_get(op->slots_in, "use_gridfill");
+ use_sphere = BMO_slot_bool_get(op->slots_in, "use_sphere");
BLI_srandom(seed);
@@ -774,10 +775,12 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
}
/* first go through and tag edges */
- BMO_slot_buffer_from_enabled_flag(bm, op, "edges", BM_EDGE, SUBD_SPLIT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT);
params.numcuts = numcuts;
params.op = op;
+ params.slot_edgepercents = BMO_slot_get(op->slots_in, "edgepercents");
+ params.slot_custompatterns = BMO_slot_get(op->slots_in, "custompatterns");
params.smooth = smooth;
params.seed = seed;
params.fractal = fractal;
@@ -790,10 +793,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
params.off[1] = (float)BLI_drand() * 200.0f;
params.off[2] = (float)BLI_drand() * 200.0f;
- BMO_slot_map_to_flag(bm, op, "custompatterns",
+ BMO_slot_map_to_flag(bm, op->slots_in, "custompatterns",
BM_FACE, FACE_CUSTOMFILL);
- BMO_slot_map_to_flag(bm, op, "edgepercents",
+ BMO_slot_map_to_flag(bm, op->slots_in, "edgepercents",
BM_EDGE, EDGE_PERCENT);
@@ -837,8 +840,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
}
if (BMO_elem_flag_test(bm, face, FACE_CUSTOMFILL)) {
- pat = BMO_slot_map_data_get(bm, op,
- "custompatterns", face);
+ pat = BMO_slot_map_data_get(params.slot_custompatterns, face);
for (i = 0; i < pat->len; i++) {
matched = 1;
for (j = 0; j < pat->len; j++) {
@@ -910,11 +912,11 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
}
}
- einput = BMO_slot_get(op, "edges");
+ einput = BMO_slot_get(op->slots_in, "edges");
/* go through and split edges */
for (i = 0; i < einput->len; i++) {
- edge = ((BMEdge **)einput->data.p)[i];
+ edge = einput->data.buf[i];
bm_subdivide_multicut(bm, edge, &params, edge->v1, edge->v2);
}
@@ -1075,10 +1077,10 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
BLI_array_free(loops_split);
BLI_array_free(loops);
- BMO_slot_buffer_from_enabled_flag(bm, op, "outinner", BM_ALL, ELE_INNER);
- BMO_slot_buffer_from_enabled_flag(bm, op, "outsplit", BM_ALL, ELE_SPLIT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_inner.out", BM_ALL, ELE_INNER);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_split.out", BM_ALL, ELE_SPLIT);
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, ELE_INNER | ELE_SPLIT | SUBD_SPLIT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL, ELE_INNER | ELE_SPLIT | SUBD_SPLIT);
}
/* editmesh-emulating function */
@@ -1095,8 +1097,8 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
BMO_op_initf(bm, &op, BMO_FLAG_DEFAULTS,
"subdivide_edges edges=%he "
"smooth=%f fractal=%f along_normal=%f "
- "numcuts=%i "
- "quadcornertype=%i "
+ "cuts=%i "
+ "quad_corner_type=%i "
"use_singleedge=%b use_gridfill=%b "
"seed=%i",
edge_hflag,
@@ -1112,7 +1114,7 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
BMOIter iter;
BMElem *ele;
- for (ele = BMO_iter_new(&iter, bm, &op, "outinner", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
+ for (ele = BMO_iter_new(&iter, op.slots_out, "geom_inner.out", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
BM_elem_select_set(bm, ele, TRUE);
}
}
@@ -1123,7 +1125,7 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
/* deselect input */
BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
- for (ele = BMO_iter_new(&iter, bm, &op, "outinner", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
+ for (ele = BMO_iter_new(&iter, op.slots_out, "geom_inner.out", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
BM_elem_select_set(bm, ele, TRUE);
if (ele->head.htype == BM_VERT) {
@@ -1158,8 +1160,9 @@ void bmo_bisect_edges_exec(BMesh *bm, BMOperator *op)
SubDParams params = {0};
int skey;
- params.numcuts = BMO_slot_int_get(op, "numcuts");
+ params.numcuts = BMO_slot_int_get(op->slots_in, "cuts");
params.op = op;
+ params.slot_edgepercents = BMO_slot_get(op->slots_in, "edgepercents");
BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
skey = CustomData_number_of_layers(&bm->vdata, CD_SHAPEKEY) - 1;
@@ -1167,11 +1170,11 @@ void bmo_bisect_edges_exec(BMesh *bm, BMOperator *op)
params.origkey = skey;
/* go through and split edges */
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
bm_subdivide_multicut(bm, e, &params, e->v1, e->v2);
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "outsplit", BM_ALL, ELE_SPLIT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom_split.out", BM_ALL, ELE_SPLIT);
BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, skey);
}
diff --git a/source/blender/bmesh/operators/bmo_subdivide.h b/source/blender/bmesh/operators/bmo_subdivide.h
index d4b926b9275..d0676508917 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.h
+++ b/source/blender/bmesh/operators/bmo_subdivide.h
@@ -39,6 +39,8 @@ typedef struct SubDParams {
int seed;
int origkey; /* shapekey holding displaced vertex coordinates for current geometry */
BMOperator *op;
+ BMOpSlot *slot_edgepercents; /* BMO_slot_get(params->op->slots_in, "edgepercents"); */
+ BMOpSlot *slot_custompatterns; /* BMO_slot_get(params->op->slots_in, "custompatterns"); */
float off[3];
} SubDParams;
diff --git a/source/blender/bmesh/operators/bmo_symmetrize.c b/source/blender/bmesh/operators/bmo_symmetrize.c
index 5d4698a0c7a..8c440cae83e 100644
--- a/source/blender/bmesh/operators/bmo_symmetrize.c
+++ b/source/blender/bmesh/operators/bmo_symmetrize.c
@@ -96,7 +96,7 @@ static void symm_verts_mirror(Symm *symm)
symm->vert_symm_map = BLI_ghash_ptr_new(AT);
- BMO_ITER (src_v, &oiter, symm->bm, symm->op, "input", BM_VERT) {
+ BMO_ITER (src_v, &oiter, symm->op->slots_in, "input", BM_VERT) {
SymmSide side = symm_co_side(symm, src_v->co);
float co[3];
@@ -145,7 +145,7 @@ static void symm_split_asymmetric_edges(Symm *symm)
symm->edge_split_map = BLI_ghash_ptr_new(AT);
- BMO_ITER (e, &oiter, symm->bm, symm->op, "input", BM_EDGE) {
+ BMO_ITER (e, &oiter, symm->op->slots_in, "input", BM_EDGE) {
float flipped[3];
copy_v3_v3(flipped, e->v1->co);
@@ -195,7 +195,7 @@ static void symm_mirror_edges(Symm *symm)
BMOIter oiter;
BMEdge *e;
- BMO_ITER (e, &oiter, symm->bm, symm->op, "input", BM_EDGE) {
+ BMO_ITER (e, &oiter, symm->op->slots_in, "input", BM_EDGE) {
BMVert *v1 = NULL, *v2 = NULL;
BMEdge *e_new;
@@ -448,7 +448,7 @@ static void symm_mirror_polygons(Symm *symm)
BLI_array_declare(fv);
BLI_array_declare(fe);
- BMO_ITER (f, &oiter, symm->bm, symm->op, "input", BM_FACE) {
+ BMO_ITER (f, &oiter, symm->op->slots_in, "input", BM_FACE) {
BMIter iter;
BMLoop *l;
int mirror_all = TRUE, ignore_all = TRUE;
@@ -607,7 +607,7 @@ static void symm_kill_unused(Symm *symm)
BMVert *v;
/* Kill unused edges */
- BMO_ITER (e, &oiter, symm->bm, symm->op, "input", BM_EDGE) {
+ BMO_ITER (e, &oiter, symm->op->slots_in, "input", BM_EDGE) {
const int crosses = symm_edge_crosses_axis(symm, e);
const int symmetric = (crosses &&
(!BLI_ghash_haskey(symm->edge_split_map, e)));
@@ -623,7 +623,7 @@ static void symm_kill_unused(Symm *symm)
}
/* Kill unused vertices */
- BMO_ITER (v, &oiter, symm->bm, symm->op, "input", BM_VERT) {
+ BMO_ITER (v, &oiter, symm->op->slots_in, "input", BM_VERT) {
if (symm_co_side(symm, v->co) == SYMM_SIDE_KILL) {
if (BM_vert_edge_count(v) == 0)
BM_vert_kill(symm->bm, v);
@@ -634,7 +634,7 @@ static void symm_kill_unused(Symm *symm)
void bmo_symmetrize_exec(BMesh *bm, BMOperator *op)
{
Symm symm;
- BMO_SymmDirection direction = BMO_slot_int_get(op, "direction");
+ BMO_SymmDirection direction = BMO_slot_int_get(op->slots_in, "direction");
symm.bm = bm;
symm.op = op;
@@ -658,6 +658,6 @@ void bmo_symmetrize_exec(BMesh *bm, BMOperator *op)
BLI_ghash_free(symm.vert_symm_map, NULL, NULL);
BLI_ghash_free(symm.edge_split_map, NULL, NULL);
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL,
- SYMM_OUTPUT_GEOM);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out",
+ BM_ALL, SYMM_OUTPUT_GEOM);
}
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index de876477e5a..775fa0cb60d 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -52,9 +52,10 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
float (*projectverts)[3] = NULL;
BLI_array_declare(projectverts);
int i;
- const int use_beauty = BMO_slot_bool_get(op, "use_beauty");
+ const int use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty");
+ BMOpSlot *slot_facemap_out = BMO_slot_get(op->slots_out, "facemap.out");
- for (face = BMO_iter_new(&siter, bm, op, "faces", BM_FACE); face; face = BMO_iter_step(&siter)) {
+ for (face = BMO_iter_new(&siter, op->slots_in, "faces", BM_FACE); face; face = BMO_iter_step(&siter)) {
BLI_array_empty(projectverts);
BLI_array_empty(newfaces);
@@ -64,16 +65,14 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
BM_face_triangulate(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces, use_beauty);
- BMO_slot_map_ptr_insert(bm, op, "facemap", face, face);
+ BMO_slot_map_ptr_insert(op, slot_facemap_out, face, face);
for (i = 0; newfaces[i]; i++) {
- BMO_slot_map_ptr_insert(bm, op, "facemap",
- newfaces[i], face);
-
+ BMO_slot_map_ptr_insert(op, slot_facemap_out, newfaces[i], face);
}
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_NEW);
- BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_NEW);
BLI_array_free(projectverts);
BLI_array_free(newfaces);
@@ -87,9 +86,9 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
BMEdge *e;
int stop = 0;
- BMO_slot_buffer_flag_enable(bm, op, "constrain_edges", BM_EDGE, EDGE_MARK);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "constrain_edges", BM_EDGE, EDGE_MARK);
- BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
if (f->len == 3) {
BMO_elem_flag_enable(bm, f, FACE_MARK);
}
@@ -152,7 +151,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE | BM_FACE, ELE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW);
}
void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
@@ -170,7 +169,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
BLI_scanfill_begin(&sf_ctx);
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
BMO_elem_flag_enable(bm, e, EDGE_MARK);
if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v1)) {
@@ -214,8 +213,8 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
/* clean up fill */
BMO_op_initf(bm, &bmop, op->flag, "beautify_fill faces=%ff constrain_edges=%fe", ELE_NEW, EDGE_MARK);
BMO_op_exec(bm, &bmop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE | BM_EDGE, ELE_NEW);
+ BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_FACE | BM_EDGE, ELE_NEW);
BMO_op_finish(bm, &bmop);
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE | BM_FACE, ELE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW);
}
diff --git a/source/blender/bmesh/operators/bmo_unsubdivide.c b/source/blender/bmesh/operators/bmo_unsubdivide.c
index 3d44feac380..fae7db3d175 100644
--- a/source/blender/bmesh/operators/bmo_unsubdivide.c
+++ b/source/blender/bmesh/operators/bmo_unsubdivide.c
@@ -39,10 +39,10 @@ void bmo_unsubdivide_exec(BMesh *bm, BMOperator *op)
BMVert *v;
BMIter iter;
- const int iterations = max_ii(1, BMO_slot_int_get(op, "iterations"));
+ const int iterations = max_ii(1, BMO_slot_int_get(op->slots_in, "iterations"));
- BMOpSlot *vinput = BMO_slot_get(op, "verts");
- BMVert **vinput_arr = (BMVert **)vinput->data.p;
+ BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
+ BMVert **vinput_arr = (BMVert **)vinput->data.buf;
int v_index;
/* tag verts */
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index aa514a5c0a7..d56b2ca0d73 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -45,21 +45,21 @@ void bmo_create_vert_exec(BMesh *bm, BMOperator *op)
{
float vec[3];
- BMO_slot_vec_get(op, "co", vec);
+ BMO_slot_vec_get(op->slots_in, "co", vec);
BMO_elem_flag_enable(bm, BM_vert_create(bm, vec, NULL), 1);
- BMO_slot_buffer_from_enabled_flag(bm, op, "newvertout", BM_VERT, 1);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "vert.out", BM_VERT, 1);
}
-void bmo_transform_exec(BMesh *bm, BMOperator *op)
+void bmo_transform_exec(BMesh *UNUSED(bm), BMOperator *op)
{
BMOIter iter;
BMVert *v;
float mat[4][4];
- BMO_slot_mat4_get(op, "mat", mat);
+ BMO_slot_mat4_get(op->slots_in, "mat", mat);
- BMO_ITER (v, &iter, bm, op, "verts", BM_VERT) {
+ BMO_ITER (v, &iter, op->slots_in, "verts", BM_VERT) {
mul_m4_v3(mat, v->co);
}
}
@@ -68,7 +68,7 @@ void bmo_translate_exec(BMesh *bm, BMOperator *op)
{
float mat[4][4], vec[3];
- BMO_slot_vec_get(op, "vec", vec);
+ BMO_slot_vec_get(op->slots_in, "vec", vec);
unit_m4(mat);
copy_v3_v3(mat[3], vec);
@@ -80,7 +80,7 @@ void bmo_scale_exec(BMesh *bm, BMOperator *op)
{
float mat[3][3], vec[3];
- BMO_slot_vec_get(op, "vec", vec);
+ BMO_slot_vec_get(op->slots_in, "vec", vec);
unit_m3(mat);
mat[0][0] = vec[0];
@@ -94,7 +94,7 @@ void bmo_rotate_exec(BMesh *bm, BMOperator *op)
{
float vec[3];
- BMO_slot_vec_get(op, "cent", vec);
+ BMO_slot_vec_get(op->slots_in, "cent", vec);
/* there has to be a proper matrix way to do this, but
* this is how editmesh did it and I'm too tired to think
@@ -113,7 +113,7 @@ void bmo_reverse_faces_exec(BMesh *bm, BMOperator *op)
BMOIter siter;
BMFace *f;
- BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
BM_face_normal_flip(bm, f);
}
}
@@ -122,8 +122,8 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
{
BMOIter siter;
BMEdge *e, *e2;
- int ccw = BMO_slot_bool_get(op, "ccw");
- int is_single = BMO_slot_buffer_count(bm, op, "edges") == 1;
+ const int use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
+ const int is_single = BMO_slot_buffer_count(op->slots_in, "edges") == 1;
short check_flag = is_single ?
BM_EDGEROT_CHECK_EXISTS :
BM_EDGEROT_CHECK_EXISTS | BM_EDGEROT_CHECK_DEGENERATE;
@@ -131,7 +131,7 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
#define EDGE_OUT 1
#define FACE_TAINT 1
- BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+ BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
/**
* this ends up being called twice, could add option to not to call check in
* #BM_edge_rotate to get some extra speed */
@@ -144,7 +144,7 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_test(bm, fb, FACE_TAINT) == FALSE)
{
- if (!(e2 = BM_edge_rotate(bm, e, ccw, check_flag))) {
+ if (!(e2 = BM_edge_rotate(bm, e, use_ccw, check_flag))) {
#if 0
BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Could not rotate edge");
return;
@@ -162,7 +162,7 @@ void bmo_rotate_edges_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_OUT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_OUT);
#undef EDGE_OUT
#undef FACE_TAINT
@@ -180,7 +180,7 @@ static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, int usefaces)
BMOIter siter;
if (!usefaces) {
- BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
@@ -202,7 +202,7 @@ static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, int usefaces)
BMFace *f, *f2;
BMLoop *l;
- BMO_ITER (f, &siter, bm, op, "geom", BM_FACE) {
+ BMO_ITER (f, &siter, op->slots_in, "geom", BM_FACE) {
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) {
if (!BM_elem_flag_test(f2, BM_ELEM_HIDDEN)) {
@@ -224,7 +224,7 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
BMOIter siter;
if (!usefaces) {
- BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
@@ -248,7 +248,7 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
BMFace *f, *f2;
BMLoop *l;
- BMO_ITER (f, &siter, bm, op, "geom", BM_FACE) {
+ BMO_ITER (f, &siter, op->slots_in, "geom", BM_FACE) {
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) {
if (!BM_elem_flag_test(f2, BM_ELEM_HIDDEN)) {
@@ -265,17 +265,17 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
void bmo_region_extend_exec(BMesh *bm, BMOperator *op)
{
- int use_faces = BMO_slot_bool_get(op, "use_faces");
- int constrict = BMO_slot_bool_get(op, "constrict");
+ int use_faces = BMO_slot_bool_get(op->slots_in, "use_faces");
+ int constrict = BMO_slot_bool_get(op->slots_in, "use_constrict");
- BMO_slot_buffer_flag_enable(bm, op, "geom", BM_ALL, SEL_ORIG);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "geom", BM_ALL, SEL_ORIG);
if (constrict)
bmo_region_extend_constrict(bm, op, use_faces);
else
bmo_region_extend_extend(bm, op, use_faces);
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, SEL_FLAG);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL, SEL_FLAG);
}
/********* righthand faces implementation ****** */
@@ -314,15 +314,15 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(fstack);
BMLoop *l, *l2;
float maxx, maxx_test, cent[3];
- int i, i_max, flagflip = BMO_slot_bool_get(op, "do_flip");
+ int i, i_max, flagflip = BMO_slot_bool_get(op->slots_in, "use_flip");
startf = NULL;
maxx = -1.0e10;
- BMO_slot_buffer_flag_enable(bm, op, "faces", BM_FACE, FACE_FLAG);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_FLAG);
/* find a starting face */
- BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
/* clear dirty flag */
BM_elem_flag_disable(f, BM_ELEM_TAG);
@@ -405,7 +405,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
BLI_array_free(fstack);
/* check if we have faces yet to do. if so, recurse */
- BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
if (!BMO_elem_flag_test(bm, f, FACE_VIS)) {
bmo_recalc_face_normals_exec(bm, op);
break;
@@ -413,7 +413,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
}
}
-void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
+void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op)
{
BMOIter siter;
BMIter iter;
@@ -421,20 +421,20 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
BMEdge *e;
BLI_array_declare(cos);
float (*cos)[3] = NULL;
- float *co, *co2, clipdist = BMO_slot_float_get(op, "clipdist");
+ float *co, *co2, clip_dist = BMO_slot_float_get(op->slots_in, "clip_dist");
int i, j, clipx, clipy, clipz;
int xaxis, yaxis, zaxis;
- clipx = BMO_slot_bool_get(op, "mirror_clip_x");
- clipy = BMO_slot_bool_get(op, "mirror_clip_y");
- clipz = BMO_slot_bool_get(op, "mirror_clip_z");
+ clipx = BMO_slot_bool_get(op->slots_in, "mirror_clip_x");
+ clipy = BMO_slot_bool_get(op->slots_in, "mirror_clip_y");
+ clipz = BMO_slot_bool_get(op->slots_in, "mirror_clip_z");
- xaxis = BMO_slot_bool_get(op, "use_axis_x");
- yaxis = BMO_slot_bool_get(op, "use_axis_y");
- zaxis = BMO_slot_bool_get(op, "use_axis_z");
+ xaxis = BMO_slot_bool_get(op->slots_in, "use_axis_x");
+ yaxis = BMO_slot_bool_get(op->slots_in, "use_axis_y");
+ zaxis = BMO_slot_bool_get(op->slots_in, "use_axis_z");
i = 0;
- BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
BLI_array_grow_one(cos);
co = cos[i];
@@ -454,18 +454,18 @@ void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
mul_v3_fl(co, 1.0f / (float)j);
mid_v3_v3v3(co, co, v->co);
- if (clipx && fabsf(v->co[0]) <= clipdist)
+ if (clipx && fabsf(v->co[0]) <= clip_dist)
co[0] = 0.0f;
- if (clipy && fabsf(v->co[1]) <= clipdist)
+ if (clipy && fabsf(v->co[1]) <= clip_dist)
co[1] = 0.0f;
- if (clipz && fabsf(v->co[2]) <= clipdist)
+ if (clipz && fabsf(v->co[2]) <= clip_dist)
co[2] = 0.0f;
i++;
}
i = 0;
- BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+ BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
if (xaxis)
v->co[0] = cos[i][0];
if (yaxis)
@@ -489,11 +489,11 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
BMFace *fs; /* current face */
BMIter l_iter; /* iteration loop */
- int dir = BMO_slot_int_get(op, "dir");
+ const int use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
- BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
- if (dir == DIRECTION_CW) { /* same loops direction */
+ if (use_ccw == FALSE) { /* same loops direction */
BMLoop *lf; /* current face loops */
MLoopUV *f_luv; /* first face loop uv */
float p_uv[2]; /* previous uvs */
@@ -517,7 +517,7 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
copy_v2_v2(f_luv->uv, p_uv);
}
- else if (dir == DIRECTION_CCW) { /* counter loop direction */
+ else { /* counter loop direction */
BMLoop *lf; /* current face loops */
MLoopUV *p_luv; /* previous loop uv */
MLoopUV *luv;
@@ -556,7 +556,7 @@ void bmo_reverse_uvs_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(uvs);
float (*uvs)[2] = NULL;
- BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
BMLoop *lf; /* current face loops */
int i;
@@ -594,11 +594,11 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
BMFace *fs; /* current face */
BMIter l_iter; /* iteration loop */
- int dir = BMO_slot_int_get(op, "dir");
+ const int use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
- BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
- if (dir == DIRECTION_CW) { /* same loops direction */
+ if (use_ccw == FALSE) { /* same loops direction */
BMLoop *lf; /* current face loops */
MLoopCol *f_lcol; /* first face loop color */
MLoopCol p_col; /* previous color */
@@ -622,7 +622,7 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
*f_lcol = p_col;
}
- else if (dir == DIRECTION_CCW) { /* counter loop direction */
+ else { /* counter loop direction */
BMLoop *lf; /* current face loops */
MLoopCol *p_lcol; /* previous loop color */
MLoopCol *lcol;
@@ -661,7 +661,7 @@ void bmo_reverse_colors_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(cols);
MLoopCol *cols = NULL;
- BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
BMLoop *lf; /* current face loops */
int i;
@@ -710,12 +710,13 @@ void bmo_shortest_path_exec(BMesh *bm, BMOperator *op)
ElemNode *vert_list = NULL;
int num_total = 0 /*, num_sels = 0 */, i = 0;
- const int type = BMO_slot_int_get(op, "type");
+ const int type = BMO_slot_int_get(op->slots_in, "type");
- BMO_ITER (vs, &vs_iter, bm, op, "startv", BM_VERT) {
+ /* BMESH_TODO use BMO_slot_buffer_elem_first here? */
+ BMO_ITER (vs, &vs_iter, op->slots_in, "startv", BM_VERT) {
sv = vs;
}
- BMO_ITER (vs, &vs_iter, bm, op, "endv", BM_VERT) {
+ BMO_ITER (vs, &vs_iter, op->slots_in, "endv", BM_VERT) {
ev = vs;
}
@@ -795,5 +796,5 @@ void bmo_shortest_path_exec(BMesh *bm, BMOperator *op)
BLI_heap_free(h, NULL);
MEM_freeN(vert_list);
- BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+ BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, VERT_MARK);
}
diff --git a/source/blender/bmesh/operators/bmo_wireframe.c b/source/blender/bmesh/operators/bmo_wireframe.c
index d572a1c5863..532145ab129 100644
--- a/source/blender/bmesh/operators/bmo_wireframe.c
+++ b/source/blender/bmesh/operators/bmo_wireframe.c
@@ -77,39 +77,60 @@ static void bm_vert_boundary_tangent(BMVert *v, float r_no[3], float r_no_face[3
}
}
- l_a = bm_edge_tag_faceloop(e_a);
- l_b = bm_edge_tag_faceloop(e_b);
+ if (e_a && e_b) {
+ l_a = bm_edge_tag_faceloop(e_a);
+ l_b = bm_edge_tag_faceloop(e_b);
+
+ /* average edge face normal */
+ add_v3_v3v3(no_face, l_a->f->no, l_b->f->no);
+
+ /* average edge direction */
+ v_a = BM_edge_other_vert(e_a, v);
+ v_b = BM_edge_other_vert(e_b, v);
+
+ sub_v3_v3v3(tvec_a, v->co, v_a->co);
+ sub_v3_v3v3(tvec_b, v_b->co, v->co);
+ normalize_v3(tvec_a);
+ normalize_v3(tvec_b);
+ add_v3_v3v3(no_edge, tvec_a, tvec_b); /* not unit length but this is ok */
+
+ /* check are we flipped the right way */
+ BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
+ BM_edge_calc_face_tangent(e_b, l_b, tvec_b);
+ add_v3_v3(tvec_a, tvec_b);
+
+ *r_va_other = v_a;
+ *r_vb_other = v_b;
+ }
+ else {
+ /* degenerate case - vertex connects a boundary edged face to other faces,
+ * so we have only one boundary face - only use it for calculations */
+ l_a = bm_edge_tag_faceloop(e_a);
- /* average edge face normal */
- add_v3_v3v3(no_face, l_a->f->no, l_b->f->no);
+ copy_v3_v3(no_face, l_a->f->no);
- /* average edge direction */
- v_a = BM_edge_other_vert(e_a, v);
- v_b = BM_edge_other_vert(e_b, v);
+ /* edge direction */
+ v_a = BM_edge_other_vert(e_a, v);
+ v_b = NULL;
- sub_v3_v3v3(tvec_a, v->co, v_a->co);
- sub_v3_v3v3(tvec_b, v_b->co, v->co);
- normalize_v3(tvec_a);
- normalize_v3(tvec_b);
- add_v3_v3v3(no_edge, tvec_a, tvec_b); /* not unit length but this is ok */
+ sub_v3_v3v3(no_edge, v->co, v_a->co);
+ /* check are we flipped the right way */
+ BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
+
+ *r_va_other = NULL;
+ *r_vb_other = NULL;
+ }
/* find the normal */
cross_v3_v3v3(r_no, no_edge, no_face);
normalize_v3(r_no);
- /* check are we flipped the right way */
- BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
- BM_edge_calc_face_tangent(e_b, l_b, tvec_b);
- add_v3_v3(tvec_a, tvec_b);
-
if (dot_v3v3(r_no, tvec_a) > 0.0f) {
negate_v3(r_no);
}
copy_v3_v3(r_no_face, no_face);
- *r_va_other = v_a;
- *r_vb_other = v_b;
}
/* check if we are the only tagged loop-face around this edge */
@@ -134,12 +155,12 @@ extern float BM_vert_calc_mean_tagged_edge_length(BMVert *v);
void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
{
- const int use_boundary = BMO_slot_bool_get(op, "use_boundary");
- const int use_even_offset = BMO_slot_bool_get(op, "use_even_offset");
- const int use_relative_offset = BMO_slot_bool_get(op, "use_relative_offset");
- const int use_crease = (BMO_slot_bool_get(op, "use_crease") &&
+ const int use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary");
+ const int use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
+ const int use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
+ const int use_crease = (BMO_slot_bool_get(op->slots_in, "use_crease") &&
CustomData_has_layer(&bm->edata, CD_CREASE));
- const float depth = BMO_slot_float_get(op, "thickness");
+ const float depth = BMO_slot_float_get(op->slots_in, "thickness");
const float inset = depth;
const int totvert_orig = bm->totvert;
@@ -184,7 +205,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
/* setup tags, all faces and verts will be tagged which will be duplicated */
BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f_src, &oiter, op->slots_in, "faces", BM_FACE) {
verts_loop_tot += f_src->len;
BM_elem_flag_enable(f_src, BM_ELEM_TAG);
BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
@@ -230,7 +251,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
verts_loop = MEM_mallocN(sizeof(BMVert **) * verts_loop_tot, __func__);
verts_loop_tot = 0; /* count up again */
- BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f_src, &oiter, op->slots_in, "faces", BM_FACE) {
BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
BM_elem_index_set(l, verts_loop_tot); /* set_loop */
@@ -269,10 +290,12 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
/* similar to code above but different angle calc */
fac = inset;
if (use_even_offset) {
- fac *= shell_angle_to_dist(((float)M_PI - angle_on_axis_v3v3v3_v3(va_other->co,
- l_pair[i]->v->co,
- vb_other->co,
- no_face)) * 0.5f);
+ if (va_other) { /* for verts with only one boundary edge - this will be NULL */
+ fac *= shell_angle_to_dist(((float)M_PI - angle_on_axis_v3v3v3_v3(va_other->co,
+ l_pair[i]->v->co,
+ vb_other->co,
+ no_face)) * 0.5f);
+ }
}
if (use_relative_offset) {
fac *= verts_relfac[BM_elem_index_get(l_pair[i]->v)];
@@ -288,7 +311,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
+ BMO_ITER (f_src, &oiter, op->slots_in, "faces", BM_FACE) {
BM_elem_flag_disable(f_src, BM_ELEM_TAG);
BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
BMFace *f_new;
@@ -400,5 +423,5 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
MEM_freeN(verts_pos);
MEM_freeN(verts_loop);
- BMO_slot_buffer_from_enabled_hflag(bm, op, "faceout", BM_FACE, 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/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index cfc7edb2400..75e74155f66 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -52,7 +52,7 @@
typedef struct NewVert {
BMVert *v;
float co[3];
- int _pad;
+// int _pad;
} NewVert;
struct BoundVert;
@@ -242,20 +242,24 @@ static BMFace *boundvert_rep_face(BoundVert *v)
return fans;
}
-/* Make ngon from verts alone.
+/**
+ * Make ngon from verts alone.
* Make sure to properly copy face attributes and do custom data interpolation from
- * example face, facerep. */
-static BMFace *bev_create_ngon(BMesh *bm, BMVert **vert_arr, int totv, BMFace *facerep)
+ * example face, facerep.
+ *
+ * \note ALL face creation goes through this function, this is important to keep!
+ */
+static BMFace *bev_create_ngon(BMesh *bm, BMVert **vert_arr, const int totv, BMFace *facerep)
{
BMIter iter;
BMLoop *l;
BMFace *f;
if (totv == 3) {
- f = BM_face_create_quad_tri_v(bm, vert_arr, 3, facerep, 0);
+ f = BM_face_create_quad_tri_v(bm, vert_arr, 3, facerep, FALSE);
}
else if (totv == 4) {
- f = BM_face_create_quad_tri_v(bm, vert_arr, 4, facerep, 0);
+ f = BM_face_create_quad_tri_v(bm, vert_arr, 4, facerep, FALSE);
}
else {
int i;
@@ -278,18 +282,20 @@ static BMFace *bev_create_ngon(BMesh *bm, BMVert **vert_arr, int totv, BMFace *f
BM_loop_interp_multires(bm, l, facerep);
}
}
+
+ /* not essential for bevels own internal logic,
+ * this is done so the operator can select newly created faces */
+ if (f) {
+ BM_elem_flag_enable(f, BM_ELEM_TAG);
+ }
+
return f;
}
static BMFace *bev_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
BMFace *facerep)
{
- BMVert *varr[4];
-
- varr[0] = v1;
- varr[1] = v2;
- varr[2] = v3;
- varr[3] = v4;
+ BMVert *varr[4] = {v1, v2, v3, v4};
return bev_create_ngon(bm, varr, v4 ? 4 : 3, facerep);
}
@@ -313,12 +319,7 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f,
sub_v3_v3v3(dir1, v->co, BM_edge_other_vert(e1->e, v)->co);
sub_v3_v3v3(dir2, BM_edge_other_vert(e2->e, v)->co, v->co);
- /* get normal to plane where meet point should be */
- cross_v3_v3v3(norm_v, dir2, dir1);
- normalize_v3(norm_v);
- if (!on_right)
- negate_v3(norm_v);
- if (is_zero_v3(norm_v)) {
+ if (angle_v3v3(dir1, dir2) < 100.0f * (float)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 */
@@ -333,6 +334,12 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f,
copy_v3_v3(meetco, off1a);
}
else {
+ /* get normal to plane where meet point should be */
+ cross_v3_v3v3(norm_v, dir2, dir1);
+ normalize_v3(norm_v);
+ if (!on_right)
+ negate_v3(norm_v);
+
/* get vectors perp to each edge, perp to norm_v, and pointing into face */
if (f) {
copy_v3_v3(norm_v, f->no);
@@ -387,7 +394,7 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, BMVert *v,
madd_v3_v3fl(off2a, norm_perp2, e2->offset);
add_v3_v3v3(off2b, off2a, dir2);
- if (angle_v3v3(dir1, dir2) < (float)BEVEL_EPSILON) {
+ if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON) {
/* lines are parallel; off1a is a good meet point */
copy_v3_v3(meetco, off1a);
}
@@ -471,15 +478,13 @@ static int bev_ccw_test(BMEdge *a, BMEdge *b, BMFace *f)
static void vmesh_cent(VMesh *vm, float r_cent[3])
{
BoundVert *v;
- int tot = 0;
zero_v3(r_cent);
v = vm->boundstart;
do {
add_v3_v3(r_cent, v->nv.co);
- tot++;
} while ((v = v->next) != vm->boundstart);
- mul_v3_fl(r_cent, 1.0f / (float)tot);
+ mul_v3_fl(r_cent, 1.0f / (float)vm->count);
}
/**
@@ -608,7 +613,7 @@ static void get_point_on_round_edge(EdgeHalf *e, int k,
else
sub_v3_v3v3(dir, e->e->v2->co, e->e->v1->co);
normalize_v3(dir);
- if (fabsf(angle_v3v3(vva, vvb) - (float)M_PI) > (float)BEVEL_EPSILON) {
+ if (fabsf(angle_v3v3(vva, vvb) - (float)M_PI) > 100.f *(float)BEVEL_EPSILON) {
copy_v3_v3(vaadj, va);
madd_v3_v3fl(vaadj, dir, -len_v3(vva) * cosf(angle_v3v3(vva, dir)));
copy_v3_v3(vbadj, vb);
@@ -1402,8 +1407,9 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
BMFace *f;
BMIter iter, iter2;
EdgeHalf *e;
- int i, ntot, found_shared_face, ccw_test_sum;
+ int i, found_shared_face, ccw_test_sum;
int nsel = 0;
+ int ntot = 0;
/* Gather input selected edges.
* Only bevel selected edges that have exactly two incident faces.
@@ -1414,12 +1420,19 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
BLI_assert(BM_edge_is_manifold(bme));
nsel++;
}
+ ntot++;
}
- if (nsel == 0)
+ if (nsel == 0) {
+ /* signal this vert isn't being beveled */
+ BM_elem_flag_disable(v, BM_ELEM_TAG);
return;
+ }
+
+ /* avoid calling BM_vert_edge_count since we loop over edges already */
+ // ntot = BM_vert_edge_count(v);
+ // BLI_assert(ntot == BM_vert_edge_count(v));
- ntot = BM_vert_edge_count(v);
bv = (BevVert *)BLI_memarena_alloc(bp->mem_arena, (sizeof(BevVert)));
bv->v = v;
bv->edgecount = ntot;
@@ -1489,10 +1502,13 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
}
}
+ /* do later when we loop over edges */
+#if 0
/* clear BEVEL_EDGE_TAG now that we are finished with it*/
for (i = 0; i < ntot; i++) {
BM_BEVEL_EDGE_TAG_DISABLE(bv->edges[i].e);
}
+#endif
/* if edge array doesn't go CCW around vertex from average normal side,
* reverse the array, being careful to reverse face pointers too */
@@ -1514,10 +1530,10 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
}
}
- for (i = 0; i < ntot; i++) {
- e = &bv->edges[i];
+ 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];
+ BM_BEVEL_EDGE_TAG_DISABLE(e->e);
}
build_boundary(bp->mem_arena, bv);
@@ -1525,7 +1541,7 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
}
/* Face f has at least one beveled vertex. Rebuild f */
-static void rebuild_polygon(BMesh *bm, BevelParams *bp, BMFace *f)
+static int bev_rebuild_polygon(BMesh *bm, BevelParams *bp, BMFace *f)
{
BMIter liter;
BMLoop *l, *lprev;
@@ -1534,14 +1550,15 @@ static void rebuild_polygon(BMesh *bm, BevelParams *bp, BMFace *f)
EdgeHalf *e, *eprev;
VMesh *vm;
int i, k;
+ int do_rebuild = FALSE;
BMVert *bmv;
BMVert **vv = NULL;
- BLI_array_declare(vv);
+ BLI_array_staticdeclare(vv, BM_DEFAULT_NGON_STACK_SIZE);
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
- bv = find_bevvert(bp, l->v);
- if (bv) {
+ if (BM_elem_flag_test(l->v, BM_ELEM_TAG)) {
lprev = l->prev;
+ bv = find_bevvert(bp, l->v);
e = find_edge_half(bv, l->e);
eprev = find_edge_half(bv, lprev->e);
BLI_assert(e != NULL && eprev != NULL);
@@ -1566,13 +1583,24 @@ static void rebuild_polygon(BMesh *bm, BevelParams *bp, BMFace *f)
v = v->prev;
BLI_array_append(vv, v->nv.v);
}
+
+ do_rebuild = TRUE;
}
else {
BLI_array_append(vv, l->v);
}
}
- bev_create_ngon(bm, vv, BLI_array_count(vv), f);
+ if (do_rebuild) {
+ BMFace *f_new = bev_create_ngon(bm, vv, BLI_array_count(vv), f);
+
+ /* don't select newly created boundary faces... */
+ if (f_new) {
+ BM_elem_flag_disable(f_new, BM_ELEM_TAG);
+ }
+ }
+
BLI_array_free(vv);
+ return do_rebuild;
}
/* All polygons touching v need rebuilding because beveling v has made new vertices */
@@ -1586,8 +1614,9 @@ static void bevel_rebuild_existing_polygons(BMesh *bm, BevelParams *bp, BMVert *
if (LIKELY(faces != NULL)) {
for (f_index = 0; f_index < faces_len; f_index++) {
BMFace *f = faces[f_index];
- rebuild_polygon(bm, bp, f);
- BM_face_kill(bm, f);
+ if (bev_rebuild_polygon(bm, bp, f)) {
+ BM_face_kill(bm, f);
+ }
}
if (faces != (BMFace **)faces_stack) {
@@ -1597,7 +1626,6 @@ static void bevel_rebuild_existing_polygons(BMesh *bm, BevelParams *bp, BMVert *
}
-
/*
* Build the polygons along the selected Edge
*/
@@ -1664,8 +1692,13 @@ static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme)
}
/**
- * currently only bevels BM_ELEM_TAG'd verts and edges
- * all tagged edges _must_ be manifold.
+ * - Currently only bevels BM_ELEM_TAG'd verts and edges.
+ *
+ * - Newly created faces are BM_ELEM_TAG'd too,
+ * the caller needs to ensure this is cleared before calling
+ * if its going to use this face tag.
+ *
+ * \warning all tagged edges _must_ be manifold.
*/
void BM_mesh_bevel(BMesh *bm, const float offset, const float segments)
{
@@ -1705,9 +1738,8 @@ void BM_mesh_bevel(BMesh *bm, const float offset, const float segments)
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
- if (find_bevvert(&bp, v)) {
- BM_vert_kill(bm, v);
- }
+ BLI_assert(find_bevvert(&bp, v) != NULL);
+ BM_vert_kill(bm, v);
}
}
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index c6e0f6c2cfb..1ec4ac7699b 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -247,9 +247,14 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
*/
static void debug_check_node_connections(Node *node)
{
+ /* note: connected inputs are not checked here,
+ * it would break quite a lot and such inputs are ignored later anyway
+ */
+#if 0
for (int i = 0; i < node->getNumberOfInputSockets(); ++i) {
BLI_assert(!node->getInputSocket(i)->isConnected());
}
+#endif
for (int i = 0; i < node->getNumberOfOutputSockets(); ++i) {
BLI_assert(!node->getOutputSocket(i)->isConnected());
}
diff --git a/source/blender/compositor/nodes/COM_MuteNode.cpp b/source/blender/compositor/nodes/COM_MuteNode.cpp
index 4502dcf469c..de12fff3591 100644
--- a/source/blender/compositor/nodes/COM_MuteNode.cpp
+++ b/source/blender/compositor/nodes/COM_MuteNode.cpp
@@ -43,6 +43,10 @@ void MuteNode::reconnect(ExecutionSystem *graph, OutputSocket *output)
if (input->getDataType() == output->getDataType()) {
if (input->isConnected()) {
output->relinkConnections(input->getConnection()->getFromSocket(), false);
+ /* output connections have been redirected,
+ * remove the input connection to completely unlink the node.
+ */
+ input->unlinkConnections(graph);
return;
}
}
diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cpp b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
index 921b9e63a73..3b1871b307b 100644
--- a/source/blender/compositor/nodes/COM_OutputFileNode.cpp
+++ b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
@@ -41,6 +41,12 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
* otherwise, it overwrites the output files just
* scrubbing through the timeline when the compositor updates.
*/
+
+ /* still, need to unlink input sockets to remove the node from the graph completely */
+ int num_inputs = getNumberOfInputSockets();
+ for (int i = 0; i < num_inputs; ++i) {
+ getInputSocket(i)->unlinkConnections(graph);
+ }
return;
}
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index 4bdb2591cb7..9231261986d 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -230,6 +230,7 @@ FastGaussianBlurValueOperation::FastGaussianBlurValueOperation() : NodeOperation
this->m_iirgaus = NULL;
this->m_inputprogram = NULL;
this->m_sigma = 1.0f;
+ this->m_overlay = 0;
setComplex(true);
}
@@ -281,7 +282,7 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
if (this->m_overlay == FAST_GAUSS_OVERLAY_MIN) {
float *src = newBuf->getBuffer();
float *dst = copy->getBuffer();
- for (int i = copy->getWidth() * copy->getHeight() * COM_NUMBER_OF_CHANNELS; i != 0; i--, src++, dst++) {
+ for (int i = copy->getWidth() * copy->getHeight(); i != 0; i--, src += COM_NUMBER_OF_CHANNELS, dst += COM_NUMBER_OF_CHANNELS) {
if (*src < *dst) {
*dst = *src;
}
@@ -290,7 +291,7 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
else if (this->m_overlay == FAST_GAUSS_OVERLAY_MAX) {
float *src = newBuf->getBuffer();
float *dst = copy->getBuffer();
- for (int i = copy->getWidth() * copy->getHeight() * COM_NUMBER_OF_CHANNELS; i != 0; i--, src++, dst++) {
+ for (int i = copy->getWidth() * copy->getHeight(); i != 0; i--, src += COM_NUMBER_OF_CHANNELS, dst += COM_NUMBER_OF_CHANNELS) {
if (*src > *dst) {
*dst = *src;
}
diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
index c36a6f896c2..8f92dc02a57 100644
--- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
+++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp
@@ -48,6 +48,7 @@ void GammaCorrectOperation::executePixel(float output[4], float x, float y, Pixe
output[0] = inputColor[0] > 0.0f ? inputColor[0] * inputColor[0] : 0.0f;
output[1] = inputColor[1] > 0.0f ? inputColor[1] * inputColor[1] : 0.0f;
output[2] = inputColor[2] > 0.0f ? inputColor[2] * inputColor[2] : 0.0f;
+ output[3] = inputColor[3];
if (inputColor[3] > 0.0f) {
output[0] *= inputColor[3];
@@ -86,6 +87,7 @@ void GammaUncorrectOperation::executePixel(float output[4], float x, float y, Pi
output[0] = inputColor[0] > 0.0f ? sqrtf(inputColor[0]) : 0.0f;
output[1] = inputColor[1] > 0.0f ? sqrtf(inputColor[1]) : 0.0f;
output[2] = inputColor[2] > 0.0f ? sqrtf(inputColor[2]) : 0.0f;
+ output[3] = inputColor[3];
if (inputColor[3] > 0.0f) {
output[0] *= inputColor[3];
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index f6459bfc542..bb324337ffb 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -1564,6 +1564,8 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op)
/* duplicate of 'ANIM_OT_channels_setting_toggle' for menu title only, weak! */
static void ANIM_OT_channels_setting_enable(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Enable Channel Setting";
ot->idname = "ANIM_OT_channels_setting_enable";
@@ -1579,13 +1581,16 @@ static void ANIM_OT_channels_setting_enable(wmOperatorType *ot)
/* props */
/* flag-setting mode */
- RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_ADD, "Mode", "");
+ prop = RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_ADD, "Mode", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN);
/* setting to set */
ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
}
/* duplicate of 'ANIM_OT_channels_setting_toggle' for menu title only, weak! */
static void ANIM_OT_channels_setting_disable(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Disable Channel Setting";
ot->idname = "ANIM_OT_channels_setting_disable";
@@ -1601,13 +1606,16 @@ static void ANIM_OT_channels_setting_disable(wmOperatorType *ot)
/* props */
/* flag-setting mode */
- RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_CLEAR, "Mode", "");
+ prop = RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_CLEAR, "Mode", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN); /* internal hack - don't expose */
/* setting to set */
ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
}
static void ANIM_OT_channels_setting_toggle(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Toggle Channel Setting";
ot->idname = "ANIM_OT_channels_setting_toggle";
@@ -1623,13 +1631,16 @@ static void ANIM_OT_channels_setting_toggle(wmOperatorType *ot)
/* props */
/* flag-setting mode */
- RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
+ prop = RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN); /* internal hack - don't expose */
/* setting to set */
ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
}
static void ANIM_OT_channels_editable_toggle(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Toggle Channel Editability";
ot->idname = "ANIM_OT_channels_editable_toggle";
@@ -1646,7 +1657,8 @@ static void ANIM_OT_channels_editable_toggle(wmOperatorType *ot)
/* flag-setting mode */
RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
/* setting to set */
- RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, ACHANNEL_SETTING_PROTECT, "Type", "");
+ prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, ACHANNEL_SETTING_PROTECT, "Type", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN); /* internal hack - don't expose */
}
/* ********************** Expand Channels Operator *********************** */
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 852f3fa5469..4ac7b61fccb 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -706,8 +706,13 @@ static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *e
}
/* note, init has to be called succesfully */
-static void ed_marker_move_apply(wmOperator *op)
+static void ed_marker_move_apply(bContext *C, wmOperator *op)
{
+#ifdef DURIAN_CAMERA_SWITCH
+ bScreen *sc = CTX_wm_screen(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *camera = scene->camera;
+#endif
MarkerMove *mm = op->customdata;
TimeMarker *marker;
int a, offs;
@@ -719,17 +724,27 @@ static void ed_marker_move_apply(wmOperator *op)
a++;
}
}
+
+ WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
+
+#ifdef DURIAN_CAMERA_SWITCH
+ /* so we get view3d redraws */
+ BKE_scene_camera_switch_update(scene);
+
+ if(camera != scene->camera) {
+ BKE_screen_view3d_scene_sync(sc);
+ WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene);
+ }
+#endif
}
/* only for modal */
static int ed_marker_move_cancel(bContext *C, wmOperator *op)
{
RNA_int_set(op->ptr, "frames", 0);
- ed_marker_move_apply(op);
+ ed_marker_move_apply(C, op);
ed_marker_move_exit(C, op);
-
- WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
- WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
return OPERATOR_CANCELLED;
}
@@ -789,7 +804,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
offs = (int)fac;
RNA_int_set(op->ptr, "frames", offs);
- ed_marker_move_apply(op);
+ ed_marker_move_apply(C, op);
/* cruft below is for header print */
for (a = 0, marker = mm->markers->first; marker; marker = marker->next) {
@@ -840,8 +855,6 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
}
}
- WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
- WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
ED_area_headerprint(CTX_wm_area(C), str);
}
}
@@ -855,14 +868,11 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
outputNumInput(&mm->num, str_tx);
RNA_int_set(op->ptr, "frames", vec);
- ed_marker_move_apply(op);
+ ed_marker_move_apply(C, op);
// ed_marker_header_update(C, op, str, (int)vec[0]);
// strcat(str, str_tx);
BLI_snprintf(str, sizeof(str), "Marker offset %s", str_tx);
ED_area_headerprint(CTX_wm_area(C), str);
-
- WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
- WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
}
}
@@ -872,7 +882,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
static int ed_marker_move_exec(bContext *C, wmOperator *op)
{
if (ed_marker_move_init(C, op)) {
- ed_marker_move_apply(op);
+ ed_marker_move_apply(C, op);
ed_marker_move_exit(C, op);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 48da23d5e8d..e801d3689e5 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -3569,16 +3569,16 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
bArmature *arm = obedit->data;
EditBone *newbone, *tbone;
- int numcuts, i;
+ int cuts, i;
/* there may not be a number_cuts property defined (for 'simple' subdivide) */
- numcuts = RNA_int_get(op->ptr, "number_cuts");
+ cuts = RNA_int_get(op->ptr, "number_cuts");
/* loop over all editable bones */
// XXX the old code did this in reverse order though!
CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
{
- for (i = numcuts + 1; i > 1; i--) {
+ for (i = cuts + 1; i > 1; i--) {
/* compute cut ratio first */
float cutratio = 1.0f / (float)i;
float cutratioI = 1.0f - cutratio;
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 348b98a0380..23fed4ce8fc 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1069,7 +1069,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
Nurb *nu = editnurb->nurbs.first;
CVKeyIndex *keyIndex;
char rna_path[64], orig_rna_path[64];
- AnimData *ad = BKE_animdata_from_id(&cu->id);
+ AnimData *adt = BKE_animdata_from_id(&cu->id);
ListBase curves = {NULL, NULL};
FCurve *fcu, *next;
@@ -1089,14 +1089,14 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
char handle_path[64], orig_handle_path[64];
BLI_snprintf(orig_handle_path, sizeof(orig_rna_path), "%s.handle_left", orig_rna_path);
BLI_snprintf(handle_path, sizeof(rna_path), "%s.handle_right", rna_path);
- fcurve_path_rename(ad, orig_handle_path, handle_path, orig_curves, &curves);
+ fcurve_path_rename(adt, orig_handle_path, handle_path, orig_curves, &curves);
BLI_snprintf(orig_handle_path, sizeof(orig_rna_path), "%s.handle_right", orig_rna_path);
BLI_snprintf(handle_path, sizeof(rna_path), "%s.handle_left", rna_path);
- fcurve_path_rename(ad, orig_handle_path, handle_path, orig_curves, &curves);
+ fcurve_path_rename(adt, orig_handle_path, handle_path, orig_curves, &curves);
}
- fcurve_path_rename(ad, orig_rna_path, rna_path, orig_curves, &curves);
+ fcurve_path_rename(adt, orig_rna_path, rna_path, orig_curves, &curves);
keyIndex->nu_index = nu_index;
keyIndex->pt_index = pt_index;
@@ -1116,7 +1116,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
if (keyIndex) {
BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d].points[%d]", nu_index, pt_index);
BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d].points[%d]", keyIndex->nu_index, keyIndex->pt_index);
- fcurve_path_rename(ad, orig_rna_path, rna_path, orig_curves, &curves);
+ fcurve_path_rename(adt, orig_rna_path, rna_path, orig_curves, &curves);
keyIndex->nu_index = nu_index;
keyIndex->pt_index = pt_index;
@@ -1140,7 +1140,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
char *ch = strchr(fcu->rna_path, '.');
if (ch && (!strncmp(ch, ".bezier_points", 14) || !strncmp(ch, ".points", 7)))
- fcurve_remove(ad, orig_curves, fcu);
+ fcurve_remove(adt, orig_curves, fcu);
}
}
@@ -1156,7 +1156,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
if (keyIndex) {
BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d]", nu_index);
BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d]", keyIndex->nu_index);
- fcurve_path_rename(ad, orig_rna_path, rna_path, orig_curves, &curves);
+ fcurve_path_rename(adt, orig_rna_path, rna_path, orig_curves, &curves);
}
nu_index++;
@@ -1168,7 +1168,7 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
for (fcu = orig_curves->first; fcu; fcu = next) {
next = fcu->next;
- if (!strncmp(fcu->rna_path, "splines", 7)) fcurve_remove(ad, orig_curves, fcu);
+ if (!strncmp(fcu->rna_path, "splines", 7)) fcurve_remove(adt, orig_curves, fcu);
else BLI_addtail(&curves, fcu);
}
@@ -1178,14 +1178,14 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
/* return 0 if animation data wasn't changed, 1 otherwise */
int ED_curve_updateAnimPaths(Curve *cu)
{
- AnimData *ad = BKE_animdata_from_id(&cu->id);
+ AnimData *adt = BKE_animdata_from_id(&cu->id);
if (!curve_is_animated(cu)) return 0;
- if (ad->action)
- curve_rename_fcurves(cu, &ad->action->curves);
+ if (adt->action)
+ curve_rename_fcurves(cu, &adt->action->curves);
- curve_rename_fcurves(cu, &ad->drivers);
+ curve_rename_fcurves(cu, &adt->drivers);
return 1;
}
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index e400e44e944..10c585aa802 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -593,6 +593,7 @@ DEF_ICON(MOD_REMESH)
DEF_ICON(MOD_OCEAN)
DEF_ICON(MOD_WARP)
DEF_ICON(MOD_SKIN)
+DEF_ICON(MOD_TRIANGULATE)
#ifndef DEF_ICON_BLANK_SKIP
DEF_ICON(BLANK166)
DEF_ICON(BLANK167)
@@ -606,7 +607,6 @@ DEF_ICON(MOD_SKIN)
DEF_ICON(BLANK175)
DEF_ICON(BLANK176)
DEF_ICON(BLANK177)
- DEF_ICON(BLANK177b)
#endif
/* ANIMATION */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index e2f105b5761..535239cd462 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1677,7 +1677,7 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
{
if (but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
PropertyType type;
- char *buf = NULL;
+ const char *buf = NULL;
int buf_len;
type = RNA_property_type(but->rnaprop);
@@ -1686,11 +1686,22 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
/* RNA string */
buf = RNA_property_string_get_alloc(&but->rnapoin, but->rnaprop, str, maxlen, &buf_len);
}
+ else if (type == PROP_ENUM) {
+ /* RNA enum */
+ int value = RNA_property_enum_get(&but->rnapoin, but->rnaprop);
+ if (RNA_property_enum_name(but->block->evil_C, &but->rnapoin, but->rnaprop, value, &buf)) {
+ BLI_strncpy(str, buf, maxlen);
+ buf = str;
+ }
+ }
else if (type == PROP_POINTER) {
/* RNA pointer */
PointerRNA ptr = RNA_property_pointer_get(&but->rnapoin, but->rnaprop);
buf = RNA_struct_name_get_alloc(&ptr, str, maxlen, &buf_len);
}
+ else {
+ BLI_assert(0);
+ }
if (!buf) {
str[0] = '\0';
@@ -1698,7 +1709,7 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
else if (buf && buf != str) {
/* string was too long, we have to truncate */
memcpy(str, buf, MIN2(maxlen, (size_t)buf_len + 1));
- MEM_freeN(buf);
+ MEM_freeN((void *)buf);
}
}
else if (but->type == IDPOIN) {
@@ -1841,6 +1852,17 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
return 0;
}
+ else if (type == PROP_ENUM) {
+ int value;
+ if (RNA_property_enum_value(but->block->evil_C, &but->rnapoin, but->rnaprop, str, &value)) {
+ RNA_property_enum_set(&but->rnapoin, but->rnaprop, value);
+ return 1;
+ }
+ return 0;
+ }
+ else {
+ BLI_assert(0);
+ }
}
}
else if (but->type == IDPOIN) {
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index e000265bb1e..9759c22f30e 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1384,6 +1384,12 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
but->rnasearchprop = searchprop;
but->flag |= UI_ICON_LEFT | UI_TEXT_LEFT;
+ if (RNA_property_type(prop) == PROP_ENUM) {
+ /* XXX, this will have a menu string,
+ * but in this case we just want the text */
+ but->str[0] = 0;
+ }
+
uiButSetSearchFunc(but, rna_search_cb, but, NULL, NULL);
}
}
@@ -1401,13 +1407,14 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
prop = RNA_struct_find_property(ptr, propname);
if (!prop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ RNA_warning("property not found: %s.%s",
+ RNA_struct_identifier(ptr->type), propname);
return;
}
type = RNA_property_type(prop);
- if (!ELEM(type, PROP_POINTER, PROP_STRING)) {
- RNA_warning("Property %s must be a pointer or string", propname);
+ if (!ELEM3(type, PROP_POINTER, PROP_STRING, PROP_ENUM)) {
+ RNA_warning("Property %s must be a pointer, string or enum", propname);
return;
}
@@ -1415,11 +1422,13 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
if (!searchprop) {
- RNA_warning("search collection property not found: %s.%s", RNA_struct_identifier(ptr->type), searchpropname);
+ RNA_warning("search collection property not found: %s.%s",
+ RNA_struct_identifier(searchptr->type), searchpropname);
return;
}
else if (RNA_property_type(searchprop) != PROP_COLLECTION) {
- RNA_warning("search collection property is not a collection type: %s.%s", RNA_struct_identifier(ptr->type), searchpropname);
+ RNA_warning("search collection property is not a collection type: %s.%s",
+ RNA_struct_identifier(searchptr->type), searchpropname);
return;
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index dbb401c898b..309fbdb1cea 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -185,7 +185,8 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
/* fake button, it holds space for search items */
uiDefBut(block, LABEL, 0, "", 10, 15, w, h, NULL, 0, 0, 0, 0, NULL);
- but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, 19, template.prv_rows, template.prv_cols, "");
+ but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, 19,
+ template.prv_rows, template.prv_cols, "");
uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
}
/* list view */
@@ -315,34 +316,70 @@ static const char *template_id_browse_tip(StructRNA *type)
if (type) {
switch (RNA_type_to_ID_code(type)) {
case ID_SCE: return N_("Browse Scene to be linked");
- case ID_OB: return N_("Browse Object to be linked");
- case ID_ME: return N_("Browse Mesh Data to be linked");
- case ID_CU: return N_("Browse Curve Data to be linked");
- case ID_MB: return N_("Browse Metaball Data to be linked");
- case ID_MA: return N_("Browse Material to be linked");
- case ID_TE: return N_("Browse Texture to be linked");
- case ID_IM: return N_("Browse Image to be linked");
- case ID_LT: return N_("Browse Lattice Data to be linked");
- case ID_LA: return N_("Browse Lamp Data to be linked");
- case ID_CA: return N_("Browse Camera Data to be linked");
- case ID_WO: return N_("Browse World Settings to be linked");
+ case ID_OB: return N_("Browse Object to be linked");
+ case ID_ME: return N_("Browse Mesh Data to be linked");
+ case ID_CU: return N_("Browse Curve Data to be linked");
+ case ID_MB: return N_("Browse Metaball Data to be linked");
+ case ID_MA: return N_("Browse Material to be linked");
+ case ID_TE: return N_("Browse Texture to be linked");
+ case ID_IM: return N_("Browse Image to be linked");
+ case ID_LS: return N_("Browse Line Style Data to be linked");
+ case ID_LT: return N_("Browse Lattice Data to be linked");
+ case ID_LA: return N_("Browse Lamp Data to be linked");
+ case ID_CA: return N_("Browse Camera Data to be linked");
+ case ID_WO: return N_("Browse World Settings to be linked");
case ID_SCR: return N_("Choose Screen lay-out");
case ID_TXT: return N_("Browse Text to be linked");
case ID_SPK: return N_("Browse Speaker Data to be linked");
- case ID_SO: return N_("Browse Sound to be linked");
- case ID_AR: return N_("Browse Armature data to be linked");
- case ID_AC: return N_("Browse Action to be linked");
- case ID_NT: return N_("Browse Node Tree to be linked");
- case ID_BR: return N_("Browse Brush to be linked");
- case ID_PA: return N_("Browse Particle System to be linked");
- case ID_GD: return N_("Browse Grease Pencil Data to be linked");
- case ID_LS: return N_("Browse Line Style Data to be linked");
+ case ID_SO: return N_("Browse Sound to be linked");
+ case ID_AR: return N_("Browse Armature data to be linked");
+ case ID_AC: return N_("Browse Action to be linked");
+ case ID_NT: return N_("Browse Node Tree to be linked");
+ case ID_BR: return N_("Browse Brush to be linked");
+ case ID_PA: return N_("Browse Particle System to be linked");
+ case ID_GD: return N_("Browse Grease Pencil Data to be linked");
}
}
return N_("Browse ID data to be linked");
}
-static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, short idcode, int flag, const char *newop, const char *openop, const char *unlinkop)
+/* Return a type-based i18n context, needed e.g. by "New" button.
+ * In most languages, this adjective takes different form based on gender of type name...
+ */
+static const char *template_id_context(StructRNA *type)
+{
+ if (type) {
+ switch (RNA_type_to_ID_code(type)) {
+ case ID_SCE: return BLF_I18NCONTEXT_ID_SCENE;
+ case ID_OB: return BLF_I18NCONTEXT_ID_OBJECT;
+ case ID_ME: return BLF_I18NCONTEXT_ID_MESH;
+ case ID_CU: return BLF_I18NCONTEXT_ID_CURVE;
+ case ID_MB: return BLF_I18NCONTEXT_ID_METABALL;
+ case ID_MA: return BLF_I18NCONTEXT_ID_MATERIAL;
+ case ID_TE: return BLF_I18NCONTEXT_ID_TEXTURE;
+ case ID_IM: return BLF_I18NCONTEXT_ID_IMAGE;
+ case ID_LS: return BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE;
+ case ID_LT: return BLF_I18NCONTEXT_ID_LATTICE;
+ case ID_LA: return BLF_I18NCONTEXT_ID_LAMP;
+ case ID_CA: return BLF_I18NCONTEXT_ID_CAMERA;
+ case ID_WO: return BLF_I18NCONTEXT_ID_WORLD;
+ case ID_SCR: return BLF_I18NCONTEXT_ID_SCREEN;
+ case ID_TXT: return BLF_I18NCONTEXT_ID_TEXT;
+ case ID_SPK: return BLF_I18NCONTEXT_ID_SPEAKER;
+ case ID_SO: return BLF_I18NCONTEXT_ID_SOUND;
+ case ID_AR: return BLF_I18NCONTEXT_ID_ARMATURE;
+ case ID_AC: return BLF_I18NCONTEXT_ID_ACTION;
+ case ID_NT: return BLF_I18NCONTEXT_ID_NODETREE;
+ case ID_BR: return BLF_I18NCONTEXT_ID_BRUSH;
+ case ID_PA: return BLF_I18NCONTEXT_ID_PARTICLESETTINGS;
+ case ID_GD: return BLF_I18NCONTEXT_ID_GPENCIL;
+ }
+ }
+ return BLF_I18NCONTEXT_DEFAULT;
+}
+
+static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, short idcode, int flag,
+ const char *newop, const char *openop, const char *unlinkop)
{
uiBut *but;
uiBlock *block;
@@ -350,6 +387,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
// ListBase *lb; // UNUSED
ID *id, *idfrom;
int editable = RNA_property_editable(&template->ptr, template->prop);
+ const char *i18n_ctxt = template_id_context(type);
idptr = RNA_property_pointer_get(&template->ptr, template->prop);
id = idptr.data;
@@ -401,19 +439,20 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
//text_idbutton(id, name);
name[0] = '\0';
- but = uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, &idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type));
+ but = uiDefButR(block, TEX, 0, name, 0, 0, UI_UNIT_X * 6, UI_UNIT_Y,
+ &idptr, "name", -1, 0, 0, -1, -1, RNA_struct_ui_description(type));
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_RENAME));
if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
if (id->lib) {
if (id->flag & LIB_INDIRECT) {
- but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- TIP_("Indirect library datablock, cannot change"));
+ but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Indirect library datablock, cannot change"));
uiButSetFlag(but, UI_BUT_DISABLED);
}
else {
- but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- TIP_("Direct linked library datablock, click to make local"));
+ but = uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Direct linked library datablock, click to make local"));
if (!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib))
uiButSetFlag(but, UI_BUT_DISABLED);
}
@@ -426,7 +465,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
BLI_snprintf(numstr, sizeof(numstr), "%d", id->us);
- but = uiDefBut(block, BUT, 0, numstr, 0, 0, UI_UNIT_X + ((id->us < 10) ? 0 : 10), UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ but = uiDefBut(block, BUT, 0, numstr, 0, 0, UI_UNIT_X + ((id->us < 10) ? 0 : 10), UI_UNIT_Y,
+ NULL, 0, 0, 0, 0,
TIP_("Display number of users of this data (click to make a single-user copy)"));
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE));
@@ -451,12 +491,39 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
if (flag & UI_ID_ADD_NEW) {
int w = id ? UI_UNIT_X : (flag & UI_ID_OPEN) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
+ /* i18n markup, does nothing! */
+ BLF_I18N_MSGID_MULTI_CTXT("New", BLF_I18NCONTEXT_DEFAULT,
+ BLF_I18NCONTEXT_ID_SCENE,
+ BLF_I18NCONTEXT_ID_OBJECT,
+ BLF_I18NCONTEXT_ID_MESH,
+ BLF_I18NCONTEXT_ID_CURVE,
+ BLF_I18NCONTEXT_ID_METABALL,
+ BLF_I18NCONTEXT_ID_MATERIAL,
+ BLF_I18NCONTEXT_ID_TEXTURE,
+ BLF_I18NCONTEXT_ID_IMAGE,
+ BLF_I18NCONTEXT_ID_LATTICE,
+ BLF_I18NCONTEXT_ID_LAMP,
+ BLF_I18NCONTEXT_ID_CAMERA,
+ BLF_I18NCONTEXT_ID_WORLD,
+ BLF_I18NCONTEXT_ID_SCREEN,
+ BLF_I18NCONTEXT_ID_TEXT);
+ BLF_I18N_MSGID_MULTI_CTXT("New", BLF_I18NCONTEXT_ID_SPEAKER,
+ BLF_I18NCONTEXT_ID_SOUND,
+ BLF_I18NCONTEXT_ID_ARMATURE,
+ BLF_I18NCONTEXT_ID_ACTION,
+ BLF_I18NCONTEXT_ID_NODETREE,
+ BLF_I18NCONTEXT_ID_BRUSH,
+ BLF_I18NCONTEXT_ID_PARTICLESETTINGS,
+ BLF_I18NCONTEXT_ID_GPENCIL);
+
if (newop) {
- but = uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id) ? "" : IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL);
+ but = uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN,
+ (id) ? "" : CTX_IFACE_(i18n_ctxt, "New"), 0, 0, w, UI_UNIT_Y, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
else {
- but = uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id) ? "" : IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+ but = uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(i18n_ctxt, "New"),
+ 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
@@ -468,11 +535,13 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
if (openop) {
- but = uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL);
+ but = uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"),
+ 0, 0, w, UI_UNIT_Y, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN));
}
else {
- but = uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+ but = uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, NULL);
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN));
}
@@ -489,7 +558,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
}
else {
but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- TIP_("Unlink datablock. Shift + Click to set users to zero, data will then not be saved"));
+ TIP_("Unlink datablock "
+ "(Shift + Click to set users to zero, data will then not be saved)"));
uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE));
if (RNA_property_flag(template->prop) & PROP_NEVER_NULL)
@@ -506,7 +576,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
uiBlockEndAlign(block);
}
-static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols)
+static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
+ const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols)
{
TemplateID *template;
PropertyRNA *prop;
@@ -546,19 +617,24 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
MEM_freeN(template);
}
-void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop)
+void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
+ const char *openop, const char *unlinkop)
{
- ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, 0, 0);
+ ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop,
+ UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE, 0, 0);
}
-void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop)
+void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
+ const char *openop, const char *unlinkop)
{
ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME, 0, 0);
}
-void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols)
+void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop,
+ const char *openop, const char *unlinkop, int rows, int cols)
{
- ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, rows, cols);
+ ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop,
+ UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, rows, cols);
}
/************************ ID Chooser Template ***************************/
@@ -568,7 +644,8 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
* - propname: property identifier for property that ID-pointer gets stored to
* - proptypename: property identifier for property used to determine the type of ID-pointer that can be used
*/
-void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename, const char *text)
+void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename,
+ const char *text)
{
PropertyRNA *propID, *propType;
uiLayout *row;
@@ -615,7 +692,8 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
* - propname: property identifier for property that path gets stored to
* - root_ptr: struct that path gets built from
*/
-void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr), const char *text)
+void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr),
+ const char *text)
{
PropertyRNA *propPath;
uiLayout *row;
@@ -780,7 +858,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
uiBlockBeginAlign(block);
/* Softbody not allowed in this situation, enforce! */
if (((md->type != eModifierType_Softbody && md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) &&
- (md->type != eModifierType_Surface) )
+ (md->type != eModifierType_Surface) )
{
uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
@@ -792,7 +870,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
if (ob->type == OB_MESH) {
if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) {
/* -- convert to rna ? */
- but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
+ but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0,
+ UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
TIP_("Apply modifier to editing cage during Edit mode"));
if (index < cageIndex)
uiButSetFlag(but, UI_BUT_DISABLED);
@@ -803,7 +882,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
/* place holder button */
uiBlockSetEmboss(block, UI_EMBOSSN);
- but = uiDefIconBut(block, BUT, 0, ICON_NONE, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, NULL);
+ but = uiDefIconBut(block, BUT, 0, ICON_NONE, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, NULL);
uiButSetFlag(but, UI_BUT_DISABLED);
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -813,7 +893,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
/* add disabled pre-tessellated button, so users could have
* message for this modifiers */
- but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
+ but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0,
+ UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
TIP_("This modifier could be applied on splines' points only"));
uiButSetFlag(but, UI_BUT_DISABLED);
}
@@ -867,15 +948,20 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply"), 0, "apply_as", MODIFIER_APPLY_DATA);
- if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md))
- uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape Key"), 0, "apply_as", MODIFIER_APPLY_SHAPE);
+ if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) {
+ uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape Key"), 0,
+ "apply_as", MODIFIER_APPLY_SHAPE);
+ }
}
uiBlockClearButLock(block);
uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE);
- if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth, eModifierType_Smoke))
+ if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem,
+ eModifierType_Cloth, eModifierType_Smoke))
+ {
uiItemO(row, IFACE_("Copy"), ICON_NONE, "OBJECT_OT_modifier_copy");
+ }
}
/* result is the layout block inside the box, that we return so that modifier settings can be drawn */
@@ -1047,8 +1133,10 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
uiBlockSetEmboss(block, UI_EMBOSSN);
/* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */
- uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco + 244, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
- uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 262, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
+ uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco + 244, yco, 19, 19,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
+ uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco + 262, yco, 19, 19,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected"));
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -1077,7 +1165,8 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
/* enabled */
uiBlockSetEmboss(block, UI_EMBOSSN);
- uiItemR(row, &ptr, "mute", 0, "", (con->flag & CONSTRAINT_OFF) ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF);
+ uiItemR(row, &ptr, "mute", 0, "",
+ (con->flag & CONSTRAINT_OFF) ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF);
uiBlockSetEmboss(block, UI_EMBOSS);
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
@@ -1234,14 +1323,22 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr);
uiLayoutRow(layout, TRUE);
- uiDefButS(block, ROW, B_MATPRV, IFACE_("Texture"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
- if (GS(parent->name) == ID_MA)
- uiDefButS(block, ROW, B_MATPRV, IFACE_("Material"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
- else if (GS(parent->name) == ID_LA)
- uiDefButS(block, ROW, B_MATPRV, IFACE_("Lamp"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
- else if (GS(parent->name) == ID_WO)
- uiDefButS(block, ROW, B_MATPRV, IFACE_("World"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
- uiDefButS(block, ROW, B_MATPRV, IFACE_("Both"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, "");
+ uiDefButS(block, ROW, B_MATPRV, IFACE_("Texture"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+ pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
+ if (GS(parent->name) == ID_MA) {
+ uiDefButS(block, ROW, B_MATPRV, IFACE_("Material"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+ pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+ }
+ else if (GS(parent->name) == ID_LA) {
+ uiDefButS(block, ROW, B_MATPRV, IFACE_("Lamp"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+ pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+ }
+ else if (GS(parent->name) == ID_WO) {
+ uiDefButS(block, ROW, B_MATPRV, IFACE_("World"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+ pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
+ }
+ uiDefButS(block, ROW, B_MATPRV, IFACE_("Both"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+ pr_texture, 10, TEX_PR_BOTH, 0, 0, "");
/* Alpha button for texture preview */
if (*pr_texture != TEX_PR_OTHER) {
@@ -1331,7 +1428,8 @@ static void colorband_update_cb(bContext *UNUSED(C), void *bt_v, void *coba_v)
}
/* offset aligns from bottom, standard width 300, height 115 */
-static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand *coba, int xoffs, int yoffs, RNAUpdateCb *cb)
+static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand *coba,
+ int xoffs, int yoffs, RNAUpdateCb *cb)
{
uiBut *bt;
uiLayout *row;
@@ -1350,13 +1448,16 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
/* XXX, todo for later - convert to operator - campbell */
- bt = uiDefBut(block, BUT, 0, "F", 95 + xoffs, line1_y, 20, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Flip colorband"));
+ bt = uiDefBut(block, BUT, 0, "F", 95 + xoffs, line1_y, 20, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Flip colorband"));
uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
- uiDefButS(block, NUM, 0, "", 120 + xoffs, line1_y, 80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot - 1)), 0, 0, TIP_("Choose active color stop"));
+ uiDefButS(block, NUM, 0, "", 120 + xoffs, line1_y, 80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot - 1)),
+ 0, 0, TIP_("Choose active color stop"));
- bt = uiDefButS(block, MENU, 0, IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"),
- 210 + xoffs, line1_y, 90, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, TIP_("Set interpolation between color stops"));
+ bt = uiDefButS(block, MENU, 0, IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"),
+ 210 + xoffs, line1_y, 90, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0,
+ TIP_("Set interpolation between color stops"));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
uiBlockEndAlign(block);
@@ -1392,10 +1493,11 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
bt = uiDefBut(block, BUT, 0, IFACE_("Add"), xs, butr->ymin + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y, NULL, 0, 0, 0, 0,
TIP_("Add a new color stop to the colorband"));
uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba);
- bt = uiDefBut(block, BUT, 0, IFACE_("Delete"), xs + 2.0f * unit, butr->ymin + UI_UNIT_Y, 1.5f * unit, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- TIP_("Delete the active position"));
+ bt = uiDefBut(block, BUT, 0, IFACE_("Delete"), xs + 2.0f * unit, butr->ymin + UI_UNIT_Y, 1.5f * unit, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Delete the active position"));
uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba);
- bt = uiDefBut(block, BUT, 0, "F", xs + 3.5f * unit, butr->ymin + UI_UNIT_Y, 0.5f * unit, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Flip the color ramp"));
+ bt = uiDefBut(block, BUT, 0, "F", xs + 3.5f * unit, butr->ymin + UI_UNIT_Y, 0.5f * unit, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Flip the color ramp"));
uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
uiBlockEndAlign(block);
@@ -1407,7 +1509,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
}
bt = uiDefButS(block, MENU, 0, IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"),
- xs + 10.0f * unit, butr->ymin + UI_UNIT_Y, unit * 4, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0,
+ xs + 10.0f * unit, butr->ymin + UI_UNIT_Y, unit * 4, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0,
TIP_("Set interpolation between color stops"));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
@@ -1417,7 +1519,8 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
uiBlockEndAlign(block);
}
-static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, int small, RNAUpdateCb *cb)
+static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr,
+ int small, RNAUpdateCb *cb)
{
if (small)
colorband_buttons_small(layout, block, coba, butr, cb);
@@ -1486,7 +1589,8 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
hist->height = (hist->height <= UI_UNIT_Y) ? UI_UNIT_Y : hist->height;
- bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), hist->height, hist, 0, 0, 0, 0, "");
+ bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), hist->height, hist,
+ 0, 0, 0, 0, "");
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
MEM_freeN(cb);
@@ -1523,7 +1627,8 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height;
- bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->wavefrm_height, scopes, 0, 0, 0, 0, "");
+ bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->wavefrm_height, scopes,
+ 0, 0, 0, 0, "");
(void)bt; /* UNUSED */
MEM_freeN(cb);
@@ -1560,7 +1665,8 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
scopes->vecscope_height = (scopes->vecscope_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->vecscope_height;
- bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
+ bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect),
+ scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
MEM_freeN(cb);
@@ -1659,10 +1765,14 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v)
uiButSetFunc(bt, curvemap_buttons_setclip, cumap, NULL);
uiBlockBeginAlign(block);
- uiDefButF(block, NUM, 0, IFACE_("Min X "), 0, 4 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, "");
- uiDefButF(block, NUM, 0, IFACE_("Min Y "), 0, 3 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, "");
- uiDefButF(block, NUM, 0, IFACE_("Max X "), 0, 2 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, "");
- uiDefButF(block, NUM, 0, IFACE_("Max Y "), 0, UI_UNIT_Y, width, UI_UNIT_Y, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, IFACE_("Min X "), 0, 4 * UI_UNIT_Y, width, UI_UNIT_Y,
+ &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, "");
+ uiDefButF(block, NUM, 0, IFACE_("Min Y "), 0, 3 * UI_UNIT_Y, width, UI_UNIT_Y,
+ &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, "");
+ uiDefButF(block, NUM, 0, IFACE_("Max X "), 0, 2 * UI_UNIT_Y, width, UI_UNIT_Y,
+ &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, "");
+ uiDefButF(block, NUM, 0, IFACE_("Max Y "), 0, UI_UNIT_Y, width, UI_UNIT_Y,
+ &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, "");
uiBlockSetDirection(block, UI_RIGHT);
@@ -1711,12 +1821,18 @@ static uiBlock *curvemap_tools_func(bContext *C, ARegion *ar, void *cumap_v)
block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Horizontal"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Horizontal"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 50);
@@ -1733,10 +1849,14 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *ar, void *cumap_
block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco -= UI_UNIT_Y,
+ menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 50);
@@ -1776,7 +1896,8 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
}
/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */
-static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labeltype, int levels, int brush, RNAUpdateCb *cb)
+static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labeltype, int levels,
+ int brush, RNAUpdateCb *cb)
{
CurveMapping *cumap = ptr->data;
CurveMap *cm = &cumap->cm[cumap->cur];
@@ -1957,7 +2078,8 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn
#define WHEEL_SIZE 100
/* This template now follows User Preference for type - name is not correct anymore... */
-void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic)
+void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider,
+ int lock, int lock_luminosity, int cubic)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
uiBlock *block = uiLayoutGetBlock(layout);
@@ -1977,16 +2099,20 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna
switch (U.color_picker_type) {
case USER_CP_CIRCLE:
- but = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, "");
+ but = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, 0, 0, "");
break;
case USER_CP_SQUARE_SV:
- but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, UI_GRAD_SV, 0, "");
+ but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, UI_GRAD_SV, 0, "");
break;
case USER_CP_SQUARE_HS:
- but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, UI_GRAD_HS, 0, "");
+ but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, UI_GRAD_HS, 0, "");
break;
case USER_CP_SQUARE_HV:
- but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, UI_GRAD_HV, 0, "");
+ but = uiDefButR_prop(block, HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, UI_GRAD_HV, 0, "");
break;
}
@@ -2011,19 +2137,23 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna
switch (U.color_picker_type) {
case USER_CP_CIRCLE:
uiItemS(row);
- uiDefButR_prop(block, HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
+ uiDefButR_prop(block, HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
break;
case USER_CP_SQUARE_SV:
uiItemS(col);
- uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, -1, softmin, softmax, UI_GRAD_SV + 3, 0, "");
+ uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_SV + 3, 0, "");
break;
case USER_CP_SQUARE_HS:
uiItemS(col);
- uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, -1, softmin, softmax, UI_GRAD_HS + 3, 0, "");
+ uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_HS + 3, 0, "");
break;
case USER_CP_SQUARE_HV:
uiItemS(col);
- uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, -1, softmin, softmax, UI_GRAD_HV + 3, 0, "");
+ uiDefButR_prop(block, HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_HV + 3, 0, "");
break;
}
@@ -2185,7 +2315,8 @@ void uiTemplateGameStates(uiLayout *layout, PointerRNA *ptr, const char *propnam
else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, state))
icon = ICON_LAYER_USED;
- but = uiDefIconButR_prop(block, ICONTOG, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop, state, 0, 0, -1, -1, sca_state_name_get(ob, state));
+ but = uiDefIconButR_prop(block, ICONTOG, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop,
+ state, 0, 0, -1, -1, sca_state_name_get(ob, state));
uiButSetFunc(but, handle_layer_buttons, but, SET_INT_IN_POINTER(state));
but->type = TOG;
}
@@ -2233,7 +2364,8 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int
return rnaicon;
}
-static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i, int rnaicon, PointerRNA *activeptr, PropertyRNA *activeprop, const char *prop_list_id)
+static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i,
+ int rnaicon, PointerRNA *activeptr, PropertyRNA *activeprop, const char *prop_list_id)
{
uiBlock *block = uiLayoutGetBlock(layout);
uiBut *but;
@@ -2247,7 +2379,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
/* list item behind label & other buttons */
sub = uiLayoutRow(overlap, FALSE);
- but = uiDefButR_prop(block, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, activeptr, activeprop, 0, 0, i, 0, 0, "");
+ but = uiDefButR_prop(block, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, activeptr, activeprop,
+ 0, 0, i, 0, 0, "");
uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
sub = uiLayoutRow(overlap, FALSE);
@@ -2264,7 +2397,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
if (itemptr->type == &RNA_MeshTexturePolyLayer || itemptr->type == &RNA_MeshLoopColorLayer) {
uiItemL(sub, name, icon);
uiBlockSetEmboss(block, UI_EMBOSSN);
- uiDefIconButR(block, TOG, 0, ICON_SCENE, 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "active_render", 0, 0, 0, 0, 0, NULL);
+ uiDefIconButR(block, TOG, 0, ICON_SCENE, 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "active_render",
+ 0, 0, 0, 0, 0, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
}
else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialTextureSlot)) {
@@ -2357,7 +2491,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
uiItemL(sub, name_final, icon);
if (dynamicPaint_surfaceHasColorPreview(surface)) {
uiBlockSetEmboss(block, UI_EMBOSSN);
- uiDefIconButR(block, OPTION, 0, (surface->flags & MOD_DPAINT_PREVIEW) ? ICON_RESTRICT_VIEW_OFF : ICON_RESTRICT_VIEW_ON,
+ uiDefIconButR(block, OPTION, 0,
+ (surface->flags & MOD_DPAINT_PREVIEW) ? ICON_RESTRICT_VIEW_OFF : ICON_RESTRICT_VIEW_ON,
0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "show_preview", 0, 0, 0, 0, 0, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -2446,7 +2581,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
}
}
-void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr, const char *activepropname, const char *prop_list, int rows, int maxrows, int listtype)
+void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr,
+ const char *activepropname, const char *prop_list, int rows, int maxrows, int listtype)
{
PropertyRNA *prop = NULL, *activeprop;
PropertyType type, activetype;
@@ -2522,7 +2658,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
row = uiLayoutRow(col, FALSE);
icon = list_item_icon_get(C, &itemptr, rnaicon, 1);
- but = uiDefIconButR_prop(block, LISTROW, 0, icon, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, activeptr, activeprop, 0, 0, i, 0, 0, "");
+ but = uiDefIconButR_prop(block, LISTROW, 0, icon, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, activeptr,
+ activeprop, 0, 0, i, 0, 0, "");
uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
@@ -2564,7 +2701,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
/* next/prev button */
BLI_snprintf(numstr, sizeof(numstr), "%d :", i);
- but = uiDefIconTextButR_prop(block, NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, activeptr, activeprop, 0, 0, 0, 0, 0, "");
+ but = uiDefIconTextButR_prop(block, NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, activeptr,
+ activeprop, 0, 0, 0, 0, 0, "");
if (i == 0)
uiButSetFlag(but, UI_BUT_DISABLED);
}
@@ -2621,7 +2759,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
/* add scrollbar */
if (len > items) {
col = uiLayoutColumn(row, FALSE);
- uiDefButI(block, SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * items, &pa->list_scroll, 0, len - items, items, 0, "");
+ uiDefButI(block, SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * items, &pa->list_scroll,
+ 0, len - items, items, 0, "");
}
}
}
@@ -2768,19 +2907,19 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
ui_abs = uiLayoutAbsolute(layout, FALSE);
(void)ui_abs; /* UNUSED */
- uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE,
- 0, UI_UNIT_Y * 0.1, UI_UNIT_X * 0.8, UI_UNIT_Y * 0.8, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job"));
+ uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE, 0, UI_UNIT_Y * 0.1, UI_UNIT_X * 0.8, UI_UNIT_Y * 0.8,
+ NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job"));
uiDefBut(block, PROGRESSBAR, 0, WM_jobs_name(wm, owner),
UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, TIP_("Progress"));
uiLayoutRow(layout, FALSE);
}
if (WM_jobs_test(wm, screen, WM_JOB_TYPE_SCREENCAST))
- uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, 85, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
- TIP_("Stop screencast"));
+ uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, 85, UI_UNIT_Y,
+ NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop screencast"));
if (screen->animtimer)
- uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, IFACE_("Anim Player"), 0, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
- TIP_("Stop animation playback"));
+ uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, IFACE_("Anim Player"), 0, 0, 100, UI_UNIT_Y,
+ NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop animation playback"));
}
/************************* Reports for Last Operator Template **************************/
@@ -2819,7 +2958,8 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
rgb_float_to_uchar(but->col, rti->col);
but->col[3] = 255;
- but = uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+ but = uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y,
+ NULL, 0.0f, 0.0f, 0, 0, "");
but->col[0] = but->col[1] = but->col[2] = FTOCHAR(rti->grayscale);
but->col[3] = 255;
@@ -2840,14 +2980,15 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
uiBlockSetEmboss(block, UI_EMBOSSN);
if (reports->list.first != reports->list.last)
- uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0,
- UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see the remaining reports in text block: 'Recent Reports'"));
+ uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X,
+ UI_UNIT_Y, TIP_("Click to see the remaining reports in text block: 'Recent Reports'"));
else
uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
uiBlockSetEmboss(block, UI_EMBOSS);
- uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+ uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y,
+ NULL, 0.0f, 0.0f, 0, 0, "");
}
/********************************* Keymap *************************************/
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index b8736d4f1d0..65d70e231a4 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -108,8 +108,8 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op)
obedit = make_prim_init(C, "Plane", &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
- if (!EDBM_op_call_and_selectf(em, op, "vertout",
- "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", 1, 1, dia, mat))
+ if (!EDBM_op_call_and_selectf(em, op, "verts.out",
+ "create_grid x_segments=%i y_segments=%i size=%f mat=%m4", 1, 1, dia, mat))
{
return OPERATOR_CANCELLED;
}
@@ -149,7 +149,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
obedit = make_prim_init(C, "Cube", &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
- if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_cube mat=%m4 size=%f", mat, dia * 2.0f)) {
+ if (!EDBM_op_call_and_selectf(em, op, "verts.out", "create_cube mat=%m4 size=%f", mat, dia * 2.0f)) {
return OPERATOR_CANCELLED;
}
@@ -198,7 +198,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
obedit = make_prim_init(C, "Circle", &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
- if (!EDBM_op_call_and_selectf(em, op, "vertout",
+ if (!EDBM_op_call_and_selectf(em, op, "verts.out",
"create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b mat=%m4",
RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius") * dia,
cap_end, cap_tri, mat))
@@ -253,7 +253,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
- em, op, "vertout",
+ em, op, "verts.out",
"create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f mat=%m4",
RNA_int_get(op->ptr, "vertices"),
RNA_float_get(op->ptr, "radius") * dia,
@@ -313,7 +313,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
- em, op, "vertout",
+ em, op, "verts.out",
"create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f mat=%m4",
RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius1") * dia,
RNA_float_get(op->ptr, "radius2") * dia, cap_end, cap_tri, RNA_float_get(op->ptr, "depth") * dia, mat))
@@ -368,8 +368,8 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op)
obedit = make_prim_init(C, "Grid", &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
- if (!EDBM_op_call_and_selectf(em, op, "vertout",
- "create_grid xsegments=%i ysegments=%i size=%f mat=%m4",
+ if (!EDBM_op_call_and_selectf(em, op, "verts.out",
+ "create_grid x_segments=%i y_segments=%i size=%f mat=%m4",
RNA_int_get(op->ptr, "x_subdivisions"),
RNA_int_get(op->ptr, "y_subdivisions"),
RNA_float_get(op->ptr, "size") * dia, mat))
@@ -427,7 +427,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
em = BMEdit_FromObject(obedit);
- if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_monkey mat=%m4", mat)) {
+ if (!EDBM_op_call_and_selectf(em, op, "verts.out", "create_monkey mat=%m4", mat)) {
return OPERATOR_CANCELLED;
}
@@ -466,8 +466,8 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
obedit = make_prim_init(C, "Sphere", &dia, mat, &state, loc, rot, layer);
em = BMEdit_FromObject(obedit);
- if (!EDBM_op_call_and_selectf(em, op, "vertout",
- "create_uvsphere segments=%i revolutions=%i diameter=%f mat=%m4",
+ if (!EDBM_op_call_and_selectf(em, op, "verts.out",
+ "create_uvsphere u_segments=%i v_segments=%i diameter=%f mat=%m4",
RNA_int_get(op->ptr, "segments"), RNA_int_get(op->ptr, "ring_count"),
RNA_float_get(op->ptr, "size") * dia, mat))
{
@@ -518,7 +518,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
em = BMEdit_FromObject(obedit);
if (!EDBM_op_call_and_selectf(
- em, op, "vertout",
+ em, op, "verts.out",
"create_icosphere subdivisions=%i diameter=%f mat=%m4",
RNA_int_get(op->ptr, "subdivisions"),
RNA_float_get(op->ptr, "size") * dia, mat))
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 5ba85115b2f..aed16be5b73 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1823,7 +1823,7 @@ static void remerge_faces(KnifeTool_OpData *kcd)
BMO_op_initf(bm, &bmop, "beautify_fill faces=%ff constrain_edges=%fe", FACE_NEW, BOUNDARY);
BMO_op_exec(bm, &bmop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE, FACE_NEW);
+ BMO_slot_buffer_flag_enable(bm, &bmop, "geom.out", BM_FACE, FACE_NEW);
BMO_op_finish(bm, &bmop);
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index 6379bdbc0ca..d3a4c951e06 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -489,7 +489,7 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
}
/* face should never exist */
- BLI_assert(BM_face_exists(bm, f_verts, f_verts[3] ? 4 : 3, &f) == FALSE);
+ BLI_assert(BM_face_exists(f_verts, f_verts[3] ? 4 : 3, &f) == FALSE);
f = BM_face_create_quad_tri_v(bm, f_verts, f_verts[3] ? 4 : 3, f_example, FALSE);
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 8b217223907..2f40d281505 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -734,7 +734,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_ALL, BM_ELEM_SELECT, TRUE);
/* finish the operator */
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -775,7 +775,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_ALL, BM_ELEM_SELECT, TRUE);
EDBM_selectmode_flush(em);
/* finish the operator */
@@ -819,7 +819,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_ALL, BM_ELEM_SELECT, TRUE);
/* finish the operator */
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -1085,7 +1085,7 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot)
/* ***************** loop select (non modal) ************** */
-static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
+static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short deselect, short toggle, short ring)
{
ViewContext vc;
BMEditMesh *em;
@@ -1104,14 +1104,20 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
eed = EDBM_edge_find_nearest(&vc, &dist);
if (eed) {
- if (extend == 0) {
+ if (extend == 0 && deselect == 0 && toggle == 0) {
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
}
- if (BM_elem_flag_test(eed, BM_ELEM_SELECT) == 0) {
+ if (extend) {
select = TRUE;
}
- else if (extend) {
+ else if (deselect) {
+ select = FALSE;
+ }
+ else if (BM_elem_flag_test(eed, BM_ELEM_SELECT) == 0) {
+ select = TRUE;
+ }
+ else if (toggle) {
select = FALSE;
}
@@ -1204,6 +1210,8 @@ static int edbm_select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event)
view3d_operator_needs_opengl(C);
mouse_mesh_loop(C, event->mval, RNA_boolean_get(op->ptr, "extend"),
+ RNA_boolean_get(op->ptr, "deselect"),
+ RNA_boolean_get(op->ptr, "toggle"),
RNA_boolean_get(op->ptr, "ring"));
/* cannot do tweaks for as long this keymap is after transform map */
@@ -1226,6 +1234,8 @@ void MESH_OT_loop_select(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "Extend the selection");
+ RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from the selection");
+ RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Select", "Toggle the selection");
RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "Select ring");
}
@@ -1244,6 +1254,8 @@ void MESH_OT_edgering_select(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
+ RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from the selection");
+ RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Select", "Toggle the selection");
RNA_def_boolean(ot->srna, "ring", 1, "Select Ring", "Select ring");
}
@@ -2248,6 +2260,8 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *
return OPERATOR_CANCELLED;
if (limit) {
+ /* grr, shouldn't need to alloc BMO flags here */
+ BM_mesh_elem_toolflags_ensure(bm);
/* hflag no-seam --> bmo-tag */
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
/* BMESH_TODO, don't use 'BM_ELEM_SELECT' here, its a HFLAG only! */
@@ -2340,6 +2354,8 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
}
if (limit) {
+ /* grr, shouldn't need to alloc BMO flags here */
+ BM_mesh_elem_toolflags_ensure(bm);
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
/* BMESH_TODO, don't use 'BM_ELEM_SELECT' here, its a HFLAG only! */
BMO_elem_flag_set(bm, e, BM_ELEM_SELECT, !BM_elem_flag_test(e, BM_ELEM_SEAM));
@@ -2360,6 +2376,10 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
}
}
BMW_end(&walker);
+
+ if (limit) {
+ BM_mesh_elem_toolflags_clear(bm);
+ }
}
else {
BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
@@ -2505,6 +2525,9 @@ static void walker_deselect_nth(BMEditMesh *em, int nth, int offset, BMHeader *h
break;
}
+ /* grr, shouldn't need to alloc BMO flags here */
+ BM_mesh_elem_toolflags_ensure(bm);
+
/* Walker restrictions uses BMO flags, not header flags,
* so transfer BM_ELEM_SELECT from HFlags onto a BMO flag layer. */
BMO_push(bm, NULL);
diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c
index d370b5a881e..c32033054e0 100644
--- a/source/blender/editors/mesh/editmesh_slide.c
+++ b/source/blender/editors/mesh/editmesh_slide.c
@@ -738,10 +738,10 @@ static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_u
BMO_op_exec(bm, &bmop);
/* Deselect the input edges */
- BMO_slot_buffer_hflag_disable(bm, &bmop, "edge", BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_disable(bm, bmop.slots_in, "edge", BM_ALL, BM_ELEM_SELECT, TRUE);
/* Select the output vert */
- BMO_slot_buffer_hflag_enable(bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(bm, bmop.slots_out, "verts.out", BM_ALL, BM_ELEM_SELECT, TRUE);
/* Flush the select buffers */
EDBM_selectmode_flush(em);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 2b3f7faf8fc..eb98efdfea3 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -72,6 +72,7 @@
#include "RE_render_ext.h"
#include "UI_interface.h"
+#include "UI_resources.h"
#include "mesh_intern.h"
@@ -242,7 +243,7 @@ static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const c
BMO_op_exec(em->bm, &bmop);
- BMO_ITER (f, &siter, em->bm, &bmop, "faceout", BM_FACE) {
+ BMO_ITER (f, &siter, bmop.slots_out, "faces.out", BM_FACE) {
BM_face_select_set(em->bm, f, TRUE);
/* set face vertex normals to face normal */
@@ -269,7 +270,7 @@ static short edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
BMO_op_exec(em->bm, &bmop);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_VERT | BM_EDGE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_VERT | BM_EDGE, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return 0;
@@ -286,10 +287,10 @@ static short edbm_extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char
EDBM_op_init(em, &bmop, op, "extrude_vert_indiv verts=%hv", hflag);
/* deselect original verts */
- BMO_slot_buffer_hflag_disable(em->bm, &bmop, "verts", BM_VERT, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "verts", BM_VERT, BM_ELEM_SELECT, TRUE);
BMO_op_exec(em->bm, &bmop);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_VERT, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return 0;
@@ -308,9 +309,12 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
BMFace *f;
ModifierData *md;
BMElem *ele;
+ BMOpSlot *slot_edges_exclude;
BMO_op_init(bm, &extop, BMO_FLAG_DEFAULTS, "extrude_face_region");
- BMO_slot_buffer_from_enabled_hflag(bm, &extop, "edgefacein", BM_VERT | BM_EDGE | BM_FACE, hflag);
+ BMO_slot_buffer_from_enabled_hflag(bm, &extop, extop.slots_in, "geom", BM_VERT | BM_EDGE | BM_FACE, hflag);
+
+ slot_edges_exclude = BMO_slot_get(extop.slots_in, "edges_exclude");
/* If a mirror modifier with clipping is on, we need to adjust some
* of the cases above to handle edges on the line of symmetry.
@@ -350,21 +354,21 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
if ((fabsf(co1[0]) < mmd->tolerance) &&
(fabsf(co2[0]) < mmd->tolerance))
{
- BMO_slot_map_ptr_insert(bm, &extop, "exclude", edge, NULL);
+ BMO_slot_map_ptr_insert(&extop, slot_edges_exclude, edge, NULL);
}
}
if (mmd->flag & MOD_MIR_AXIS_Y) {
if ((fabsf(co1[1]) < mmd->tolerance) &&
(fabsf(co2[1]) < mmd->tolerance))
{
- BMO_slot_map_ptr_insert(bm, &extop, "exclude", edge, NULL);
+ BMO_slot_map_ptr_insert(&extop, slot_edges_exclude, edge, NULL);
}
}
if (mmd->flag & MOD_MIR_AXIS_Z) {
if ((fabsf(co1[2]) < mmd->tolerance) &&
(fabsf(co2[2]) < mmd->tolerance))
{
- BMO_slot_map_ptr_insert(bm, &extop, "exclude", edge, NULL);
+ BMO_slot_map_ptr_insert(&extop, slot_edges_exclude, edge, NULL);
}
}
}
@@ -379,7 +383,7 @@ static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag,
zero_v3(nor);
- BMO_ITER (ele, &siter, bm, &extop, "geomout", BM_ALL) {
+ BMO_ITER (ele, &siter, extop.slots_out, "geom.out", BM_ALL) {
BM_elem_select_set(bm, ele, TRUE);
if (ele->head.htype == BM_FACE) {
@@ -449,7 +453,7 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op)
for (a = 0; a < steps; a++) {
edbm_extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
- //BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, "extrude_face_region edgefacein=%hef", BM_ELEM_SELECT);
+ //BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, "extrude_face_region geom=%hef", BM_ELEM_SELECT);
BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
"translate vec=%v verts=%hv",
(float *)dvec, BM_ELEM_SELECT);
@@ -915,7 +919,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent
EDBM_op_init(vc.em, &bmop, op, "create_vert co=%v", min);
BMO_op_exec(vc.em->bm, &bmop);
- BMO_ITER (v1, &oiter, vc.em->bm, &bmop, "newvertout", BM_VERT) {
+ BMO_ITER (v1, &oiter, bmop.slots_out, "vert.out", BM_VERT) {
BM_vert_select_set(vc.em->bm, v1, TRUE);
}
@@ -1110,8 +1114,8 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
}
BMO_op_exec(em->bm, &bmop);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -1261,7 +1265,7 @@ static int edbm_vert_connect(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
BMO_op_exec(bm, &bmop);
- len = BMO_slot_get(&bmop, "edgeout")->len;
+ len = BMO_slot_get(bmop.slots_out, "edges.out")->len;
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
}
@@ -1301,7 +1305,7 @@ static int edbm_edge_split_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
BMO_op_exec(bm, &bmop);
- len = BMO_slot_get(&bmop, "edgeout")->len;
+ len = BMO_slot_get(bmop.slots_out, "edges.out")->len;
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
}
@@ -1339,7 +1343,7 @@ static int edbm_duplicate_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "newout", BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -1405,8 +1409,8 @@ void MESH_OT_flip_normals(wmOperatorType *ot)
}
static const EnumPropertyItem direction_items[] = {
- {DIRECTION_CW, "CW", 0, "Clockwise", ""},
- {DIRECTION_CCW, "CCW", 0, "Counter Clockwise", ""},
+ {FALSE, "CW", 0, "Clockwise", ""},
+ {TRUE, "CCW", 0, "Counter Clockwise", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -1418,7 +1422,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
BMOperator bmop;
BMEdge *eed;
BMIter iter;
- const int do_ccw = RNA_enum_get(op->ptr, "direction") == 1;
+ const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
int tot = 0;
if (em->bm->totedgesel == 0) {
@@ -1448,17 +1452,17 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Could not find any selected edges that can be rotated");
return OPERATOR_CANCELLED;
}
-
- EDBM_op_init(em, &bmop, op, "rotate_edges edges=%he ccw=%b", BM_ELEM_TAG, do_ccw);
+
+ EDBM_op_init(em, &bmop, op, "rotate_edges edges=%he use_ccw=%b", BM_ELEM_TAG, use_ccw);
/* avoids leaving old verts selected which can be a problem running multiple times,
* since this means the edges become selected around the face which then attempt to rotate */
- BMO_slot_buffer_hflag_disable(em->bm, &bmop, "edges", BM_EDGE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_in, "edges", BM_EDGE, BM_ELEM_SELECT, TRUE);
BMO_op_exec(em->bm, &bmop);
/* edges may rotate into hidden vertices, if this does _not_ run we get an ilogical state */
- BMO_slot_buffer_hflag_disable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_HIDDEN, TRUE);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_HIDDEN, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, TRUE);
EDBM_selectmode_flush(em);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -1485,7 +1489,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
- RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate edge around");
+ RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", "");
}
@@ -1553,7 +1557,7 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op)
/* doflip has to do with bmesh_rationalize_normals, it's an internal
* thing */
- if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf do_flip=%b", BM_ELEM_SELECT, TRUE))
+ if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf use_flip=%b", BM_ELEM_SELECT, TRUE))
return OPERATOR_CANCELLED;
if (RNA_boolean_get(op->ptr, "inside"))
@@ -1590,7 +1594,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
ModifierData *md;
int mirrx = FALSE, mirry = FALSE, mirrz = FALSE;
int i, repeat;
- float clipdist = 0.0f;
+ float clip_dist = 0.0f;
int xaxis = RNA_boolean_get(op->ptr, "xaxis");
int yaxis = RNA_boolean_get(op->ptr, "yaxis");
@@ -1616,7 +1620,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
if (mmd->flag & MOD_MIR_AXIS_Z)
mirrz = TRUE;
- clipdist = mmd->tolerance;
+ clip_dist = mmd->tolerance;
}
}
}
@@ -1627,9 +1631,9 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
for (i = 0; i < repeat; i++) {
if (!EDBM_op_callf(em, op,
- "smooth_vert verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f "
+ "smooth_vert verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clip_dist=%f "
"use_axis_x=%b use_axis_y=%b use_axis_z=%b",
- BM_ELEM_SELECT, mirrx, mirry, mirrz, clipdist, xaxis, yaxis, zaxis))
+ BM_ELEM_SELECT, mirrx, mirry, mirrz, clip_dist, xaxis, yaxis, zaxis))
{
return OPERATOR_CANCELLED;
}
@@ -1670,7 +1674,7 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- int usex = TRUE, usey = TRUE, usez = TRUE, volume_preservation = TRUE;
+ int usex = TRUE, usey = TRUE, usez = TRUE, preserve_volume = TRUE;
int i, repeat;
float lambda;
float lambda_border;
@@ -1698,14 +1702,14 @@ static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op)
usex = RNA_boolean_get(op->ptr, "use_x");
usey = RNA_boolean_get(op->ptr, "use_y");
usez = RNA_boolean_get(op->ptr, "use_z");
- volume_preservation = RNA_boolean_get(op->ptr, "volume_preservation");
+ preserve_volume = RNA_boolean_get(op->ptr, "preserve_volume");
if (!repeat)
repeat = 1;
for (i = 0; i < repeat; i++) {
if (!EDBM_op_callf(em, op,
- "smooth_laplacian_vert verts=%hv lambda=%f lambda_border=%f use_x=%b use_y=%b use_z=%b volume_preservation=%b",
- BM_ELEM_SELECT, lambda, lambda_border, usex, usey, usez, volume_preservation))
+ "smooth_laplacian_vert verts=%hv lambda=%f lambda_border=%f use_x=%b use_y=%b use_z=%b preserve_volume=%b",
+ BM_ELEM_SELECT, lambda, lambda_border, usex, usey, usez, preserve_volume))
{
return OPERATOR_CANCELLED;
}
@@ -1745,7 +1749,7 @@ void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_x", 1, "Smooth X Axis", "Smooth object along X axis");
RNA_def_boolean(ot->srna, "use_y", 1, "Smooth Y Axis", "Smooth object along Y axis");
RNA_def_boolean(ot->srna, "use_z", 1, "Smooth Z Axis", "Smooth object along Z axis");
- RNA_def_boolean(ot->srna, "volume_preservation", 1, "Preserve Volume", "Apply volume preservation after smooth");
+ RNA_def_boolean(ot->srna, "preserve_volume", 1, "Preserve Volume", "Apply volume preservation after smooth");
}
/********************** Smooth/Solid Operators *************************/
@@ -1828,10 +1832,10 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* get the direction from RNA */
- int dir = RNA_enum_get(op->ptr, "direction");
+ const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "rotate_uvs faces=%hf dir=%i", BM_ELEM_SELECT, dir);
+ EDBM_op_init(em, &bmop, op, "rotate_uvs faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1877,10 +1881,10 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* get the direction from RNA */
- int dir = RNA_enum_get(op->ptr, "direction");
+ const int use_ccw = RNA_boolean_get(op->ptr, "use_ccw");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "rotate_colors faces=%hf dir=%i", BM_ELEM_SELECT, dir);
+ EDBM_op_init(em, &bmop, op, "rotate_colors faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1936,7 +1940,7 @@ void MESH_OT_uvs_rotate(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
- RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate UVs around");
+ RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", "");
}
//void MESH_OT_uvs_mirror(wmOperatorType *ot)
@@ -1973,7 +1977,7 @@ void MESH_OT_colors_rotate(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
- RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CCW, "Direction", "Direction to rotate edge around");
+ RNA_def_boolean(ot->srna, "use_ccw", FALSE, "Counter Clockwise", "");
}
void MESH_OT_colors_reverse(wmOperatorType *ot)
@@ -2174,7 +2178,7 @@ void MESH_OT_merge(wmOperatorType *ot)
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", merge_type_items, 3, "Type", "Merge method to use");
RNA_def_enum_funcs(ot->prop, merge_type_itemf);
- RNA_def_boolean(ot->srna, "uvs", 1, "UVs", "Move UVs according to merge");
+ RNA_def_boolean(ot->srna, "uvs", 0, "UVs", "Move UVs according to merge");
}
@@ -2204,7 +2208,7 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
BM_ELEM_SELECT, threshold);
BMO_op_exec(em->bm, &bmop);
- if (!EDBM_op_callf(em, op, "weld_verts targetmap=%s", &bmop, "targetmapout")) {
+ if (!EDBM_op_callf(em, op, "weld_verts targetmap=%S", &bmop, "targetmap.out")) {
BMO_op_finish(em->bm, &bmop);
return OPERATOR_CANCELLED;
}
@@ -2313,7 +2317,7 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
/* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */
/* select the output */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_ALL, BM_ELEM_SELECT, TRUE);
/* finish the operator */
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -2505,6 +2509,22 @@ static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr), Prop
return item;
}
+static void edbm_blend_from_shape_ui(bContext *C, wmOperator *op)
+{
+ uiLayout *layout = op->layout;
+ PointerRNA ptr;
+ Object *obedit = CTX_data_edit_object(C);
+ Mesh *me = obedit->data;
+ PointerRNA ptr_key;
+
+ RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
+ RNA_id_pointer_create((ID *)me->key, &ptr_key);
+
+ uiItemPointerR(layout, &ptr, "shape", &ptr_key, "key_blocks", "", ICON_SHAPEKEY_DATA);
+ uiItemR(layout, &ptr, "blend", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "add", 0, NULL, ICON_NONE);
+}
+
void MESH_OT_blend_from_shape(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -2517,7 +2537,8 @@ void MESH_OT_blend_from_shape(wmOperatorType *ot)
/* api callbacks */
ot->exec = edbm_blend_from_shape_exec;
- ot->invoke = WM_operator_props_popup_call;
+// ot->invoke = WM_operator_props_popup_call; /* disable because search popup closes too easily */
+ ot->ui = edbm_blend_from_shape_ui;
ot->poll = ED_operator_editmesh;
/* flags */
@@ -2630,13 +2651,13 @@ static int edbm_solidify_exec(bContext *C, wmOperator *op)
/* deselect only the faces in the region to be solidified (leave wire
* edges and loose verts selected, as there will be no corresponding
* geometry selected below) */
- BMO_slot_buffer_hflag_disable(bm, &bmop, "geom", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_disable(bm, bmop.slots_in, "geom", BM_FACE, BM_ELEM_SELECT, TRUE);
/* run the solidify operator */
BMO_op_exec(bm, &bmop);
/* select the newly generated faces */
- BMO_slot_buffer_hflag_enable(bm, &bmop, "geomout", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(bm, bmop.slots_out, "geom.out", BM_FACE, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -2868,6 +2889,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
float isect = 0.0f;
int len = 0, isected, i;
short numcuts = 1, mode = RNA_int_get(op->ptr, "type");
+ BMOpSlot *slot_edgepercents;
/* allocd vars */
float (*screen_vert_coords)[2], (*sco)[2], (*mouse_path)[2];
@@ -2922,6 +2944,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
}
/* store percentage of edge cut for KNIFE_EXACT here.*/
+ slot_edgepercents = BMO_slot_get(bmop.slots_in, "edgepercents");
for (be = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); be; be = BM_iter_step(&iter)) {
int is_cut = FALSE;
if (BM_elem_flag_test(be, BM_ELEM_SELECT)) {
@@ -2934,9 +2957,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
if (isect != 0.0f) {
if (mode != KNIFE_MULTICUT && mode != KNIFE_MIDPOINT) {
- BMO_slot_map_float_insert(bm, &bmop,
- "edgepercents",
- be, isect);
+ BMO_slot_map_float_insert(&bmop, slot_edgepercents, be, isect);
}
}
}
@@ -2951,16 +2972,16 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
MEM_freeN(mouse_path);
- BMO_slot_buffer_from_enabled_flag(bm, &bmop, "edges", BM_EDGE, ELE_EDGE_CUT);
+ BMO_slot_buffer_from_enabled_flag(bm, &bmop, bmop.slots_in, "edges", BM_EDGE, ELE_EDGE_CUT);
if (mode == KNIFE_MIDPOINT) numcuts = 1;
- BMO_slot_int_set(&bmop, "numcuts", numcuts);
+ BMO_slot_int_set(bmop.slots_in, "cuts", numcuts);
- BMO_slot_int_set(&bmop, "quadcornertype", SUBD_STRAIGHT_CUT);
- BMO_slot_bool_set(&bmop, "use_singleedge", FALSE);
- BMO_slot_bool_set(&bmop, "use_gridfill", FALSE);
+ BMO_slot_int_set(bmop.slots_in, "quad_corner_type", SUBD_STRAIGHT_CUT);
+ BMO_slot_bool_set(bmop.slots_in, "use_singleedge", FALSE);
+ BMO_slot_bool_set(bmop.slots_in, "use_gridfill", FALSE);
- BMO_slot_float_set(&bmop, "radius", 0);
+ BMO_slot_float_set(bmop.slots_in, "radius", 0);
BMO_op_exec(bm, &bmop);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -3303,7 +3324,7 @@ static int edbm_fill_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
/* select new geometry */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_FACE | BM_EDGE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_FACE | BM_EDGE, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -3575,7 +3596,7 @@ static int edbm_split_exec(bContext *C, wmOperator *op)
EDBM_op_init(em, &bmop, op, "split geom=%hvef use_only_faces=%b", BM_ELEM_SELECT, FALSE);
BMO_op_exec(em->bm, &bmop);
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
}
@@ -3630,14 +3651,14 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
mul_m3_v3(imat, axis);
if (!EDBM_op_init(em, &spinop, op,
- "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i ang=%f do_dupli=%b",
+ "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b",
BM_ELEM_SELECT, cent, axis, d, steps, degr, dupli))
{
return OPERATOR_CANCELLED;
}
BMO_op_exec(bm, &spinop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &spinop, op, TRUE)) {
return OPERATOR_CANCELLED;
}
@@ -3754,14 +3775,14 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
negate_v3(dvec);
if (!EDBM_op_init(em, &spinop, op,
- "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i ang=%f do_dupli=%b",
+ "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b",
BM_ELEM_SELECT, cent, axis, dvec, turns * steps, 360.0f * turns, FALSE))
{
return OPERATOR_CANCELLED;
}
BMO_op_exec(bm, &spinop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(bm, &spinop, "lastout", BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(bm, spinop.slots_out, "geom_last.out", BM_ALL, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &spinop, op, TRUE)) {
return OPERATOR_CANCELLED;
}
@@ -4757,11 +4778,20 @@ static int edbm_bevel_calc(bContext *C, wmOperator *op)
if (!EDBM_op_init(em, &bmop, op,
"bevel geom=%hev offset=%f segments=%i",
BM_ELEM_SELECT, offset, segments))
- {
- return 0;
- }
-
+ {
+ return 0;
+ }
+
BMO_op_exec(em->bm, &bmop);
+
+ if (offset != 0.0f) {
+ /* not essential, but we may have some loose geometry that
+ * won't get bevel'd and better not leave it selected */
+ EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
+ }
+
+ /* no need to de-select existing geometry */
if (!EDBM_op_finish(em, &bmop, op, TRUE))
return 0;
#else
@@ -5095,7 +5125,7 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
/* when merge is used the edges are joined and remain selected */
if (use_merge == FALSE) {
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
}
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -5268,11 +5298,11 @@ static int edbm_inset_calc(bContext *C, wmOperator *op)
if (use_select_inset) {
/* deselect original faces/verts */
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
}
else {
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE, BM_ELEM_SELECT, FALSE);
- BMO_slot_buffer_hflag_disable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, FALSE);
+ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, FALSE);
/* re-select faces so the verts and edges get selected too */
BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, TRUE, BM_ELEM_SELECT);
}
@@ -5529,7 +5559,7 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
if (use_replace) {
BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_in, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS,
"delete geom=%hvef context=%i",
@@ -5537,7 +5567,7 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
}
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -5600,8 +5630,8 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
/* Delete unused vertices, edges, and faces */
if (RNA_boolean_get(op->ptr, "delete_unused")) {
- if (!EDBM_op_callf(em, op, "delete geom=%s context=%i",
- &bmop, "unused_geom", DEL_ONLYTAGGED))
+ if (!EDBM_op_callf(em, op, "delete geom=%S context=%i",
+ &bmop, "geom_unused.out", DEL_ONLYTAGGED))
{
EDBM_op_finish(em, &bmop, op, TRUE);
return OPERATOR_CANCELLED;
@@ -5610,8 +5640,8 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
/* Delete hole edges/faces */
if (RNA_boolean_get(op->ptr, "make_holes")) {
- if (!EDBM_op_callf(em, op, "delete geom=%s context=%i",
- &bmop, "holes_geom", DEL_ONLYTAGGED))
+ if (!EDBM_op_callf(em, op, "delete geom=%S context=%i",
+ &bmop, "geom_holes.out", DEL_ONLYTAGGED))
{
EDBM_op_finish(em, &bmop, op, TRUE);
return OPERATOR_CANCELLED;
@@ -5620,8 +5650,8 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
/* Merge adjacent triangles */
if (RNA_boolean_get(op->ptr, "join_triangles")) {
- if (!EDBM_op_callf(em, op, "join_triangles faces=%s limit=%f",
- &bmop, "geomout",
+ if (!EDBM_op_callf(em, op, "join_triangles faces=%S limit=%f",
+ &bmop, "geom.out",
RNA_float_get(op->ptr, "limit")))
{
EDBM_op_finish(em, &bmop, op, TRUE);
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index ef3d8db4156..22c71d5d3ca 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -263,7 +263,7 @@ int EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)
return EDBM_op_finish(em, &bmop, op, TRUE);
}
-int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *selectslot, const char *fmt, ...)
+int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *select_slot_out, const char *fmt, ...)
{
BMesh *bm = em->bm;
BMOperator bmop;
@@ -285,7 +285,7 @@ int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *selects
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, selectslot, BM_ALL, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, select_slot_out, BM_ALL, BM_ELEM_SELECT, TRUE);
va_end(list);
return EDBM_op_finish(em, &bmop, op, TRUE);
@@ -494,11 +494,11 @@ void EDBM_select_more(BMEditMesh *em)
int use_faces = em->selectmode == SCE_SELECT_FACE;
BMO_op_initf(em->bm, &bmop, BMO_FLAG_DEFAULTS,
- "region_extend geom=%hvef constrict=%b use_faces=%b",
+ "region_extend geom=%hvef use_constrict=%b use_faces=%b",
BM_ELEM_SELECT, FALSE, use_faces);
BMO_op_exec(em->bm, &bmop);
/* don't flush selection in edge/vertex mode */
- BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
+ BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "geom.out", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
BMO_op_finish(em->bm, &bmop);
EDBM_select_flush(em);
@@ -510,11 +510,11 @@ void EDBM_select_less(BMEditMesh *em)
int use_faces = em->selectmode == SCE_SELECT_FACE;
BMO_op_initf(em->bm, &bmop, BMO_FLAG_DEFAULTS,
- "region_extend geom=%hvef constrict=%b use_faces=%b",
+ "region_extend geom=%hvef use_constrict=%b use_faces=%b",
BM_ELEM_SELECT, TRUE, use_faces);
BMO_op_exec(em->bm, &bmop);
/* don't flush selection in edge/vertex mode */
- BMO_slot_buffer_hflag_disable(em->bm, &bmop, "geomout", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
+ BMO_slot_buffer_hflag_disable(em->bm, bmop.slots_out, "geom.out", BM_ALL, BM_ELEM_SELECT, use_faces ? TRUE : FALSE);
BMO_op_finish(em->bm, &bmop);
EDBM_selectmode_flush(em);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 95c4691e440..a2ac08268e0 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -280,13 +280,21 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
/* standard mouse selection goes via space_view3d */
kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+ RNA_boolean_set(kmi->ptr, "toggle", FALSE);
kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0);
- RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+ RNA_boolean_set(kmi->ptr, "toggle", TRUE);
kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT | KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+ RNA_boolean_set(kmi->ptr, "toggle", FALSE);
kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT | KM_CTRL, 0);
- RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ RNA_boolean_set(kmi->ptr, "extend", FALSE);
+ RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+ RNA_boolean_set(kmi->ptr, "toggle", TRUE);
WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 4d6b9ed10bb..d39e34824b9 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -550,7 +550,8 @@ static int editmode_toggle_poll(bContext *C)
if (ELEM(NULL, ob, ob->data) || ((ID *)ob->data)->lib)
return 0;
- if (ob->restrictflag & OB_RESTRICT_VIEW)
+ /* if hidden but in edit mode, we still display */
+ if ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT))
return 0;
return (ob->type == OB_MESH || ob->type == OB_ARMATURE ||
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 2b6d69ca694..6a511d4d924 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -137,9 +137,11 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
}
if (key->totkey == 0) {
- if (GS(key->from->name) == ID_ME) ((Mesh *)key->from)->key = NULL;
- else if (GS(key->from->name) == ID_CU) ((Curve *)key->from)->key = NULL;
- else if (GS(key->from->name) == ID_LT) ((Lattice *)key->from)->key = NULL;
+ switch (GS(key->from->name)) {
+ case ID_ME: ((Mesh *)key->from)->key = NULL; break;
+ case ID_CU: ((Curve *)key->from)->key = NULL; break;
+ case ID_LT: ((Lattice *)key->from)->key = NULL; break;
+ }
BKE_libblock_free_us(&(bmain->key), key);
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index e56ca20dfcc..d7c7d4c04ef 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -2574,7 +2574,7 @@ static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op))
ED_vgroup_add(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
@@ -2605,7 +2605,7 @@ static int vertex_group_remove_exec(bContext *C, wmOperator *op)
vgroup_delete(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
@@ -2771,7 +2771,7 @@ static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op))
vgroup_duplicate(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob->data);
return OPERATOR_FINISHED;
}
@@ -3199,7 +3199,7 @@ static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op))
DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, base->object);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, base->object->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, base->object->data);
retval = OPERATOR_FINISHED;
}
@@ -3356,7 +3356,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op)
ob->actdef = nr + 1;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob);
return OPERATOR_FINISHED;
}
@@ -3520,7 +3520,7 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op)
if (ret != OPERATOR_CANCELLED) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob);
}
if (name_array) MEM_freeN(name_array);
@@ -3575,7 +3575,7 @@ static int vgroup_move_exec(bContext *C, wmOperator *op)
if (ret != OPERATOR_CANCELLED) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob);
}
return ret;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 0c88519b62b..2ac5f98927c 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -401,6 +401,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
static int key_test_depth(PEData *data, const float co[3], const int screen_co[2])
{
View3D *v3d= data->vc.v3d;
+ ViewDepths *vd = data->vc.rv3d->depths;
double ux, uy, uz;
float depth;
@@ -428,12 +429,15 @@ static int key_test_depth(PEData *data, const float co[3], const int screen_co[2
/* view3d_validate_backbuf(&data->vc); */
glReadPixels(screen_co[0], screen_co[1], 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
#else /* faster to use depths, these are calculated in PE_set_view3d_data */
- {
- ViewDepths *vd = data->vc.rv3d->depths;
- assert(vd && vd->depths);
+
+ /* check if screen_co is within bounds because brush_cut uses out of screen coords */
+ if(screen_co[0] >= 0 && screen_co[0] < vd->w && screen_co[1] >= 0 && screen_co[1] < vd->h) {
+ BLI_assert(vd && vd->depths);
/* we know its not clipped */
depth = vd->depths[screen_co[1] * vd->w + screen_co[0]];
}
+ else
+ return 0;
#endif
if ((float)uz - 0.00001f > depth)
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 7cd153d9564..5304c64c2a9 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -446,7 +446,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
for (fobj=fobjects->first; fobj; fobj=fobj->next) {
Object *ob = fobj->object;
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
- float active= (float)(fluidmd->fss->flag & OB_FLUIDSIM_ACTIVE);
+ float active= (float) ((fluidmd->fss->flag & OB_FLUIDSIM_ACTIVE) > 0 ? 1 : 0);
float rot_d[3] = {0.f, 0.f, 0.f}, old_rot[3] = {0.f, 0.f, 0.f};
if (ELEM(fluidmd->fss->type, OB_FLUIDSIM_DOMAIN, OB_FLUIDSIM_PARTICLE))
@@ -467,6 +467,8 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
set_channel(fobj->Scale, timeAtFrame, ob->size, i, CHANNEL_VEC);
set_channel(fobj->Active, timeAtFrame, &active, i, CHANNEL_FLOAT);
set_channel(fobj->InitialVelocity, timeAtFrame, &fluidmd->fss->iniVelx, i, CHANNEL_VEC);
+
+ // printf("Active: %f, Frame: %f\n", active, timeAtFrame);
if (fluidmd->fss->type == OB_FLUIDSIM_CONTROL) {
set_channel(fobj->AttractforceStrength, timeAtFrame, &fluidmd->fss->attractforceStrength, i, CHANNEL_FLOAT);
@@ -962,8 +964,8 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
/* ******** prepare output file paths ******** */
outStringsChanged = fluid_init_filepaths(fsDomain, targetDir, targetFile, debugStrBuffer);
- channels->length = scene->r.efra;
- channels->aniFrameTime = (double)(domainSettings->animEnd - domainSettings->animStart) / (double)noFrames;
+ channels->length = scene->r.efra; // DG TODO: why using endframe and not "noFrames" here? .. because "noFrames" is buggy too? (not using sfra)
+ channels->aniFrameTime = (double)((double)domainSettings->animEnd - (double)domainSettings->animStart) / (double)noFrames;
/* ******** initialize and allocate animation channels ******** */
fluid_init_all_channels(C, fsDomain, domainSettings, channels, fobjects);
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index 5155f1001ab..3f438c5948e 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -250,6 +250,24 @@ static void material_changed(Main *bmain, Material *ma)
}
}
+static void lamp_changed(Main *bmain, Lamp *la)
+{
+ Object *ob;
+ Material *ma;
+
+ /* icons */
+ BKE_icon_changed(BKE_icon_getid(&la->id));
+
+ /* glsl */
+ for (ob = bmain->object.first; ob; ob = ob->id.next)
+ if (ob->data == la && ob->gpulamp.first)
+ GPU_lamp_free(ob);
+
+ for (ma = bmain->mat.first; ma; ma = ma->id.next)
+ if (ma->gpumaterial.first)
+ GPU_material_free(ma);
+}
+
static void texture_changed(Main *bmain, Tex *tex)
{
Material *ma;
@@ -282,16 +300,14 @@ static void texture_changed(Main *bmain, Tex *tex)
/* find lamps */
for (la = bmain->lamp.first; la; la = la->id.next) {
if (mtex_use_tex(la->mtex, MAX_MTEX, tex)) {
- /* pass */
+ lamp_changed(bmain, la);
}
else if (la->nodetree && nodes_use_tex(la->nodetree, tex)) {
- /* pass */
+ lamp_changed(bmain, la);
}
else {
continue;
}
-
- BKE_icon_changed(BKE_icon_getid(&la->id));
}
/* find worlds */
@@ -320,24 +336,6 @@ static void texture_changed(Main *bmain, Tex *tex)
}
}
-static void lamp_changed(Main *bmain, Lamp *la)
-{
- Object *ob;
- Material *ma;
-
- /* icons */
- BKE_icon_changed(BKE_icon_getid(&la->id));
-
- /* glsl */
- for (ob = bmain->object.first; ob; ob = ob->id.next)
- if (ob->data == la && ob->gpulamp.first)
- GPU_lamp_free(ob);
-
- for (ma = bmain->mat.first; ma; ma = ma->id.next)
- if (ma->gpumaterial.first)
- GPU_material_free(ma);
-}
-
static void world_changed(Main *bmain, World *wo)
{
Material *ma;
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 6a9c24d2913..67d4af916aa 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -293,29 +293,35 @@ int ED_operator_console_active(bContext *C)
return ed_spacetype_test(C, SPACE_CONSOLE);
}
+static int ed_object_hidden(Object *ob)
+{
+ /* if hidden but in edit mode, we still display, can happen with animation */
+ return ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT));
+}
+
int ED_operator_object_active(bContext *C)
{
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !(ob->restrictflag & OB_RESTRICT_VIEW));
+ return ((ob != NULL) && !ed_object_hidden(ob));
}
int ED_operator_object_active_editable(bContext *C)
{
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW));
+ return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob));
}
int ED_operator_object_active_editable_mesh(bContext *C)
{
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) &&
+ return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob) &&
(ob->type == OB_MESH) && !(((ID *)ob->data)->lib));
}
int ED_operator_object_active_editable_font(bContext *C)
{
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) &&
+ return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob) &&
(ob->type == OB_FONT));
}
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index ffe4762ad15..77e2a1bb3d3 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1028,17 +1028,14 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- MovieClip *clip = ED_space_clip_get_clip(sc);
- float x1, y1, w, h;
+ float x1, y1, w, h, aspx, aspy;
int width, height, winx, winy;
ED_space_clip_get_size(sc, &width, &height);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
- w = width;
- h = height;
-
- if (clip)
- h *= clip->aspy / clip->aspx / clip->tracking.camera.pixel_aspect;
+ w = width * aspx;
+ h = height * aspy;
winx = BLI_rcti_size_x(&ar->winrct) + 1;
winy = BLI_rcti_size_y(&ar->winrct) + 1;
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index d3ae5373a18..bb46135545c 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -157,10 +157,9 @@ static ConsoleLine *console_lb_add__internal(ListBase *lb, ConsoleLine *from)
ConsoleLine *ci = MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
if (from) {
- ci->line = BLI_strdup(from->line);
- ci->len = strlen(ci->line);
- ci->len_alloc = ci->len;
-
+ BLI_assert(strlen(from->line) == from->len);
+ ci->line = BLI_strdupn(from->line, from->len);
+ ci->len = ci->len_alloc = from->len;
ci->cursor = from->cursor;
ci->type = from->type;
}
@@ -174,10 +173,8 @@ static ConsoleLine *console_lb_add__internal(ListBase *lb, ConsoleLine *from)
return ci;
}
-static ConsoleLine *console_history_add(const bContext *C, ConsoleLine *from)
+static ConsoleLine *console_history_add(SpaceConsole *sc, ConsoleLine *from)
{
- SpaceConsole *sc = CTX_wm_space_console(C);
-
return console_lb_add__internal(&sc->history, from);
}
@@ -217,7 +214,7 @@ ConsoleLine *console_history_verify(const bContext *C)
SpaceConsole *sc = CTX_wm_space_console(C);
ConsoleLine *ci = sc->history.last;
if (ci == NULL)
- ci = console_history_add(C, NULL);
+ ci = console_history_add(sc, NULL);
return ci;
}
@@ -623,8 +620,9 @@ static int console_clear_line_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
- console_history_add(C, ci);
- console_history_add(C, NULL);
+ console_history_add(sc, ci);
+ console_history_add(sc, NULL);
+ console_select_offset(sc, -ci->len);
console_textview_update_rect(sc, ar);
@@ -727,7 +725,7 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
while ((cl = console_history_find(sc, ci->line, ci)))
console_history_free(sc, cl);
- console_history_add(C, (ConsoleLine *)sc->history.last);
+ console_history_add(sc, (ConsoleLine *)sc->history.last);
}
ci = sc->history.last;
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 8bb57a32090..483348db18e 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -714,7 +714,17 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
row = uiLayoutRow(box, TRUE);
uiItemL(row, IFACE_("Value:"), ICON_NONE);
- BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
+ if ((dvar->type == DVAR_TYPE_ROT_DIFF) ||
+ (dvar->type == DVAR_TYPE_TRANSFORM_CHAN &&
+ dvar->targets[0].transChan >= DTAR_TRANSCHAN_ROTX &&
+ dvar->targets[0].transChan < DTAR_TRANSCHAN_SCALEX))
+ {
+ BLI_snprintf(valBuf, sizeof(valBuf), "%.3f (%4.1f°)", dvar->curval, RAD2DEGF(dvar->curval));
+ }
+ else {
+ BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
+ }
+
uiItemL(row, valBuf, ICON_NONE);
}
}
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index d4f24babff6..0d0fdc6be1c 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -81,6 +81,8 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "PIL_time.h"
+
#include "image_intern.h"
/******************** view navigation utilities *********************/
@@ -367,10 +369,18 @@ void IMAGE_OT_view_pan(wmOperatorType *ot)
/********************** view zoom operator *********************/
typedef struct ViewZoomData {
- float x, y;
+ float origx, origy;
float zoom;
int event_type;
float location[2];
+
+ /* needed for continuous zoom */
+ wmTimer *timer;
+ double timer_lastdraw;
+
+ /* */
+ SpaceImage *sima;
+ ARegion *ar;
} ViewZoomData;
static void image_view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
@@ -382,13 +392,22 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
op->customdata = vpd = MEM_callocN(sizeof(ViewZoomData), "ImageViewZoomData");
WM_cursor_modal(CTX_wm_window(C), BC_NSEW_SCROLLCURSOR);
- vpd->x = event->x;
- vpd->y = event->y;
+ vpd->origx = event->x;
+ vpd->origy = event->y;
vpd->zoom = sima->zoom;
vpd->event_type = event->type;
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &vpd->location[0], &vpd->location[1]);
+ if (U.viewzoom == USER_ZOOM_CONT) {
+ /* needs a timer to continue redrawing */
+ vpd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
+ vpd->timer_lastdraw = PIL_check_seconds_timer();
+ }
+
+ vpd->sima = sima;
+ vpd->ar = ar;
+
WM_event_add_modal_handler(C, op);
}
@@ -402,6 +421,9 @@ static void image_view_zoom_exit(bContext *C, wmOperator *op, int cancel)
ED_region_tag_redraw(CTX_wm_region(C));
}
+ if (vpd->timer)
+ WM_event_remove_timer(CTX_wm_manager(C), vpd->timer->win, vpd->timer);
+
WM_cursor_restore(CTX_wm_window(C));
MEM_freeN(op->customdata);
}
@@ -427,6 +449,12 @@ static int image_view_zoom_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
+enum {
+ VIEW_PASS = 0,
+ VIEW_APPLY,
+ VIEW_CONFIRM
+};
+
static int image_view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if (event->type == MOUSEZOOM) {
@@ -454,31 +482,72 @@ static int image_view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
}
+static void image_zoom_apply(ViewZoomData *vpd, wmOperator *op, const int x, const int y, const short viewzoom, const short zoom_invert)
+{
+ float factor;
+
+ if (viewzoom == USER_ZOOM_CONT) {
+ double time = PIL_check_seconds_timer();
+ float time_step = (float)(time - vpd->timer_lastdraw);
+ float fac;
+ float zfac;
+
+ if (U.uiflag & USER_ZOOM_HORIZ) {
+ fac = (float)(x - vpd->origx);
+ }
+ else {
+ fac = (float)(y - vpd->origy);
+ }
+
+ if (zoom_invert) {
+ fac = -fac;
+ }
+
+ /* oldstyle zoom */
+ zfac = 1.0f + ((fac / 20.0f) * time_step);
+ vpd->timer_lastdraw = time;
+ /* this is the final zoom, but instead make it into a factor */
+ //zoom = vpd->sima->zoom * zfac;
+ factor = (vpd->sima->zoom * zfac) / vpd->zoom;
+ }
+ else {
+ /* for now do the same things for scale and dolly */
+ float delta = x - vpd->origx + y - vpd->origy;
+
+ if (zoom_invert)
+ delta *= -1.0f;
+
+ factor = 1.0f + delta / 300.0f;
+ }
+
+ RNA_float_set(op->ptr, "factor", factor);
+ sima_zoom_set(vpd->sima, vpd->ar, vpd->zoom * factor, vpd->location);
+ ED_region_tag_redraw(vpd->ar);
+}
+
static int image_view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
ViewZoomData *vpd = op->customdata;
- float delta, factor;
-
- switch (event->type) {
- case MOUSEMOVE:
- delta = event->x - vpd->x + event->y - vpd->y;
+ short event_code = VIEW_PASS;
- if (U.uiflag & USER_ZOOM_INVERT)
- delta *= -1;
+ /* execute the events */
+ if (event->type == TIMER && event->customdata == vpd->timer) {
+ /* continuous zoom */
+ event_code = VIEW_APPLY;
+ }
+ else if (event->type == MOUSEMOVE) {
+ event_code = VIEW_APPLY;
+ }
+ else if (event->type == vpd->event_type && event->val == KM_RELEASE) {
+ event_code = VIEW_CONFIRM;
+ }
- factor = 1.0f + delta / 300.0f;
- RNA_float_set(op->ptr, "factor", factor);
- sima_zoom_set(sima, ar, vpd->zoom * factor, vpd->location);
- ED_region_tag_redraw(CTX_wm_region(C));
- break;
- default:
- if (event->type == vpd->event_type && event->val == KM_RELEASE) {
- image_view_zoom_exit(C, op, 0);
- return OPERATOR_FINISHED;
- }
- break;
+ if (event_code == VIEW_APPLY) {
+ 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);
+ return OPERATOR_FINISHED;
}
return OPERATOR_RUNNING_MODAL;
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 2c40e0e656d..61d513929ad 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1038,6 +1038,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
UI_icon_draw(x, y, ICON_MOD_WARP); break;
case eModifierType_Skin:
UI_icon_draw(x, y, ICON_MOD_SKIN); break;
+ case eModifierType_Triangulate:
+ UI_icon_draw(x, y, ICON_MOD_TRIANGULATE); break;
/* Default */
case eModifierType_None:
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 6cfc3f97b31..f8856cb9646 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -337,8 +337,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
break;
case NC_GEOM:
switch (wmn->data) {
- case ND_DATA:
- /* needed for vertex groups only, no special notifier atm so use NC_GEOM|ND_DATA */
+ case ND_VERTEX_GROUP:
ED_region_tag_redraw(ar);
break;
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 37e57a1e850..5fefafaa54a 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -822,6 +822,7 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int
int rectx, recty;
float render_size = 0.0;
float proxy_size = 100.0;
+ short is_break = G.is_break;
render_size = sseq->render_size;
if (render_size == 0) {
@@ -840,6 +841,11 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int
context = BKE_sequencer_new_render_data(bmain, scene, rectx, recty, proxy_size);
+ /* sequencer could start rendering, in this case we need to be sure it wouldn't be canceled
+ * by Esc pressed somewhere in the past
+ */
+ G.is_break = FALSE;
+
if (special_seq_update)
ibuf = BKE_sequencer_give_ibuf_direct(context, cfra + frame_ofs, special_seq_update);
else if (!U.prefetchframes) // XXX || (G.f & G_PLAYANIM) == 0) {
@@ -847,6 +853,9 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int
else
ibuf = BKE_sequencer_give_ibuf_threaded(context, cfra + frame_ofs, sseq->chanshown);
+ /* restore state so real rendering would be canceled (if needed) */
+ G.is_break = is_break;
+
return ibuf;
}
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 3f70b2cb66e..d74e32620af 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -196,10 +196,6 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_unindent);
WM_operatortype_append(TEXT_OT_indent);
- WM_operatortype_append(TEXT_OT_markers_clear);
- WM_operatortype_append(TEXT_OT_next_marker);
- WM_operatortype_append(TEXT_OT_previous_marker);
-
WM_operatortype_append(TEXT_OT_select_line);
WM_operatortype_append(TEXT_OT_select_all);
WM_operatortype_append(TEXT_OT_select_word);
@@ -227,7 +223,6 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_find_set_selected);
WM_operatortype_append(TEXT_OT_replace);
WM_operatortype_append(TEXT_OT_replace_set_selected);
- WM_operatortype_append(TEXT_OT_mark_all);
WM_operatortype_append(TEXT_OT_to_3d_object);
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 76908e5b369..46ab2d9e688 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -734,7 +734,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
if (st->showsyntax && format) format_draw_color(format[a]);
x += text_font_draw_character_utf8(st, x, y, str + ma);
}
- y -= st->lheight;
+ y -= st->lheight + TXT_LINE_SPACING;
x = basex;
lines++;
start = end; mstart = mend;
@@ -1070,40 +1070,6 @@ int text_get_total_lines(SpaceText *st, ARegion *ar)
return drawcache->total_lines;
}
-/* Move pointer to first visible line (top) */
-static TextLine *first_visible_line(SpaceText *st, ARegion *ar, int *wrap_top)
-{
- Text *text = st->text;
- TextLine *pline = text->lines.first;
- int i = st->top, lineno = 0;
-
- text_update_drawcache(st, ar);
-
- if (wrap_top) *wrap_top = 0;
-
- if (st->wordwrap) {
- while (i > 0 && pline) {
- int lines = text_get_visible_lines_no(st, lineno);
-
- if (i - lines < 0) {
- if (wrap_top) *wrap_top = i;
- break;
- }
- else {
- pline = pline->next;
- i -= lines;
- lineno++;
- }
- }
- }
- else {
- for (i = st->top; pline->next && i > 0; i--)
- pline = pline->next;
- }
-
- return pline;
-}
-
/************************ draw scrollbar *****************************/
static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
@@ -1241,90 +1207,6 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
glDisable(GL_BLEND);
}
-/************************** draw markers **************************/
-
-static void draw_markers(SpaceText *st, ARegion *ar)
-{
- Text *text = st->text;
- TextMarker *marker, *next;
- TextLine *top, *line;
- int offl, offc, i, x1, x2, y1, y2, x, y;
- int topi, topy;
-
- /* Move pointer to first visible line (top) */
- top = first_visible_line(st, ar, NULL);
- topi = BLI_findindex(&text->lines, top);
-
- topy = txt_get_span(text->lines.first, top);
-
- for (marker = text->markers.first; marker; marker = next) {
- next = marker->next;
-
- /* invisible line (before top) */
- if (marker->lineno < topi) continue;
-
- line = BLI_findlink(&text->lines, marker->lineno);
-
- /* Remove broken markers */
- if (marker->end > line->len || marker->start > marker->end) {
- BLI_freelinkN(&text->markers, marker);
- continue;
- }
-
- wrap_offset(st, ar, line, marker->start, &offl, &offc);
- y1 = txt_get_span(top, line) - st->top + offl + topy;
- x1 = text_get_char_pos(st, line->line, marker->start) - st->left + offc;
-
- wrap_offset(st, ar, line, marker->end, &offl, &offc);
- y2 = txt_get_span(top, line) - st->top + offl + topy;
- x2 = text_get_char_pos(st, line->line, marker->end) - st->left + offc;
-
- /* invisible part of line (before top, after last visible line) */
- if (y2 < 0 || y1 > st->top + st->viewlines) continue;
-
- glColor3ubv(marker->color);
- x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
- y = ar->winy - 3;
-
- if (y1 == y2) {
- y -= y1 * st->lheight;
- glBegin(GL_LINE_LOOP);
- glVertex2i(x + x2 * st->cwidth + 1, y);
- glVertex2i(x + x1 * st->cwidth - 2, y);
- glVertex2i(x + x1 * st->cwidth - 2, y - st->lheight);
- glVertex2i(x + x2 * st->cwidth + 1, y - st->lheight);
- glEnd();
- }
- else {
- y -= y1 * st->lheight;
- glBegin(GL_LINE_STRIP);
- glVertex2i(ar->winx, y);
- glVertex2i(x + x1 * st->cwidth - 2, y);
- glVertex2i(x + x1 * st->cwidth - 2, y - st->lheight);
- glVertex2i(ar->winx, y - st->lheight);
- glEnd();
- y -= st->lheight;
-
- for (i = y1 + 1; i < y2; i++) {
- glBegin(GL_LINES);
- glVertex2i(x, y);
- glVertex2i(ar->winx, y);
- glVertex2i(x, y - st->lheight);
- glVertex2i(ar->winx, y - st->lheight);
- glEnd();
- y -= st->lheight;
- }
-
- glBegin(GL_LINE_STRIP);
- glVertex2i(x, y);
- glVertex2i(x + x2 * st->cwidth + 1, y);
- glVertex2i(x + x2 * st->cwidth + 1, y - st->lheight);
- glVertex2i(x, y - st->lheight);
- glEnd();
- }
- }
-}
-
/*********************** draw documentation *******************************/
static void draw_documentation(SpaceText *st, ARegion *ar)
@@ -1834,16 +1716,14 @@ void draw_text_main(SpaceText *st, ARegion *ar)
if (st->wordwrap) {
/* draw word wrapped text */
int lines = text_draw_wrapped(st, tmp->line, x, y, winx - x, tmp->format, wrap_skip);
- y -= lines * st->lheight;
+ y -= lines * (st->lheight + TXT_LINE_SPACING);
}
else {
/* draw unwrapped text */
text_draw(st, tmp->line, st->left, ar->winx / st->cwidth, 1, x, y, tmp->format);
- y -= st->lheight;
+ y -= st->lheight + TXT_LINE_SPACING;
}
- y-= TXT_LINE_SPACING;
-
wrap_skip = 0;
}
@@ -1862,7 +1742,6 @@ void draw_text_main(SpaceText *st, ARegion *ar)
/* draw other stuff */
draw_brackets(st, ar);
- draw_markers(st, ar);
glTranslatef(GLA_PIXEL_OFS, GLA_PIXEL_OFS, 0.0f); /* XXX scroll requires exact pixel space */
draw_textscroll(st, &scroll, &back);
draw_documentation(st, ar);
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index d687f4cdd8a..ea61644cee9 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -69,9 +69,6 @@ void text_update_cursor_moved(struct bContext *C);
#define TOOL_SUGG_LIST 0x01
#define TOOL_DOCUMENT 0x02
-#define TMARK_GRP_CUSTOM 0x00010000 /* Lower 2 bytes used for Python groups */
-#define TMARK_GRP_FINDALL 0x00020000
-
typedef struct FlattenString {
char fixedbuf[256];
int fixedaccum[256];
@@ -130,10 +127,6 @@ void TEXT_OT_indent(struct wmOperatorType *ot);
void TEXT_OT_line_break(struct wmOperatorType *ot);
void TEXT_OT_insert(struct wmOperatorType *ot);
-void TEXT_OT_markers_clear(struct wmOperatorType *ot);
-void TEXT_OT_next_marker(struct wmOperatorType *ot);
-void TEXT_OT_previous_marker(struct wmOperatorType *ot);
-
void TEXT_OT_select_line(struct wmOperatorType *ot);
void TEXT_OT_select_all(struct wmOperatorType *ot);
void TEXT_OT_select_word(struct wmOperatorType *ot);
@@ -158,7 +151,6 @@ void TEXT_OT_find(struct wmOperatorType *ot);
void TEXT_OT_find_set_selected(struct wmOperatorType *ot);
void TEXT_OT_replace(struct wmOperatorType *ot);
void TEXT_OT_replace_set_selected(struct wmOperatorType *ot);
-void TEXT_OT_mark_all(struct wmOperatorType *ot);
void TEXT_OT_to_3d_object(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index ae5de4c6a25..cd6d8719544 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1377,104 +1377,6 @@ void TEXT_OT_move_lines(wmOperatorType *ot)
RNA_def_enum(ot->srna, "direction", direction_items, 1, "Direction", "");
}
-/******************* previous marker operator *********************/
-
-static int text_previous_marker_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Text *text = CTX_data_edit_text(C);
- TextMarker *mrk;
- int lineno;
-
- lineno = txt_get_span(text->lines.first, text->curl);
- mrk = text->markers.last;
- while (mrk && (mrk->lineno > lineno || (mrk->lineno == lineno && mrk->end > text->curc)))
- mrk = mrk->prev;
- if (!mrk) mrk = text->markers.last;
- if (mrk) {
- txt_move_to(text, mrk->lineno, mrk->start, 0);
- txt_move_to(text, mrk->lineno, mrk->end, 1);
- }
-
- text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-
- return OPERATOR_FINISHED;
-}
-
-void TEXT_OT_previous_marker(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Previous Marker";
- ot->idname = "TEXT_OT_previous_marker";
- ot->description = "Move to previous marker";
-
- /* api callbacks */
- ot->exec = text_previous_marker_exec;
- ot->poll = text_edit_poll;
-}
-
-/******************* next marker operator *********************/
-
-static int text_next_marker_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Text *text = CTX_data_edit_text(C);
- TextMarker *mrk;
- int lineno;
-
- lineno = txt_get_span(text->lines.first, text->curl);
- mrk = text->markers.first;
- while (mrk && (mrk->lineno < lineno || (mrk->lineno == lineno && mrk->start <= text->curc)))
- mrk = mrk->next;
- if (!mrk) mrk = text->markers.first;
- if (mrk) {
- txt_move_to(text, mrk->lineno, mrk->start, 0);
- txt_move_to(text, mrk->lineno, mrk->end, 1);
- }
-
- text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-
- return OPERATOR_FINISHED;
-}
-
-void TEXT_OT_next_marker(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Next Marker";
- ot->idname = "TEXT_OT_next_marker";
- ot->description = "Move to next marker";
-
- /* api callbacks */
- ot->exec = text_next_marker_exec;
- ot->poll = text_edit_poll;
-}
-
-/******************* clear all markers operator *********************/
-
-static int text_clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Text *text = CTX_data_edit_text(C);
-
- txt_clear_markers(text, 0, 0);
-
- text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
-
- return OPERATOR_FINISHED;
-}
-
-void TEXT_OT_markers_clear(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Clear All Markers";
- ot->idname = "TEXT_OT_markers_clear";
- ot->description = "Clear all markers";
-
- /* api callbacks */
- ot->exec = text_clear_all_markers_exec;
- ot->poll = text_edit_poll;
-}
-
/************************ move operator ************************/
static EnumPropertyItem move_type_items[] = {
@@ -2956,14 +2858,13 @@ void TEXT_OT_insert(wmOperatorType *ot)
/* mode */
#define TEXT_FIND 0
#define TEXT_REPLACE 1
-#define TEXT_MARK_ALL 2
static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
{
Main *bmain = CTX_data_main(C);
SpaceText *st = CTX_wm_space_text(C);
- Text *start = NULL, *text = st->text;
- int flags, first = 1;
+ Text *text = st->text;
+ int flags;
int found = 0;
char *tmp;
@@ -2972,79 +2873,48 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
flags = st->flags;
if (flags & ST_FIND_ALL)
- flags ^= ST_FIND_WRAP;
-
- do {
- int proceed = 0;
-
- if (first) {
- if (text->markers.first)
- WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+ flags &= ~ST_FIND_WRAP;
- txt_clear_markers(text, TMARK_GRP_FINDALL, 0);
- }
-
- first = 0;
-
- /* Replace current */
- if (mode != TEXT_FIND && txt_has_sel(text)) {
- tmp = txt_sel_to_buf(text);
-
- if (flags & ST_MATCH_CASE) proceed = strcmp(st->findstr, tmp) == 0;
- else proceed = BLI_strcasecmp(st->findstr, tmp) == 0;
-
- if (proceed) {
- if (mode == TEXT_REPLACE) {
- txt_insert_buf(text, st->replacestr);
- if (text->curl && text->curl->format) {
- MEM_freeN(text->curl->format);
- text->curl->format = NULL;
- }
- text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
- text_drawcache_tag_update(CTX_wm_space_text(C), 1);
- }
- else if (mode == TEXT_MARK_ALL) {
- unsigned char color[4];
- UI_GetThemeColor4ubv(TH_SHADE2, color);
+ /* Replace current */
+ if (mode != TEXT_FIND && txt_has_sel(text)) {
+ tmp = txt_sel_to_buf(text);
- if (txt_find_marker(text, text->curl, text->selc, TMARK_GRP_FINDALL, 0)) {
- if (tmp) MEM_freeN(tmp), tmp = NULL;
- break;
- }
+ if (flags & ST_MATCH_CASE) found = strcmp(st->findstr, tmp) == 0;
+ else found = BLI_strcasecmp(st->findstr, tmp) == 0;
- txt_add_marker(text, text->curl, text->curc, text->selc, color, TMARK_GRP_FINDALL, TMARK_EDITALL);
- text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+ if (found) {
+ if (mode == TEXT_REPLACE) {
+ txt_insert_buf(text, st->replacestr);
+ if (text->curl && text->curl->format) {
+ MEM_freeN(text->curl->format);
+ text->curl->format = NULL;
}
+ text_update_cursor_moved(C);
+ WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+ text_drawcache_tag_update(CTX_wm_space_text(C), 1);
}
- MEM_freeN(tmp);
- tmp = NULL;
}
+ MEM_freeN(tmp);
+ tmp = NULL;
+ }
- /* Find next */
- if (txt_find_string(text, st->findstr, flags & ST_FIND_WRAP, flags & ST_MATCH_CASE)) {
- text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
- }
- else if (flags & ST_FIND_ALL) {
- if (text == start) break;
- if (!start) start = text;
- if (text->id.next)
- text = st->text = text->id.next;
- else
- text = st->text = bmain->text.first;
- txt_move_toline(text, 0, 0);
- text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
- first = 1;
- }
- else {
- if (!found && !proceed) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr);
- break;
- }
- found = 1;
- } while (mode == TEXT_MARK_ALL);
+ /* Find next */
+ if (txt_find_string(text, st->findstr, flags & ST_FIND_WRAP, flags & ST_MATCH_CASE)) {
+ text_update_cursor_moved(C);
+ WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
+ }
+ else if (flags & ST_FIND_ALL) {
+ if (text->id.next)
+ text = st->text = text->id.next;
+ else
+ text = st->text = bmain->text.first;
+ txt_move_toline(text, 0, 0);
+ text_update_cursor_moved(C);
+ WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
+ }
+ else {
+ if (!found) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr);
+ }
return OPERATOR_FINISHED;
}
@@ -3085,25 +2955,6 @@ void TEXT_OT_replace(wmOperatorType *ot)
ot->poll = text_space_edit_poll;
}
-/******************* mark all operator *********************/
-
-static int text_mark_all_exec(bContext *C, wmOperator *op)
-{
- return text_find_and_replace(C, op, TEXT_MARK_ALL);
-}
-
-void TEXT_OT_mark_all(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Mark All";
- ot->idname = "TEXT_OT_mark_all";
- ot->description = "Mark all specified text";
-
- /* api callbacks */
- ot->exec = text_mark_all_exec;
- ot->poll = text_space_edit_poll;
-}
-
/******************* find set selected *********************/
static int text_find_set_selected_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c
index 966afe22e42..4c9b4b900cc 100644
--- a/source/blender/editors/space_text/text_python.c
+++ b/source/blender/editors/space_text/text_python.c
@@ -359,177 +359,3 @@ static short UNUSED_FUNCTION(do_texttools) (SpaceText * st, char ascii, unsigned
return swallow;
}
-
-static short UNUSED_FUNCTION(do_textmarkers) (SpaceText * st, char ascii, unsigned short evnt, short val)
-{
- Text *text;
- TextMarker *marker, *mrk, *nxt;
- int c, s, draw = 0, swallow = 0;
- int qual = 0; // XXX
-
- text = st->text;
- if (!text || text->id.lib || text->curl != text->sell) return 0;
-
- marker = txt_find_marker(text, text->sell, text->selc, 0, 0);
- if (marker && (marker->start > text->curc || marker->end < text->curc))
- marker = NULL;
-
- if (!marker) {
- /* Find the next temporary marker */
- if (evnt == TABKEY) {
- int lineno = txt_get_span(text->lines.first, text->curl);
- mrk = text->markers.first;
- while (mrk) {
- if (!marker && (mrk->flags & TMARK_TEMP)) marker = mrk;
- if ((mrk->flags & TMARK_TEMP) && (mrk->lineno > lineno || (mrk->lineno == lineno && mrk->end > text->curc))) {
- marker = mrk;
- break;
- }
- mrk = mrk->next;
- }
- if (marker) {
- txt_move_to(text, marker->lineno, marker->start, 0);
- txt_move_to(text, marker->lineno, marker->end, 1);
- // XXX text_update_cursor_moved(C);
- // XXX WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
- evnt = ascii = val = 0;
- draw = 1;
- swallow = 1;
- }
- }
- else if (evnt == ESCKEY) {
- if (txt_clear_markers(text, 0, TMARK_TEMP)) swallow = 1;
- else if (txt_clear_markers(text, 0, 0)) swallow = 1;
- else return 0;
- evnt = ascii = val = 0;
- draw = 1;
- }
- if (!swallow) return 0;
- }
-
- if (ascii) {
- if (marker->flags & TMARK_EDITALL) {
- c = text->curc - marker->start;
- s = text->selc - marker->start;
- if (s < 0 || s > marker->end - marker->start) return 0;
-
- mrk = txt_next_marker(text, marker);
- while (mrk) {
- nxt = txt_next_marker(text, mrk); /* mrk may become invalid */
- txt_move_to(text, mrk->lineno, mrk->start + c, 0);
- if (s != c) txt_move_to(text, mrk->lineno, mrk->start + s, 1);
- if (st->overwrite) {
- if (txt_replace_char(text, ascii))
- text_update_line_edited(st->text->curl);
- }
- else {
- if (txt_add_char(text, ascii)) {
- text_update_line_edited(st->text->curl);
- }
- }
-
- if (mrk == marker || mrk == nxt) break;
- mrk = nxt;
- }
- swallow = 1;
- draw = 1;
- }
- }
- else if (val) {
- switch (evnt) {
- case BACKSPACEKEY:
- if (marker->flags & TMARK_EDITALL) {
- c = text->curc - marker->start;
- s = text->selc - marker->start;
- if (s < 0 || s > marker->end - marker->start) return 0;
-
- mrk = txt_next_marker(text, marker);
- while (mrk) {
- nxt = txt_next_marker(text, mrk); /* mrk may become invalid */
- txt_move_to(text, mrk->lineno, mrk->start + c, 0);
- if (s != c) txt_move_to(text, mrk->lineno, mrk->start + s, 1);
- txt_backspace_char(text);
- text_update_line_edited(st->text->curl);
- if (mrk == marker || mrk == nxt) break;
- mrk = nxt;
- }
- swallow = 1;
- draw = 1;
- }
- break;
- case DELKEY:
- if (marker->flags & TMARK_EDITALL) {
- c = text->curc - marker->start;
- s = text->selc - marker->start;
- if (s < 0 || s > marker->end - marker->start) return 0;
-
- mrk = txt_next_marker(text, marker);
- while (mrk) {
- nxt = txt_next_marker(text, mrk); /* mrk may become invalid */
- txt_move_to(text, mrk->lineno, mrk->start + c, 0);
- if (s != c) txt_move_to(text, mrk->lineno, mrk->start + s, 1);
- txt_delete_char(text);
- text_update_line_edited(st->text->curl);
- if (mrk == marker || mrk == nxt) break;
- mrk = nxt;
- }
- swallow = 1;
- draw = 1;
- }
- break;
- case TABKEY:
- if (qual & LR_SHIFTKEY) {
- nxt = marker->prev;
- if (!nxt) nxt = text->markers.last;
- }
- else {
- nxt = marker->next;
- if (!nxt) nxt = text->markers.first;
- }
- if (marker->flags & TMARK_TEMP) {
- if (nxt == marker) nxt = NULL;
- BLI_freelinkN(&text->markers, marker);
- }
- mrk = nxt;
- if (mrk) {
- txt_move_to(text, mrk->lineno, mrk->start, 0);
- txt_move_to(text, mrk->lineno, mrk->end, 1);
- // XXX text_update_cursor_moved(C);
- // XXX WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
- }
- swallow = 1;
- draw = 1;
- break;
-
- /* Events that should clear markers */
- case UKEY: if (!(qual & LR_ALTKEY)) break;
- case ZKEY: if (evnt == ZKEY && !(qual & LR_CTRLKEY)) break;
- case RETKEY:
- case ESCKEY:
- if (marker->flags & (TMARK_EDITALL | TMARK_TEMP))
- txt_clear_markers(text, marker->group, 0);
- else
- BLI_freelinkN(&text->markers, marker);
- swallow = 1;
- draw = 1;
- break;
- case RIGHTMOUSE: /* Marker context menu? */
- case LEFTMOUSE:
- break;
- case FKEY: /* Allow find */
- if (qual & LR_SHIFTKEY) swallow = 1;
- break;
-
- default:
- if (qual != 0 && qual != LR_SHIFTKEY)
- swallow = 1; /* Swallow all other shortcut events */
- }
- }
-
- if (draw) {
- // XXX redraw_alltext();
- }
-
- return swallow;
-}
-
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index ec564e95c65..726fd26b11d 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -702,6 +702,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
case NC_GEOM:
switch (wmn->data) {
case ND_DATA:
+ case ND_VERTEX_GROUP:
case ND_SELECT:
ED_region_tag_redraw(ar);
break;
@@ -920,6 +921,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
case NC_GEOM:
switch (wmn->data) {
case ND_DATA:
+ case ND_VERTEX_GROUP:
case ND_SELECT:
ED_region_tag_redraw(ar);
break;
@@ -1119,16 +1121,21 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
return 1;
}
else if (CTX_data_equals(member, "active_base")) {
- if (scene->basact && (scene->basact->lay & lay))
- if ((scene->basact->object->restrictflag & OB_RESTRICT_VIEW) == 0)
+ if (scene->basact && (scene->basact->lay & lay)) {
+ Object *ob = scene->basact->object;
+ /* if hidden but in edit mode, we still display, can happen with animation */
+ if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0 || (ob->mode & OB_MODE_EDIT))
CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, scene->basact);
+ }
return 1;
}
else if (CTX_data_equals(member, "active_object")) {
- if (scene->basact && (scene->basact->lay & lay))
- if ((scene->basact->object->restrictflag & OB_RESTRICT_VIEW) == 0)
+ if (scene->basact && (scene->basact->lay & lay)) {
+ Object *ob = scene->basact->object;
+ if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0 || (ob->mode & OB_MODE_EDIT))
CTX_data_id_pointer_set(result, &scene->basact->object->id);
+ }
return 1;
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 7a1b97ff1d6..fcd92cd5639 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1422,8 +1422,8 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
ibuf = IMB_allocImBuf((xmaxc - xminc + 1), (ymaxc - yminc + 1), 32, IB_rect);
- view3d_validate_backbuf(vc);
-
+ view3d_validate_backbuf(vc);
+
glReadPixels(vc->ar->winrct.xmin + xminc,
vc->ar->winrct.ymin + yminc,
(xmaxc - xminc + 1),
@@ -1931,10 +1931,17 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
for (; dob; dob_prev = dob, dob = dob_next, dob_next = dob_next ? dupli_step(dob_next->next) : NULL) {
tbase.object = dob->ob;
- /* extra service: draw the duplicator in drawtype of parent */
- /* MIN2 for the drawtype to allow bounding box objects in groups for lods */
- dt = tbase.object->dt; tbase.object->dt = MIN2(tbase.object->dt, base->object->dt);
- dtx = tbase.object->dtx; tbase.object->dtx = base->object->dtx;
+ /* extra service: draw the duplicator in drawtype of parent, minimum taken
+ * to allow e.g. boundbox box objects in groups for LOD */
+ dt = tbase.object->dt;
+ tbase.object->dt = MIN2(tbase.object->dt, base->object->dt);
+
+ /* inherit draw extra, but not if a boundbox under the assumption that this
+ * is intended to speed up drawing, and drawing extra (especially wire) can
+ * slow it down too much */
+ dtx = tbase.object->dtx;
+ if(tbase.object->dt != OB_BOUNDBOX)
+ tbase.object->dtx = base->object->dtx;
/* negative scale flag has to propagate */
transflag = tbase.object->transflag;
@@ -2996,9 +3003,10 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
v3d->zbuf = FALSE;
/* enables anti-aliasing for 3D view drawing */
- if (U.ogl_multisamples)
- if (!(U.gameflags & USER_DISABLE_AA))
- glEnable(GL_MULTISAMPLE_ARB);
+ if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
+ // if (!(U.gameflags & USER_DISABLE_AA))
+ glEnable(GL_MULTISAMPLE_ARB);
+ }
/* needs to be done always, gridview is adjusted in drawgrid() now */
@@ -3113,9 +3121,10 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
BIF_draw_manipulator(C);
/* Disable back anti-aliasing */
- if (U.ogl_multisamples)
- if (!(U.gameflags & USER_DISABLE_AA))
- glDisable(GL_MULTISAMPLE_ARB);
+ if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
+ // if (!(U.gameflags & USER_DISABLE_AA))
+ glDisable(GL_MULTISAMPLE_ARB);
+ }
if (v3d->zbuf) {
@@ -3235,12 +3244,16 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
#ifdef DEBUG_DRAW
/* debug drawing */
#define _DEBUG_DRAW_QUAD_TOT 1024
+#define _DEBUG_DRAW_EDGE_TOT 1024
static float _bl_debug_draw_quads[_DEBUG_DRAW_QUAD_TOT][4][3];
static int _bl_debug_draw_quads_tot = 0;
+static float _bl_debug_draw_edges[_DEBUG_DRAW_QUAD_TOT][2][3];
+static int _bl_debug_draw_edges_tot = 0;
void bl_debug_draw_quad_clear(void)
{
_bl_debug_draw_quads_tot = 0;
+ _bl_debug_draw_edges_tot = 0;
}
void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2[3], const float v3[3])
{
@@ -3258,16 +3271,14 @@ void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2
}
void bl_debug_draw_edge_add(const float v0[3], const float v1[3])
{
- if (_bl_debug_draw_quads_tot >= _DEBUG_DRAW_QUAD_TOT) {
- printf("%s: max edge count hit %d!", __func__, _bl_debug_draw_quads_tot);
+ if (_bl_debug_draw_quads_tot >= _DEBUG_DRAW_EDGE_TOT) {
+ printf("%s: max edge count hit %d!", __func__, _bl_debug_draw_edges_tot);
}
else {
- float *pt = &_bl_debug_draw_quads[_bl_debug_draw_quads_tot][0][0];
+ float *pt = &_bl_debug_draw_edges[_bl_debug_draw_edges_tot][0][0];
copy_v3_v3(pt, v0); pt += 3;
copy_v3_v3(pt, v1); pt += 3;
- copy_v3_v3(pt, v0); pt += 3;
- copy_v3_v3(pt, v1); pt += 3;
- _bl_debug_draw_quads_tot++;
+ _bl_debug_draw_edges_tot++;
}
}
static void bl_debug_draw(void)
@@ -3284,5 +3295,22 @@ static void bl_debug_draw(void)
}
glEnd();
}
+ if (_bl_debug_draw_edges_tot) {
+ int i;
+ cpack(0x00FFFF00);
+ glBegin(GL_LINES);
+ for (i = 0; i < _bl_debug_draw_edges_tot; i ++) {
+ glVertex3fv(_bl_debug_draw_edges[i][0]);
+ glVertex3fv(_bl_debug_draw_edges[i][1]);
+ }
+ glEnd();
+ glPointSize(4.0);
+ glBegin(GL_POINTS);
+ for (i = 0; i < _bl_debug_draw_edges_tot; i ++) {
+ glVertex3fv(_bl_debug_draw_edges[i][0]);
+ glVertex3fv(_bl_debug_draw_edges[i][1]);
+ }
+ glEnd();
+ }
}
#endif
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index c7ba3378073..0d8567b256d 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1653,7 +1653,7 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
}
-static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom, const short zoom_invert)
+static void viewzoom_apply(ViewOpsData *vod, const int x, const int y, const short viewzoom, const short zoom_invert)
{
float zfac = 1.0;
short use_cam_zoom;
@@ -1674,10 +1674,10 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
float fac;
if (U.uiflag & USER_ZOOM_HORIZ) {
- fac = (float)(x - vod->origx);
+ fac = (float)(vod->origx - x);
}
else {
- fac = (float)(y - vod->origy);
+ fac = (float)(vod->origy - y);
}
if (zoom_invert) {
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 5aee90f0860..cddfae53f6f 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -369,8 +369,6 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event
}
/* store the original camera loc and rot */
- /* TODO. axis angle etc */
-
fly->obtfm = BKE_object_tfm_backup(ob_back);
BKE_object_where_is_calc(fly->scene, fly->v3d->camera);
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 73f1563417c..6105b5e4eb5 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -274,8 +274,8 @@ void view3d_keymap(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, KM_ALT, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.viewport_shade");
- RNA_string_set(kmi->ptr, "value_1", "TEXTURED");
- RNA_string_set(kmi->ptr, "value_2", "SOLID");
+ RNA_string_set(kmi->ptr, "value_1", "SOLID");
+ RNA_string_set(kmi->ptr, "value_2", "TEXTURED");
/* selection*/
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 23c764f9252..b26718bb516 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2860,11 +2860,21 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
(void)spos;
}
-#define SIGN(a) (a<-FLT_EPSILON ? 1 : a>FLT_EPSILON ? 2 : 3)
-#define VECSIGNFLIP(a, b) ((SIGN(a[0]) & SIGN(b[0])) == 0 || (SIGN(a[1]) & SIGN(b[1])) == 0 || (SIGN(a[2]) & SIGN(b[2])) == 0)
+/* FLT_EPSILON is too small [#29633], 0.0000001f starts to flip */
+#define TX_FLIP_EPS 0.00001f
+BLI_INLINE int tx_sign(const float a)
+{
+ return (a < -TX_FLIP_EPS ? 1 : a > TX_FLIP_EPS ? 2 : 3);
+}
+BLI_INLINE int tx_vec_sign_flip(const float a[3], const float b[3])
+{
+ return ((tx_sign(a[0]) & tx_sign(b[0])) == 0 ||
+ (tx_sign(a[1]) & tx_sign(b[1])) == 0 ||
+ (tx_sign(a[2]) & tx_sign(b[2])) == 0);
+}
/* smat is reference matrix, only scaled */
-static void TransMat3ToSize(float mat[][3], float smat[][3], float *size)
+static void TransMat3ToSize(float mat[][3], float smat[][3], float size[3])
{
float vec[3];
@@ -2876,9 +2886,9 @@ static void TransMat3ToSize(float mat[][3], float smat[][3], float *size)
size[2] = normalize_v3(vec);
/* first tried with dotproduct... but the sign flip is crucial */
- if (VECSIGNFLIP(mat[0], smat[0]) ) size[0] = -size[0];
- if (VECSIGNFLIP(mat[1], smat[1]) ) size[1] = -size[1];
- if (VECSIGNFLIP(mat[2], smat[2]) ) size[2] = -size[2];
+ if (tx_vec_sign_flip(mat[0], smat[0]) ) size[0] = -size[0];
+ if (tx_vec_sign_flip(mat[1], smat[1]) ) size[1] = -size[1];
+ if (tx_vec_sign_flip(mat[2], smat[2]) ) size[2] = -size[2];
}
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 311cb5ee94d..947bdf53bee 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -150,8 +150,8 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
if (hasNumInput(&t->num)) {
applyNumInput(&t->num, vec);
- removeAspectRatio(t, vec);
constraintNumInput(t, vec);
+ removeAspectRatio(t, vec);
}
/* autovalues is operator param, use that directly but not if snapping is forced */
diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c
index fa39a52444b..1c32c01b8f0 100644
--- a/source/blender/editors/uvedit/uvedit_buttons.c
+++ b/source/blender/editors/uvedit/uvedit_buttons.c
@@ -94,14 +94,19 @@ static int uvedit_center(Scene *scene, BMEditMesh *em, Image *ima, float center[
return tot;
}
-static void uvedit_translate(Scene *scene, BMEditMesh *em, Image *UNUSED(ima), float delta[2])
+static void uvedit_translate(Scene *scene, BMEditMesh *em, Image *ima, float delta[2])
{
BMFace *f;
BMLoop *l;
BMIter iter, liter;
MLoopUV *luv;
+ MTexPoly *tf;
BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
+ tf = CustomData_bmesh_get(&em->bm->pdata, f->head.data, CD_MTEXPOLY);
+ if (!uvedit_face_visible_test(scene, ima, f, tf))
+ continue;
+
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
if (uvedit_uv_select_test(em, scene, l)) {
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 6664f8e860e..0feaec514d2 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -1705,7 +1705,7 @@ static void UV_OT_remove_doubles(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Doubles UV";
- ot->description = "Selected UV vertices that are within a radius of eachother are welded together";
+ ot->description = "Selected UV vertices that are within a radius of each other are welded together";
ot->idname = "UV_OT_remove_doubles";
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/gpu/shaders/gpu_shader_vertex.glsl b/source/blender/gpu/shaders/gpu_shader_vertex.glsl
index a86431bdd7a..574455e42b3 100644
--- a/source/blender/gpu/shaders/gpu_shader_vertex.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_vertex.glsl
@@ -10,3 +10,11 @@ void main()
varnormal = normalize(gl_NormalMatrix * gl_Normal);
gl_Position = gl_ProjectionMatrix * co;
+ // Setting gl_ClipVertex is necessary to get glClipPlane working on NVIDIA graphic cards.
+ // gl_ClipVertex works only on NVIDIA graphic cards so we have to check with
+ // __GLSL_CG_DATA_TYPES if a NVIDIA graphic card is used (Cg support).
+ // gl_ClipVerte is supported up to GLSL 1.20.
+ #ifdef __GLSL_CG_DATA_TYPES
+ gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+ #endif
+
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index af15333ece5..ca81f4c915a 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -379,6 +379,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
copy_v3_v3(goalpos, goal[3]);
copy_m3_m4(goalrot, goal);
+ normalize_m3(goalrot);
/* same for pole vector target */
if (data->poletar) {
@@ -433,7 +434,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
iktarget = iktree[target->tip];
- if (data->weight != 0.0f) {
+ if ((data->flag & CONSTRAINT_IK_POS) && data->weight != 0.0f) {
if (poleconstrain)
IK_SolverSetPoleVectorConstraint(solver, iktarget, goalpos,
polepos, data->poleangle, (poleangledata == data));
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index d20c6dec9d3..c8bc3f8ebb8 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -139,9 +139,19 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon
if (ibuf->rect_float != 0 && bitspersample != 8) {
/* don't use the float buffer to save 8 bpp picture to prevent color banding
(there's no dithering algorithm behing the logImageSetDataRGBA function) */
- IMB_flipy(ibuf);
- rvalue = (logImageSetDataRGBA(logImage, ibuf->rect_float, 1) == 0);
- IMB_flipy(ibuf);
+
+ fbuf = (float *)MEM_mallocN(ibuf->x * ibuf->y * 4 * sizeof(float), "fbuf in imb_save_dpx_cineon");
+
+ for (y = 0; y < ibuf->y; y++) {
+ float *dst_ptr = fbuf + 4 * ((ibuf->y - y - 1) * ibuf->x);
+ float *src_ptr = ibuf->rect_float + 4 * (y * ibuf->x);
+
+ memcpy(dst_ptr, src_ptr, 4 * ibuf->x * sizeof(float));
+ }
+
+ rvalue = (logImageSetDataRGBA(logImage, fbuf, 1) == 0);
+
+ MEM_freeN(fbuf);
}
else {
if (ibuf->rect == 0)
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index 9926d8c8562..3049a5be514 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -188,7 +188,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
}
else {
if (verbose) printf("Cineon: Bad magic number %lu in \"%s\".\n",
- (uintptr_t)header.fileHeader.magic_num, byteStuff);
+ (unsigned long)header.fileHeader.magic_num, byteStuff);
logImageClose(cineon);
return 0;
}
diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt
index d5cb8e8a3b6..6c428afe535 100644
--- a/source/blender/imbuf/intern/openexr/CMakeLists.txt
+++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt
@@ -52,4 +52,6 @@ if(WITH_IMAGE_OPENEXR)
add_definitions(-DWITH_OPENEXR)
endif()
+message(STATUS "EXR ${INC_SYS}")
+
blender_add_lib(bf_imbuf_openexr "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 5d2632ec0d7..da7b31cc2ba 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -72,21 +72,6 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
#include <iostream>
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-#include <half.h>
-#include <Iex/Iex.h>
-#include <IlmImf/ImfVersion.h>
-#include <IlmImf/ImfArray.h>
-#include <IlmImf/ImfIO.h>
-#include <IlmImf/ImfChannelList.h>
-#include <IlmImf/ImfPixelType.h>
-#include <IlmImf/ImfInputFile.h>
-#include <IlmImf/ImfOutputFile.h>
-#include <IlmImf/ImfCompression.h>
-#include <IlmImf/ImfCompressionAttribute.h>
-#include <IlmImf/ImfStringAttribute.h>
-#include <Imath/ImathBox.h>
-#else
#include <half.h>
#include <Iex.h>
#include <ImfVersion.h>
@@ -100,7 +85,6 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
#include <ImfCompression.h>
#include <ImfCompressionAttribute.h>
#include <ImfStringAttribute.h>
-#endif
using namespace Imf;
using namespace Imath;
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index fe138a71a4a..42fb0c79b62 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -228,16 +228,27 @@ static int isqtime(const char *name)
#ifdef WITH_FFMPEG
+#ifdef _MSC_VER
+#define va_copy(dst, src) ((dst) = (src))
+#endif
+
/* BLI_vsnprintf in ffmpeg_log_callback() causes invalid warning */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-format-attribute"
+#ifdef __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wmissing-format-attribute"
+#endif
static char ffmpeg_last_error[1024];
static void ffmpeg_log_callback(void *ptr, int level, const char *format, va_list arg)
{
if (ELEM(level, AV_LOG_FATAL, AV_LOG_ERROR)) {
- size_t n = BLI_vsnprintf(ffmpeg_last_error, sizeof(ffmpeg_last_error), format, arg);
+ size_t n;
+ va_list arg2;
+
+ va_copy(arg2, arg);
+
+ n = BLI_vsnprintf(ffmpeg_last_error, sizeof(ffmpeg_last_error), format, arg2);
/* strip trailing \n */
ffmpeg_last_error[n - 1] = '\0';
@@ -249,7 +260,9 @@ static void ffmpeg_log_callback(void *ptr, int level, const char *format, va_lis
}
}
-#pragma GCC diagnostic pop
+#ifdef __GNUC__
+# pragma GCC diagnostic pop
+#endif
void IMB_ffmpeg_init(void)
{
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index a730bee4f79..94d8ed00cf7 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -372,7 +372,7 @@ typedef enum ePose_Flags {
/* bPose->iksolver and bPose->ikparam->iksolver */
typedef enum ePose_IKSolverType {
- IKSOLVER_LEGACY = 0,
+ IKSOLVER_STANDARD = 0,
IKSOLVER_ITASC = 1
} ePose_IKSolverType;
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 2c896e4893f..3875a0d5799 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -76,6 +76,7 @@ typedef enum ModifierType {
eModifierType_Remesh = 41,
eModifierType_Skin = 42,
eModifierType_LaplacianSmooth = 43,
+ eModifierType_Triangulate = 44,
NUM_MODIFIER_TYPES
} ModifierType;
@@ -1114,11 +1115,23 @@ enum {
MOD_SKIN_SMOOTH_SHADING = 1
};
+/* Triangulate modifier */
+
+typedef struct TriangulateModifierData {
+ ModifierData modifier;
+ int flag;
+ int pad;
+} TriangulateModifierData;
+
+enum {
+ MOD_TRIANGULATE_BEAUTY = (1 << 0),
+};
+
/* Smooth modifier flags */
#define MOD_LAPLACIANSMOOTH_X (1<<1)
#define MOD_LAPLACIANSMOOTH_Y (1<<2)
#define MOD_LAPLACIANSMOOTH_Z (1<<3)
-#define MOD_LAPLACIANSMOOTH_VOLUME_PRESERVATION (1<<4)
+#define MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME (1 << 4)
typedef struct LaplacianSmoothModifierData {
ModifierData modifier;
diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h
index 810628ac29b..6ce883905d4 100644
--- a/source/blender/makesdna/DNA_text_types.h
+++ b/source/blender/makesdna/DNA_text_types.h
@@ -44,15 +44,6 @@ typedef struct TextLine {
int len, blen; /* blen unused */
} TextLine;
-typedef struct TextMarker {
- struct TextMarker *next, *prev;
-
- int lineno, start, end, pad1; /* line number and start/end character indices */
-
- int group, flags; /* see BKE_text.h for flag defines */
- unsigned char color[4], pad[4]; /* draw color of the marker */
-} TextMarker;
-
typedef struct Text {
ID id;
@@ -63,7 +54,6 @@ typedef struct Text {
ListBase lines;
TextLine *curl, *sell;
int curc, selc;
- ListBase markers;
char *undo_buf;
int undo_pos, undo_len;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 1770a6e497c..b8bb7a5846d 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -601,7 +601,7 @@ typedef enum eOpenGL_RenderingOptions {
/* backwards compatibilty in do_versions! */
USER_DISABLE_MIPMAP = (1 << 2),
USER_DISABLE_VBO = (1 << 3),
- USER_DISABLE_AA = (1 << 4),
+ /* USER_DISABLE_AA = (1 << 4), */ /* DEPRECATED */
} eOpenGL_RenderingOptions;
/* wm draw method */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 8885349ecc5..0df6fc41269 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -561,7 +561,6 @@ extern StructRNA RNA_TextBox;
extern StructRNA RNA_TextCharacterFormat;
extern StructRNA RNA_TextCurve;
extern StructRNA RNA_TextLine;
-extern StructRNA RNA_TextMarker;
extern StructRNA RNA_Texture;
extern StructRNA RNA_TextureNode;
extern StructRNA RNA_TextureNodeBricks;
@@ -1089,6 +1088,11 @@ __attribute__ ((format(printf, 1, 2)))
#endif
;
+/* Equals test (skips pointers and collections) */
+
+int RNA_property_equals(struct PointerRNA *a, struct PointerRNA *b, struct PropertyRNA *prop);
+int RNA_struct_equals(struct PointerRNA *a, struct PointerRNA *b);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index c057739a28f..075dc959173 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -1223,6 +1223,89 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
return func;
}
+static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc, const char *item_type)
+{
+ char *func;
+ StructRNA *item_srna, *item_name_base;
+ PropertyRNA *item_name_prop;
+ const int namebuflen = 1024;
+
+ if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
+ return NULL;
+
+ if (!manualfunc) {
+ if (!dp->dnastructname || !dp->dnaname)
+ return NULL;
+
+ /* only supported for collection items with name properties */
+ item_srna = rna_find_struct(item_type);
+ if (item_srna && item_srna->nameproperty) {
+ item_name_prop = item_srna->nameproperty;
+ item_name_base = item_srna;
+ while (item_name_base->base && item_name_base->base->nameproperty == item_name_prop)
+ item_name_base = item_name_base->base;
+ }
+ else
+ return NULL;
+ }
+
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_string");
+
+ fprintf(f, "int %s(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)\n", func);
+ fprintf(f, "{\n");
+
+ if (manualfunc) {
+ fprintf(f, " return %s(ptr, key, r_ptr);\n", manualfunc);
+ fprintf(f, "}\n\n");
+ return func;
+ }
+
+ /* XXX extern declaration could be avoid by including RNA_blender.h, but this has lots of unknown
+ * DNA types in functions, leading to conflicting function signatures.
+ */
+ fprintf(f, " extern int %s_%s_length(PointerRNA *);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " extern void %s_%s_get(PointerRNA *, char *);\n\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+
+ fprintf(f, " int found= 0;\n");
+ fprintf(f, " CollectionPropertyIterator iter;\n");
+ fprintf(f, " char namebuf[%d];\n", namebuflen);
+ fprintf(f, " char *name;\n\n");
+
+ fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+
+ fprintf(f, " while (iter.valid) {\n");
+ fprintf(f, " int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " if (namelen < %d) {\n", namebuflen);
+ fprintf(f, " %s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " if (strcmp(namebuf, key) == 0) {\n");
+ fprintf(f, " found = 1;\n");
+ fprintf(f, " *r_ptr = iter.ptr;\n");
+ fprintf(f, " break;\n");
+ fprintf(f, " }\n");
+ fprintf(f, " }\n");
+ fprintf(f, " else {\n");
+ fprintf(f, " name = MEM_mallocN(namelen+1, \"name string\");\n");
+ fprintf(f, " %s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " if (strcmp(name, key) == 0) {\n");
+ fprintf(f, " MEM_freeN(name);\n\n");
+ fprintf(f, " found = 1;\n");
+ fprintf(f, " *r_ptr = iter.ptr;\n");
+ fprintf(f, " break;\n");
+ fprintf(f, " }\n");
+ fprintf(f, " else\n");
+ fprintf(f, " MEM_freeN(name);\n");
+ fprintf(f, " }\n");
+ fprintf(f, " %s_%s_next(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, " }\n");
+ fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+
+ fprintf(f, " return found;\n");
+ fprintf(f, "}\n\n");
+
+ return func;
+}
+
static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *UNUSED(dp),
const char *manualfunc)
{
@@ -1403,6 +1486,7 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
{
CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
const char *nextfunc = (const char *)cprop->next;
+ const char *item_type = (const char *)cprop->item_type;
if (dp->dnatype && strcmp(dp->dnatype, "ListBase") == 0) {
/* pass */
@@ -1426,6 +1510,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
cprop->end = (void *)rna_def_property_end_func(f, srna, prop, dp, (const char *)cprop->end);
cprop->lookupint = (void *)rna_def_property_lookup_int_func(f, srna, prop, dp,
(const char *)cprop->lookupint, nextfunc);
+ cprop->lookupstring = (void *)rna_def_property_lookup_string_func(f, srna, prop, dp,
+ (const char *)cprop->lookupstring, item_type);
if (!(prop->flag & PROP_IDPROPERTY)) {
if (!cprop->begin) {
@@ -3172,6 +3258,8 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
fprintf(f, "#include <string.h>\n\n");
fprintf(f, "#include <stddef.h>\n\n");
+ fprintf(f, "#include \"MEM_guardedalloc.h\"\n\n");
+
fprintf(f, "#include \"DNA_ID.h\"\n");
fprintf(f, "#include \"DNA_scene_types.h\"\n");
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 81e738ed82f..470e87daeea 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -2551,7 +2551,10 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
pprop = (PointerPropertyRNA *)prop;
/* for groups, data is idprop itself */
- return rna_pointer_inherit_refine(ptr, pprop->type, idprop);
+ if (pprop->typef)
+ return rna_pointer_inherit_refine(ptr, pprop->typef(ptr), idprop);
+ else
+ return rna_pointer_inherit_refine(ptr, pprop->type, idprop);
}
else if (pprop->get) {
return pprop->get(ptr);
@@ -4147,12 +4150,15 @@ char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop)
path = BLI_sprintfN(is_rna ? "%s.%s" : "%s[\"%s\"]", ptrpath, propname);
MEM_freeN(ptrpath);
}
- else {
+ else if (RNA_struct_is_ID(ptr->type)) {
if (is_rna)
path = BLI_strdup(propname);
else
path = BLI_sprintfN("[\"%s\"]", propname);
}
+ else {
+ path = NULL;
+ }
return path;
}
@@ -5718,7 +5724,7 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
/* get the length of the array to work with */
len = RNA_property_array_length(ptr, prop);
- fromlen = RNA_property_array_length(ptr, prop);
+ fromlen = RNA_property_array_length(fromptr, prop);
if (len != fromlen)
return 0;
@@ -5832,3 +5838,146 @@ void _RNA_warning(const char *format, ...)
}
#endif
}
+
+int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop)
+{
+ /* get the length of the array to work with */
+ int len = RNA_property_array_length(a, prop);
+ int fromlen = RNA_property_array_length(b, prop);
+
+ if (len != fromlen)
+ return 0;
+
+ /* get and set the default values as appropriate for the various types */
+ switch (RNA_property_type(prop)) {
+ case PROP_BOOLEAN: {
+ if (len) {
+ int fixed_a[16], fixed_b[16];
+ int *array_a, *array_b;
+ int equals;
+
+ array_a = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_a;
+ array_b = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_b;
+
+ RNA_property_boolean_get_array(a, prop, array_a);
+ RNA_property_boolean_get_array(b, prop, array_b);
+
+ equals = memcmp(array_a, array_b, sizeof(int) * len) == 0;
+
+ if (array_a != fixed_a) MEM_freeN(array_a);
+ if (array_b != fixed_b) MEM_freeN(array_b);
+
+ return equals;
+ }
+ else {
+ int value = RNA_property_boolean_get(a, prop);
+ return value == RNA_property_boolean_get(b, prop);
+ }
+ }
+
+ case PROP_INT: {
+ if (len) {
+ int fixed_a[16], fixed_b[16];
+ int *array_a, *array_b;
+ int equals;
+
+ array_a = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_a;
+ array_b = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_b;
+
+ RNA_property_int_get_array(a, prop, array_a);
+ RNA_property_int_get_array(b, prop, array_b);
+
+ equals = memcmp(array_a, array_b, sizeof(int) * len) == 0;
+
+ if (array_a != fixed_a) MEM_freeN(array_a);
+ if (array_b != fixed_b) MEM_freeN(array_b);
+
+ return equals;
+ }
+ else {
+ int value = RNA_property_int_get(a, prop);
+ return value == RNA_property_int_get(b, prop);
+ }
+ }
+
+ case PROP_FLOAT: {
+ if (len) {
+ float fixed_a[16], fixed_b[16];
+ float *array_a, *array_b;
+ int equals;
+
+ array_a = (len > 16)? MEM_callocN(sizeof(float) * len, "RNA equals"): fixed_a;
+ array_b = (len > 16)? MEM_callocN(sizeof(float) * len, "RNA equals"): fixed_b;
+
+ RNA_property_float_get_array(a, prop, array_a);
+ RNA_property_float_get_array(b, prop, array_b);
+
+ equals = memcmp(array_a, array_b, sizeof(float) * len) == 0;
+
+ if (array_a != fixed_a) MEM_freeN(array_a);
+ if (array_b != fixed_b) MEM_freeN(array_b);
+
+ return equals;
+ }
+ else {
+ float value = RNA_property_float_get(a, prop);
+ return value == RNA_property_float_get(b, prop);
+ }
+ }
+
+ case PROP_ENUM: {
+ int value = RNA_property_enum_get(a, prop);
+ return value == RNA_property_enum_get(b, prop);
+ }
+
+ case PROP_STRING: {
+ char fixed_a[128], fixed_b[128];
+ int len_a, len_b;
+ char *value_a = RNA_property_string_get_alloc(a, prop, fixed_a, sizeof(fixed_a), &len_a);
+ char *value_b = RNA_property_string_get_alloc(b, prop, fixed_b, sizeof(fixed_b), &len_b);
+ int equals = strcmp(value_a, value_b) == 0;
+
+ if (value_a != fixed_a) MEM_freeN(value_a);
+ if (value_b != fixed_b) MEM_freeN(value_b);
+
+ return equals;
+ }
+
+ default:
+ break;
+ }
+
+ return 1;
+}
+
+int RNA_struct_equals(PointerRNA *a, PointerRNA *b)
+{
+ CollectionPropertyIterator iter;
+// CollectionPropertyRNA *citerprop; /* UNUSED */
+ PropertyRNA *iterprop;
+ int equals = 1;
+
+ if (a == NULL && b == NULL)
+ return 1;
+ else if (a == NULL || b == NULL)
+ return 0;
+ else if (a->type != b->type)
+ return 0;
+
+ iterprop = RNA_struct_iterator_property(a->type);
+// citerprop = (CollectionPropertyRNA *)rna_ensure_property(iterprop); /* UNUSED */
+
+ RNA_property_collection_begin(a, iterprop, &iter);
+ for (; iter.valid; RNA_property_collection_next(&iter)) {
+ PropertyRNA *prop = iter.ptr.data;
+
+ if (!RNA_property_equals(a, b, prop)) {
+ equals = 0;
+ break;
+ }
+ }
+ RNA_property_collection_end(&iter);
+
+ return equals;
+}
+
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index b1fdfccd0be..b653289e44d 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -973,13 +973,13 @@ static void rna_def_sound_actuator(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
RNA_def_property_range(prop, 0.0, 2.0);
RNA_def_property_ui_text(prop, "Volume", "Initial volume of the sound");
- RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+ RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_range(prop, -12.0, 12.0, 1, 2);
RNA_def_property_ui_text(prop, "Pitch", "Pitch of the sound");
- RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+ RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
RNA_def_property_update(prop, NC_LOGIC, NULL);
/* floats - 3D Parameters */
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 7b6b629ca82..30a9bfd81f6 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -614,7 +614,7 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 10000);
+ RNA_def_property_range(prop, 0, 10000);
RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations");
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index 9d63e0e687d..af39500442d 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -421,7 +421,7 @@ static void rna_def_lamp(BlenderRNA *brna)
/* textures */
rna_def_mtex_common(brna, srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get",
- "rna_Lamp_active_texture_set", NULL, "LampTextureSlot", "LampTextureSlots", "rna_Lamp_update");
+ "rna_Lamp_active_texture_set", NULL, "LampTextureSlot", "LampTextureSlots", "rna_Lamp_draw_update");
}
static void rna_def_lamp_falloff(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 2e3f8feda44..06df6c5afbc 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -78,6 +78,7 @@ EnumPropertyItem modifier_type_items[] = {
{eModifierType_Skin, "SKIN", ICON_MOD_SKIN, "Skin", ""},
{eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
{eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
+ {eModifierType_Triangulate, "TRIANGULATE", ICON_MOD_TRIANGULATE, "Triangulate", ""},
{0, "", 0, N_("Deform"), ""},
{eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
{eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
@@ -213,6 +214,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
return &RNA_SkinModifier;
case eModifierType_LaplacianSmooth:
return &RNA_LaplacianSmoothModifier;
+ case eModifierType_Triangulate:
+ return &RNA_TriangulateModifier;
default:
return &RNA_Modifier;
}
@@ -1814,7 +1817,7 @@ static void rna_def_modifier_laplaciansmooth(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_VOLUME_PRESERVATION);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME);
RNA_def_property_ui_text(prop, "Preserve Volume", "Apply volume preservation after smooth");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -3361,6 +3364,22 @@ static void rna_def_modifier_skin(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
+static void rna_def_modifier_triangulate(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "TriangulateModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Triangulate Modifier", "Triangulate Mesh");
+ 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");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+}
+
void RNA_def_modifier(BlenderRNA *brna)
{
StructRNA *srna;
@@ -3468,6 +3487,7 @@ void RNA_def_modifier(BlenderRNA *brna)
rna_def_modifier_remesh(brna);
rna_def_modifier_skin(brna);
rna_def_modifier_laplaciansmooth(brna);
+ rna_def_modifier_triangulate(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 412aad20a41..5c90fb8787c 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -675,7 +675,7 @@ static void rna_def_bone_group(BlenderRNA *brna)
}
static EnumPropertyItem prop_iksolver_items[] = {
- {IKSOLVER_LEGACY, "LEGACY", 0, "Legacy", "Original IK solver"},
+ {IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"},
{IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"},
{0, NULL, 0, NULL, NULL}
};
@@ -1126,7 +1126,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "numiter");
- RNA_def_property_range(prop, 1.f, 1000.f);
+ RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_text(prop, "Iterations",
"Maximum number of iterations for convergence in case of reiteration");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
@@ -1221,8 +1221,7 @@ static void rna_def_pose_ikparam(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "iksolver");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, prop_iksolver_items);
- RNA_def_property_ui_text(prop, "IK Solver",
- "IK solver for which these parameters are defined, 0 for Legacy, 1 for iTaSC");
+ RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined");
}
/* pose.bone_groups */
@@ -1285,8 +1284,7 @@ static void rna_def_pose(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "iksolver");
RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL);
RNA_def_property_enum_items(prop, prop_iksolver_items);
- RNA_def_property_ui_text(prop, "IK Solver",
- "Selection of IK solver for IK chain, current choice is 0 for Legacy, 1 for iTaSC");
+ RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_ik_solver_update");
prop = RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 09d0eeb1e34..ffcca772764 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3575,7 +3575,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Volume", "Audio volume");
- RNA_def_property_translation_context(prop, "Audio");
+ RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
#endif
@@ -4408,6 +4408,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_sequencer_gl_preview", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_GL_PREV);
RNA_def_property_ui_text(prop, "Sequencer OpenGL", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
#if 0 /* see R_SEQ_GL_REND comment */
prop = RNA_def_property(srna, "use_sequencer_gl_render", PROP_BOOLEAN, PROP_NONE);
@@ -5017,7 +5018,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "audio.volume");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Volume", "Audio volume");
- RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+ RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
RNA_def_property_update(prop, NC_SCENE, NULL);
RNA_def_property_float_funcs(prop, NULL, "rna_Scene_volume_set", NULL);
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index c2fa64698e4..18a9b9683f8 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1875,7 +1875,7 @@ static void rna_def_sound(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "volume");
RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
- RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+ RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_volume_set", NULL);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
@@ -1883,7 +1883,7 @@ static void rna_def_sound(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "pitch");
RNA_def_property_range(prop, 0.1f, 10.0f);
RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
- RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+ RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pitch_set", NULL);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
diff --git a/source/blender/makesrna/intern/rna_speaker.c b/source/blender/makesrna/intern/rna_speaker.c
index a160aaf94e2..139582104ee 100644
--- a/source/blender/makesrna/intern/rna_speaker.c
+++ b/source/blender/makesrna/intern/rna_speaker.c
@@ -152,7 +152,7 @@ static void rna_def_speaker(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "volume");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Volume", "How loud the sound is");
- RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+ RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_set", NULL); */
/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
@@ -160,7 +160,7 @@ static void rna_def_speaker(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "pitch");
RNA_def_property_range(prop, 0.1f, 10.0f);
RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
- RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_AUDIO);
+ RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND);
/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_pitch_set", NULL); */
/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index e46373b250c..b1637ef4c8a 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -129,49 +129,6 @@ static void rna_def_text_line(BlenderRNA *brna)
RNA_def_property_update(prop, NC_TEXT | NA_EDITED, NULL);
}
-static void rna_def_text_marker(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "TextMarker", NULL);
- RNA_def_struct_ui_text(srna, "Text Marker", "Marker highlighting a portion of text in a Text datablock");
-
- prop = RNA_def_property(srna, "line", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "lineno");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Line", "Line in which the marker is located");
-
- prop = RNA_def_property(srna, "character_index_start", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "start");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Start", "Start position of the marker in the line");
-
- prop = RNA_def_property(srna, "character_index_end", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "end");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "End", "Start position of the marker in the line");
-
- prop = RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_range(prop, 0, (int)0xFFFF);
- RNA_def_property_ui_text(prop, "Group", "");
-
- prop = RNA_def_property(srna, "is_temporary", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", TMARK_TEMP);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Temporary", "Marker is temporary");
-
- prop = RNA_def_property(srna, "use_edit_all", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", TMARK_EDITALL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Edit All", "Edit all markers of the same group as one");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Color", "Color to display the marker with");
-}
-
static void rna_def_text(BlenderRNA *brna)
{
StructRNA *srna;
@@ -241,17 +198,12 @@ static void rna_def_text(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Selection End Character",
"Index of character after end of selection in the selection end line");
- prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "TextMarker");
- RNA_def_property_ui_text(prop, "Markers", "Text markers highlighting part of the text");
-
RNA_api_text(srna);
}
void RNA_def_text(BlenderRNA *brna)
{
rna_def_text_line(brna);
- rna_def_text_marker(brna);
rna_def_text(brna);
}
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index e77c5d13a6b..e67985f68c5 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -233,6 +233,7 @@ void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN
break;
case ID_LA:
WM_main_add_notifier(NC_LAMP | ND_LIGHTING, id);
+ WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, id);
break;
case ID_BR:
WM_main_add_notifier(NC_BRUSH, id);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index de53ef1f90a..59a3a8c2522 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3246,10 +3246,12 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* this isn't essential but nice to check if VBO draws any differently */
RNA_def_property_update(prop, NC_WINDOW, NULL);
+#if 0
prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_AA);
RNA_def_property_ui_text(prop, "Anti-aliasing",
"Use anti-aliasing for the 3D view (may impact redraw performance)");
+#endif
prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter");
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 3a7066ff41a..cf3bb05849a 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -94,6 +94,7 @@ set(SRC
intern/MOD_weightvgedit.c
intern/MOD_weightvgmix.c
intern/MOD_weightvgproximity.c
+ intern/MOD_triangulate.c
MOD_modifiertypes.h
intern/MOD_boolean_util.h
diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h
index a4817ff775d..290ba193567 100644
--- a/source/blender/modifiers/MOD_modifiertypes.h
+++ b/source/blender/modifiers/MOD_modifiertypes.h
@@ -76,6 +76,7 @@ extern ModifierTypeInfo modifierType_DynamicPaint;
extern ModifierTypeInfo modifierType_Remesh;
extern ModifierTypeInfo modifierType_Skin;
extern ModifierTypeInfo modifierType_LaplacianSmooth;
+extern ModifierTypeInfo modifierType_Triangulate;
/* MOD_util.c */
void modifier_type_init(ModifierTypeInfo *types[]);
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 8ddae9f3c57..d4463098f07 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -178,14 +178,14 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
amd->merge_dist, dupe_op, "geom");
BMO_op_exec(bm, &find_op);
-
+
i = 0;
- BMO_ITER (ele, &oiter, bm, dupe_op, "geom", BM_ALL) {
+ BMO_ITER (ele, &oiter, dupe_op->slots_in, "geom", BM_ALL) {
BM_elem_index_set(ele, i); /* set_dirty */
i++;
}
- BMO_ITER (ele, &oiter, bm, dupe_op, "newout", BM_ALL) {
+ BMO_ITER (ele, &oiter, dupe_op->slots_out, "geom.out", BM_ALL) {
BM_elem_index_set(ele, i); /* set_dirty */
i++;
}
@@ -197,7 +197,7 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
index_map = MEM_callocN(sizeof(int) * (*index_map_length), "index_map");
/*element type argument doesn't do anything here*/
- BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
+ BMO_ITER (v, &oiter, find_op.slots_out, "targetmap.out", 0) {
v2 = BMO_iter_map_value_p(&oiter);
index_map[BM_elem_index_get(v)] = BM_elem_index_get(v2) + 1;
@@ -218,9 +218,10 @@ static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
const ArrayModifierData *amd,
BMOperator *dupe_op,
- const char *dupe_slot_name,
+ BMOpSlot dupe_op_slot_args[BMO_OP_MAX_SLOTS], const char *dupe_slot_name,
BMOperator *weld_op)
{
+ const int is_input = (dupe_op->slots_in == dupe_op_slot_args);
BMVert *v, *v2, *v3;
BMIter iter;
@@ -234,14 +235,27 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
BMOIter oiter;
BMOperator find_op;
+ BMOpSlot *slot_targetmap;
BMO_op_initf(bm, &find_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
- "find_doubles verts=%Hv dist=%f keep_verts=%s",
+ is_input ? /* ugh */
+ "find_doubles verts=%Hv dist=%f keep_verts=%s" :
+ "find_doubles verts=%Hv dist=%f keep_verts=%S",
BM_ELEM_TAG, amd->merge_dist,
dupe_op, dupe_slot_name);
/* append the dupe's geom to the findop input verts */
- BMO_slot_buffer_append(&find_op, "verts", dupe_op, dupe_slot_name);
+ if (is_input) {
+ BMO_slot_buffer_append(&find_op, slots_in, "verts",
+ dupe_op, slots_in, dupe_slot_name);
+ }
+ else if (dupe_op->slots_out == dupe_op_slot_args) {
+ BMO_slot_buffer_append(&find_op, slots_in, "verts",
+ dupe_op, slots_out, dupe_slot_name);
+ }
+ else {
+ BLI_assert(0);
+ }
/* transform and tag verts */
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
@@ -253,15 +267,17 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
BMO_op_exec(bm, &find_op);
+ slot_targetmap = BMO_slot_get(weld_op->slots_in, "targetmap");
+
/* add new merge targets to weld operator */
- BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
+ BMO_ITER (v, &oiter, find_op.slots_out, "targetmap.out", 0) {
v2 = BMO_iter_map_value_p(&oiter);
/* check in case the target vertex (v2) is already marked
* for merging */
- while ((v3 = BMO_slot_map_ptr_get(bm, weld_op, "targetmap", v2))) {
+ while ((v3 = BMO_slot_map_ptr_get(slot_targetmap, v2))) {
v2 = v3;
}
- BMO_slot_map_ptr_insert(bm, weld_op, "targetmap", v, v2);
+ BMO_slot_map_ptr_insert(weld_op, slot_targetmap, v, v2);
}
BMO_op_finish(bm, &find_op);
@@ -286,6 +302,7 @@ static void merge_first_last(BMesh *bm,
BMOperator find_op;
BMOIter oiter;
BMVert *v, *v2;
+ BMOpSlot *slot_targetmap;
BMO_op_initf(bm, &find_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"find_doubles verts=%s dist=%f keep_verts=%s",
@@ -293,14 +310,16 @@ static void merge_first_last(BMesh *bm,
dupe_first, "geom");
/* append the last dupe's geom to the findop input verts */
- BMO_slot_buffer_append(&find_op, "verts", dupe_last, "newout");
+ BMO_slot_buffer_append(&find_op, slots_in, "verts",
+ dupe_last, slots_out, "geom.out");
BMO_op_exec(bm, &find_op);
/* add new merge targets to weld operator */
- BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
+ slot_targetmap = BMO_slot_get(weld_op->slots_in, "targetmap");
+ BMO_ITER (v, &oiter, find_op.slots_out, "targetmap.out", 0) {
v2 = BMO_iter_map_value_p(&oiter);
- BMO_slot_map_ptr_insert(bm, weld_op, "targetmap", v, v2);
+ BMO_slot_map_ptr_insert(weld_op, slot_targetmap, v, v2);
}
BMO_op_finish(bm, &find_op);
@@ -325,6 +344,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
int *indexMap = NULL;
DerivedMesh *start_cap = NULL, *end_cap = NULL;
MVert *src_mvert;
+ BMOpSlot *slot_targetmap = NULL; /* for weldop */
/* need to avoid infinite recursion here */
if (amd->start_cap && amd->start_cap != ob)
@@ -412,10 +432,13 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
BMO_push(bm, NULL);
bmesh_edit_begin(bm, 0);
- if (amd->flags & MOD_ARR_MERGE)
+ if (amd->flags & MOD_ARR_MERGE) {
BMO_op_init(bm, &weld_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"weld_verts");
+ slot_targetmap = BMO_slot_get(weld_op.slots_in, "targetmap");
+ }
+
BMO_op_initf(bm, &dupe_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"duplicate geom=%avef");
first_dupe_op = dupe_op;
@@ -423,18 +446,18 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
for (j = 0; j < count - 1; j++) {
BMVert *v, *v2, *v3;
BMOpSlot *geom_slot;
- BMOpSlot *newout_slot;
+ BMOpSlot *geom_out_slot;
BMOIter oiter;
if (j != 0) {
BMO_op_initf(bm, &dupe_op,
(BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
- "duplicate geom=%s", &old_dupe_op, "newout");
+ "duplicate geom=%S", &old_dupe_op, "geom.out");
}
BMO_op_exec(bm, &dupe_op);
- geom_slot = BMO_slot_get(&dupe_op, "geom");
- newout_slot = BMO_slot_get(&dupe_op, "newout");
+ geom_slot = BMO_slot_get(dupe_op.slots_in, "geom");
+ geom_out_slot = BMO_slot_get(dupe_op.slots_out, "geom.out");
if ((amd->flags & MOD_ARR_MERGEFINAL) && j == 0) {
int first_geom_bytes = sizeof(BMVert *) * geom_slot->len;
@@ -446,7 +469,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
}
/* apply transformation matrix */
- BMO_ITER (v, &oiter, bm, &dupe_op, "newout", BM_VERT) {
+ BMO_ITER (v, &oiter, dupe_op.slots_out, "geom.out", BM_VERT) {
mul_m4_v3(offset, v->co);
}
@@ -465,17 +488,17 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
for (i = 0; i < index_len; i++) {
if (!indexMap[i]) continue;
- /* merge v (from 'newout') into v2 (from old 'geom') */
- v = _E(newout_slot, i - geom_slot->len);
+ /* merge v (from 'geom.out') into v2 (from old 'geom') */
+ v = _E(geom_out_slot, i - geom_slot->len);
v2 = _E(geom_slot, indexMap[i] - 1);
/* check in case the target vertex (v2) is already marked
* for merging */
- while ((v3 = BMO_slot_map_ptr_get(bm, &weld_op, "targetmap", v2))) {
+ while ((v3 = BMO_slot_map_ptr_get(slot_targetmap, v2))) {
v2 = v3;
}
- BMO_slot_map_ptr_insert(bm, &weld_op, "targetmap", v, v2);
+ BMO_slot_map_ptr_insert(&weld_op, slot_targetmap, v, v2);
}
#undef _E
@@ -511,14 +534,15 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
float startoffset[4][4];
invert_m4_m4(startoffset, offset);
bm_merge_dm_transform(bm, start_cap, startoffset, amd,
- &first_dupe_op, "geom", &weld_op);
+ &first_dupe_op, first_dupe_op.slots_in, "geom", &weld_op);
}
if (end_cap) {
float endoffset[4][4];
mult_m4_m4m4(endoffset, offset, final_offset);
bm_merge_dm_transform(bm, end_cap, endoffset, amd,
- &dupe_op, count == 1 ? "geom" : "newout", &weld_op);
+ &dupe_op, (count == 1) ? dupe_op.slots_in : dupe_op.slots_out,
+ (count == 1) ? "geom" : "geom.out", &weld_op);
}
}
/* done capping */
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 47523286229..13d409dc941 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -426,7 +426,11 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm,
FluidsimModifierData *fluidmd, int framenr, int useRenderParams)
{
int displaymode = 0;
- int curFrame = framenr - 1 /*scene->r.sfra*/; /* start with 0 at start frame */
+
+ int curFrame = framenr /* - 1 */ /*scene->r.sfra*/; /* start with 0 at start frame */
+ /* why start with 0 as start frame?? Animations + time are frozen for frame 0 anyway. (See physics_fluid.c for that. - DG */
+ /* If we start with frame 0, we need to remap all animation channels, too, because they will all be 1 frame late if using frame-1! - DG */
+
char targetFile[FILE_MAX];
FluidsimSettings *fss = fluidmd->fss;
DerivedMesh *dm = NULL;
diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
index 6f6589d4d14..266226040a3 100644
--- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c
+++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
@@ -199,7 +199,7 @@ static void init_data(ModifierData *md)
smd->lambda = 0.00001f;
smd->lambda_border = 0.00005f;
smd->repeat = 1;
- smd->flag = MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z | MOD_LAPLACIANSMOOTH_VOLUME_PRESERVATION;
+ smd->flag = MOD_LAPLACIANSMOOTH_X | MOD_LAPLACIANSMOOTH_Y | MOD_LAPLACIANSMOOTH_Z | MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME;
smd->defgrp_name[0] = '\0';
}
@@ -511,7 +511,7 @@ static void validate_solution(LaplacianSystem *sys, short flag)
float leni, lene;
float vini, vend;
float *vi1, *vi2, ve1[3], ve2[3];
- if (flag & MOD_LAPLACIANSMOOTH_VOLUME_PRESERVATION) {
+ if (flag & MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME) {
vini = compute_volume(sys->vertexCos, sys->mfaces, sys->numFaces);
}
for (i = 0; i < sys->numEdges; i++) {
@@ -545,7 +545,7 @@ static void validate_solution(LaplacianSystem *sys, short flag)
}
}
}
- if (flag & MOD_LAPLACIANSMOOTH_VOLUME_PRESERVATION) {
+ if (flag & MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME) {
vend = compute_volume(sys->vertexCos, sys->mfaces, sys->numFaces);
volume_preservation(sys, vini, vend, flag);
}
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index 96f97a6fa8a..9f702957fa5 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -249,14 +249,14 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
}
/* Apply face attributes to hull output */
- BMO_ITER (f, &oiter, bm, &op, "geomout", BM_FACE) {
+ BMO_ITER (f, &oiter, op.slots_out, "geom.out", BM_FACE) {
if (so->smd->flag & MOD_SKIN_SMOOTH_SHADING)
BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
f->mat_nr = so->mat_nr;
}
/* Mark interior frames */
- BMO_ITER (v, &oiter, bm, &op, "interior_geom", BM_VERT) {
+ BMO_ITER (v, &oiter, op.slots_out, "geom_interior.out", BM_VERT) {
for (i = 0; i < totframe; i++) {
Frame *frame = frames[i];
@@ -309,7 +309,7 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
/* Check if removing triangles above will create wire triangles,
* mark them too */
- BMO_ITER (e, &oiter, bm, &op, "geomout", BM_EDGE) {
+ BMO_ITER (e, &oiter, op.slots_out, "geom.out", BM_EDGE) {
int is_wire = TRUE;
BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
if (!BM_elem_flag_test(f, BM_ELEM_TAG)) {
@@ -1080,17 +1080,20 @@ static BMFace *collapse_face_corners(BMesh *bm, BMFace *f, int n,
BMOperator op;
BMIter iter;
int i;
+ BMOpSlot *slot_targetmap;
shortest_edge = BM_face_find_shortest_loop(f)->e;
BMO_op_initf(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE), "weld_verts");
+ slot_targetmap = BMO_slot_get(op.slots_in, "targetmap");
+
/* Note: could probably calculate merges in one go to be
* faster */
v_safe = shortest_edge->v1;
v_merge = shortest_edge->v2;
mid_v3_v3v3(v_safe->co, v_safe->co, v_merge->co);
- BMO_slot_map_ptr_insert(bm, &op, "targetmap", v_merge, v_safe);
+ BMO_slot_map_ptr_insert(&op, slot_targetmap, v_merge, v_safe);
BMO_op_exec(bm, &op);
BMO_op_finish(bm, &op);
@@ -1216,6 +1219,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
BMOIter oiter;
BMOperator op;
int i, best_order[4];
+ BMOpSlot *slot_targetmap;
BLI_assert(split_face->len >= 3);
@@ -1229,7 +1233,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
/* Update split face (should only be one new face created
* during extrusion) */
split_face = NULL;
- BMO_ITER (f, &oiter, bm, &op, "faceout", BM_FACE) {
+ BMO_ITER (f, &oiter, op.slots_out, "faces.out", BM_FACE) {
BLI_assert(!split_face);
split_face = f;
}
@@ -1247,7 +1251,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
BM_elem_flag_enable(longest_edge, BM_ELEM_TAG);
BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
- "subdivide_edges edges=%he numcuts=%i quadcornertype=%i",
+ "subdivide_edges edges=%he cuts=%i quad_corner_type=%i",
BM_ELEM_TAG, 1, SUBD_STRAIGHT_CUT);
}
else if (split_face->len > 4) {
@@ -1281,8 +1285,9 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
BM_face_kill(bm, split_face);
BMO_op_init(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"weld_verts");
+ slot_targetmap = BMO_slot_get(op.slots_in, "targetmap");
for (i = 0; i < 4; i++) {
- BMO_slot_map_ptr_insert(bm, &op, "targetmap",
+ BMO_slot_map_ptr_insert(&op, slot_targetmap,
verts[i], frame->verts[best_order[i]]);
}
BMO_op_exec(bm, &op);
diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c
new file mode 100644
index 00000000000..645fd5eb2cf
--- /dev/null
+++ b/source/blender/modifiers/intern/MOD_triangulate.c
@@ -0,0 +1,144 @@
+/*
+ * ***** 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.
+ *
+ * Contributor(s): Antony Riakiotakis
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+/** \file blender/modifiers/intern/MOD_triangulate.c
+ * \ingroup modifiers
+ */
+
+#include "DNA_object_types.h"
+
+#include "BLI_utildefines.h"
+
+#include "BKE_cdderivedmesh.h"
+#include "BKE_modifier.h"
+#include "BKE_tessmesh.h"
+
+/* triangulation modifier, directly calls the bmesh operator */
+
+static DerivedMesh *triangulate_dm(DerivedMesh *dm, const int flag)
+{
+ DerivedMesh *result;
+ BMesh *bm;
+ int total_edges, i;
+ MEdge *me;
+
+ bm = DM_to_bmesh(dm);
+
+ BM_mesh_elem_toolflags_ensure(bm);
+ BMO_push(bm, NULL);
+
+ BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
+ "triangulate faces=%af use_beauty=%b",
+ (flag & MOD_TRIANGULATE_BEAUTY));
+ BMO_pop(bm);
+
+ result = CDDM_from_bmesh(bm, FALSE);
+ BM_mesh_free(bm);
+
+ total_edges = result->getNumEdges(result);
+ me = CDDM_get_edges(result);
+
+ /* force drawing of all edges (seems to be omitted in CDDM_from_bmesh) */
+ for (i = 0; i < total_edges; i++, me++)
+ me->flag |= ME_EDGEDRAW | ME_EDGERENDER;
+
+ CDDM_calc_normals(result);
+
+ return result;
+}
+
+
+static void initData(ModifierData *md)
+{
+ TriangulateModifierData *tmd = (TriangulateModifierData *)md;
+
+ /* Enable in editmode by default */
+ md->mode |= eModifierMode_Editmode;
+ tmd->flag = MOD_TRIANGULATE_BEAUTY;
+}
+
+
+static void copyData(ModifierData *md, ModifierData *target)
+{
+ TriangulateModifierData *smd = (TriangulateModifierData *) md;
+ TriangulateModifierData *tsmd = (TriangulateModifierData *) target;
+
+ *tsmd = *smd;
+}
+
+static DerivedMesh *applyModifierEM(ModifierData *md,
+ Object *UNUSED(ob),
+ struct BMEditMesh *UNUSED(em),
+ DerivedMesh *dm)
+{
+ TriangulateModifierData *tmd = (TriangulateModifierData *)md;
+ DerivedMesh *result;
+ if (!(result = triangulate_dm(dm, tmd->flag))) {
+ return dm;
+ }
+
+ return result;
+}
+
+static DerivedMesh *applyModifier(ModifierData *md,
+ Object *UNUSED(ob),
+ DerivedMesh *dm,
+ ModifierApplyFlag UNUSED(flag))
+{
+ TriangulateModifierData *tmd = (TriangulateModifierData *)md;
+ DerivedMesh *result;
+ if (!(result = triangulate_dm(dm, tmd->flag))) {
+ return dm;
+ }
+
+ return result;
+}
+
+ModifierTypeInfo modifierType_Triangulate = {
+ /* name */ "Triangulate",
+ /* structName */ "TriangulateModifierData",
+ /* structSize */ sizeof(TriangulateModifierData),
+ /* type */ eModifierTypeType_Constructive,
+ /* flags */ eModifierTypeFlag_AcceptsMesh |
+ eModifierTypeFlag_SupportsEditmode |
+ eModifierTypeFlag_SupportsMapping |
+ eModifierTypeFlag_EnableInEditmode |
+ eModifierTypeFlag_AcceptsCVs,
+
+ /* copyData */ copyData,
+ /* deformVerts */ NULL,
+ /* deformMatrices */ NULL,
+ /* deformVertsEM */ NULL,
+ /* deformMatricesEM */ NULL,
+ /* applyModifier */ applyModifier,
+ /* applyModifierEM */ applyModifierEM,
+ /* initData */ initData,
+ /* requiredDataMask */ NULL, //requiredDataMask,
+ /* freeData */ NULL,
+ /* isDisabled */ NULL,
+ /* updateDepgraph */ NULL,
+ /* dependsOnTime */ NULL,
+ /* dependsOnNormals */ NULL,
+ /* foreachObjectLink */ NULL,
+ /* foreachIDLink */ NULL,
+};
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index 3b769a30994..a27d5e5e03b 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -278,5 +278,6 @@ void modifier_type_init(ModifierTypeInfo *types[])
INIT_TYPE(Remesh);
INIT_TYPE(Skin);
INIT_TYPE(LaplacianSmooth);
+ INIT_TYPE(Triangulate);
#undef INIT_TYPE
}
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 9e412785467..141a3680df2 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -123,7 +123,6 @@ set(SRC
composite/nodes/node_composite_pixelate.c
composite/node_composite_tree.c
- composite/node_composite_util.c
shader/nodes/node_shader_camera.c
shader/nodes/node_shader_common.c
@@ -223,7 +222,6 @@ set(SRC
intern/node_common.c
intern/node_socket.c
- composite/node_composite_util.h
shader/node_shader_util.h
texture/node_texture_util.h
@@ -236,6 +234,13 @@ set(SRC
intern/node_common.h
)
+if(WITH_COMPOSITOR_LEGACY)
+ list(APPEND SRC
+ composite/node_composite_util.h
+ composite/node_composite_util.c
+ )
+endif()
+
if(WITH_PYTHON)
list(APPEND INC
../python
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.c b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
index ee83699abdb..6a4eb9d81df 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal_map.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
@@ -31,7 +31,7 @@
static bNodeSocketTemplate sh_node_normal_map_in[] = {
{ SOCK_FLOAT, 1, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f},
- { SOCK_RGBA, 0, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 1, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c
index fb5b94249e6..2b82826eb04 100644
--- a/source/blender/python/bmesh/bmesh_py_ops.c
+++ b/source/blender/python/bmesh/bmesh_py_ops.c
@@ -90,6 +90,7 @@ static PyObject *bpy_bmesh_op_repr(BPy_BMeshOpFunc *self)
static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
{
+ PyObject *ret;
BPy_BMesh *py_bm;
BMesh *bm;
@@ -122,7 +123,7 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
Py_ssize_t pos = 0;
while (PyDict_Next(kw, &pos, &key, &value)) {
const char *slot_name = _PyUnicode_AsString(key);
- BMOpSlot *slot = BMO_slot_get(&bmop, slot_name);
+ BMOpSlot *slot = BMO_slot_get(bmop.slots_in, slot_name);
if (slot == NULL) {
PyErr_Format(PyExc_TypeError,
@@ -146,7 +147,7 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
return NULL;
}
else {
- slot->data.i = param;
+ BMO_SLOT_AS_BOOL(slot) = param;
}
break;
@@ -169,7 +170,7 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
return NULL;
}
else {
- slot->data.i = (int)param;
+ BMO_SLOT_AS_INT(slot) = (int)param;
}
break;
}
@@ -183,7 +184,7 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
return NULL;
}
else {
- slot->data.f = param;
+ BMO_SLOT_AS_FLOAT(slot) = param;
}
break;
}
@@ -210,13 +211,13 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
return NULL;
}
- BMO_slot_mat_set(&bmop, slot_name, ((MatrixObject *)value)->matrix, size);
+ BMO_slot_mat_set(&bmop, bmop.slots_in, slot_name, ((MatrixObject *)value)->matrix, size);
break;
}
case BMO_OP_SLOT_VEC:
{
/* passing slot name here is a bit non-descriptive */
- if (mathutils_array_parse(slot->data.vec, 3, 3, value, slot_name) == -1) {
+ if (mathutils_array_parse(BMO_SLOT_AS_VECTOR(slot), 3, 3, value, slot_name) == -1) {
return NULL;
}
break;
@@ -243,15 +244,15 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
if (BPy_BMVertSeq_Check(value)) {
BPY_BM_GENERIC_MESH_TEST("verts");
- BMO_slot_buffer_from_all(bm, &bmop, slot_name, BM_VERT);
+ BMO_slot_buffer_from_all(bm, &bmop, bmop.slots_in, slot_name, BM_VERT);
}
else if (BPy_BMEdgeSeq_Check(value)) {
BPY_BM_GENERIC_MESH_TEST("edges");
- BMO_slot_buffer_from_all(bm, &bmop, slot_name, BM_EDGE);
+ BMO_slot_buffer_from_all(bm, &bmop, bmop.slots_in, slot_name, BM_EDGE);
}
else if (BPy_BMFaceSeq_Check(value)) {
BPY_BM_GENERIC_MESH_TEST("faces");
- BMO_slot_buffer_from_all(bm, &bmop, slot_name, BM_FACE);
+ BMO_slot_buffer_from_all(bm, &bmop, bmop.slots_in, slot_name, BM_FACE);
}
else if (BPy_BMElemSeq_Check(value)) {
BMIter iter;
@@ -266,11 +267,11 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
/* calls bpy_bmelemseq_length() */
tot = Py_TYPE(value)->tp_as_sequence->sq_length((PyObject *)self);
- BMO_slot_buffer_alloc(&bmop, slot_name, tot);
+ BMO_slot_buffer_alloc(&bmop, bmop.slots_in, slot_name, tot);
i = 0;
BM_ITER_BPY_BM_SEQ (ele, &iter, ((BPy_BMElemSeq *)value)) {
- ((void **)slot->data.buf)[i] = (void *)ele;
+ slot->data.buf[i] = ele;
i++;
}
}
@@ -288,7 +289,7 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
return NULL;
}
- BMO_slot_buffer_alloc(&bmop, slot_name, elem_array_len);
+ BMO_slot_buffer_alloc(&bmop, bmop.slots_in, slot_name, elem_array_len);
memcpy(slot->data.buf, elem_array, sizeof(void *) * elem_array_len);
PyMem_FREE(elem_array);
}
@@ -316,13 +317,104 @@ static PyObject *pyrna_op_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *
}
BMO_op_exec(bm, &bmop);
- BMO_op_finish(bm, &bmop);
- if (bpy_bm_op_as_py_error(bm) == -1) {
- return NULL;
+ /* from here until the end of the function, no returns, just set 'ret' */
+ if (UNLIKELY(bpy_bm_op_as_py_error(bm) == -1)) {
+ ret = NULL; /* exception raised above */
}
+ else if (bmop.slots_out[0].slot_name == NULL) {
+ ret = (Py_INCREF(Py_None), Py_None);
+ }
+ else {
+ /* build return value */
+ int i;
+ ret = PyDict_New();
- Py_RETURN_NONE;
+ for (i = 0; bmop.slots_out[i].slot_name; i++) {
+ // BMOpDefine *op_def = opdefines[bmop.type];
+ // BMOSlotType *slot_type = op_def->slot_types_out[i];
+ BMOpSlot *slot = &bmop.slots_out[i];
+ PyObject *item = NULL;
+
+ /* keep switch in same order as above */
+ switch (slot->slot_type) {
+ case BMO_OP_SLOT_BOOL:
+ item = PyBool_FromLong((BMO_SLOT_AS_BOOL(slot)));
+ break;
+ case BMO_OP_SLOT_INT:
+ item = PyLong_FromLong(BMO_SLOT_AS_INT(slot));
+ break;
+ case BMO_OP_SLOT_FLT:
+ item = PyFloat_FromDouble((double)BMO_SLOT_AS_FLOAT(slot));
+ break;
+ case BMO_OP_SLOT_MAT:
+ item = Matrix_CreatePyObject((float *)BMO_SLOT_AS_MATRIX(slot), 4, 4, Py_NEW, NULL);
+ break;
+ case BMO_OP_SLOT_VEC:
+ item = Vector_CreatePyObject(BMO_SLOT_AS_VECTOR(slot), slot->len, Py_NEW, NULL);
+ break;
+ case BMO_OP_SLOT_ELEMENT_BUF:
+ {
+ const int size = slot->len;
+ void **buffer = BMO_SLOT_AS_BUFFER(slot);
+ int j;
+
+ item = PyList_New(size);
+ for (j = 0; j < size; j++) {
+ BMHeader *ele = buffer[i];
+ PyList_SET_ITEM(item, j, ele ? BPy_BMElem_CreatePyObject(bm, ele) : (Py_INCREF(Py_None), Py_None));
+ }
+ break;
+ }
+ case BMO_OP_SLOT_MAPPING:
+ {
+ GHash *slot_hash = BMO_SLOT_AS_GHASH(slot);
+ GHashIterator *hash_iter;
+ item = PyDict_New();
+
+ for (hash_iter = BLI_ghashIterator_new(slot_hash);
+ !BLI_ghashIterator_isDone(hash_iter);
+ BLI_ghashIterator_step(hash_iter) )
+ {
+ BMHeader *ele_key = BLI_ghashIterator_getKey(hash_iter);
+ BMHeader **ele_val = BLI_ghashIterator_getValue(hash_iter);
+
+ PyObject *py_key = ele_key ? BPy_BMElem_CreatePyObject(bm, ele_key) : (Py_INCREF(Py_None), Py_None);
+ PyObject *py_val = *ele_val ? BPy_BMElem_CreatePyObject(bm, *ele_val) : (Py_INCREF(Py_None), Py_None);
+
+ PyDict_SetItem(ret, py_key, py_val);
+ Py_DECREF(py_key);
+ Py_DECREF(py_val);
+ }
+ BLI_ghashIterator_free(hash_iter);
+ break;
+ }
+ }
+ BLI_assert(item != NULL);
+ if (item == NULL) {
+ item = (Py_INCREF(Py_None), Py_None);
+ }
+
+#if 1
+ /* temp code, strip off '.out' while we keep this convention */
+ {
+ char slot_name_strip[MAX_SLOTNAME];
+ char *ch = strchr(slot->slot_name, '.'); /* can't fail! */
+ int tot = ch - slot->slot_name;
+ BLI_assert(ch != NULL);
+ memcpy(slot_name_strip, slot->slot_name, tot);
+ slot_name_strip[tot] = '\0';
+ PyDict_SetItemString(ret, slot_name_strip, item);
+ }
+#else
+ PyDict_SetItemString(ret, slot->slot_name, item);
+#endif
+ Py_DECREF(item);
+ }
+ }
+
+ BMO_op_finish(bm, &bmop);
+ return ret;
}
@@ -413,17 +505,17 @@ static PyObject *bpy_bmesh_fmod_getattro(PyObject *UNUSED(self), PyObject *pynam
{
const unsigned int tot = bmesh_total_ops;
unsigned int i;
- const char *name = _PyUnicode_AsString(pyname);
+ const char *opname = _PyUnicode_AsString(pyname);
for (i = 0; i < tot; i++) {
- if (strcmp(opdefines[i]->name, name) == 0) {
- return bpy_bmesh_op_CreatePyObject(opdefines[i]->name);
+ if (strcmp(opdefines[i]->opname, opname) == 0) {
+ return bpy_bmesh_op_CreatePyObject(opdefines[i]->opname);
}
}
PyErr_Format(PyExc_AttributeError,
"BMeshOpsModule: operator \"%.200s\" doesn't exist",
- name);
+ opname);
return NULL;
}
@@ -436,7 +528,7 @@ static PyObject *bpy_bmesh_fmod_dir(PyObject *UNUSED(self))
ret = PyList_New(bmesh_total_ops);
for (i = 0; i < tot; i++) {
- PyList_SET_ITEM(ret, i, PyUnicode_FromString(opdefines[i]->name));
+ PyList_SET_ITEM(ret, i, PyUnicode_FromString(opdefines[i]->opname));
}
return ret;
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 2cae10101d1..ee4528df50d 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -801,34 +801,92 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
Py_RETURN_NONE;
}
-/* note: rna_Object_to_mesh() also has apply_modifiers arg that works the same way */
PyDoc_STRVAR(bpy_bmesh_from_object_doc,
-".. method:: from_object(mesh, apply_modifiers=True)\n"
+".. method:: from_object(object, scene, deform=True, render=False, cage=False)\n"
"\n"
-" Initialize this bmesh from existing object datablock.\n"
+" Initialize this bmesh from existing object datablock (currently only meshes are supported).\n"
"\n"
" :arg object: The object data to load.\n"
" :type object: :class:`Object`\n"
-" :arg apply_modifiers: Use the final display mesh rather then the deformed cage.\n"
-" :type apply_modifiers: boolean\n"
+" :arg deform: Apply deformation modifiers.\n"
+" :type deform: boolean\n"
+" :arg render: Use render settings.\n"
+" :type render: boolean\n"
+" :arg cage: Get the mesh as a deformed cage.\n"
+" :type cage: boolean\n"
);
static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args)
{
PyObject *py_object;
+ PyObject *py_scene;
Object *ob;
+ struct Scene *scene;
BMesh *bm;
- int apply_modifiers = TRUE;
+ int use_deform = TRUE;
+ int use_render = FALSE;
+ int use_cage = FALSE;
DerivedMesh *dm;
+ const int mask = CD_MASK_BMESH;
BPY_BM_CHECK_OBJ(self);
- if (!PyArg_ParseTuple(args, "O|i:from_object", &py_object, &apply_modifiers) ||
- !(ob = PyC_RNA_AsPointer(py_object, "Object")))
+ if (!PyArg_ParseTuple(args, "OO|iii:from_object", &py_object, &py_scene, &use_render, &use_cage) ||
+ !(ob = PyC_RNA_AsPointer(py_object, "Object")) ||
+ !(scene = PyC_RNA_AsPointer(py_scene, "Scene")))
{
return NULL;
}
- dm = apply_modifiers ? ob->derivedFinal : ob->derivedDeform;
+ if (ob->type != OB_MESH) {
+ PyErr_SetString(PyExc_ValueError,
+ "from_object(...): currently only mesh objects are supported");
+ return NULL;
+ }
+
+ /* Write the display mesh into the dummy mesh */
+ if (use_deform) {
+ if (use_render) {
+ if (use_cage) {
+ PyErr_SetString(PyExc_ValueError,
+ "from_object(...): cage arg is unsupported when (render=True)");
+ return NULL;
+ }
+ else {
+ dm = mesh_create_derived_render(scene, ob, mask);
+ }
+ }
+ else {
+ if (use_cage) {
+ dm = mesh_get_derived_deform(scene, ob, mask); /* ob->derivedDeform */
+ }
+ else {
+ dm = mesh_get_derived_final(scene, ob, mask); /* ob->derivedFinal */
+ }
+ }
+ }
+ else {
+ /* !use_deform */
+ if (use_render) {
+ if (use_cage) {
+ PyErr_SetString(PyExc_ValueError,
+ "from_object(...): cage arg is unsupported when (render=True)");
+ return NULL;
+ }
+ else {
+ dm = mesh_create_derived_no_deform_render(scene, ob, NULL, mask);
+ }
+ }
+ else {
+ if (use_cage) {
+ PyErr_SetString(PyExc_ValueError,
+ "from_object(...): cage arg is unsupported when (deform=False, render=False)");
+ return NULL;
+ }
+ else {
+ dm = mesh_create_derived_no_deform(scene, ob, NULL, mask);
+ }
+ }
+ }
if (dm == NULL) {
PyErr_Format(PyExc_ValueError,
@@ -840,6 +898,8 @@ static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args)
DM_to_bmesh_ex(dm, bm);
+ dm->release(dm);
+
Py_RETURN_NONE;
}
@@ -1790,7 +1850,7 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
}
/* check if the face exists */
- if (BM_face_exists(bm, vert_array, vert_seq_len, NULL)) {
+ if (BM_face_exists(vert_array, vert_seq_len, NULL)) {
PyErr_SetString(PyExc_ValueError,
"faces.new(verts): face already exists");
goto cleanup;
@@ -2012,7 +2072,7 @@ static PyObject *bpy_bmfaceseq_get__method(BPy_BMElemSeq *self, PyObject *args)
return NULL;
}
- if (BM_face_exists(bm, vert_array, vert_seq_len, &f)) {
+ if (BM_face_exists(vert_array, vert_seq_len, &f)) {
ret = BPy_BMFace_CreatePyObject(bm, f);
}
else {
@@ -3306,6 +3366,7 @@ PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele)
case BM_LOOP:
return BPy_BMLoop_CreatePyObject(bm, (BMLoop *)ele);
default:
+ BLI_assert(0);
PyErr_SetString(PyExc_SystemError, "internal error");
return NULL;
}
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 1fea12d105c..14132d08fe6 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -981,7 +981,7 @@ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
}
case CD_PROP_INT:
{
- ret = PyLong_FromSsize_t((Py_ssize_t)(*(int *)value));
+ ret = PyLong_FromLong(*(int *)value);
break;
}
case CD_PROP_STR:
@@ -1060,7 +1060,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
}
case CD_PROP_INT:
{
- int tmp_val = PyLong_AsSsize_t(py_value);
+ int tmp_val = PyLong_AsLong(py_value);
if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
PyErr_Format(PyExc_TypeError, "expected an int, not a %.200s", Py_TYPE(py_value)->tp_name);
ret = -1;
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 8316d33ea38..b0870578f5a 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -527,7 +527,7 @@ static PyObject *bpy_bmdeformvert_keys(BPy_BMDeformVert *self)
ret = PyList_New(self->data->totweight);
for (i = 0; i < self->data->totweight; i++, dw++) {
- PyList_SET_ITEM(ret, i, PyLong_FromSsize_t(dw->def_nr));
+ PyList_SET_ITEM(ret, i, PyLong_FromLong(dw->def_nr));
}
return ret;
@@ -576,7 +576,7 @@ static PyObject *bpy_bmdeformvert_items(BPy_BMDeformVert *self)
for (i = 0; i < self->data->totweight; i++, dw++) {
item = PyTuple_New(2);
- PyTuple_SET_ITEM(item, 0, PyLong_FromSsize_t(dw->def_nr));
+ PyTuple_SET_ITEM(item, 0, PyLong_FromLong(dw->def_nr));
PyTuple_SET_ITEM(item, 1, PyFloat_FromDouble(dw->weight));
PyList_SET_ITEM(ret, i, item);
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index a10bfef2a8d..22b9c1a2208 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -613,15 +613,15 @@ static PyObject *Buffer_repr(Buffer *self)
}
-BGL_Wrap(2, Accum, void, (GLenum, GLfloat))
-BGL_Wrap(1, ActiveTexture, void, (GLenum))
-BGL_Wrap(2, AlphaFunc, void, (GLenum, GLclampf))
+BGL_Wrap(2, Accum, void, (GLenum, GLfloat))
+BGL_Wrap(1, ActiveTexture, void, (GLenum))
+BGL_Wrap(2, AlphaFunc, void, (GLenum, GLclampf))
BGL_Wrap(3, AreTexturesResident, GLboolean, (GLsizei, GLuintP, GLbooleanP))
BGL_Wrap(2, AttachShader, void, (GLuint, GLuint))
-BGL_Wrap(1, Begin, void, (GLenum))
-BGL_Wrap(2, BindTexture, void, (GLenum, GLuint))
-BGL_Wrap(7, Bitmap, void, (GLsizei, GLsizei, GLfloat,
- GLfloat, GLfloat, GLfloat, GLubyteP))
+BGL_Wrap(1, Begin, void, (GLenum))
+BGL_Wrap(2, BindTexture, void, (GLenum, GLuint))
+BGL_Wrap(7, Bitmap, void, (GLsizei, GLsizei, GLfloat,
+ GLfloat, GLfloat, GLfloat, GLubyteP))
BGL_Wrap(2, BlendFunc, void, (GLenum, GLenum))
BGL_Wrap(1, CallList, void, (GLuint))
BGL_Wrap(3, CallLists, void, (GLsizei, GLenum, GLvoidP))
@@ -675,7 +675,7 @@ BGL_Wrap(1, CullFace, void, (GLenum))
BGL_Wrap(2, DeleteLists, void, (GLuint, GLsizei))
BGL_Wrap(1, DeleteProgram, void, (GLuint))
BGL_Wrap(1, DeleteShader, void, (GLuint))
-BGL_Wrap(2, DeleteTextures, void, (GLsizei, GLuintP))
+BGL_Wrap(2, DeleteTextures, void, (GLsizei, GLuintP))
BGL_Wrap(1, DepthFunc, void, (GLenum))
BGL_Wrap(1, DepthMask, void, (GLboolean))
BGL_Wrap(2, DepthRange, void, (GLclampd, GLclampd))
@@ -773,7 +773,7 @@ BGL_Wrap(3, Lighti, void, (GLenum, GLenum, GLint))
BGL_Wrap(3, Lightiv, void, (GLenum, GLenum, GLintP))
BGL_Wrap(2, LineStipple, void, (GLint, GLushort))
BGL_Wrap(1, LineWidth, void, (GLfloat))
-BGL_Wrap(1, LinkProgram, void, (GLuint))
+BGL_Wrap(1, LinkProgram, void, (GLuint))
BGL_Wrap(1, ListBase, void, (GLuint))
BGL_Wrap(1, LoadIdentity, void, (void))
BGL_Wrap(1, LoadMatrixd, void, (GLdoubleP))
@@ -1907,9 +1907,9 @@ PyObject *BPyInit_bgl(void)
return submodule;
}
-static PyObject *Method_ShaderSource (PyObject *UNUSED(self), PyObject *args)
+static PyObject *Method_ShaderSource(PyObject *UNUSED(self), PyObject *args)
{
- int shader;
+ unsigned int shader;
char *source;
if (!PyArg_ParseTuple(args, "Is", &shader, &source))
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 529b2e708ad..53112d46098 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -249,7 +249,7 @@ static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUS
#if 0
static PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
{
- return PyLong_FromSsize_t(self->prop->type);
+ return PyLong_FromLong(self->prop->type);
}
#endif
@@ -351,7 +351,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
prop = IDP_New(IDP_DOUBLE, &val, name);
}
else if (PyLong_Check(ob)) {
- val.i = (int) PyLong_AsSsize_t(ob);
+ val.i = (int)PyLong_AsLong(ob);
prop = IDP_New(IDP_INT, &val, name);
}
else if (PyUnicode_Check(ob)) {
@@ -409,7 +409,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
prop = IDP_New(IDP_ARRAY, &val, name);
for (i = 0; i < val.array.len; i++) {
item = PySequence_Fast_GET_ITEM(ob_seq_fast, i);
- ((int *)IDP_Array(prop))[i] = (int)PyLong_AsSsize_t(item);
+ ((int *)IDP_Array(prop))[i] = (int)PyLong_AsLong(item);
}
break;
case IDP_IDPARRAY:
@@ -1072,7 +1072,7 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
((double *)IDP_Array(self->prop))[index] = d;
break;
case IDP_INT:
- i = PyLong_AsSsize_t(value);
+ i = PyLong_AsLong(value);
if (i == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "expected an int type");
return -1;
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index b8537a1359f..f62fdaf09db 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -83,13 +83,13 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
/* could use is_double for 'long int' but no use now */
int *array_int = array;
for (i = 0; i < length; i++) {
- array_int[i] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i));
+ array_int[i] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value_fast, i));
}
}
else if (type == &PyBool_Type) {
int *array_bool = array;
for (i = 0; i < length; i++) {
- array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
+ array_bool[i] = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
}
}
else {
@@ -567,7 +567,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
ret = PyObject_CallFunction(calcsize, (char *)"s", format);
if (ret) {
- sizes[i] = PyLong_AsSsize_t(ret);
+ sizes[i] = PyLong_AsLong(ret);
Py_DECREF(ret);
ret = PyObject_CallFunction(unpack, (char *)"sy#", format, (char *)ptr, sizes[i]);
}
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index a8aa7269b72..b1eeff8b3ae 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -195,12 +195,12 @@ PyDoc_STRVAR(bpy_app_debug_value_doc,
);
static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(closure))
{
- return PyLong_FromSsize_t(G.debug_value);
+ return PyLong_FromLong(G.debug_value);
}
static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
{
- int param = PyLong_AsSsize_t(value);
+ int param = PyLong_AsLong(value);
if (param == -1 && PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number");
diff --git a/source/blender/python/intern/bpy_intern_string.c b/source/blender/python/intern/bpy_intern_string.c
index 7c8291d62d3..70ea57bb33f 100644
--- a/source/blender/python/intern/bpy_intern_string.c
+++ b/source/blender/python/intern/bpy_intern_string.c
@@ -38,6 +38,8 @@ PyObject *bpy_intern_str_bl_rna;
PyObject *bpy_intern_str_order;
PyObject *bpy_intern_str_attr;
PyObject *bpy_intern_str___slots__;
+PyObject *bpy_intern_str___name__;
+PyObject *bpy_intern_str___doc__;
void bpy_intern_string_init(void)
{
@@ -47,6 +49,8 @@ void bpy_intern_string_init(void)
bpy_intern_str_order = PyUnicode_FromString("order");
bpy_intern_str_attr = PyUnicode_FromString("attr");
bpy_intern_str___slots__ = PyUnicode_FromString("__slots__");
+ bpy_intern_str___name__ = PyUnicode_FromString("__name__");
+ bpy_intern_str___doc__ = PyUnicode_FromString("__doc__");
}
void bpy_intern_string_exit(void)
@@ -57,4 +61,6 @@ void bpy_intern_string_exit(void)
Py_DECREF(bpy_intern_str_order);
Py_DECREF(bpy_intern_str_attr);
Py_DECREF(bpy_intern_str___slots__);
+ Py_DECREF(bpy_intern_str___name__);
+ Py_DECREF(bpy_intern_str___doc__);
}
diff --git a/source/blender/python/intern/bpy_intern_string.h b/source/blender/python/intern/bpy_intern_string.h
index dc7af735743..0b7ca2cd47b 100644
--- a/source/blender/python/intern/bpy_intern_string.h
+++ b/source/blender/python/intern/bpy_intern_string.h
@@ -33,3 +33,5 @@ extern PyObject *bpy_intern_str_bl_rna;
extern PyObject *bpy_intern_str_order;
extern PyObject *bpy_intern_str_attr;
extern PyObject *bpy_intern_str___slots__;
+extern PyObject *bpy_intern_str___name__;
+extern PyObject *bpy_intern_str___doc__;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index eaaced416fe..a0df8988068 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1344,7 +1344,7 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
ret = PyBool_FromLong(RNA_property_boolean_get(ptr, prop));
break;
case PROP_INT:
- ret = PyLong_FromSsize_t((Py_ssize_t)RNA_property_int_get(ptr, prop));
+ ret = PyLong_FromLong(RNA_property_int_get(ptr, prop));
break;
case PROP_FLOAT:
ret = PyFloat_FromDouble(RNA_property_float_get(ptr, prop));
@@ -2371,7 +2371,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
RNA_property_int_get_array(ptr, prop, values);
for (count = start; count < stop; count++)
- PyTuple_SET_ITEM(tuple, count - start, PyLong_FromSsize_t(values[count]));
+ PyTuple_SET_ITEM(tuple, count - start, PyLong_FromLong(values[count]));
if (values != values_stack) {
PyMem_FREE(values);
@@ -4077,7 +4077,7 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
}
else {
/* a bit strange but better then returning an empty list */
- PyTuple_SET_ITEM(item, 0, PyLong_FromSsize_t(i));
+ PyTuple_SET_ITEM(item, 0, PyLong_FromLong(i));
}
PyTuple_SET_ITEM(item, 1, pyrna_struct_CreatePyObject(&itemptr));
@@ -4256,7 +4256,7 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key
}
RNA_PROP_END;
- return PyLong_FromSsize_t(index);
+ return PyLong_FromLong(index);
}
static void foreach_attr_type(BPy_PropertyRNA *self, const char *attr,
@@ -4463,13 +4463,13 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
switch (raw_type) {
case PROP_RAW_CHAR:
- item = PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
+ item = PyLong_FromLong((long) ((char *)array)[i]);
break;
case PROP_RAW_SHORT:
- item = PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
+ item = PyLong_FromLong((long) ((short *)array)[i]);
break;
case PROP_RAW_INT:
- item = PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
+ item = PyLong_FromLong((long) ((int *)array)[i]);
break;
case PROP_RAW_FLOAT:
item = PyFloat_FromDouble((double) ((float *)array)[i]);
@@ -4756,7 +4756,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
case PROP_INT:
ret = PyTuple_New(len);
for (a = 0; a < len; a++)
- PyTuple_SET_ITEM(ret, a, PyLong_FromSsize_t((Py_ssize_t)((int *)data)[a]));
+ PyTuple_SET_ITEM(ret, a, PyLong_FromLong(((int *)data)[a]));
break;
case PROP_FLOAT:
switch (RNA_property_subtype(prop)) {
@@ -4797,7 +4797,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
ret = PyBool_FromLong(*(int *)data);
break;
case PROP_INT:
- ret = PyLong_FromSsize_t((Py_ssize_t)*(int *)data);
+ ret = PyLong_FromLong(*(int *)data);
break;
case PROP_FLOAT:
ret = PyFloat_FromDouble(*(float *)data);
@@ -6883,8 +6883,8 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
/* Sneaky workaround to use the class name as the bl_idname */
#define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \
- if (strcmp(identifier, rna_attr) == 0) { \
- item = PyObject_GetAttrString(py_class, py_attr); \
+ (strcmp(identifier, rna_attr) == 0) { \
+ item = PyObject_GetAttr(py_class, py_attr); \
if (item && item != Py_None) { \
if (pyrna_py_to_prop(dummyptr, prop, NULL, \
item, "validating class:") != 0) \
@@ -6894,11 +6894,10 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
} \
} \
Py_XDECREF(item); \
- } (void)0
-
+ } /* intendionally allow else here */
- BPY_REPLACEMENT_STRING("bl_idname", "__name__");
- BPY_REPLACEMENT_STRING("bl_description", "__doc__");
+ if BPY_REPLACEMENT_STRING("bl_idname", bpy_intern_str___name__)
+ else if BPY_REPLACEMENT_STRING("bl_description", bpy_intern_str___doc__)
#undef BPY_REPLACEMENT_STRING
@@ -6912,10 +6911,11 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v
PyErr_Clear();
}
else {
- Py_DECREF(item); /* no need to keep a ref, the class owns it */
-
- if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0)
+ if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) {
+ Py_DECREF(item);
return -1;
+ }
+ Py_DECREF(item);
}
}
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index e66d8f05309..62c0ced9eab 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -507,7 +507,7 @@ static void py_to_float(PyObject *py, char *data)
static void py_to_int(PyObject *py, char *data)
{
- *(int *)data = (int)PyLong_AsSsize_t(py);
+ *(int *)data = (int)PyLong_AsLong(py);
}
static void py_to_bool(PyObject *py, char *data)
@@ -609,7 +609,7 @@ PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
item = PyBool_FromLong(RNA_property_boolean_get_index(ptr, prop, index));
break;
case PROP_INT:
- item = PyLong_FromSsize_t(RNA_property_int_get_index(ptr, prop, index));
+ item = PyLong_FromLong(RNA_property_int_get_index(ptr, prop, index));
break;
default:
PyErr_SetString(PyExc_TypeError, "not an array type");
@@ -766,7 +766,7 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
case PROP_BOOLEAN:
case PROP_INT:
{
- int value_i = PyLong_AsSsize_t(value);
+ int value_i = PyLong_AsLong(value);
if (value_i == -1 && PyErr_Occurred()) {
PyErr_Clear();
return 0;
diff --git a/source/blender/render/intern/include/initrender.h b/source/blender/render/intern/include/initrender.h
index 43ab9552194..73dc29c8feb 100644
--- a/source/blender/render/intern/include/initrender.h
+++ b/source/blender/render/intern/include/initrender.h
@@ -40,8 +40,9 @@ struct Object;
void free_sample_tables(Render *re);
void make_sample_tables(Render *re);
-void initparts(Render *re, int do_crop);
-void freeparts(Render *re);
+void RE_parts_clamp(Render *re);
+void RE_parts_init(Render *re, int do_crop);
+void RE_parts_free(Render *re);
#endif /* __INITRENDER_H__ */
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 47bff762d13..6993e1baab4 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -126,7 +126,9 @@
#define FLT_EPSILON10 1.19209290e-06F
/* could enable at some point but for now there are far too many conversions */
-#pragma GCC diagnostic ignored "-Wdouble-promotion"
+#ifdef __GNUC__
+# pragma GCC diagnostic ignored "-Wdouble-promotion"
+#endif
/* ------------------------------------------------------------------------- */
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 9053bc84bbc..6fdf11ba48c 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -376,7 +376,7 @@ int RE_engine_render(Render *re, int do_all)
if ((re->r.scemode & (R_NO_FRAME_UPDATE | R_PREVIEWBUTS)) == 0)
BKE_scene_update_for_newframe(re->main, re->scene, re->lay);
- initparts(re, FALSE);
+ RE_parts_init(re, FALSE);
engine->tile_x = re->partx;
engine->tile_y = re->party;
@@ -393,6 +393,8 @@ int RE_engine_render(Render *re, int do_all)
engine->tile_y = 0;
engine->flag &= ~RE_ENGINE_RENDERING;
+ render_result_free_list(&engine->fullresult, engine->fullresult.first);
+
/* re->engine becomes zero if user changed active render engine during render */
if (!persistent_data || !re->engine) {
RE_engine_free(engine);
@@ -405,9 +407,7 @@ int RE_engine_render(Render *re, int do_all)
BLI_rw_mutex_unlock(&re->resultmutex);
}
- freeparts(re);
-
- render_result_free_list(&engine->fullresult, engine->fullresult.first);
+ RE_parts_free(re);
if (BKE_reports_contain(re->reports, RPT_ERROR))
G.is_break = TRUE;
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index b2cf8db7995..3ea74abbcc2 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -525,7 +525,7 @@ void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, flo
/* ~~~~~~~~~~~~~~~~ part (tile) calculus ~~~~~~~~~~~~~~~~~~~~~~ */
-void freeparts(Render *re)
+void RE_parts_free(Render *re)
{
RenderPart *part = re->parts.first;
@@ -537,12 +537,19 @@ void freeparts(Render *re)
BLI_freelistN(&re->parts);
}
-void initparts(Render *re, int do_crop)
+void RE_parts_clamp(Render *re)
+{
+ /* part size */
+ re->partx = min_ii(re->r.tilex, re->rectx);
+ re->party = min_ii(re->r.tiley, re->recty);
+}
+
+void RE_parts_init(Render *re, int do_crop)
{
int nr, xd, yd, partx, party, xparts, yparts;
int xminb, xmaxb, yminb, ymaxb;
- freeparts(re);
+ RE_parts_free(re);
/* this is render info for caller, is not reset when parts are freed! */
re->i.totpart = 0;
@@ -555,13 +562,10 @@ void initparts(Render *re, int do_crop)
xmaxb = re->disprect.xmax;
ymaxb = re->disprect.ymax;
- /* part size */
- partx = min_ii(re->r.tilex, re->rectx);
- party = min_ii(re->r.tiley, re->recty);
-
- re->partx = partx;
- re->party = party;
-
+ RE_parts_clamp(re);
+
+ partx = re->partx;
+ party = re->party;
/* part count */
xparts = (re->rectx + partx - 1) / partx;
yparts = (re->recty + party - 1) / party;
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 75d45144ccd..24b0830e651 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -696,7 +696,7 @@ static void *do_part_thread(void *pa_v)
/* calculus for how much 1 pixel rendered should rotate the 3d geometry */
/* is not that simple, needs to be corrected for errors of larger viewplane sizes */
-/* called in initrender.c, initparts() and convertblender.c, for speedvectors */
+/* called in initrender.c, RE_parts_init() and convertblender.c, for speedvectors */
float panorama_pixel_rot(Render *re)
{
float psize, phi, xfac;
@@ -839,7 +839,7 @@ static void threaded_tile_processor(Render *re)
/* warning; no return here without closing exr file */
- initparts(re, TRUE);
+ RE_parts_init(re, TRUE);
if (re->result->do_exr_tile)
render_result_exr_file_begin(re);
@@ -931,7 +931,7 @@ static void threaded_tile_processor(Render *re)
g_break = 0;
BLI_end_threads(&threads);
- freeparts(re);
+ RE_parts_free(re);
re->viewplane = viewplane; /* restore viewplane, modified by pano render */
}
@@ -952,6 +952,7 @@ static void do_render_3d(Render *re)
return;
/* internal */
+ RE_parts_clamp(re);
// re->cfra= cfra; /* <- unused! */
re->scene->r.subframe = re->mblur_offs + re->field_offs;
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index 7a7602dcce2..44daaf516e1 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -1179,30 +1179,36 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
/* -------------------------- operations on entire database ----------------------- */
/* ugly function for halos in panorama */
-static int panotestclip(Render *re, int do_pano, float *v)
+static int panotestclip(Render *re, int do_pano, float v[4])
{
- /* to be used for halos en infos */
- float abs4;
- short c=0;
- int xparts = (re->rectx + re->partx - 1) / re->partx;
+ /* part size (ensure we run RE_parts_clamp first) */
+ BLI_assert(re->partx == min_ii(re->r.tilex, re->rectx));
+ BLI_assert(re->party == min_ii(re->r.tiley, re->recty));
if (do_pano == FALSE) {
return testclip(v);
}
+ else {
+ /* to be used for halos en infos */
+ float abs4;
+ short c = 0;
+
+ int xparts = (re->rectx + re->partx - 1) / re->partx;
- abs4= fabs(v[3]);
+ abs4= fabsf(v[3]);
- if (v[2]< -abs4) c=16; /* this used to be " if (v[2]<0) ", see clippz() */
- else if (v[2]> abs4) c+= 32;
+ if (v[2]< -abs4) c=16; /* this used to be " if (v[2]<0) ", see clippz() */
+ else if (v[2]> abs4) c+= 32;
- if ( v[1]>abs4) c+=4;
- else if ( v[1]< -abs4) c+=8;
+ if ( v[1]>abs4) c+=4;
+ else if ( v[1]< -abs4) c+=8;
- abs4*= xparts;
- if ( v[0]>abs4) c+=2;
- else if ( v[0]< -abs4) c+=1;
+ abs4*= xparts;
+ if ( v[0]>abs4) c+=2;
+ else if ( v[0]< -abs4) c+=1;
- return c;
+ return c;
+ }
}
/**
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index dfa1bec5f8c..a425d9a330b 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -58,7 +58,9 @@
#include "shading.h" /* own include */
/* could enable at some point but for now there are far too many conversions */
-#pragma GCC diagnostic ignored "-Wdouble-promotion"
+#ifdef __GNUC__
+# pragma GCC diagnostic ignored "-Wdouble-promotion"
+#endif
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* defined in pipeline.c, is hardcopy of active dynamic allocated Render */
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 62bf9ac2005..c52fb84a7f8 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -77,7 +77,9 @@
#include "zbuf.h"
/* could enable at some point but for now there are far too many conversions */
-#pragma GCC diagnostic ignored "-Wdouble-promotion"
+#ifdef __GNUC__
+# pragma GCC diagnostic ignored "-Wdouble-promotion"
+#endif
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* defined in pipeline.c, is hardcopy of active dynamic allocated Render */
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 4dbb3a85425..1d8949292ce 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -327,6 +327,7 @@ typedef struct wmNotifier {
/* Mesh, Curve, MetaBall, Armature, .. */
#define ND_SELECT (90<<16)
#define ND_DATA (91<<16)
+#define ND_VERTEX_GROUP (92<<16)
/* NC_NODE Nodes */
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index bd6e752076d..a92ed65392c 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -753,6 +753,15 @@ void wm_draw_update(bContext *C)
GPU_free_unused_buffers();
for (win = wm->windows.first; win; win = win->next) {
+ int state = GHOST_GetWindowState(win->ghostwin);;
+
+ if (state == GHOST_kWindowStateMinimized) {
+ /* do not update minimized windows, it gives issues on intel drivers (see [#33223])
+ * anyway, it seems logical to skip update for invisile windows
+ */
+ continue;
+ }
+
if (win->drawmethod != U.wmdrawmethod) {
wm_draw_window_clear(win);
win->drawmethod = U.wmdrawmethod;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 5cbad42134c..b3c9cfbc79e 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1310,7 +1310,8 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi)
if (kmi->oskey != KM_ANY)
if (winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey)) return 0;
- if (winevent->keymodifier != kmi->keymodifier) return 0;
+ if (kmi->keymodifier)
+ if (winevent->keymodifier != kmi->keymodifier) return 0;
return 1;
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index f5c83d48cb9..7481c01d72b 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -405,9 +405,11 @@ void WM_jobs_kill_all(wmWindowManager *wm)
/* wait until every job ended, except for one owner (used in undo to keep screen job alive) */
void WM_jobs_kill_all_except(wmWindowManager *wm, void *owner)
{
- wmJob *wm_job;
+ wmJob *wm_job, *next_job;
- for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+ for (wm_job = wm->jobs.first; wm_job; wm_job = next_job) {
+ next_job = wm_job->next;
+
if (wm_job->owner != owner)
wm_jobs_kill_job(wm, wm_job);
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 024b6017699..4fe1e3b64ab 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -101,11 +101,8 @@ static int wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b)
if (strcmp(a->idname, b->idname) != 0)
return 0;
- if (!((a->ptr == NULL && b->ptr == NULL) ||
- (a->ptr && b->ptr && IDP_EqualsProperties(a->ptr->data, b->ptr->data))))
- {
+ if (!RNA_struct_equals(a->ptr, b->ptr))
return 0;
- }
if ((a->flag & KMI_INACTIVE) != (b->flag & KMI_INACTIVE))
return 0;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 896a24f3fba..84cfe791bce 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1450,7 +1450,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiItemL(col, "Links", ICON_NONE);
uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment");
uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits");
- uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-264");
+ uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-265");
uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.6/Manual");
uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org");
uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community");
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index f4c2c13dcac..d29d08a5431 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -189,21 +189,6 @@ static void playanim_event_qual_update(void)
GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyRightAlt, &val);
if (val) g_WS.qual |= WS_QUAL_RALT;
else g_WS.qual &= ~WS_QUAL_RALT;
-
- /* LMB */
- GHOST_GetButtonState(g_WS.ghost_system, GHOST_kButtonMaskLeft, &val);
- if (val) g_WS.qual |= WS_QUAL_LMOUSE;
- else g_WS.qual &= ~WS_QUAL_LMOUSE;
-
- /* MMB */
- GHOST_GetButtonState(g_WS.ghost_system, GHOST_kButtonMaskMiddle, &val);
- if (val) g_WS.qual |= WS_QUAL_MMOUSE;
- else g_WS.qual &= ~WS_QUAL_MMOUSE;
-
- /* RMB */
- GHOST_GetButtonState(g_WS.ghost_system, GHOST_kButtonMaskRight, &val);
- if (val) g_WS.qual |= WS_QUAL_RMOUSE;
- else g_WS.qual &= ~WS_QUAL_RMOUSE;
}
typedef struct PlayAnimPict {
@@ -455,33 +440,42 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
case GHOST_kKeyP:
if (val) ps->pingpong = !ps->pingpong;
break;
+ case GHOST_kKey1:
case GHOST_kKeyNumpad1:
if (val) swaptime = ps->fstep / 60.0;
break;
+ case GHOST_kKey2:
case GHOST_kKeyNumpad2:
if (val) swaptime = ps->fstep / 50.0;
break;
+ case GHOST_kKey3:
case GHOST_kKeyNumpad3:
if (val) swaptime = ps->fstep / 30.0;
break;
+ case GHOST_kKey4:
case GHOST_kKeyNumpad4:
if (g_WS.qual & WS_QUAL_SHIFT)
swaptime = ps->fstep / 24.0;
else
swaptime = ps->fstep / 25.0;
break;
+ case GHOST_kKey5:
case GHOST_kKeyNumpad5:
if (val) swaptime = ps->fstep / 20.0;
break;
+ case GHOST_kKey6:
case GHOST_kKeyNumpad6:
if (val) swaptime = ps->fstep / 15.0;
break;
+ case GHOST_kKey7:
case GHOST_kKeyNumpad7:
if (val) swaptime = ps->fstep / 12.0;
break;
+ case GHOST_kKey8:
case GHOST_kKeyNumpad8:
if (val) swaptime = ps->fstep / 10.0;
break;
+ case GHOST_kKey9:
case GHOST_kKeyNumpad9:
if (val) swaptime = ps->fstep / 6.0;
break;
@@ -548,6 +542,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
}
}
break;
+ case GHOST_kKey0:
case GHOST_kKeyNumpad0:
if (val) {
if (ps->once) {
@@ -566,6 +561,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
ps->wait2 = ps->sstep = FALSE;
}
break;
+ case GHOST_kKeyPeriod:
case GHOST_kKeyNumpadPeriod:
if (val) {
if (ps->sstep) ps->wait2 = FALSE;
@@ -607,6 +603,44 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
}
break;
}
+ case GHOST_kEventButtonDown:
+ case GHOST_kEventButtonUp:
+ {
+ GHOST_TEventButtonData *bd = GHOST_GetEventData(evt);
+ int cx, cy, sizex, sizey, inside_window;
+
+ GHOST_GetCursorPosition(g_WS.ghost_system, &cx, &cy);
+ GHOST_ScreenToClient(g_WS.ghost_window, cx, cy, &cx, &cy);
+ playanim_window_get_size(&sizex, &sizey);
+
+ inside_window = (cx >= 0 && cx < sizex && cy >= 0 && cy <= sizey);
+
+ if (bd->button == GHOST_kButtonMaskLeft) {
+ if (type == GHOST_kEventButtonDown) {
+ if (inside_window)
+ g_WS.qual |= WS_QUAL_LMOUSE;
+ }
+ else
+ g_WS.qual &= ~WS_QUAL_LMOUSE;
+ }
+ else if (bd->button == GHOST_kButtonMaskMiddle) {
+ if (type == GHOST_kEventButtonDown) {
+ if (inside_window)
+ g_WS.qual |= WS_QUAL_MMOUSE;
+ }
+ else
+ g_WS.qual &= ~WS_QUAL_MMOUSE;
+ }
+ else if (bd->button == GHOST_kButtonMaskRight) {
+ if (type == GHOST_kEventButtonDown) {
+ if (inside_window)
+ g_WS.qual |= WS_QUAL_RMOUSE;
+ }
+ else
+ g_WS.qual &= ~WS_QUAL_RMOUSE;
+ }
+ break;
+ }
case GHOST_kEventCursorMove:
{
if (g_WS.qual & WS_QUAL_LMOUSE) {
@@ -638,6 +672,11 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
}
break;
}
+ case GHOST_kEventWindowActivate:
+ case GHOST_kEventWindowDeactivate: {
+ g_WS.qual &= ~WS_QUAL_MOUSE;
+ break;
+ }
case GHOST_kEventWindowSize:
case GHOST_kEventWindowMove:
{
diff --git a/source/creator/blender.map b/source/creator/blender.map
new file mode 100644
index 00000000000..dc7bc3151e8
--- /dev/null
+++ b/source/creator/blender.map
@@ -0,0 +1,11 @@
+
+/* on Linux we exclude LLVM symbols, they conflict with Mesa llvmpipe */
+
+{
+global:
+ *;
+local:
+ *llvm*;
+ *LLVM*;
+};
+
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
index 7c4c759e361..00836fa8ecb 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
@@ -95,35 +95,29 @@ static void DisableForText()
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */
- if (glIsEnabled(GL_BLEND)) glDisable(GL_BLEND);
- if (glIsEnabled(GL_ALPHA_TEST)) glDisable(GL_ALPHA_TEST);
+ glDisable(GL_BLEND);
+ glDisable(GL_ALPHA_TEST);
- if (glIsEnabled(GL_LIGHTING)) {
- glDisable(GL_LIGHTING);
- glDisable(GL_COLOR_MATERIAL);
- }
+ 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)
- if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
- glDisable(GL_TEXTURE_CUBE_MAP_ARB);
+ glDisable(GL_TEXTURE_CUBE_MAP_ARB);
- if (glIsEnabled(GL_TEXTURE_2D))
- glDisable(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);
+ glDisable(GL_TEXTURE_CUBE_MAP_ARB);
- if (glIsEnabled(GL_TEXTURE_2D))
- glDisable(GL_TEXTURE_2D);
+ glDisable(GL_TEXTURE_2D);
}
}
diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp
index 0261a4a2d02..2cacea98467 100644
--- a/source/gameengine/Expressions/IntValue.cpp
+++ b/source/gameengine/Expressions/IntValue.cpp
@@ -323,9 +323,6 @@ void CIntValue::SetValue(CValue* newval)
#ifdef WITH_PYTHON
PyObject *CIntValue::ConvertValueToPython()
{
- if ((m_int > INT_MIN) && (m_int < INT_MAX))
- return PyLong_FromSsize_t(m_int);
- else
- return PyLong_FromLongLong(m_int);
+ return PyLong_FromLongLong(m_int);
}
#endif // WITH_PYTHON
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index 8cff5a01c0e..5f97b03fed4 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -365,7 +365,7 @@ static PyObject *listvalue_mapping_subscript(PyObject *self, PyObject *key)
}
}
else if (PyIndex_Check(key)) {
- int index = PyLong_AsSsize_t(key);
+ Py_ssize_t index = PyLong_AsSsize_t(key);
return listvalue_buffer_item(self, index); /* wont add a ref */
}
else if (PySlice_Check(key)) {
@@ -602,10 +602,10 @@ PyObject *CListValue::Pyindex(PyObject *value)
int numelem = GetCount();
for (int i=0;i<numelem;i++)
{
- CValue* elem = GetValue(i);
+ CValue* elem = GetValue(i);
if (checkobj==elem || CheckEqual(checkobj,elem))
{
- result = PyLong_FromSsize_t(i);
+ result = PyLong_FromLong(i);
break;
}
}
@@ -628,7 +628,7 @@ PyObject *CListValue::Pycount(PyObject *value)
if (checkobj==NULL) { /* in this case just return that there are no items in the list */
PyErr_Clear();
- return PyLong_FromSsize_t(0);
+ return PyLong_FromLong(0);
}
int numelem = GetCount();
@@ -642,7 +642,7 @@ PyObject *CListValue::Pycount(PyObject *value)
}
checkobj->Release();
- return PyLong_FromSsize_t(numfound);
+ return PyLong_FromLong(numfound);
}
/* Matches python dict.get(key, [default]) */
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 77c76ca8153..11b00b7bbf5 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -311,14 +311,14 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
{
bool *val = reinterpret_cast<bool*>(ptr);
ptr += sizeof(bool);
- PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
+ PyList_SET_ITEM(resultlist,i,PyBool_FromLong(*val));
break;
}
case KX_PYATTRIBUTE_TYPE_SHORT:
{
short int *val = reinterpret_cast<short int*>(ptr);
ptr += sizeof(short int);
- PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
+ PyList_SET_ITEM(resultlist,i,PyLong_FromLong(*val));
break;
}
case KX_PYATTRIBUTE_TYPE_ENUM:
@@ -333,7 +333,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
{
int *val = reinterpret_cast<int*>(ptr);
ptr += sizeof(int);
- PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
+ PyList_SET_ITEM(resultlist,i,PyLong_FromLong(*val));
break;
}
case KX_PYATTRIBUTE_TYPE_FLOAT:
@@ -381,17 +381,17 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
}
if (attrdef->m_imax)
bval = !bval;
- return PyLong_FromSsize_t(bval);
+ return PyBool_FromLong(bval);
}
case KX_PYATTRIBUTE_TYPE_BOOL:
{
bool *val = reinterpret_cast<bool*>(ptr);
- return PyLong_FromSsize_t(*val);
+ return PyBool_FromLong(*val);
}
case KX_PYATTRIBUTE_TYPE_SHORT:
{
short int *val = reinterpret_cast<short int*>(ptr);
- return PyLong_FromSsize_t(*val);
+ return PyLong_FromLong(*val);
}
case KX_PYATTRIBUTE_TYPE_ENUM:
// enum are like int, just make sure the field size is the same
@@ -403,7 +403,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
case KX_PYATTRIBUTE_TYPE_INT:
{
int *val = reinterpret_cast<int*>(ptr);
- return PyLong_FromSsize_t(*val);
+ return PyLong_FromLong(*val);
}
case KX_PYATTRIBUTE_TYPE_FLOAT:
{
@@ -583,7 +583,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
ptr += sizeof(bool);
if (PyLong_Check(item))
{
- *var = (PyLong_AsSsize_t(item) != 0);
+ *var = (PyLong_AsLong(item) != 0);
}
else if (PyBool_Check(item))
{
@@ -602,7 +602,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
ptr += sizeof(short int);
if (PyLong_Check(item))
{
- long val = PyLong_AsSsize_t(item);
+ int val = PyLong_AsLong(item);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
@@ -638,7 +638,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
ptr += sizeof(int);
if (PyLong_Check(item))
{
- long val = PyLong_AsSsize_t(item);
+ int val = PyLong_AsLong(item);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
@@ -786,7 +786,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
bool *var = reinterpret_cast<bool*>(ptr);
if (PyLong_Check(value))
{
- *var = (PyLong_AsSsize_t(value) != 0);
+ *var = (PyLong_AsLong(value) != 0);
}
else if (PyBool_Check(value))
{
@@ -804,7 +804,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
bool bval;
if (PyLong_Check(value))
{
- bval = (PyLong_AsSsize_t(value) != 0);
+ bval = (PyLong_AsLong(value) != 0);
}
else if (PyBool_Check(value))
{
@@ -847,7 +847,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
short int *var = reinterpret_cast<short int*>(ptr);
if (PyLong_Check(value))
{
- long val = PyLong_AsSsize_t(value);
+ int val = PyLong_AsLong(value);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
@@ -882,7 +882,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
int *var = reinterpret_cast<int*>(ptr);
if (PyLong_Check(value))
{
- long val = PyLong_AsSsize_t(value);
+ int val = PyLong_AsLong(value);
if (attrdef->m_clamp)
{
if (val < attrdef->m_imin)
diff --git a/source/gameengine/GameLogic/SCA_IController.cpp b/source/gameengine/GameLogic/SCA_IController.cpp
index 57f7dd64287..f922e617367 100644
--- a/source/gameengine/GameLogic/SCA_IController.cpp
+++ b/source/gameengine/GameLogic/SCA_IController.cpp
@@ -241,7 +241,7 @@ PyAttributeDef SCA_IController::Attributes[] = {
PyObject *SCA_IController::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_IController* self = static_cast<SCA_IController*>(self_v);
- return PyLong_FromSsize_t(self->m_statemask);
+ return PyLong_FromLong(self->m_statemask);
}
PyObject *SCA_IController::pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
index 4916d8a0a57..34fa1c98a73 100644
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
+++ b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp
@@ -256,7 +256,7 @@ bool SCA_ILogicBrick::PyArgToBool(int boolArg)
PyObject *SCA_ILogicBrick::BoolToPyArg(bool boolarg)
{
- return PyLong_FromSsize_t(boolarg? KX_TRUE: KX_FALSE);
+ return PyLong_FromLong(boolarg ? KX_TRUE: KX_FALSE);
}
#endif // WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index bfb78abef04..1cb17af8325 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -383,16 +383,16 @@ PyAttributeDef SCA_ISensor::Attributes[] = {
PyObject *SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- int retval = 0;
+ bool retval = false;
if (SCA_PythonController::m_sCurrentController)
retval = SCA_PythonController::m_sCurrentController->IsTriggered(self);
- return PyLong_FromSsize_t(retval);
+ return PyBool_FromLong(retval);
}
PyObject *SCA_ISensor::pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_ISensor* self = static_cast<SCA_ISensor*>(self_v);
- return PyLong_FromSsize_t(self->GetState());
+ return PyBool_FromLong(self->GetState());
}
PyObject *SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -414,7 +414,7 @@ PyObject *SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF
{
status = 3;
}
- return PyLong_FromSsize_t(status);
+ return PyLong_FromLong(status);
}
PyObject *SCA_ISensor::pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index 0c4dcae16f7..c7e31f75306 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -319,7 +319,7 @@ PyObject *SCA_JoystickSensor::PyGetButtonActiveList( )
if (joy) {
for (i=0; i < joy->GetNumberOfButtons(); i++) {
if (joy->aButtonPressIsPositive(i)) {
- value = PyLong_FromSsize_t(i);
+ value = PyLong_FromLong(i);
PyList_Append(ls, value);
Py_DECREF(value);
}
@@ -355,7 +355,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYAT
PyObject *list= PyList_New(axis_index);
while (axis_index--) {
- PyList_SET_ITEM(list, axis_index, PyLong_FromSsize_t(joy->GetAxisPosition(axis_index)));
+ PyList_SET_ITEM(list, axis_index, PyLong_FromLong(joy->GetAxisPosition(axis_index)));
}
return list;
@@ -371,7 +371,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT
return NULL;
}
- return PyLong_FromSsize_t(joy->GetAxisPosition(self->m_axis-1));
+ return PyLong_FromLong(joy->GetAxisPosition(self->m_axis-1));
}
PyObject *SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -383,7 +383,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATT
PyObject *list= PyList_New(hat_index);
while (hat_index--) {
- PyList_SET_ITEM(list, hat_index, PyLong_FromSsize_t(joy->GetHat(hat_index)));
+ PyList_SET_ITEM(list, hat_index, PyLong_FromLong(joy->GetHat(hat_index)));
}
return list;
@@ -394,28 +394,28 @@ PyObject *SCA_JoystickSensor::pyattr_get_hat_single(void *self_v, const KX_PYATT
SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromSsize_t(joy->GetHat(self->m_hat-1));
+ return PyLong_FromLong(joy->GetHat(self->m_hat-1));
}
PyObject *SCA_JoystickSensor::pyattr_get_num_axis(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromSsize_t( joy ? joy->GetNumberOfAxes() : 0 );
+ return PyLong_FromLong( joy ? joy->GetNumberOfAxes() : 0 );
}
PyObject *SCA_JoystickSensor::pyattr_get_num_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromSsize_t( joy ? joy->GetNumberOfButtons() : 0 );
+ return PyLong_FromLong( joy ? joy->GetNumberOfButtons() : 0 );
}
PyObject *SCA_JoystickSensor::pyattr_get_num_hats(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_JoystickSensor* self = static_cast<SCA_JoystickSensor*>(self_v);
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
- return PyLong_FromSsize_t( joy ? joy->GetNumberOfHats() : 0 );
+ return PyLong_FromLong( joy ? joy->GetNumberOfHats() : 0 );
}
PyObject *SCA_JoystickSensor::pyattr_get_connected(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index b3346270b61..7005ea1ba5b 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -439,17 +439,18 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
return NULL;
}
- int keycode = PyLong_AsSsize_t(value);
+ SCA_IInputDevice::KX_EnumInputs keycode = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value);
- if ((keycode < SCA_IInputDevice::KX_BEGINKEY)
- || (keycode > SCA_IInputDevice::KX_ENDKEY)) {
+ if ((keycode < SCA_IInputDevice::KX_BEGINKEY) ||
+ (keycode > SCA_IInputDevice::KX_ENDKEY))
+ {
PyErr_SetString(PyExc_AttributeError, "sensor.getKeyStatus(int): Keyboard Sensor, invalid keycode specified!");
return NULL;
}
SCA_IInputDevice* inputdev = ((SCA_KeyboardManager *)m_eventmgr)->GetInputDevice();
- const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) keycode);
- return PyLong_FromSsize_t(inevent.m_status);
+ const SCA_InputEvent & inevent = inputdev->GetEventValue(keycode);
+ return PyLong_FromLong(inevent.m_status);
}
/* ------------------------------------------------------------------------- */
@@ -509,8 +510,8 @@ PyObject *SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBU
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
{
PyObject *keypair = PyList_New(2);
- PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i));
- PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status));
+ PyList_SET_ITEM(keypair,0,PyLong_FromLong(i));
+ PyList_SET_ITEM(keypair,1,PyLong_FromLong(inevent.m_status));
PyList_Append(resultlist,keypair);
}
}
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
index 51e0bc6550b..a7cf4963f04 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
@@ -250,17 +250,18 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
{
if (PyLong_Check(value))
{
- int button = PyLong_AsSsize_t(value);
+ SCA_IInputDevice::KX_EnumInputs button = (SCA_IInputDevice::KX_EnumInputs)PyLong_AsLong(value);
- if ((button < SCA_IInputDevice::KX_LEFTMOUSE)
- || (button > SCA_IInputDevice::KX_RIGHTMOUSE)) {
+ if ((button < SCA_IInputDevice::KX_LEFTMOUSE) ||
+ (button > SCA_IInputDevice::KX_RIGHTMOUSE))
+ {
PyErr_SetString(PyExc_ValueError, "sensor.getButtonStatus(int): Mouse Sensor, invalid button specified!");
return NULL;
}
SCA_IInputDevice* mousedev = ((SCA_MouseManager *)m_eventmgr)->GetInputDevice();
- const SCA_InputEvent& event = mousedev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) button);
- return PyLong_FromSsize_t(event.m_status);
+ const SCA_InputEvent& event = mousedev->GetEventValue(button);
+ return PyLong_FromLong(event.m_status);
}
Py_RETURN_NONE;
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index ece9d7b6c8f..c2b1470ae7a 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -168,12 +168,16 @@ void SCA_PythonController::SetNamespace(PyObject* pythondictionary)
}
#endif
-int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
+bool SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
{
if (std::find(m_triggeredSensors.begin(), m_triggeredSensors.end(), sensor) !=
m_triggeredSensors.end())
- return 1;
- return 0;
+ {
+ return true;
+ }
+ else {
+ return false;
+ }
}
#ifdef WITH_PYTHON
diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h
index f1f10d22711..d2549318c2e 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.h
+++ b/source/gameengine/GameLogic/SCA_PythonController.h
@@ -90,7 +90,7 @@ class SCA_PythonController : public SCA_IController
void SetDebug(bool debug) { m_debug = debug; }
void AddTriggeredSensor(class SCA_ISensor* sensor)
{ m_triggeredSensors.push_back(sensor); }
- int IsTriggered(class SCA_ISensor* sensor);
+ bool IsTriggered(class SCA_ISensor* sensor);
bool Compile();
bool Import();
void ErrorPrint(const char *error_msg);
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
index 42cda9433b8..19aae46f2a3 100644
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
@@ -117,7 +117,7 @@ PyObject *SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBU
{
const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
- PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+ PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
}
Py_INCREF(self->m_event_dict);
return self->m_event_dict;
@@ -134,7 +134,7 @@ PyObject *SCA_PythonKeyboard::pyattr_get_active_events(void *self_v, const KX_PY
const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
- PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+ PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
}
Py_INCREF(self->m_event_dict);
return self->m_event_dict;
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
index 0806bda072b..1617f714113 100644
--- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
@@ -100,7 +100,7 @@ PyObject *SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_
{
const SCA_InputEvent & inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
- PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+ PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
}
Py_INCREF(self->m_event_dict);
return self->m_event_dict;
@@ -117,7 +117,7 @@ PyObject *SCA_PythonMouse::pyattr_get_active_events(void *self_v, const KX_PYATT
const SCA_InputEvent & inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i);
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
- PyDict_SetItem(self->m_event_dict, PyLong_FromSsize_t(i), PyLong_FromSsize_t(inevent.m_status));
+ PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
}
Py_INCREF(self->m_event_dict);
return self->m_event_dict;
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index 01995b13ad7..5568072abcf 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -363,17 +363,17 @@ PyAttributeDef SCA_RandomActuator::Attributes[] = {
PyObject *SCA_RandomActuator::pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
- return PyLong_FromSsize_t(act->m_base->GetSeed());
+ return PyLong_FromLong(act->m_base->GetSeed());
}
int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
- if (PyLong_Check(value)) {
- int ival = PyLong_AsSsize_t(value);
- act->m_base->SetSeed(ival);
+ if (PyLong_Check(value)) {
+ act->m_base->SetSeed(PyLong_AsLong(value));
return PY_SET_ATTR_SUCCESS;
- } else {
+ }
+ else {
PyErr_SetString(PyExc_TypeError, "actuator.seed = int: Random Actuator, expected an integer");
return PY_SET_ATTR_FAIL;
}
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
index 7199ee6cf22..4e93556453a 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
@@ -168,7 +168,7 @@ PyAttributeDef SCA_RandomSensor::Attributes[] = {
PyObject *SCA_RandomSensor::pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
SCA_RandomSensor* self = static_cast<SCA_RandomSensor*>(self_v);
- return PyLong_FromSsize_t(self->m_basegenerator->GetSeed());
+ return PyLong_FromLong(self->m_basegenerator->GetSeed());
}
int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
@@ -178,7 +178,7 @@ int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *at
PyErr_SetString(PyExc_TypeError, "sensor.seed = int: Random Sensor, expected an integer");
return PY_SET_ATTR_FAIL;
}
- self->m_basegenerator->SetSeed(PyLong_AsSsize_t(value));
+ self->m_basegenerator->SetSeed(PyLong_AsLong(value));
return PY_SET_ATTR_SUCCESS;
}
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index 40b52c3212a..92db1fe790e 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -555,7 +555,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
bool showPhysics = (gm->flag & GAME_SHOW_PHYSICS);
SYS_WriteCommandLineInt(syshandle, "show_physics", showPhysics);
- bool fixed_framerate= (SYS_GetCommandLineInt(syshandle, "fixed_framerate", fixedFr) != 0);
+ bool fixed_framerate= (SYS_GetCommandLineInt(syshandle, "fixedtime", fixedFr) != 0);
bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0);
bool useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", gm->flag & GAME_DISPLAY_LISTS) != 0);
bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0);
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp
index b047588df5a..4a74024b5bb 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -849,7 +849,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" )
KX_PYMETHODDEF_DOC( BL_Shader, isValid, "isValid()" )
{
- return PyLong_FromSsize_t( ( mShader !=0 && mOk ) );
+ return PyBool_FromLong(( mShader !=0 && mOk ));
}
KX_PYMETHODDEF_DOC( BL_Shader, getVertexProg, "getVertexProg( )" )
@@ -1224,7 +1224,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2
for (unsigned int i=0; (i<list_size && i<4); i++)
{
PyObject *item = PySequence_GetItem(listPtr, i);
- array_data[i] = PyLong_AsSsize_t(item);
+ array_data[i] = PyLong_AsLong(item);
Py_DECREF(item);
}
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt
index 2eada3e5071..524a38a4c26 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -101,7 +101,6 @@ set(SRC
KX_ObstacleSimulation.cpp
KX_OrientationInterpolator.cpp
KX_ParentActuator.cpp
- KX_PhysicsObjectWrapper.cpp
KX_PolyProxy.cpp
KX_PolygonMaterial.cpp
KX_PositionInterpolator.cpp
@@ -184,7 +183,6 @@ set(SRC
KX_OrientationInterpolator.h
KX_ParentActuator.h
KX_PhysicsEngineEnums.h
- KX_PhysicsObjectWrapper.h
KX_PhysicsPropertiesobsolete.h
KX_PolyProxy.h
KX_PolygonMaterial.h
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 88e26fd9a55..20c36c2cc44 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -849,7 +849,7 @@ PyObject *KX_BlenderMaterial::pyattr_get_shader(void *self_v, const KX_PYATTRIBU
PyObject *KX_BlenderMaterial::pyattr_get_materialIndex(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_BlenderMaterial* self = static_cast<KX_BlenderMaterial*>(self_v);
- return PyLong_FromSsize_t(self->GetMaterialIndex());
+ return PyLong_FromLong(self->GetMaterialIndex());
}
PyObject *KX_BlenderMaterial::pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -931,7 +931,7 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getMaterialIndex, "getMaterialIndex()")
{
- return PyLong_FromSsize_t( GetMaterialIndex() );
+ return PyLong_FromLong(GetMaterialIndex());
}
KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getTexture, "getTexture( index )" )
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 39b0a24865e..e56dbfdcac8 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -593,7 +593,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
MT_Point3 center;
if (PyVecTo(pycenter, center))
{
- return PyLong_FromSsize_t(SphereInsideFrustum(center, radius)); /* new ref */
+ return PyLong_FromLong(SphereInsideFrustum(center, radius)); /* new ref */
}
}
@@ -644,7 +644,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum,
return NULL;
}
- return PyLong_FromSsize_t(BoxInsideFrustum(box)); /* new ref */
+ return PyLong_FromLong(BoxInsideFrustum(box)); /* new ref */
}
KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
@@ -666,7 +666,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
MT_Point3 point;
if (PyVecTo(value, point))
{
- return PyLong_FromSsize_t(PointInsideFrustum(point)); /* new ref */
+ return PyLong_FromLong(PointInsideFrustum(point)); /* new ref */
}
PyErr_SetString(PyExc_TypeError, "camera.pointInsideFrustum(point): KX_Camera, expected point argument.");
@@ -869,11 +869,11 @@ PyObject *KX_Camera::pyattr_get_world_to_camera(void *self_v, const KX_PYATTRIBU
PyObject *KX_Camera::pyattr_get_INSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{ return PyLong_FromSsize_t(INSIDE); }
+{ return PyLong_FromLong(INSIDE); }
PyObject *KX_Camera::pyattr_get_OUTSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{ return PyLong_FromSsize_t(OUTSIDE); }
+{ return PyLong_FromLong(OUTSIDE); }
PyObject *KX_Camera::pyattr_get_INTERSECT(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{ return PyLong_FromSsize_t(INTERSECT); }
+{ return PyLong_FromLong(INTERSECT); }
bool ConvertPythonToCamera(PyObject *value, KX_Camera **object, bool py_none_ok, const char *error_prefix)
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index a37b1b0c396..59ca0d8d326 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -388,8 +388,8 @@ PyAttributeDef KX_CameraActuator::Attributes[] = {
KX_PYATTRIBUTE_FLOAT_RW("min",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_minHeight),
KX_PYATTRIBUTE_FLOAT_RW("max",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_maxHeight),
KX_PYATTRIBUTE_FLOAT_RW("height",-FLT_MAX,FLT_MAX,KX_CameraActuator,m_height),
- KX_PYATTRIBUTE_SHORT_RW("axis", 0, 3, true, KX_CameraActuator,m_axis),
- KX_PYATTRIBUTE_RW_FUNCTION("object", KX_CameraActuator, pyattr_get_object, pyattr_set_object),
+ KX_PYATTRIBUTE_SHORT_RW("axis", 0, 5, true, KX_CameraActuator, m_axis),
+ KX_PYATTRIBUTE_RW_FUNCTION("object", KX_CameraActuator, pyattr_get_object, pyattr_set_object),
KX_PYATTRIBUTE_FLOAT_RW("damping",0.f,10.f,KX_CameraActuator,m_damping),
{NULL}
};
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
index 662db974ee8..e09449c4f1d 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
@@ -52,7 +52,7 @@ KX_ConstraintWrapper::~KX_ConstraintWrapper()
PyObject *KX_ConstraintWrapper::PyGetConstraintId()
{
- return PyLong_FromSsize_t(m_constraintId);
+ return PyLong_FromLong(m_constraintId);
}
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index cfccb8e8ced..c7f6954fd6c 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -2475,13 +2475,13 @@ PyObject *KX_GameObject::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
int state = 0;
state |= self->GetState();
- return PyLong_FromSsize_t(state);
+ return PyLong_FromLong(state);
}
int KX_GameObject::pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_GameObject* self = static_cast<KX_GameObject*>(self_v);
- int state_i = PyLong_AsSsize_t(value);
+ int state_i = PyLong_AsLong(value);
unsigned int state = 0;
if (state_i == -1 && PyErr_Occurred()) {
@@ -2897,7 +2897,7 @@ PyObject *KX_GameObject::PyGetPhysicsId()
{
physid= (uint_ptr)ctrl->GetUserData();
}
- return PyLong_FromSsize_t((long)physid);
+ return PyLong_FromLong((long)physid);
}
PyObject *KX_GameObject::PyGetPropertyNames()
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 0ab7b9ec9e5..a12e12ccef2 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -534,29 +534,27 @@ bool KX_KetsjiEngine::NextFrame()
{
double timestep = 1.0/m_ticrate;
double framestep = timestep;
-// static hidden::Clock sClock;
+ // static hidden::Clock sClock;
-m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(),true);
+ m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(),true);
-//float dt = sClock.getTimeMicroseconds() * 0.000001f;
-//sClock.reset();
+ //float dt = sClock.getTimeMicroseconds() * 0.000001f;
+ //sClock.reset();
-if (m_bFixedTime)
- m_clockTime += timestep;
-else
-{
-
-// m_clockTime += dt;
- m_clockTime = m_kxsystem->GetTimeInSeconds();
-}
+ if (m_bFixedTime) {
+ m_clockTime += timestep;
+ }
+ else {
+ // m_clockTime += dt;
+ m_clockTime = m_kxsystem->GetTimeInSeconds();
+ }
double deltatime = m_clockTime - m_frameTime;
if (deltatime<0.f)
{
- printf("problem with clock\n");
- deltatime = 0.f;
- m_clockTime = 0.f;
- m_frameTime = 0.f;
+ // We got here too quickly, which means there is nothing todo, just return and don't render.
+ // Not sure if this is the best fix, but it seems to stop the jumping framerate issue (#33088)
+ return false;
}
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index a4e90cb1e83..cf58d18838a 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -372,11 +372,11 @@ PyObject *KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
const char* type = attrdef->m_name;
if (!strcmp(type, "SPOT")) {
- retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SPOT);
+ retvalue = PyLong_FromLong(RAS_LightObject::LIGHT_SPOT);
} else if (!strcmp(type, "SUN")) {
- retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SUN);
+ retvalue = PyLong_FromLong(RAS_LightObject::LIGHT_SUN);
} else if (!strcmp(type, "NORMAL")) {
- retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_NORMAL);
+ retvalue = PyLong_FromLong(RAS_LightObject::LIGHT_NORMAL);
}
else {
/* should never happen */
@@ -390,13 +390,13 @@ PyObject *KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
PyObject *KX_LightObject::pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
- return PyLong_FromSsize_t(self->m_lightobj.m_type);
+ return PyLong_FromLong(self->m_lightobj.m_type);
}
int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
{
KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
- int val = PyLong_AsSsize_t(value);
+ const int val = PyLong_AsLong(value);
if ((val==-1 && PyErr_Occurred()) || val<0 || val>2) {
PyErr_SetString(PyExc_ValueError, "light.type= val: KX_LightObject, expected an int between 0 and 2");
return PY_SET_ATTR_FAIL;
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index dbbf6bd8c2a..d83e98d4712 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -172,7 +172,7 @@ PyObject *KX_MeshProxy::PyGetVertexArrayLength(PyObject *args, PyObject *kwds)
length = m_meshobj->NumVertices(mat);
}
- return PyLong_FromSsize_t(length);
+ return PyLong_FromLong(length);
}
@@ -406,13 +406,13 @@ PyObject *KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_
PyObject * KX_MeshProxy::pyattr_get_numMaterials(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef)
{
KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
- return PyLong_FromSsize_t(self->m_meshobj->NumMaterials());
+ return PyLong_FromLong(self->m_meshobj->NumMaterials());
}
PyObject * KX_MeshProxy::pyattr_get_numPolygons(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef)
{
KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
- return PyLong_FromSsize_t(self->m_meshobj->NumPolygons());
+ return PyLong_FromLong(self->m_meshobj->NumPolygons());
}
/* a close copy of ConvertPythonToGameObject but for meshes */
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index e5f7ea22b36..931039bc54c 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -529,7 +529,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitX(void *self_v, const KX_PYATTRIBUTE
{
self->m_drot[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
self->m_dloc[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
- self->m_bitLocalFlag.Torque = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+ self->m_bitLocalFlag.Torque = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
if (!PyErr_Occurred())
{
@@ -565,7 +565,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitY(void *self_v, const KX_PYATTRIBUTE
{
self->m_drot[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
self->m_dloc[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
- self->m_bitLocalFlag.DLoc = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+ self->m_bitLocalFlag.DLoc = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
if (!PyErr_Occurred())
{
@@ -601,7 +601,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitZ(void *self_v, const KX_PYATTRIBUTE
{
self->m_drot[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
self->m_dloc[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
- self->m_bitLocalFlag.DRot = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+ self->m_bitLocalFlag.DRot = (PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
if (!PyErr_Occurred())
{
diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
deleted file mode 100644
index f18c35c0c78..00000000000
--- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
+++ /dev/null
@@ -1,145 +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_PhysicsObjectWrapper.cpp
- * \ingroup ketsji
- */
-
-
-#include "PyObjectPlus.h"
-
-#include "KX_PhysicsObjectWrapper.h"
-#include "PHY_IPhysicsEnvironment.h"
-#include "PHY_IPhysicsController.h"
-
-KX_PhysicsObjectWrapper::KX_PhysicsObjectWrapper(
- PHY_IPhysicsController* ctrl,
- PHY_IPhysicsEnvironment* physenv) :
- PyObjectPlus(),
- m_ctrl(ctrl),
- m_physenv(physenv)
-{
-}
-
-KX_PhysicsObjectWrapper::~KX_PhysicsObjectWrapper()
-{
-}
-
-#ifdef WITH_PYTHON
-
-PyObject *KX_PhysicsObjectWrapper::PySetPosition(PyObject *args)
-{
- float x,y,z;
- if (PyArg_ParseTuple(args,"fff:setPosition",&x,&y,&z))
- {
- m_ctrl->setPosition(x,y,z);
- }
- else {
- return NULL;
- }
- Py_RETURN_NONE;
-}
-
-
-PyObject *KX_PhysicsObjectWrapper::PySetLinearVelocity(PyObject *args)
-{
- float x,y,z;
- int local;
- if (PyArg_ParseTuple(args,"fffi:setLinearVelocity",&x,&y,&z,&local))
- {
- m_ctrl->SetLinearVelocity(x,y,z,local != 0);
- }
- else {
- return NULL;
- }
- Py_RETURN_NONE;
-}
-
-PyObject *KX_PhysicsObjectWrapper::PySetAngularVelocity(PyObject *args)
-{
- float x,y,z;
- int local;
- if (PyArg_ParseTuple(args,"fffi:setAngularVelocity",&x,&y,&z,&local))
- {
- m_ctrl->SetAngularVelocity(x,y,z,local != 0);
- }
- else {
- return NULL;
- }
- Py_RETURN_NONE;
-}
-
-PyObject* KX_PhysicsObjectWrapper::PySetActive(PyObject *args)
-{
- int active;
- if (PyArg_ParseTuple(args,"i:setActive",&active))
- {
- m_ctrl->SetActive(active!=0);
- }
- else {
- return NULL;
- }
- Py_RETURN_NONE;
-}
-
-
-PyAttributeDef KX_PhysicsObjectWrapper::Attributes[] = {
- { NULL } //Sentinel
-};
-
-//python specific stuff
-PyTypeObject KX_PhysicsObjectWrapper::Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "KX_PhysicsObjectWrapper",
- 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
-};
-
-PyMethodDef KX_PhysicsObjectWrapper::Methods[] = {
- {"setPosition",(PyCFunction) KX_PhysicsObjectWrapper::sPySetPosition, METH_VARARGS},
- {"setLinearVelocity",(PyCFunction) KX_PhysicsObjectWrapper::sPySetLinearVelocity, METH_VARARGS},
- {"setAngularVelocity",(PyCFunction) KX_PhysicsObjectWrapper::sPySetAngularVelocity, METH_VARARGS},
- {"setActive",(PyCFunction) KX_PhysicsObjectWrapper::sPySetActive, METH_VARARGS},
- {NULL,NULL} //Sentinel
-};
-
-#endif
diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
deleted file mode 100644
index 171416c5e8f..00000000000
--- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
+++ /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 KX_PhysicsObjectWrapper.h
- * \ingroup ketsji
- */
-
-#ifndef __KX_PHYSICSOBJECTWRAPPER_H__
-#define __KX_PHYSICSOBJECTWRAPPER_H__
-
-#include "Value.h"
-#include "PHY_DynamicTypes.h"
-
-class KX_PhysicsObjectWrapper : public PyObjectPlus
-{
- Py_Header
-public:
- KX_PhysicsObjectWrapper(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsEnvironment* physenv);
- virtual ~KX_PhysicsObjectWrapper();
-
-#ifdef WITH_PYTHON
-
- KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetPosition);
- KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetLinearVelocity);
- KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetAngularVelocity);
- KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetActive);
-
-#endif /* WITH_PYTHON */
-
-private:
- class PHY_IPhysicsController* m_ctrl;
- PHY_IPhysicsEnvironment* m_physenv;
-};
-
-#endif /* __KX_PHYSICSOBJECTWRAPPER_H__ */
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp
index 465e91ffb32..840ffdde165 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.cpp
+++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp
@@ -140,21 +140,21 @@ PyObject *KX_PolyProxy::pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *at
{
KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
- return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0));
+ return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0));
}
PyObject *KX_PolyProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
- return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1));
+ return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1));
}
PyObject *KX_PolyProxy::pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
- return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2));
+ return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2));
}
PyObject *KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -163,9 +163,9 @@ PyObject *KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *at
if (3 < self->m_polygon->VertexCount())
{
- return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3));
+ return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3));
}
- return PyLong_FromSsize_t(0);
+ return PyLong_FromLong(0);
}
PyObject *KX_PolyProxy::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -192,25 +192,25 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex,
// found it
break;
}
- return PyLong_FromSsize_t(matid);
+ return PyLong_FromLong(matid);
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getNumVertex,
"getNumVertex() : returns the number of vertex of the polygon, 3 or 4\n")
{
- return PyLong_FromSsize_t(m_polygon->VertexCount());
+ return PyLong_FromLong(m_polygon->VertexCount());
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isVisible,
"isVisible() : returns whether the polygon is visible or not\n")
{
- return PyLong_FromSsize_t(m_polygon->IsVisible());
+ return PyLong_FromLong(m_polygon->IsVisible());
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isCollider,
"isCollider() : returns whether the polygon is receives collision or not\n")
{
- return PyLong_FromSsize_t(m_polygon->IsCollider());
+ return PyLong_FromLong(m_polygon->IsCollider());
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialName,
@@ -243,9 +243,9 @@ KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
}
if (index < m_polygon->VertexCount())
{
- return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, index));
+ return PyLong_FromLong(m_polygon->GetVertexOffsetAbs(m_mesh, index));
}
- return PyLong_FromSsize_t(0);
+ return PyLong_FromLong(0);
}
KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMesh,
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
index f89b918f31b..f157d9ed20a 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
@@ -146,7 +146,7 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI
PyObject *ret = PyObject_CallMethod(m_pymaterial, (char *)"activate", (char *)"(NNO)", pyRasty, pyCachingInfo, (PyObject *) this->m_proxy);
if (ret)
{
- bool value = PyLong_AsSsize_t(ret);
+ bool value = PyLong_AsLong(ret);
Py_DECREF(ret);
dopass = value;
}
@@ -266,8 +266,6 @@ PyAttributeDef KX_PolygonMaterial::Attributes[] = {
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' */
-
- /* triangle used to be an attribute, removed for 2.49, nobody should be using it */
{ NULL } //Sentinel
};
@@ -381,7 +379,7 @@ PyObject *KX_PolygonMaterial::pyattr_get_gl_texture(void *self_v, const KX_PYATT
if (self->m_tface.tpage)
bindcode= self->m_tface.tpage->bindcode;
- return PyLong_FromSsize_t(bindcode);
+ return PyLong_FromLong(bindcode);
}
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index 4475ac8ec96..9bb09d56de6 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -34,7 +34,6 @@
#include "KX_ConstraintWrapper.h"
#include "KX_VehicleWrapper.h"
#include "KX_CharacterWrapper.h"
-#include "KX_PhysicsObjectWrapper.h"
#include "PHY_IPhysicsController.h"
#include "PHY_IVehicle.h"
#include "PHY_DynamicTypes.h"
@@ -51,7 +50,7 @@
#ifdef WITH_PYTHON
// macro copied from KX_PythonInit.cpp
-#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name2)); Py_DECREF(item)
+#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromLong(name2)); Py_DECREF(item)
// nasty glob variable to connect scripting language
// if there is a better way (without global), please do so!
@@ -729,7 +728,7 @@ PyObject *initPythonConstraintBinding()
KX_MACRO_addTypesToDict(d, DBG_PROFILETIMINGS, btIDebugDraw::DBG_ProfileTimings);
KX_MACRO_addTypesToDict(d, DBG_ENABLESATCOMPARISION, btIDebugDraw::DBG_EnableSatComparison);
KX_MACRO_addTypesToDict(d, DBG_DISABLEBULLETLCP, btIDebugDraw::DBG_DisableBulletLCP);
- KX_MACRO_addTypesToDict(d, DBG_ENABLECDD, btIDebugDraw::DBG_EnableCCD);
+ KX_MACRO_addTypesToDict(d, DBG_ENABLECCD, btIDebugDraw::DBG_EnableCCD);
KX_MACRO_addTypesToDict(d, DBG_DRAWCONSTRAINTS, btIDebugDraw::DBG_DrawConstraints);
KX_MACRO_addTypesToDict(d, DBG_DRAWCONSTRAINTLIMITS, btIDebugDraw::DBG_DrawConstraintLimits);
KX_MACRO_addTypesToDict(d, DBG_FASTWIREFRAME, btIDebugDraw::DBG_FastWireframe);
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 7f6655861f1..996be97c474 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -193,10 +193,10 @@ static PyObject *gp_OrigPythonSysPath= NULL;
static PyObject *gp_OrigPythonSysModules= NULL;
/* Macro for building the keyboard translation */
-//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromSsize_t(SCA_IInputDevice::KX_##name))
-#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name)); Py_DECREF(item)
+//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromLong(SCA_IInputDevice::KX_##name))
+#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromLong(name)); Py_DECREF(item)
/* For the defines for types from logic bricks, we do stuff explicitly... */
-#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name2)); Py_DECREF(item)
+#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromLong(name2)); Py_DECREF(item)
// temporarily python stuff, will be put in another place later !
@@ -429,7 +429,7 @@ static PyObject *gPySetExitKey(PyObject *, PyObject *args)
static PyObject *gPyGetExitKey(PyObject *)
{
- return PyLong_FromSsize_t(KX_KetsjiEngine::GetExitKey());
+ return PyLong_FromLong(KX_KetsjiEngine::GetExitKey());
}
static PyObject *gPySetMaxLogicFrame(PyObject *, PyObject *args)
@@ -444,7 +444,7 @@ static PyObject *gPySetMaxLogicFrame(PyObject *, PyObject *args)
static PyObject *gPyGetMaxLogicFrame(PyObject *)
{
- return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxLogicFrame());
+ return PyLong_FromLong(KX_KetsjiEngine::GetMaxLogicFrame());
}
static PyObject *gPySetMaxPhysicsFrame(PyObject *, PyObject *args)
@@ -459,7 +459,7 @@ static PyObject *gPySetMaxPhysicsFrame(PyObject *, PyObject *args)
static PyObject *gPyGetMaxPhysicsFrame(PyObject *)
{
- return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxPhysicsFrame());
+ return PyLong_FromLong(KX_KetsjiEngine::GetMaxPhysicsFrame());
}
static PyObject *gPySetPhysicsTicRate(PyObject *, PyObject *args)
@@ -862,14 +862,14 @@ static struct PyMethodDef game_methods[] = {
static PyObject *gPyGetWindowHeight(PyObject *, PyObject *args)
{
- return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetHeight() : 0));
+ return PyLong_FromLong((gp_Canvas ? gp_Canvas->GetHeight() : 0));
}
static PyObject *gPyGetWindowWidth(PyObject *, PyObject *args)
{
- return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetWidth() : 0));
+ return PyLong_FromLong((gp_Canvas ? gp_Canvas->GetWidth() : 0));
}
@@ -1203,7 +1203,7 @@ static PyObject *gPyGetGLSLMaterialSetting(PyObject *,
}
enabled = ((gs->glslflag & flag) != 0);
- return PyLong_FromSsize_t(enabled);
+ return PyLong_FromLong(enabled);
}
#define KX_TEXFACE_MATERIAL 0
@@ -1246,7 +1246,7 @@ static PyObject *gPyGetMaterialType(PyObject *)
else
flag = KX_TEXFACE_MATERIAL;
- return PyLong_FromSsize_t(flag);
+ return PyLong_FromLong(flag);
}
static PyObject *gPySetAnisotropicFiltering(PyObject *, PyObject *args)
@@ -1688,6 +1688,7 @@ PyObject *initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_DISABLE, ACT_ARM_DISABLE);
KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_SETTARGET, ACT_ARM_SETTARGET);
KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_SETWEIGHT, ACT_ARM_SETWEIGHT);
+ KX_MACRO_addTypesToDict(d, KX_ACT_ARMATURE_SETINFLUENCE, ACT_ARM_SETINFLUENCE);
/* BL_Armature Channel rotation_mode */
KX_MACRO_addTypesToDict(d, ROT_MODE_QUAT, ROT_MODE_QUAT);
diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
index 805b9ce2fc2..971730672db 100644
--- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
@@ -40,6 +40,7 @@
#include "BL_ArmatureConstraint.h"
#include "BL_ArmatureObject.h"
#include "BL_ArmatureChannel.h"
+#include "KX_ArmatureSensor.h"
#include "KX_BlenderMaterial.h"
#include "KX_CameraActuator.h"
#include "KX_CharacterWrapper.h"
@@ -54,7 +55,6 @@
#include "KX_NetworkMessageSensor.h"
#include "KX_ObjectActuator.h"
#include "KX_ParentActuator.h"
-#include "KX_PhysicsObjectWrapper.h"
#include "KX_PolyProxy.h"
#include "KX_PolygonMaterial.h"
#include "KX_PythonSeq.h"
@@ -185,8 +185,10 @@ void initPyTypes(void)
PyType_Ready_Attr(dict, BL_ArmatureConstraint, init_getset);
PyType_Ready_AttrPtr(dict, BL_ArmatureBone, init_getset);
PyType_Ready_AttrPtr(dict, BL_ArmatureChannel, init_getset);
+ // PyType_Ready_Attr(dict, CPropValue, init_getset); // doesn't use Py_Header
PyType_Ready_Attr(dict, CListValue, init_getset);
PyType_Ready_Attr(dict, CValue, init_getset);
+ PyType_Ready_Attr(dict, KX_ArmatureSensor, init_getset);
PyType_Ready_Attr(dict, KX_BlenderMaterial, init_getset);
PyType_Ready_Attr(dict, KX_Camera, init_getset);
PyType_Ready_Attr(dict, KX_CameraActuator, init_getset);
@@ -205,7 +207,6 @@ void initPyTypes(void)
PyType_Ready_Attr(dict, KX_NetworkMessageSensor, init_getset);
PyType_Ready_Attr(dict, KX_ObjectActuator, init_getset);
PyType_Ready_Attr(dict, KX_ParentActuator, init_getset);
- PyType_Ready_Attr(dict, KX_PhysicsObjectWrapper, 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);
@@ -228,6 +229,7 @@ void initPyTypes(void)
PyType_Ready_Attr(dict, PyObjectPlus, init_getset);
PyType_Ready_Attr(dict, SCA_2DFilterActuator, init_getset);
PyType_Ready_Attr(dict, SCA_ANDController, init_getset);
+ // PyType_Ready_Attr(dict, SCA_Actuator, init_getset); // doesn't use Py_Header
PyType_Ready_Attr(dict, SCA_ActuatorSensor, init_getset);
PyType_Ready_Attr(dict, SCA_AlwaysSensor, init_getset);
PyType_Ready_Attr(dict, SCA_DelaySensor, init_getset);
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp
index 6b4d88709e8..f0e11645bc1 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.cpp
+++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp
@@ -100,7 +100,7 @@ static Py_ssize_t KX_PythonSeq_len( PyObject *self )
}
}
-static PyObject *KX_PythonSeq_getIndex(PyObject *self, int index)
+static PyObject *KX_PythonSeq_getIndex(PyObject *self, Py_ssize_t index)
{
PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
@@ -273,8 +273,8 @@ static PyObject * KX_PythonSeq_subscript(PyObject *self, PyObject *key)
return NULL;
}
- if (PyLong_Check(key)) {
- return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t( key ));
+ if (PyIndex_Check(key)) {
+ return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t(key));
}
else if ( PyUnicode_Check(key) ) {
const char *name = _PyUnicode_AsString(key);
diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
index b5d6f11a2d5..9cc91a33886 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.cpp
@@ -126,13 +126,13 @@ PyObject *KX_VehicleWrapper::PyGetWheelOrientationQuaternion(PyObject *args)
PyObject *KX_VehicleWrapper::PyGetNumWheels(PyObject *args)
{
- return PyLong_FromSsize_t(m_vehicle->GetNumWheels());
+ return PyLong_FromLong(m_vehicle->GetNumWheels());
}
PyObject *KX_VehicleWrapper::PyGetConstraintId(PyObject *args)
{
- return PyLong_FromSsize_t(m_vehicle->GetUserConstraintId());
+ return PyLong_FromLong(m_vehicle->GetUserConstraintId());
}
@@ -263,7 +263,7 @@ PyObject *KX_VehicleWrapper::PySetSteeringValue(PyObject *args)
PyObject *KX_VehicleWrapper::PyGetConstraintType(PyObject *args)
{
- return PyLong_FromSsize_t(m_vehicle->GetUserConstraintType());
+ return PyLong_FromLong(m_vehicle->GetUserConstraintType());
}
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index 82e414d7c42..2354359af18 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -494,13 +494,13 @@ PyObject *KX_VertexProxy::PySetNormal(PyObject *value)
PyObject *KX_VertexProxy::PyGetRGBA()
{
int *rgba = (int *) m_vertex->getRGBA();
- return PyLong_FromSsize_t(*rgba);
+ return PyLong_FromLong(*rgba);
}
PyObject *KX_VertexProxy::PySetRGBA(PyObject *value)
{
if (PyLong_Check(value)) {
- int rgba = PyLong_AsSsize_t(value);
+ int rgba = PyLong_AsLong(value);
m_vertex->SetRGBA(rgba);
m_mesh->SetMeshModified(true);
Py_RETURN_NONE;
diff --git a/source/gameengine/VideoTexture/FilterBlueScreen.cpp b/source/gameengine/VideoTexture/FilterBlueScreen.cpp
index 551694bf8c0..662ecabd283 100644
--- a/source/gameengine/VideoTexture/FilterBlueScreen.cpp
+++ b/source/gameengine/VideoTexture/FilterBlueScreen.cpp
@@ -87,18 +87,21 @@ static PyObject *getColor (PyFilter *self, void *closure)
static int setColor (PyFilter *self, PyObject *value, void *closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 3
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2)))
+ if (value == NULL ||
+ !(PyTuple_Check(value) || PyList_Check(value)) ||
+ PySequence_Fast_GET_SIZE(value) != 3 ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)) ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 3 ints");
return -1;
}
// set color
- getFilter(self)->setColor((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
- (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
- (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))));
+ getFilter(self)->setColor(
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2))));
// success
return 0;
}
@@ -114,16 +117,19 @@ static PyObject *getLimits (PyFilter *self, void *closure)
static int setLimits (PyFilter *self, PyObject *value, void *closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
+ if (value == NULL ||
+ !(PyTuple_Check(value) || PyList_Check(value)) ||
+ PySequence_Fast_GET_SIZE(value) != 2 ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
return -1;
}
// set limits
- getFilter(self)->setLimits((unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
- (unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))));
+ getFilter(self)->setLimits(
+ (unsigned short)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+ (unsigned short)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1))));
// success
return 0;
}
@@ -163,14 +169,14 @@ PyTypeObject FilterBlueScreenType =
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
"Filter for Blue Screen objects", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- NULL, /* tp_methods */
- 0, /* tp_members */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ NULL, /* tp_methods */
+ 0, /* tp_members */
filterBSGetSets, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
diff --git a/source/gameengine/VideoTexture/FilterColor.cpp b/source/gameengine/VideoTexture/FilterColor.cpp
index 75803e46516..e4101b5587d 100644
--- a/source/gameengine/VideoTexture/FilterColor.cpp
+++ b/source/gameengine/VideoTexture/FilterColor.cpp
@@ -151,7 +151,7 @@ static int setMatrix (PyFilter *self, PyObject *value, void *closure)
valid = PyLong_Check(PySequence_Fast_GET_ITEM(row, c));
// if it is valid, save it in matrix
if (valid)
- mat[r][c] = short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(row, c)));
+ mat[r][c] = short(PyLong_AsLong(PySequence_Fast_GET_ITEM(row, c)));
}
}
// if parameter is not valid, report error
@@ -284,7 +284,7 @@ static int setLevels (PyFilter *self, PyObject *value, void *closure)
valid = PyLong_Check(PySequence_Fast_GET_ITEM(row, c));
// if it is valid, save it in matrix
if (valid)
- lev[r][c] = (unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(row, c)));
+ lev[r][c] = (unsigned short)(PyLong_AsLong(PySequence_Fast_GET_ITEM(row, c)));
}
}
// if parameter is not valid, report error
diff --git a/source/gameengine/VideoTexture/FilterNormal.cpp b/source/gameengine/VideoTexture/FilterNormal.cpp
index 8499934d61b..ba963d93079 100644
--- a/source/gameengine/VideoTexture/FilterNormal.cpp
+++ b/source/gameengine/VideoTexture/FilterNormal.cpp
@@ -85,7 +85,7 @@ static int setColor (PyFilter *self, PyObject *value, void *closure)
return -1;
}
// set color index
- getFilter(self)->setColor((unsigned short)(PyLong_AsSsize_t(value)));
+ getFilter(self)->setColor((unsigned short)(PyLong_AsLong(value)));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index b8dd4ad4552..f778f840864 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -360,10 +360,11 @@ static int setBackground (PyImage *self, PyObject *value, void *closure)
return -1;
}
// set background color
- getImageRender(self)->setBackground((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
- (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
- (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))),
- (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 3))));
+ getImageRender(self)->setBackground(
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 2))),
+ (unsigned char)(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 3))));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp
index b221cb96624..5fc388bdefb 100644
--- a/source/gameengine/VideoTexture/ImageViewport.cpp
+++ b/source/gameengine/VideoTexture/ImageViewport.cpp
@@ -89,7 +89,7 @@ void ImageViewport::setWhole (bool whole)
setPosition();
}
-void ImageViewport::setCaptureSize (short * size)
+void ImageViewport::setCaptureSize (short size[2])
{
m_whole = false;
if (size == NULL)
@@ -109,7 +109,7 @@ void ImageViewport::setCaptureSize (short * size)
}
// set position of capture rectangle
-void ImageViewport::setPosition (GLint * pos)
+void ImageViewport::setPosition (GLint pos[2])
{
// if new position is not provided, use existing position
if (pos == NULL) pos = m_position;
@@ -258,25 +258,30 @@ int ImageViewport_setAlpha (PyImage *self, PyObject *value, void *closure)
// get position
static PyObject *ImageViewport_getPosition (PyImage *self, void *closure)
{
- return Py_BuildValue("(ii)", getImageViewport(self)->getPosition()[0],
- getImageViewport(self)->getPosition()[1]);
+ GLint *pos = getImageViewport(self)->getPosition();
+ PyObject *ret = PyTuple_New(2);
+ PyTuple_SET_ITEM(ret, 0, PyLong_FromLong(pos[0]));
+ PyTuple_SET_ITEM(ret, 1, PyLong_FromLong(pos[1]));
+ return ret;
}
// set position
static int ImageViewport_setPosition (PyImage *self, PyObject *value, void *closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
+ if (value == NULL ||
+ !(PyTuple_Check(value) || PyList_Check(value)) ||
+ PySequence_Fast_GET_SIZE(value) != 2 ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
return -1;
}
// set position
- GLint pos [] = {
- GLint(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
- GLint(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1)))
+ GLint pos[2] = {
+ GLint(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+ GLint(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
};
getImageViewport(self)->setPosition(pos);
// success
@@ -286,25 +291,30 @@ static int ImageViewport_setPosition (PyImage *self, PyObject *value, void *clos
// get capture size
PyObject *ImageViewport_getCaptureSize (PyImage *self, void *closure)
{
- return Py_BuildValue("(ii)", getImageViewport(self)->getCaptureSize()[0],
- getImageViewport(self)->getCaptureSize()[1]);
+ short *size = getImageViewport(self)->getCaptureSize();
+ PyObject *ret = PyTuple_New(2);
+ PyTuple_SET_ITEM(ret, 0, PyLong_FromLong(size[0]));
+ PyTuple_SET_ITEM(ret, 1, PyLong_FromLong(size[1]));
+ return ret;
}
// set capture size
int ImageViewport_setCaptureSize (PyImage *self, PyObject *value, void *closure)
{
// check validity of parameter
- if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
- || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
+ if (value == NULL ||
+ !(PyTuple_Check(value) || PyList_Check(value)) ||
+ PySequence_Fast_GET_SIZE(value) != 2 ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0)) ||
+ !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
return -1;
}
// set capture size
- short size [] = {
- short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
- short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1)))
+ short size[2] = {
+ short(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
+ short(PyLong_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
};
try
{
diff --git a/source/gameengine/VideoTexture/ImageViewport.h b/source/gameengine/VideoTexture/ImageViewport.h
index 2c2b2a26ec2..5afd4654d62 100644
--- a/source/gameengine/VideoTexture/ImageViewport.h
+++ b/source/gameengine/VideoTexture/ImageViewport.h
@@ -60,12 +60,12 @@ public:
/// get capture size in viewport
short * getCaptureSize (void) { return m_capSize; }
/// set capture size in viewport
- void setCaptureSize (short * size = NULL);
+ void setCaptureSize (short size[2] = NULL);
/// get position in viewport
GLint * getPosition (void) { return m_position; }
/// set position in viewport
- void setPosition (GLint * pos = NULL);
+ void setPosition (GLint pos[2] = NULL);
protected:
/// frame buffer rectangle
diff --git a/source/gameengine/VideoTexture/VideoBase.cpp b/source/gameengine/VideoTexture/VideoBase.cpp
index f723001fa5a..576e358fe75 100644
--- a/source/gameengine/VideoTexture/VideoBase.cpp
+++ b/source/gameengine/VideoTexture/VideoBase.cpp
@@ -184,7 +184,7 @@ int Video_setRepeat(PyImage *self, PyObject *value, void *closure)
return -1;
}
// set repeat
- getVideo(self)->setRepeat(int(PyLong_AsSsize_t(value)));
+ getVideo(self)->setRepeat(int(PyLong_AsLong(value)));
// success
return 0;
}
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index 937705c963e..8976a21376a 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -1142,7 +1142,7 @@ static int VideoFFmpeg_setPreseek(PyImage *self, PyObject *value, void *closure)
return -1;
}
// set preseek
- getFFmpeg(self)->setPreseek(PyLong_AsSsize_t(value));
+ getFFmpeg(self)->setPreseek(PyLong_AsLong(value));
// success
return 0;
}
diff --git a/source/tests/bl_rst_completeness.py b/source/tests/bl_rst_completeness.py
new file mode 100644
index 00000000000..e9e2779bda8
--- /dev/null
+++ b/source/tests/bl_rst_completeness.py
@@ -0,0 +1,159 @@
+# ##### 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 #####
+
+# <pep8 compliant>
+
+# run this script in the game engine.
+# or on the command line with...
+# ./blender.bin --background -noaudio --python source/tests/bl_rst_completeness.py
+
+# Paste this into the bge and run on an always actuator.
+'''
+filepath = "/dsk/data/src/blender/blender/source/tests/bl_rst_completeness.py"
+exec(compile(open(filepath).read(), filepath, 'exec'))
+'''
+
+import os
+
+THIS_DIR = os.path.dirname(__file__)
+RST_DIR = os.path.normpath(os.path.join(THIS_DIR, "..", "..", "doc", "python_api", "rst"))
+
+import sys
+sys.path.append(THIS_DIR)
+
+import rst_to_doctree_mini
+
+try:
+ import bge
+except:
+ bge = None
+
+# (file, module)
+modules = (
+ ("bge.constraints.rst", "bge.constraints", False),
+ ("bge.events.rst", "bge.events", False),
+ ("bge.logic.rst", "bge.logic", False),
+ ("bge.render.rst", "bge.render", False),
+ ("bge.texture.rst", "bge.texture", False),
+ ("bge.types.rst", "bge.types", False),
+
+ ("bgl.rst", "bgl", True),
+ ("gpu.rst", "gpu", False),
+)
+
+def is_directive_pydata(filepath, directive):
+ if directive.type in {"function", "method", "class", "attribute", "data"}:
+ return True
+ elif directive.type in {"module", "note", "warning", "code-block", "hlist", "seealso"}:
+ return False
+ elif directive.type in {"literalinclude"}: # TODO
+ return False
+ else:
+ print(directive_to_str(filepath, directive), end=" ")
+ print("unknown directive type %r" % directive.type)
+ return False
+
+
+def directive_to_str(filepath, directive):
+ return "%s:%d:%d:" % (filepath, directive.line + 1, directive.indent)
+
+
+def directive_members_dict(filepath, directive_members):
+ return {directive.value_strip: directive for directive in directive_members
+ if is_directive_pydata(filepath, directive)}
+
+
+def module_validate(filepath, mod, mod_name, doctree, partial_ok):
+ # RST member missing from MODULE ???
+ for directive in doctree:
+ # print(directive.type)
+ if is_directive_pydata(filepath, directive):
+ attr = directive.value_strip
+ has_attr = hasattr(mod, attr)
+ ok = False
+ if not has_attr:
+ # so we can have glNormal docs cover glNormal3f
+ if partial_ok:
+ for s in dir(mod):
+ if s.startswith(attr):
+ ok = True
+ break
+
+ if not ok:
+ print(directive_to_str(filepath, directive), end=" ")
+ print("rst contains non existing member %r" % attr)
+
+ # if its a class, scan down the class...
+ # print(directive.type)
+ if has_attr:
+ if directive.type == "class":
+ cls = getattr(mod, attr)
+ # print("directive: ", directive)
+ for directive_child in directive.members:
+ # print("directive_child: ", directive_child)
+ if is_directive_pydata(filepath, directive_child):
+ attr_child = directive_child.value_strip
+ if attr_child not in cls.__dict__:
+ attr_id = "%s.%s" % (attr, attr_child)
+ print(directive_to_str(filepath, directive_child), end=" ")
+ print("rst contains non existing class member %r" % attr_id)
+
+
+ # MODULE member missing from RST ???
+ doctree_dict = directive_members_dict(filepath, doctree)
+ for attr in dir(mod):
+ if attr.startswith("_"):
+ continue
+
+ directive = doctree_dict.get(attr)
+ if directive is None:
+ print("module contains undocumented member %r from %r" % ("%s.%s" % (mod_name, attr), filepath))
+ else:
+ if directive.type == "class":
+ directive_dict = directive_members_dict(filepath, directive.members)
+ cls = getattr(mod, attr)
+ for attr_child in cls.__dict__.keys():
+ if attr_child.startswith("_"):
+ continue
+ if attr_child not in directive_dict:
+ attr_id = "%s.%s.%s" % (mod_name, attr, attr_child), filepath
+ print("module contains undocumented member %r from %r" % attr_id)
+
+
+def main():
+
+ if bge is None:
+ print("Skipping BGE modules!")
+
+ for filename, modname, partial_ok in modules:
+ if bge is None and modname.startswith("bge"):
+ continue
+
+ filepath = os.path.join(RST_DIR, filename)
+ if not os.path.exists(filepath):
+ raise Exception("%r not found" % filepath)
+
+ doctree = rst_to_doctree_mini.parse_rst_py(filepath)
+ __import__(modname)
+ mod = sys.modules[modname]
+
+ module_validate(filepath, mod, modname, doctree, partial_ok)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/source/tests/rst_to_doctree_mini.py b/source/tests/rst_to_doctree_mini.py
new file mode 100644
index 00000000000..181037299cf
--- /dev/null
+++ b/source/tests/rst_to_doctree_mini.py
@@ -0,0 +1,91 @@
+# ##### 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 #####
+
+# <pep8 compliant>
+
+# Module with function to extract a doctree from an reStructuredText file.
+# Named 'Mini' because we only parse the minimum data needed to check
+# Python classes, methods and attributes match up to those in existing modules.
+# (To test for documentation completeness)
+
+# note: literalinclude's are not followed.
+# could be nice to add but not really needed either right now.
+
+import collections
+
+Directive = collections.namedtuple('Directive',
+ ("type",
+ "value",
+ "value_strip",
+ "line",
+ "indent",
+ "members"))
+
+
+def parse_rst_py(filepath):
+ import re
+
+ # Get the prefix assuming the line is lstrip()'d
+ # ..foo:: bar
+ # -->
+ # ("foo", "bar")
+ re_prefix = re.compile(r"^\.\.\s([a-zA-Z09\-]+)::\s*(.*)\s*$")
+
+ tree = collections.defaultdict(list)
+ indent_map = {}
+ indent_prev = 0
+ f = open(filepath, encoding="utf-8")
+ indent_lists = []
+ for i, line in enumerate(f):
+ line_strip = line.lstrip()
+ # ^\.\.\s[a-zA-Z09\-]+::.*$
+ #if line.startswith(".. "):
+ march = re_prefix.match(line_strip)
+
+ if march:
+ directive, value = march.group(1, 2)
+ indent = len(line) - len(line_strip)
+ value_strip = value.replace("(", " ").split()
+ value_strip = value_strip[0] if value_strip else ""
+
+ item = Directive(type=directive,
+ value=value,
+ value_strip=value_strip,
+ line=i,
+ indent=indent,
+ members=[])
+
+ tree[indent].append(item)
+ if indent_prev < indent:
+ indent_map[indent] = indent_prev
+ if indent > 0:
+ tree[indent_map[indent]][-1].members.append(item)
+ indent_prev = indent
+ f.close()
+
+ return tree[0]
+
+
+if __name__ == "__main__":
+ # not intended use, but may as well print rst files passed as a test.
+ import sys
+ for arg in sys.argv:
+ if arg.lower().endswith((".txt", ".rst")):
+ items = parse_rst_py(arg)
+ for i in items:
+ print(i)