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>2013-02-10 14:17:59 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-10 14:17:59 +0400
commitac9ec06ec121589fedbfeaa10137140b45bfd668 (patch)
treeab08f9528136f0b8813593b78621f869d98d655e
parent3c064f4553e4be988fe4fcec450b59b935fa3c80 (diff)
parent63af7068ad17f30a526ccb81fbe74253b064bc89 (diff)
Merged changes in the trunk up to revision 54421.
Conflicts resolved: release/datafiles/startup.blend release/scripts/startup/bl_ui/properties_render.py source/blender/SConscript source/blender/blenloader/intern/readfile.c
-rw-r--r--CMakeLists.txt47
-rw-r--r--SConstruct8
-rw-r--r--build_files/cmake/cmake_consistency_check_config.py21
-rw-r--r--build_files/cmake/config/blender_headless.cmake22
-rw-r--r--build_files/cmake/config/blender_lite.cmake86
-rw-r--r--build_files/cmake/config/bpy_module.cmake32
-rw-r--r--build_files/scons/config/darwin-config.py2
-rw-r--r--build_files/scons/config/win64-vc-config.py2
-rw-r--r--build_files/scons/tools/Blender.py11
-rw-r--r--doc/python_api/examples/bpy.types.UIList.py11
-rw-r--r--doc/python_api/rst/bge.types.rst5379
-rw-r--r--doc/python_api/rst/bge_types/bge.types.BL_ActionActuator.rst78
-rw-r--r--doc/python_api/rst/bge_types/bge.types.BL_ArmatureActuator.rst61
-rw-r--r--doc/python_api/rst/bge_types/bge.types.BL_ArmatureBone.rst105
-rw-r--r--doc/python_api/rst/bge_types/bge.types.BL_ArmatureChannel.rst278
-rw-r--r--doc/python_api/rst/bge_types/bge.types.BL_ArmatureConstraint.rst129
-rw-r--r--doc/python_api/rst/bge_types/bge.types.BL_ArmatureObject.rst34
-rw-r--r--doc/python_api/rst/bge_types/bge.types.BL_Shader.rst220
-rw-r--r--doc/python_api/rst/bge_types/bge.types.BL_ShapeActionActuator.rst72
-rw-r--r--doc/python_api/rst/bge_types/bge.types.CListValue.rst72
-rw-r--r--doc/python_api/rst/bge_types/bge.types.CPropValue.rst11
-rw-r--r--doc/python_api/rst/bge_types/bge.types.CValue.rst17
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_ArmatureSensor.rst36
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_BlenderMaterial.rst77
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_Camera.rst284
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_CameraActuator.rst47
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_CharacterWrapper.rst45
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_ConstraintActuator.rst78
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_ConstraintWrapper.rst18
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_FontObject.rst12
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_GameActuator.rst23
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_GameObject.rst839
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_IpoActuator.rst65
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_LibLoadStatus.rst45
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_LightObject.rst90
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_MeshProxy.rst134
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_MouseFocusSensor.rst66
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_NavMeshObject.rst47
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_NearSensor.rst23
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_NetworkMessageActuator.rst35
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_NetworkMessageSensor.rst38
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_ObjectActuator.rst129
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_ParentActuator.rst38
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_PolyProxy.rst139
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_PolygonMaterial.rst250
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_RadarSensor.rst44
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_RaySensor.rst72
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_SCA_AddObjectActuator.rst55
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_SCA_DynamicActuator.rst29
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_SCA_EndObjectActuator.rst13
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_SCA_ReplaceMeshActuator.rst89
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_Scene.rst172
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_SceneActuator.rst49
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_SoundActuator.rst115
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_StateActuator.rst29
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_SteeringActuator.rst71
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_TouchSensor.rst41
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_TrackToActuator.rst39
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_VehicleWrapper.rst161
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst209
-rw-r--r--doc/python_api/rst/bge_types/bge.types.KX_VisibilityActuator.rst29
-rw-r--r--doc/python_api/rst/bge_types/bge.types.PyObjectPlus.rst21
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_2DFilterActuator.rst49
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_ANDController.rst13
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_ActuatorSensor.rst19
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_AlwaysSensor.rst11
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_DelaySensor.rst39
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_IActuator.rst11
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_IController.rst55
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_ILogicBrick.rst29
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_IObject.rst11
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_ISensor.rst95
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_JoystickSensor.rst133
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_KeyboardSensor.rst64
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_MouseSensor.rst39
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_NANDController.rst13
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_NORController.rst13
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_ORController.rst13
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_PropertyActuator.rst29
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_PropertySensor.rst41
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_PythonController.rst48
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_PythonJoystick.rst75
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_PythonKeyboard.rst37
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_PythonMouse.rst35
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_RandomActuator.rst127
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_RandomSensor.rst23
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_XNORController.rst13
-rw-r--r--doc/python_api/rst/bge_types/bge.types.SCA_XORController.rst13
-rw-r--r--doc/python_api/sphinx_doc_gen.py22
-rw-r--r--doc/python_api/sphinx_doc_gen_monkeypatch.py47
-rw-r--r--extern/bullet2/CMakeLists.txt5
-rw-r--r--extern/carve/lib/intersect_face_division.cpp4
-rw-r--r--intern/CMakeLists.txt8
-rw-r--r--intern/SConscript6
-rw-r--r--intern/cycles/CMakeLists.txt7
-rw-r--r--intern/cycles/SConscript26
-rw-r--r--intern/cycles/blender/addon/properties.py22
-rw-r--r--intern/cycles/blender/addon/ui.py104
-rw-r--r--intern/cycles/blender/blender_curves.cpp278
-rw-r--r--intern/cycles/blender/blender_mesh.cpp6
-rw-r--r--intern/cycles/blender/blender_object.cpp1
-rw-r--r--intern/cycles/blender/blender_python.cpp2
-rw-r--r--intern/cycles/blender/blender_session.cpp47
-rw-r--r--intern/cycles/blender/blender_session.h8
-rw-r--r--intern/cycles/blender/blender_shader.cpp7
-rw-r--r--intern/cycles/blender/blender_util.h4
-rw-r--r--intern/cycles/device/CMakeLists.txt4
-rw-r--r--intern/cycles/device/device_cpu.cpp48
-rw-r--r--intern/cycles/kernel/CMakeLists.txt6
-rw-r--r--intern/cycles/kernel/kernel.h13
-rw-r--r--intern/cycles/kernel/kernel_accumulate.h8
-rw-r--r--intern/cycles/kernel/kernel_bvh.h24
-rw-r--r--intern/cycles/kernel/kernel_emission.h13
-rw-r--r--intern/cycles/kernel/kernel_light.h42
-rw-r--r--intern/cycles/kernel/kernel_path.h30
-rw-r--r--intern/cycles/kernel/kernel_sse2.cpp60
-rw-r--r--intern/cycles/kernel/kernel_sse3.cpp (renamed from intern/cycles/kernel/kernel_optimized.cpp)6
-rw-r--r--intern/cycles/kernel/kernel_types.h10
-rw-r--r--intern/cycles/kernel/osl/SConscript1
-rw-r--r--intern/cycles/kernel/shaders/node_musgrave_texture.osl24
-rw-r--r--intern/cycles/kernel/shaders/node_texture.h14
-rw-r--r--intern/cycles/render/curves.h4
-rw-r--r--intern/cycles/render/image.cpp32
-rw-r--r--intern/cycles/render/image.h14
-rw-r--r--intern/cycles/render/light.cpp28
-rw-r--r--intern/cycles/render/light.h1
-rw-r--r--intern/cycles/render/nodes.cpp16
-rw-r--r--intern/cycles/render/nodes.h4
-rw-r--r--intern/cycles/render/object.cpp12
-rw-r--r--intern/cycles/render/session.cpp4
-rw-r--r--intern/cycles/util/util_system.cpp15
-rw-r--r--intern/cycles/util/util_system.h3
-rw-r--r--intern/ghost/CMakeLists.txt3
-rw-r--r--intern/ghost/GHOST_C-api.h14
-rw-r--r--intern/ghost/GHOST_ISystem.h6
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp7
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp11
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp5
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h6
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h5
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm5
-rw-r--r--intern/ghost/intern/GHOST_SystemNULL.h22
-rw-r--r--intern/ghost/intern/GHOST_SystemSDL.cpp14
-rw-r--r--intern/ghost/intern/GHOST_SystemSDL.h4
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp5
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h8
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp70
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h10
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm6
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp41
-rw-r--r--intern/opencl/CMakeLists.txt (renamed from source/blender/opencl/CMakeLists.txt)2
-rw-r--r--intern/opencl/OCL_opencl.h (renamed from source/blender/opencl/OCL_opencl.h)0
-rw-r--r--intern/opencl/SConscript (renamed from source/blender/opencl/SConscript)2
-rw-r--r--intern/opencl/intern/OCL_opencl.c (renamed from source/blender/opencl/intern/OCL_opencl.c)0
-rw-r--r--intern/opencl/intern/clew.c (renamed from source/blender/opencl/intern/clew.c)0
-rw-r--r--intern/opencl/intern/clew.h (renamed from source/blender/opencl/intern/clew.h)0
-rw-r--r--intern/rigidbody/CMakeLists.txt (renamed from source/blender/rigidbody/CMakeLists.txt)4
-rw-r--r--intern/rigidbody/RBI_api.h (renamed from source/blender/rigidbody/RBI_api.h)8
-rw-r--r--intern/rigidbody/SConscript (renamed from source/blender/rigidbody/SConscript)4
-rw-r--r--intern/rigidbody/rb_bullet_api.cpp (renamed from source/blender/rigidbody/rb_bullet_api.cpp)11
-rw-r--r--intern/smoke/intern/FLUID_3D.cpp2
-rw-r--r--release/datafiles/matcaps/license.txt2
-rw-r--r--release/datafiles/matcaps/mc01.jpgbin21395 -> 20830 bytes
-rw-r--r--release/datafiles/matcaps/mc02.jpgbin40254 -> 23428 bytes
-rw-r--r--release/datafiles/matcaps/mc03.jpgbin49292 -> 17550 bytes
-rw-r--r--release/datafiles/matcaps/mc04.jpgbin46330 -> 29197 bytes
-rw-r--r--release/datafiles/matcaps/mc05.jpgbin20830 -> 25454 bytes
-rw-r--r--release/datafiles/matcaps/mc06.jpgbin59262 -> 19864 bytes
-rw-r--r--release/datafiles/matcaps/mc07.jpgbin26688 -> 59262 bytes
-rw-r--r--release/datafiles/matcaps/mc08.jpgbin44762 -> 24133 bytes
-rw-r--r--release/datafiles/matcaps/mc09.jpgbin55815 -> 31101 bytes
-rw-r--r--release/datafiles/matcaps/mc10.jpgbin24133 -> 28973 bytes
-rw-r--r--release/datafiles/matcaps/mc11.jpgbin31101 -> 21395 bytes
-rw-r--r--release/datafiles/matcaps/mc12.jpgbin52893 -> 23797 bytes
-rw-r--r--release/datafiles/matcaps/mc13.jpgbin29197 -> 45661 bytes
-rw-r--r--release/datafiles/matcaps/mc14.jpgbin25454 -> 44762 bytes
-rw-r--r--release/datafiles/matcaps/mc15.jpgbin33401 -> 27456 bytes
-rw-r--r--release/datafiles/matcaps/mc16.jpgbin27456 -> 33401 bytes
-rw-r--r--release/datafiles/matcaps/mc17.jpgbin0 -> 49292 bytes
-rw-r--r--release/datafiles/matcaps/mc18.jpgbin0 -> 40254 bytes
-rw-r--r--release/datafiles/matcaps/mc19.jpgbin0 -> 46330 bytes
-rw-r--r--release/datafiles/matcaps/mc20.jpgbin0 -> 52893 bytes
-rw-r--r--release/datafiles/matcaps/mc21.jpgbin0 -> 28717 bytes
-rw-r--r--release/datafiles/matcaps/mc22.jpgbin0 -> 33801 bytes
-rw-r--r--release/datafiles/matcaps/mc23.jpgbin0 -> 26688 bytes
-rw-r--r--release/datafiles/matcaps/mc24.jpgbin0 -> 14149 bytes
-rw-r--r--release/datafiles/preview_cycles.blendbin1325868 -> 1326220 bytes
-rw-r--r--release/datafiles/startup.blendbin414132 -> 417040 bytes
-rw-r--r--release/scripts/modules/bl_i18n_utils/bl_process_msg.py166
-rw-r--r--release/scripts/modules/bl_i18n_utils/settings.py4
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils.py10
-rw-r--r--release/scripts/modules/bpy_extras/io_utils.py5
-rw-r--r--release/scripts/modules/bpy_types.py22
-rw-r--r--release/scripts/modules/console_python.py4
-rw-r--r--release/scripts/modules/rna_prop_ui.py4
-rw-r--r--release/scripts/presets/interface_theme/back_to_black.xml38
-rw-r--r--release/scripts/presets/interface_theme/blender_24x.xml38
-rw-r--r--release/scripts/presets/interface_theme/elsyiun.xml38
-rw-r--r--release/scripts/presets/interface_theme/hexagon.xml38
-rw-r--r--release/scripts/presets/interface_theme/ubuntu_ambiance.xml38
-rw-r--r--release/scripts/startup/bl_operators/rigidbody.py4
-rw-r--r--release/scripts/startup/bl_operators/wm.py3
-rw-r--r--release/scripts/startup/bl_ui/properties_data_mesh.py14
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py3
-rw-r--r--release/scripts/startup/bl_ui/properties_mask_common.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_material.py11
-rw-r--r--release/scripts/startup/bl_ui/properties_particle.py3
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_fluid.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_render.py1
-rw-r--r--release/scripts/startup/bl_ui/properties_scene.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_texture.py4
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py11
-rw-r--r--release/scripts/startup/bl_ui/space_console.py4
-rw-r--r--release/scripts/startup/bl_ui/space_image.py4
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py20
-rw-r--r--release/scripts/startup/bl_ui/space_text.py9
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py29
-rw-r--r--release/scripts/startup/bl_ui/space_userpref_keymap.py21
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py16
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py8
-rw-r--r--release/scripts/templates_py/ui_list.py11
-rw-r--r--source/blender/CMakeLists.txt5
-rw-r--r--source/blender/SConscript7
-rw-r--r--source/blender/blenkernel/BKE_action.h3
-rw-r--r--source/blender/blenkernel/BKE_armature.h2
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_brush.h3
-rw-r--r--source/blender/blenkernel/BKE_camera.h3
-rw-r--r--source/blender/blenkernel/BKE_curve.h3
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h3
-rw-r--r--source/blender/blenkernel/BKE_group.h3
-rw-r--r--source/blender/blenkernel/BKE_image.h6
-rw-r--r--source/blender/blenkernel/BKE_lamp.h3
-rw-r--r--source/blender/blenkernel/BKE_lattice.h8
-rw-r--r--source/blender/blenkernel/BKE_library.h6
-rw-r--r--source/blender/blenkernel/BKE_mask.h2
-rw-r--r--source/blender/blenkernel/BKE_material.h2
-rw-r--r--source/blender/blenkernel/BKE_mball.h3
-rw-r--r--source/blender/blenkernel/BKE_mesh.h4
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h2
-rw-r--r--source/blender/blenkernel/BKE_node.h2
-rw-r--r--source/blender/blenkernel/BKE_object.h5
-rw-r--r--source/blender/blenkernel/BKE_particle.h2
-rw-r--r--source/blender/blenkernel/BKE_rigidbody.h1
-rw-r--r--source/blender/blenkernel/BKE_screen.h1
-rw-r--r--source/blender/blenkernel/BKE_speaker.h4
-rw-r--r--source/blender/blenkernel/BKE_text.h4
-rw-r--r--source/blender/blenkernel/BKE_texture.h3
-rw-r--r--source/blender/blenkernel/BKE_world.h3
-rw-r--r--source/blender/blenkernel/CMakeLists.txt2
-rw-r--r--source/blender/blenkernel/SConscript2
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c7
-rw-r--r--source/blender/blenkernel/intern/action.c4
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c4
-rw-r--r--source/blender/blenkernel/intern/armature.c7
-rw-r--r--source/blender/blenkernel/intern/brush.c8
-rw-r--r--source/blender/blenkernel/intern/camera.c4
-rw-r--r--source/blender/blenkernel/intern/curve.c8
-rw-r--r--source/blender/blenkernel/intern/customdata.c3
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c11
-rw-r--r--source/blender/blenkernel/intern/displist.c71
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c1
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c86
-rw-r--r--source/blender/blenkernel/intern/group.c4
-rw-r--r--source/blender/blenkernel/intern/idprop.c1
-rw-r--r--source/blender/blenkernel/intern/image.c29
-rw-r--r--source/blender/blenkernel/intern/ipo.c4
-rw-r--r--source/blender/blenkernel/intern/lamp.c4
-rw-r--r--source/blender/blenkernel/intern/lattice.c67
-rw-r--r--source/blender/blenkernel/intern/library.c11
-rw-r--r--source/blender/blenkernel/intern/mask.c8
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c4
-rw-r--r--source/blender/blenkernel/intern/material.c6
-rw-r--r--source/blender/blenkernel/intern/mball.c4
-rw-r--r--source/blender/blenkernel/intern/mesh.c22
-rw-r--r--source/blender/blenkernel/intern/movieclip.c12
-rw-r--r--source/blender/blenkernel/intern/nla.c6
-rw-r--r--source/blender/blenkernel/intern/node.c6
-rw-r--r--source/blender/blenkernel/intern/object.c41
-rw-r--r--source/blender/blenkernel/intern/paint.c3
-rw-r--r--source/blender/blenkernel/intern/particle.c6
-rw-r--r--source/blender/blenkernel/intern/pbvh_bmesh.c2
-rw-r--r--source/blender/blenkernel/intern/pointcache.c2
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c29
-rw-r--r--source/blender/blenkernel/intern/scene.c4
-rw-r--r--source/blender/blenkernel/intern/screen.c14
-rw-r--r--source/blender/blenkernel/intern/seqmodifier.c2
-rw-r--r--source/blender/blenkernel/intern/sequencer.c4
-rw-r--r--source/blender/blenkernel/intern/smoke.c19
-rw-r--r--source/blender/blenkernel/intern/speaker.c4
-rw-r--r--source/blender/blenkernel/intern/text.c6
-rw-r--r--source/blender/blenkernel/intern/texture.c3
-rw-r--r--source/blender/blenkernel/intern/tracking.c3
-rw-r--r--source/blender/blenkernel/intern/world.c3
-rw-r--r--source/blender/blenlib/BLI_math_geom.h4
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h5
-rw-r--r--source/blender/blenlib/BLI_mempool.h7
-rw-r--r--source/blender/blenlib/BLI_utildefines.h6
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c14
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c19
-rw-r--r--source/blender/blenlib/intern/math_geom.c77
-rw-r--r--source/blender/blenlib/intern/math_matrix.c10
-rw-r--r--source/blender/blenlib/intern/math_rotation.c2
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c1
-rw-r--r--source/blender/blenlib/intern/path_util.c30
-rw-r--r--source/blender/blenloader/intern/readfile.c109
-rw-r--r--source/blender/bmesh/CMakeLists.txt2
-rw-r--r--source/blender/bmesh/bmesh.h3
-rw-r--r--source/blender/bmesh/intern/bmesh_log.c16
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c10
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c5
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c6
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c242
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.h5
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c66
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_impl.c2
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c11
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c104
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c13
-rw-r--r--source/blender/bmesh/tools/bmesh_triangulate.c87
-rw-r--r--source/blender/bmesh/tools/bmesh_triangulate.h36
-rw-r--r--source/blender/collada/AnimationExporter.cpp36
-rw-r--r--source/blender/collada/ArmatureExporter.cpp6
-rw-r--r--source/blender/collada/ArmatureExporter.h2
-rw-r--r--source/blender/collada/ArmatureImporter.cpp20
-rw-r--r--source/blender/collada/CMakeLists.txt2
-rw-r--r--source/blender/collada/ControllerExporter.cpp22
-rw-r--r--source/blender/collada/DocumentImporter.cpp108
-rw-r--r--source/blender/collada/DocumentImporter.h5
-rw-r--r--source/blender/collada/GeometryExporter.cpp2
-rw-r--r--source/blender/collada/ImportSettings.cpp27
-rw-r--r--source/blender/collada/ImportSettings.h39
-rw-r--r--source/blender/collada/MeshImporter.cpp15
-rw-r--r--source/blender/collada/SceneExporter.cpp5
-rw-r--r--source/blender/collada/TransformReader.cpp7
-rw-r--r--source/blender/collada/TransformWriter.cpp2
-rw-r--r--source/blender/collada/collada.cpp13
-rw-r--r--source/blender/collada/collada.h5
-rw-r--r--source/blender/collada/collada_utils.cpp25
-rw-r--r--source/blender/collada/collada_utils.h3
-rw-r--r--source/blender/compositor/CMakeLists.txt4
-rw-r--r--source/blender/compositor/SConscript2
-rw-r--r--source/blender/compositor/nodes/COM_GroupNode.cpp4
-rw-r--r--source/blender/compositor/nodes/COM_SetAlphaNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_SocketProxyNode.cpp18
-rw-r--r--source/blender/compositor/nodes/COM_SocketProxyNode.h4
-rw-r--r--source/blender/compositor/nodes/COM_TranslateNode.cpp27
-rw-r--r--source/blender/compositor/operations/COM_DilateErodeOperation.cpp335
-rw-r--r--source/blender/compositor/operations/COM_DilateErodeOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.cpp32
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.h10
-rw-r--r--source/blender/compositor/operations/COM_WrapOperation.cpp117
-rw-r--r--source/blender/compositor/operations/COM_WrapOperation.h47
-rw-r--r--source/blender/editors/animation/anim_markers.c11
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c83
-rw-r--r--source/blender/editors/animation/keyframes_edit.c9
-rw-r--r--source/blender/editors/animation/keyframing.c2
-rw-r--r--source/blender/editors/armature/editarmature.c105
-rw-r--r--source/blender/editors/armature/poselib.c3
-rw-r--r--source/blender/editors/datafiles/CMakeLists.txt8
-rw-r--r--source/blender/editors/datafiles/SConscript8
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c1
-rw-r--r--source/blender/editors/include/ED_datafiles.h24
-rw-r--r--source/blender/editors/include/UI_icons.h8
-rw-r--r--source/blender/editors/include/UI_interface.h5
-rw-r--r--source/blender/editors/interface/interface.c19
-rw-r--r--source/blender/editors/interface/interface_anim.c17
-rw-r--r--source/blender/editors/interface/interface_draw.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c218
-rw-r--r--source/blender/editors/interface/interface_icons.c20
-rw-r--r--source/blender/editors/interface/interface_intern.h8
-rw-r--r--source/blender/editors/interface/interface_layout.c24
-rw-r--r--source/blender/editors/interface/interface_ops.c5
-rw-r--r--source/blender/editors/interface/interface_panel.c8
-rw-r--r--source/blender/editors/interface/interface_regions.c6
-rw-r--r--source/blender/editors/interface/interface_templates.c7
-rw-r--r--source/blender/editors/interface/view2d.c10
-rw-r--r--source/blender/editors/io/io_collada.c43
-rw-r--r--source/blender/editors/mask/mask_ops.c4
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c9
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c33
-rw-r--r--source/blender/editors/mesh/mesh_data.c15
-rw-r--r--source/blender/editors/mesh/mesh_ops.c2
-rw-r--r--source/blender/editors/object/object_add.c11
-rw-r--r--source/blender/editors/object/object_group.c5
-rw-r--r--source/blender/editors/object/object_relations.c2
-rw-r--r--source/blender/editors/object/object_transform.c23
-rw-r--r--source/blender/editors/physics/CMakeLists.txt2
-rw-r--r--source/blender/editors/physics/SConscript2
-rw-r--r--source/blender/editors/physics/particle_edit.c4
-rw-r--r--source/blender/editors/physics/rigidbody_constraint.c3
-rw-r--r--source/blender/editors/physics/rigidbody_object.c11
-rw-r--r--source/blender/editors/render/render_preview.c4
-rw-r--r--source/blender/editors/render/render_shading.c9
-rw-r--r--source/blender/editors/screen/screen_edit.c5
-rw-r--r--source/blender/editors/screen/screen_ops.c6
-rw-r--r--source/blender/editors/screen/screendump.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c8
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c4
-rw-r--r--source/blender/editors/space_action/action_edit.c5
-rw-r--r--source/blender/editors/space_action/action_select.c36
-rw-r--r--source/blender/editors/space_clip/clip_ops.c3
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c27
-rw-r--r--source/blender/editors/space_file/filesel.c6
-rw-r--r--source/blender/editors/space_image/image_draw.c19
-rw-r--r--source/blender/editors/space_image/image_ops.c10
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_info/info_ops.c6
-rw-r--r--source/blender/editors/space_logic/logic_window.c19
-rw-r--r--source/blender/editors/space_node/drawnode.c19
-rw-r--r--source/blender/editors/space_node/node_add.c4
-rw-r--r--source/blender/editors/space_node/node_edit.c6
-rw-r--r--source/blender/editors/space_node/node_group.c24
-rw-r--r--source/blender/editors/space_node/node_header.c2
-rw-r--r--source/blender/editors/space_node/space_node.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c12
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c10
-rw-r--r--source/blender/editors/space_text/text_ops.c6
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c62
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c39
-rw-r--r--source/blender/editors/transform/transform.c163
-rw-r--r--source/blender/editors/transform/transform.h3
-rw-r--r--source/blender/editors/transform/transform_conversions.c14
-rw-r--r--source/blender/editors/transform/transform_input.c14
-rw-r--r--source/blender/editors/util/undo.c3
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c2
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp6
-rw-r--r--source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp2
-rw-r--r--source/blender/freestyle/intern/system/PythonInterpreter.h4
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c2
-rw-r--r--source/blender/gpu/intern/gpu_material.c2
-rw-r--r--source/blender/imbuf/IMB_imbuf_types.h2
-rw-r--r--source/blender/imbuf/intern/colormanagement.c130
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp6
-rw-r--r--source/blender/imbuf/intern/thumbs.c2
-rw-r--r--source/blender/makesdna/DNA_actuator_types.h7
-rw-r--r--source/blender/makesdna/DNA_brush_types.h2
-rw-r--r--source/blender/makesdna/DNA_image_types.h2
-rw-r--r--source/blender/makesdna/DNA_node_types.h13
-rw-r--r--source/blender/makesdna/DNA_rigidbody_types.h6
-rw-r--r--source/blender/makesdna/DNA_screen_types.h6
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h3
-rw-r--r--source/blender/makesrna/RNA_define.h2
-rw-r--r--source/blender/makesrna/RNA_types.h9
-rw-r--r--source/blender/makesrna/SConscript3
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt2
-rw-r--r--source/blender/makesrna/intern/SConscript2
-rw-r--r--source/blender/makesrna/intern/makesrna.c11
-rw-r--r--source/blender/makesrna/intern/rna_access.c33
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c17
-rw-r--r--source/blender/makesrna/intern/rna_curve.c2
-rw-r--r--source/blender/makesrna/intern/rna_define.c35
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c106
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c2
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_internal.h4
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c392
-rw-r--r--source/blender/makesrna/intern/rna_material.c2
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c6
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c27
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c191
-rw-r--r--source/blender/makesrna/intern/rna_particle.c76
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c41
-rw-r--r--source/blender/makesrna/intern/rna_scene.c18
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c3
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c4
-rw-r--r--source/blender/makesrna/intern/rna_space.c21
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c216
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c6
-rw-r--r--source/blender/modifiers/intern/MOD_boolean_util.c3
-rw-r--r--source/blender/modifiers/intern/MOD_triangulate.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehimage.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channelMatte.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_gamma.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mask.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_translate.c8
-rw-r--r--source/blender/nodes/intern/node_common.c2
-rw-r--r--source/blender/nodes/shader/node_shader_util.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_gamma.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c27
-rw-r--r--source/blender/python/generic/idprop_py_api.c4
-rw-r--r--source/blender/python/intern/bpy_interface.c29
-rw-r--r--source/blender/python/intern/bpy_intern_string.c3
-rw-r--r--source/blender/python/intern/bpy_intern_string.h1
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c76
-rw-r--r--source/blender/python/intern/bpy_rna.c18
-rw-r--r--source/blender/render/intern/source/bake.c27
-rw-r--r--source/blender/render/intern/source/convertblender.c2
-rw-r--r--source/blender/render/intern/source/imagetexture.c18
-rw-r--r--source/blender/render/intern/source/pipeline.c28
-rw-r--r--source/blender/render/intern/source/pixelblending.c2
-rw-r--r--source/blender/render/intern/source/pixelshading.c2
-rw-r--r--source/blender/render/intern/source/rayshade.c8
-rw-r--r--source/blender/render/intern/source/renderdatabase.c8
-rw-r--r--source/blender/render/intern/source/strand.c4
-rw-r--r--source/blender/windowmanager/WM_api.h6
-rw-r--r--source/blender/windowmanager/WM_types.h2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c61
-rw-r--r--source/blender/windowmanager/intern/wm_files.c17
-rw-r--r--source/blender/windowmanager/intern/wm_window.c37
-rw-r--r--source/blender/windowmanager/wm_window.h7
-rw-r--r--source/blenderplayer/CMakeLists.txt2
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c1
-rw-r--r--source/creator/CMakeLists.txt4
-rw-r--r--source/creator/creator.c26
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp10
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderCanvas.h5
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp24
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp26
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp4
-rw-r--r--source/gameengine/Converter/KX_ConvertActuators.cpp3
-rw-r--r--source/gameengine/Expressions/EmptyValue.cpp28
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp8
-rw-r--r--source/gameengine/GameLogic/SCA_IInputDevice.h25
-rw-r--r--source/gameengine/GameLogic/SCA_IObject.h2
-rw-r--r--source/gameengine/GameLogic/SCA_LogicManager.h8
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp20
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RawImage.cpp1
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.cpp17
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.h3
-rw-r--r--source/gameengine/Ketsji/KX_CharacterWrapper.cpp29
-rw-r--r--source/gameengine/Ketsji/KX_CharacterWrapper.h2
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h4
-rw-r--r--source/gameengine/Ketsji/KX_IPhysicsController.h3
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.cpp41
-rw-r--r--source/gameengine/Ketsji/KX_ObjectActuator.h8
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp11
-rw-r--r--source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h4
-rw-r--r--source/gameengine/Network/NG_NetworkDeviceInterface.h18
-rw-r--r--source/gameengine/Network/NG_NetworkMessage.h4
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp73
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.h15
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp16
-rw-r--r--source/gameengine/Physics/common/PHY_ICharacter.h4
-rw-r--r--source/gameengine/Physics/common/PHY_IController.h8
-rw-r--r--source/gameengine/Physics/common/PHY_IGraphicController.h10
-rw-r--r--source/gameengine/Physics/common/PHY_IMotionState.h6
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsController.h14
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp7
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h7
-rw-r--r--source/gameengine/Rasterizer/RAS_IPolygonMaterial.h4
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h5
-rw-r--r--source/gameengine/SceneGraph/SG_ParentRelation.h4
-rw-r--r--source/gameengine/VideoTexture/VideoFFmpeg.cpp2
-rw-r--r--source/tests/batch_import.py3
560 files changed, 11615 insertions, 8099 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e623cfe290e..90fd4c33da6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -271,6 +271,9 @@ mark_as_advanced(WITH_CXX_GUARDEDALLOC)
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF)
mark_as_advanced(WITH_ASSERT_ABORT)
+option(WITH_BOOST "Enable features depending no boost" ON)
+
+
if(APPLE)
cmake_minimum_required(VERSION 2.8.8)
cmake_policy(VERSION 2.8.8)
@@ -398,9 +401,22 @@ if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
endif()
-# auto enable boost for cycles, booleans, audaspace or i18n
-if(WITH_CYCLES OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
- set(WITH_BOOST ON)
+# enable boost for cycles, booleans, audaspace or i18n
+# otherwise if the user disabled
+if(NOT WITH_BOOST)
+ # Explicitly disabled. so disable all deps.
+ set(WITH_CYCLES OFF)
+ set(WITH_MOD_BOOLEAN OFF)
+ set(WITH_AUDASPACE OFF)
+ set(WITH_INTERNATIONAL OFF)
+
+ set(WITH_OPENAL OFF) # depends on AUDASPACE
+ set(WITH_GAMEENGINE OFF) # depends on AUDASPACE
+elseif(WITH_CYCLES OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
+ # Keep enabled
+else()
+ # Enabled but we don't need it
+ set(WITH_BOOST OFF)
endif()
# auto enable llvm for cycles_osl
@@ -800,7 +816,11 @@ if(UNIX AND NOT APPLE)
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_X11_LIB}")
if(WITH_X11_XINPUT)
- set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xinput_LIB}")
+ if(X11_Xinput_LIB)
+ set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xinput_LIB}")
+ else()
+ set(WITH_X11_XINPUT OFF)
+ endif()
endif()
if(WITH_X11_XF86VMODE)
@@ -1139,11 +1159,16 @@ elseif(WIN32)
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_CYCLES_OSL)
+ set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
+ optimized libboost_wave-${BOOST_POSTFIX}
+ debug libboost_wave-${BOOST_DEBUG_POSTFIX})
+ endif()
if(WITH_INTERNATIONAL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized libboost_locale-${BOOST_POSTFIX}
debug libboost_locale-${BOOST_DEBUG_POSTFIX})
- endif(WITH_INTERNATIONAL)
+ endif()
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
@@ -1449,11 +1474,11 @@ elseif(APPLE)
# module must be compiled against Python framework
# normally cached but not since we include them with blender
- set(PYTHON_VERSION 3.2)
+ set(PYTHON_VERSION 3.3)
set(PYTHON_INCLUDE_DIR "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION}m")
set(PYTHON_BINARY "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}")
#set(PYTHON_LIBRARY python${PYTHON_VERSION})
- set(PYTHON_LIBPATH "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config-3.2m")
+ set(PYTHON_LIBPATH "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}m")
#set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python") # won't build with this enabled
endif()
@@ -2167,12 +2192,10 @@ if(FIRST_RUN)
info_cfg_option(WITH_MOD_FLUID)
info_cfg_option(WITH_MOD_OCEANSIM)
+ # debug
+ message(STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}")
+
info_cfg_text("")
message("${_config_msg}")
endif()
-
-# debug
-message(
- STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}"
-)
diff --git a/SConstruct b/SConstruct
index 70ada74cfa9..545805d4b63 100644
--- a/SConstruct
+++ b/SConstruct
@@ -592,6 +592,14 @@ data_to_c_simple("release/datafiles/matcaps/mc13.jpg")
data_to_c_simple("release/datafiles/matcaps/mc14.jpg")
data_to_c_simple("release/datafiles/matcaps/mc15.jpg")
data_to_c_simple("release/datafiles/matcaps/mc16.jpg")
+data_to_c_simple("release/datafiles/matcaps/mc17.jpg")
+data_to_c_simple("release/datafiles/matcaps/mc18.jpg")
+data_to_c_simple("release/datafiles/matcaps/mc19.jpg")
+data_to_c_simple("release/datafiles/matcaps/mc20.jpg")
+data_to_c_simple("release/datafiles/matcaps/mc21.jpg")
+data_to_c_simple("release/datafiles/matcaps/mc22.jpg")
+data_to_c_simple("release/datafiles/matcaps/mc23.jpg")
+data_to_c_simple("release/datafiles/matcaps/mc24.jpg")
##### END DATAFILES ##########
diff --git a/build_files/cmake/cmake_consistency_check_config.py b/build_files/cmake/cmake_consistency_check_config.py
index 6b82e224a32..55bad251a53 100644
--- a/build_files/cmake/cmake_consistency_check_config.py
+++ b/build_files/cmake/cmake_consistency_check_config.py
@@ -29,6 +29,22 @@ IGNORE = (
"extern/recastnavigation/Recast/Source/RecastTimer.cpp",
"intern/audaspace/SRC/AUD_SRCResampleFactory.cpp",
"intern/audaspace/SRC/AUD_SRCResampleReader.cpp",
+ "intern/cycles/render/film_response.cpp",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_2.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_3.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_4.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_2_d.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_3.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_4.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_9.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_3_d.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_3.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_4.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_2_4_d.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_2.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_3.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_4.cc",
+ "extern/libmv/third_party/ceres/internal/ceres/generated/schur_eliminator_4_4_d.cc",
"extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h",
"extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h",
@@ -47,6 +63,11 @@ IGNORE = (
"extern/recastnavigation/Recast/Include/RecastTimer.h",
"intern/audaspace/SRC/AUD_SRCResampleFactory.h",
"intern/audaspace/SRC/AUD_SRCResampleReader.h",
+ "intern/cycles/render/film_response.h",
+ "extern/carve/include/carve/config.h",
+ "extern/carve/include/carve/external/boost/random.hpp",
+ "extern/carve/patches/files/config.h",
+ "extern/carve/patches/files/random.hpp",
)
UTF8_CHECK = True
diff --git a/build_files/cmake/config/blender_headless.cmake b/build_files/cmake/config/blender_headless.cmake
index c4d64125744..cfde86aac6d 100644
--- a/build_files/cmake/config/blender_headless.cmake
+++ b/build_files/cmake/config/blender_headless.cmake
@@ -5,19 +5,19 @@
# cmake -C../blender/build_files/cmake/config/blender_headless.cmake ../blender
#
-set(WITH_HEADLESS ON CACHE FORCE BOOL)
-set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
+set(WITH_HEADLESS ON CACHE BOOL "" FORCE)
+set(WITH_GAMEENGINE OFF CACHE BOOL "" FORCE)
# disable audio, its possible some devs may want this but for now disable
# so the python module doesnt hold the audio device and loads quickly.
-set(WITH_AUDASPACE OFF CACHE FORCE BOOL)
-set(WITH_FFTW3 OFF CACHE FORCE BOOL)
-set(WITH_JACK OFF CACHE FORCE BOOL)
-set(WITH_SDL OFF CACHE FORCE BOOL)
-set(WITH_OPENAL OFF CACHE FORCE BOOL)
-set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
-set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
+set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)
+set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
+set(WITH_JACK OFF CACHE BOOL "" FORCE)
+set(WITH_SDL OFF CACHE BOOL "" FORCE)
+set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
+set(WITH_CODEC_FFMPEG OFF CACHE BOOL "" FORCE)
+set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
# other features which are not especially useful as a python module
-set(WITH_X11_XINPUT OFF CACHE FORCE BOOL)
-set(WITH_INPUT_NDOF OFF CACHE FORCE BOOL)
+set(WITH_X11_XINPUT OFF CACHE BOOL "" FORCE)
+set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake
index e74d1adcb1b..f7778ac214d 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -5,47 +5,47 @@
# cmake -C../blender/build_files/cmake/config/blender_lite.cmake ../blender
#
-set(WITH_INSTALL_PORTABLE ON CACHE FORCE BOOL)
-set(WITH_SYSTEM_GLEW ON CACHE FORCE BOOL)
+set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
+set(WITH_SYSTEM_GLEW ON CACHE BOOL "" FORCE)
-set(WITH_BUILDINFO OFF CACHE FORCE BOOL)
-set(WITH_BULLET OFF CACHE FORCE BOOL)
-set(WITH_CODEC_AVI OFF CACHE FORCE BOOL)
-set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
-set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
-set(WITH_CYCLES OFF CACHE FORCE BOOL)
-set(WITH_FFTW3 OFF CACHE FORCE BOOL)
-set(WITH_LIBMV OFF CACHE FORCE BOOL)
-set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
-set(WITH_COMPOSITOR OFF CACHE FORCE BOOL)
-set(WITH_GHOST_XDND OFF CACHE FORCE BOOL)
-set(WITH_IK_SOLVER OFF CACHE FORCE BOOL)
-set(WITH_IK_ITASC OFF CACHE FORCE BOOL)
-set(WITH_IMAGE_CINEON OFF CACHE FORCE BOOL)
-set(WITH_IMAGE_DDS OFF CACHE FORCE BOOL)
-set(WITH_IMAGE_FRAMESERVER OFF CACHE FORCE BOOL)
-set(WITH_IMAGE_HDR OFF CACHE FORCE BOOL)
-set(WITH_IMAGE_OPENEXR OFF CACHE FORCE BOOL)
-set(WITH_IMAGE_OPENJPEG OFF CACHE FORCE BOOL)
-set(WITH_IMAGE_REDCODE OFF CACHE FORCE BOOL)
-set(WITH_IMAGE_TIFF OFF CACHE FORCE BOOL)
-set(WITH_INPUT_NDOF OFF CACHE FORCE BOOL)
-set(WITH_INTERNATIONAL OFF CACHE FORCE BOOL)
-set(WITH_JACK OFF CACHE FORCE BOOL)
-set(WITH_LZMA OFF CACHE FORCE BOOL)
-set(WITH_LZO OFF CACHE FORCE BOOL)
-set(WITH_MOD_BOOLEAN OFF CACHE FORCE BOOL)
-set(WITH_MOD_FLUID OFF CACHE FORCE BOOL)
-set(WITH_MOD_REMESH OFF CACHE FORCE BOOL)
-set(WITH_MOD_SMOKE OFF CACHE FORCE BOOL)
-set(WITH_MOD_OCEANSIM OFF CACHE FORCE BOOL)
-set(WITH_AUDASPACE OFF CACHE FORCE BOOL)
-set(WITH_OPENAL OFF CACHE FORCE BOOL)
-set(WITH_OPENCOLLADA OFF CACHE FORCE BOOL)
-set(WITH_OPENCOLORIO OFF CACHE FORCE BOOL)
-set(WITH_OPENMP OFF CACHE FORCE BOOL)
-set(WITH_PYTHON_INSTALL OFF CACHE FORCE BOOL)
-set(WITH_RAYOPTIMIZATION OFF CACHE FORCE BOOL)
-set(WITH_SDL OFF CACHE FORCE BOOL)
-set(WITH_X11_XINPUT OFF CACHE FORCE BOOL)
-set(WITH_X11_XF86VMODE OFF CACHE FORCE BOOL)
+set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
+set(WITH_BULLET OFF CACHE BOOL "" FORCE)
+set(WITH_CODEC_AVI OFF CACHE BOOL "" FORCE)
+set(WITH_CODEC_FFMPEG OFF CACHE BOOL "" FORCE)
+set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
+set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
+set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
+set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
+set(WITH_GAMEENGINE OFF CACHE BOOL "" FORCE)
+set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
+set(WITH_GHOST_XDND OFF CACHE BOOL "" FORCE)
+set(WITH_IK_SOLVER OFF CACHE BOOL "" FORCE)
+set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE)
+set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE)
+set(WITH_IMAGE_DDS OFF CACHE BOOL "" FORCE)
+set(WITH_IMAGE_FRAMESERVER OFF CACHE BOOL "" FORCE)
+set(WITH_IMAGE_HDR OFF CACHE BOOL "" FORCE)
+set(WITH_IMAGE_OPENEXR OFF CACHE BOOL "" FORCE)
+set(WITH_IMAGE_OPENJPEG OFF CACHE BOOL "" FORCE)
+set(WITH_IMAGE_REDCODE OFF CACHE BOOL "" FORCE)
+set(WITH_IMAGE_TIFF OFF CACHE BOOL "" FORCE)
+set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
+set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
+set(WITH_JACK OFF CACHE BOOL "" FORCE)
+set(WITH_LZMA OFF CACHE BOOL "" FORCE)
+set(WITH_LZO OFF CACHE BOOL "" FORCE)
+set(WITH_MOD_BOOLEAN OFF CACHE BOOL "" FORCE)
+set(WITH_MOD_FLUID OFF CACHE BOOL "" FORCE)
+set(WITH_MOD_REMESH OFF CACHE BOOL "" FORCE)
+set(WITH_MOD_SMOKE OFF CACHE BOOL "" FORCE)
+set(WITH_MOD_OCEANSIM OFF CACHE BOOL "" FORCE)
+set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)
+set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
+set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
+set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
+set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
+set(WITH_PYTHON_INSTALL OFF CACHE BOOL "" FORCE)
+set(WITH_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE)
+set(WITH_SDL OFF CACHE BOOL "" FORCE)
+set(WITH_X11_XINPUT OFF CACHE BOOL "" FORCE)
+set(WITH_X11_XF86VMODE OFF CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/bpy_module.cmake b/build_files/cmake/config/bpy_module.cmake
index 6279f06214f..b5b13b40987 100644
--- a/build_files/cmake/config/bpy_module.cmake
+++ b/build_files/cmake/config/bpy_module.cmake
@@ -4,30 +4,30 @@
# cmake -C../blender/build_files/cmake/config/bpy_module.cmake ../blender
#
-set(WITH_PYTHON_MODULE ON CACHE FORCE BOOL)
+set(WITH_PYTHON_MODULE ON CACHE BOOL "" FORCE)
# install into the systems python dir
-set(WITH_INSTALL_PORTABLE OFF CACHE FORCE BOOL)
+set(WITH_INSTALL_PORTABLE OFF CACHE BOOL "" FORCE)
# no point int copying python into python
-set(WITH_PYTHON_INSTALL OFF CACHE FORCE BOOL)
+set(WITH_PYTHON_INSTALL OFF CACHE BOOL "" FORCE)
# dont build the game engine
-set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
+set(WITH_GAMEENGINE OFF CACHE BOOL "" FORCE)
# disable audio, its possible some devs may want this but for now disable
# so the python module doesnt hold the audio device and loads quickly.
-set(WITH_AUDASPACE OFF CACHE FORCE BOOL)
-set(WITH_FFTW3 OFF CACHE FORCE BOOL)
-set(WITH_JACK OFF CACHE FORCE BOOL)
-set(WITH_SDL OFF CACHE FORCE BOOL)
-set(WITH_OPENAL OFF CACHE FORCE BOOL)
-set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
-set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
+set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)
+set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
+set(WITH_JACK OFF CACHE BOOL "" FORCE)
+set(WITH_SDL OFF CACHE BOOL "" FORCE)
+set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
+set(WITH_CODEC_FFMPEG OFF CACHE BOOL "" FORCE)
+set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
# other features which are not especially useful as a python module
-set(WITH_X11_XINPUT OFF CACHE FORCE BOOL)
-set(WITH_INPUT_NDOF OFF CACHE FORCE BOOL)
-set(WITH_OPENCOLLADA OFF CACHE FORCE BOOL)
-set(WITH_INTERNATIONAL OFF CACHE FORCE BOOL)
-set(WITH_BULLET OFF CACHE FORCE BOOL)
+set(WITH_X11_XINPUT OFF CACHE BOOL "" FORCE)
+set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
+set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
+set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
+set(WITH_BULLET OFF CACHE BOOL "" FORCE)
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py
index ee1b7bfa38c..f662ec4d2d1 100644
--- a/build_files/scons/config/darwin-config.py
+++ b/build_files/scons/config/darwin-config.py
@@ -137,7 +137,7 @@ else:
BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
#BF_PYTHON_LIB = ''
- BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
+ BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-${BF_PYTHON_VERSION}m'
WITH_BF_OPENAL = True
#different lib must be used following version of gcc
diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py
index 33f01616579..ef938ff3337 100644
--- a/build_files/scons/config/win64-vc-config.py
+++ b/build_files/scons/config/win64-vc-config.py
@@ -178,7 +178,7 @@ WITH_BF_STATICOCIO = True
WITH_BF_BOOST = True
BF_BOOST = '${LIBDIR}/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
-BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49'
+BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49 libboost_wave-vc90-mt-s-1_49'
BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc90-mt-s-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index eac26c1a50b..cfcdecac8e7 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -29,6 +29,7 @@ from SCons.Script.SConscript import SConsEnvironment
import SCons.Action
import SCons.Util
import SCons.Builder
+import SCons.Subst
import SCons.Tool
import bcolors
bc = bcolors.bcolors()
@@ -234,10 +235,6 @@ def setup_staticlibs(lenv):
if lenv['WITH_BF_STATICLLVM']:
statlibs += Split(lenv['BF_LLVM_LIB_STATIC'])
- # setting this last so any overriding of manually libs could be handled
- if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'):
- libincs.append('/usr/lib')
-
if lenv['WITH_BF_JEMALLOC']:
libincs += Split(lenv['BF_JEMALLOC_LIBPATH'])
if lenv['WITH_BF_STATICJEMALLOC']:
@@ -249,6 +246,12 @@ def setup_staticlibs(lenv):
if lenv['WITH_BF_STATIC3DMOUSE']:
statlibs += Split(lenv['BF_3DMOUSE_LIB_STATIC'])
+ # setting this last so any overriding of manually libs could be handled
+ if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'):
+ # We must remove any previous items defining this path, for same reason stated above!
+ libincs = [e for e in libincs if SCons.Subst.scons_subst(e, lenv, gvars=lenv.Dictionary()) != "/usr/lib"]
+ libincs.append('/usr/lib')
+
return statlibs, libincs
def setup_syslibs(lenv):
diff --git a/doc/python_api/examples/bpy.types.UIList.py b/doc/python_api/examples/bpy.types.UIList.py
index a37bbff726a..0f4ae0703cc 100644
--- a/doc/python_api/examples/bpy.types.UIList.py
+++ b/doc/python_api/examples/bpy.types.UIList.py
@@ -31,7 +31,8 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList):
# You should always start your row layout by a label (icon + text), this will also make the row easily
# selectable in the list!
# We use icon_value of label, as our given icon is an integer value, not an enum ID.
- layout.label(ma.name if ma else "", icon_value=icon)
+ # Note "data" names should never be translated!
+ layout.label(text=ma.name if ma else "", translate=False, icon_value=icon)
# And now we can add other UI stuff...
# Here, we add nodes info if this material uses (old!) shading nodes.
if ma and not context.scene.render.use_shading_nodes:
@@ -39,15 +40,15 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList):
if manode:
# The static method UILayout.icon returns the integer value of the icon ID "computed" for the given
# RNA object.
- layout.label("Node %s" % manode.name, icon_value=layout.icon(manode))
+ layout.label(text="Node %s" % manode.name, translate=False, icon_value=layout.icon(manode))
elif ma.use_nodes:
- layout.label("Node <none>")
+ layout.label(text="Node <none>", translate=False)
else:
- layout.label("")
+ layout.label(text="")
# 'GRID' layout type should be as compact as possible (typically a single icon!).
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
- layout.label("", icon_value=icon)
+ layout.label(text="", icon_value=icon)
# And now we can use this list everywhere in Blender. Here is a small example panel.
diff --git a/doc/python_api/rst/bge.types.rst b/doc/python_api/rst/bge.types.rst
index 1e2632b9ada..f24cc3f998c 100644
--- a/doc/python_api/rst/bge.types.rst
+++ b/doc/python_api/rst/bge.types.rst
@@ -31,5381 +31,8 @@ a :class:`SCA_PythonController` logic brick.
Types
*****
-.. class:: PyObjectPlus
+.. toctree::
+ :glob:
- PyObjectPlus base class of most other types in the Game Engine.
+ bge.types.*
- .. attribute:: invalid
-
- Test if the object has been freed by the game engine and is no longer valid.
-
- Normally this is not a problem but when storing game engine data in the GameLogic module,
- KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data.
- Calling an attribute or method on an invalid object will raise a SystemError.
-
- The invalid attribute allows testing for this case without exception handling.
-
- :type: boolean
-
-.. class:: CValue(PyObjectPlus)
-
- This class is a basis for other classes.
-
- .. attribute:: name
-
- The name of this CValue derived object (read-only).
-
- :type: string
-
-.. class:: CPropValue(CValue)
-
- This class has no python functions
-
-.. class:: SCA_ILogicBrick(CValue)
-
- Base class for all logic bricks.
-
- .. attribute:: executePriority
-
- This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first).
-
- :type: executePriority: int
-
- .. attribute:: owner
-
- The game object this logic brick is attached to (read-only).
-
- :type: :class:`KX_GameObject` or None in exceptional cases.
-
- .. attribute:: name
-
- The name of this logic brick (read-only).
-
- :type: string
-
-.. class:: SCA_PythonKeyboard(PyObjectPlus)
-
- The current keyboard.
-
- .. attribute:: events
-
- A dictionary containing the status of each keyboard event or key. (read-only).
-
- :type: dictionary {:ref:`keycode<keyboard-keys>`::ref:`status<input-status>`, ...}
-
- .. attribute:: active_events
-
- A dictionary containing the status of only the active keyboard events or keys. (read-only).
-
- :type: dictionary {:ref:`keycode<keyboard-keys>`::ref:`status<input-status>`, ...}
-
-
- .. function:: getClipboard()
-
- Gets the clipboard text.
-
- :rtype: string
-
- .. function:: setClipboard(text)
-
- Sets the clipboard text.
-
- :arg text: New clipboard text
- :type text: string
-
-.. class:: SCA_PythonMouse(PyObjectPlus)
-
- The current mouse.
-
- .. attribute:: events
-
- a dictionary containing the status of each mouse event. (read-only).
-
- :type: dictionary {:ref:`keycode<mouse-keys>`::ref:`status<input-status>`, ...}
-
- .. attribute:: active_events
-
- a dictionary containing the status of only the active mouse events. (read-only).
-
- :type: dictionary {:ref:`keycode<mouse-keys>`::ref:`status<input-status>`, ...}
-
- .. attribute:: position
-
- The normalized x and y position of the mouse cursor.
-
- :type: list [x, y]
-
- .. attribute:: visible
-
- The visibility of the mouse cursor.
-
- :type: boolean
-
-.. class:: SCA_PythonJoystick(PyObjectPlus)
-
- A Python interface to a joystick.
-
- .. attribute:: name
-
- The name assigned to the joystick by the operating system. (read-only)
-
- :type: string
-
- .. attribute:: activeButtons
-
- A list of active button values. (read-only)
-
- :type: list
-
- .. attribute:: axisValues
-
- The state of the joysticks axis as a list of values :data:`numAxis` long. (read-only).
-
- :type: list of ints.
-
- Each specifying the value of an axis between -1.0 and 1.0 depending on how far the axis is pushed, 0 for nothing.
- The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
-
- * left:[-1.0, 0.0, ...]
- * right:[1.0, 0.0, ...]
- * up:[0.0, -1.0, ...]
- * down:[0.0, 1.0, ...]
-
- .. attribute:: hatValues
-
- The state of the joysticks hats as a list of values :data:`numHats` long. (read-only).
-
- :type: list of ints
-
- Each specifying the direction of the hat from 1 to 12, 0 when inactive.
-
- Hat directions are as follows...
-
- * 0:None
- * 1:Up
- * 2:Right
- * 4:Down
- * 8:Left
- * 3:Up - Right
- * 6:Down - Right
- * 12:Down - Left
- * 9:Up - Left
-
- .. attribute:: numAxis
-
- The number of axes for the joystick at this index. (read-only).
-
- :type: integer
-
- .. attribute:: numButtons
-
- The number of buttons for the joystick at this index. (read-only).
-
- :type: integer
-
- .. attribute:: numHats
-
- The number of hats for the joystick at this index. (read-only).
-
- :type: integer
-
-.. class:: SCA_IObject(CValue)
-
- This class has no python functions
-
-.. class:: SCA_ISensor(SCA_ILogicBrick)
-
- Base class for all sensor logic bricks.
-
- .. attribute:: usePosPulseMode
-
- Flag to turn positive pulse mode on and off.
-
- :type: boolean
-
- .. attribute:: useNegPulseMode
-
- Flag to turn negative pulse mode on and off.
-
- :type: boolean
-
- .. attribute:: frequency
-
- The frequency for pulse mode sensors.
-
- :type: integer
-
- .. attribute:: level
-
- level Option whether to detect level or edge transition when entering a state.
- It makes a difference only in case of logic state transition (state actuator).
- A level detector will immediately generate a pulse, negative or positive
- depending on the sensor condition, as soon as the state is activated.
- A edge detector will wait for a state change before generating a pulse.
- note: mutually exclusive with :data:`tap`, enabling will disable :data:`tap`.
-
- :type: boolean
-
- .. attribute:: tap
-
- When enabled only sensors that are just activated will send a positive event,
- after this they will be detected as negative by the controllers.
- This will make a key thats held act as if its only tapped for an instant.
- note: mutually exclusive with :data:`level`, enabling will disable :data:`level`.
-
- :type: boolean
-
- .. attribute:: invert
-
- Flag to set if this sensor activates on positive or negative events.
-
- :type: boolean
-
- .. attribute:: triggered
-
- True if this sensor brick is in a positive state. (read-only).
-
- :type: boolean
-
- .. attribute:: positive
-
- True if this sensor brick is in a positive state. (read-only).
-
- :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>`.
-
- :type: int
-
- .. note::
-
- This convenient attribute combines the values of triggered and positive attributes.
-
- .. method:: reset()
-
- Reset sensor internal state, effect depends on the type of sensor and settings.
-
- The sensor is put in its initial state as if it was just activated.
-
-.. class:: SCA_IController(SCA_ILogicBrick)
-
- Base class for all controller logic bricks.
-
- .. attribute:: state
-
- The controllers state bitmask. This can be used with the GameObject's state to test if the controller is active.
-
- :type: int bitmask
-
- .. attribute:: sensors
-
- A list of sensors linked to this controller.
-
- :type: sequence supporting index/string lookups and iteration.
-
- .. note::
-
- The sensors are not necessarily owned by the same object.
-
- .. note::
-
- When objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
-
- .. attribute:: actuators
-
- A list of actuators linked to this controller.
-
- :type: sequence supporting index/string lookups and iteration.
-
- .. note::
-
- The sensors are not necessarily owned by the same object.
-
- .. note::
-
- When objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
-
- .. attribute:: useHighPriority
-
- When set the controller executes always before all other controllers that dont have this set.
-
- :type: boolen
-
- .. note::
-
- Order of execution between high priority controllers is not guaranteed.
-
-.. class:: SCA_IActuator(SCA_ILogicBrick)
-
- Base class for all actuator logic bricks.
-
-.. class:: BL_ActionActuator(SCA_IActuator)
-
- Action Actuators apply an action to an actor.
-
- .. attribute:: action
-
- The name of the action to set as the current action.
-
- :type: string
-
- .. attribute:: frameStart
-
- Specifies the starting frame of the animation.
-
- :type: float
-
- .. attribute:: frameEnd
-
- Specifies the ending frame of the animation.
-
- :type: float
-
- .. attribute:: blendIn
-
- Specifies the number of frames of animation to generate when making transitions between actions.
-
- :type: float
-
- .. attribute:: priority
-
- Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers.
-
- :type: integer
-
- .. attribute:: frame
-
- Sets the current frame for the animation.
-
- :type: float
-
- .. attribute:: propName
-
- Sets the property to be used in FromProp playback mode.
-
- :type: string
-
- .. attribute:: blendTime
-
- Sets the internal frame timer. This property must be in the range from 0.0 to blendIn.
-
- :type: float
-
- .. attribute:: mode
-
- The operation mode of the actuator. Can be one of :ref:`these constants<action-actuator>`.
-
- :type: integer
-
- .. attribute:: useContinue
-
- The actions continue option, True or False. When True, the action will always play from where last left off,
- otherwise negative events to this actuator will reset it to its start frame.
-
- :type: boolean
-
- .. attribute:: framePropName
-
- The name of the property that is set to the current frame number.
-
- :type: string
-
-.. class:: BL_Shader(PyObjectPlus)
-
- BL_Shader GLSL shaders.
-
- TODO - Description
-
- .. method:: setUniformfv(name, fList)
-
- Set a uniform with a list of float values
-
- :arg name: the uniform name
- :type name: string
- :arg fList: a list (2, 3 or 4 elements) of float values
- :type fList: list[float]
-
- .. method:: delSource()
-
- Clear the shader. Use this method before the source is changed with :data:`setSource`.
-
- .. method:: getFragmentProg()
-
- Returns the fragment program.
-
- :return: The fragment program.
- :rtype: string
-
- .. method:: getVertexProg()
-
- Get the vertex program.
-
- :return: The vertex program.
- :rtype: string
-
- .. method:: isValid()
-
- Check if the shader is valid.
-
- :return: True if the shader is valid
- :rtype: boolean
-
- .. method:: setAttrib(enum)
-
- Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.)
-
- :arg enum: attribute location value
- :type enum: integer
-
- .. method:: setNumberOfPasses( max_pass )
-
- Set the maximum number of passes. Not used a.t.m.
-
- :arg max_pass: the maximum number of passes
- :type max_pass: integer
-
- .. method:: setSampler(name, index)
-
- Set uniform texture sample index.
-
- :arg name: Uniform name
- :type name: string
- :arg index: Texture sample index.
- :type index: integer
-
- .. method:: setSource(vertexProgram, fragmentProgram)
-
- Set the vertex and fragment programs
-
- :arg vertexProgram: Vertex program
- :type vertexProgram: string
- :arg fragmentProgram: Fragment program
- :type fragmentProgram: string
-
- .. method:: setUniform1f(name, fx)
-
- Set a uniform with 1 float value.
-
- :arg name: the uniform name
- :type name: string
- :arg fx: Uniform value
- :type fx: float
-
- .. method:: setUniform1i(name, ix)
-
- Set a uniform with an integer value.
-
- :arg name: the uniform name
- :type name: string
- :arg ix: the uniform value
- :type ix: integer
-
- .. method:: setUniform2f(name, fx, fy)
-
- Set a uniform with 2 float values
-
- :arg name: the uniform name
- :type name: string
- :arg fx: first float value
- :type fx: float
-
- :arg fy: second float value
- :type fy: float
-
- .. method:: setUniform2i(name, ix, iy)
-
- Set a uniform with 2 integer values
-
- :arg name: the uniform name
- :type name: string
- :arg ix: first integer value
- :type ix: integer
- :arg iy: second integer value
- :type iy: integer
-
- .. method:: setUniform3f(name, fx, fy, fz)
-
- Set a uniform with 3 float values.
-
- :arg name: the uniform name
- :type name: string
- :arg fx: first float value
- :type fx: float
- :arg fy: second float value
- :type fy: float
- :arg fz: third float value
- :type fz: float
-
- .. method:: setUniform3i(name, ix, iy, iz)
-
- Set a uniform with 3 integer values
-
- :arg name: the uniform name
- :type name: string
- :arg ix: first integer value
- :type ix: integer
- :arg iy: second integer value
- :type iy: integer
- :arg iz: third integer value
- :type iz: integer
-
- .. method:: setUniform4f(name, fx, fy, fz, fw)
-
- Set a uniform with 4 float values.
-
- :arg name: the uniform name
- :type name: string
- :arg fx: first float value
- :type fx: float
- :arg fy: second float value
- :type fy: float
- :arg fz: third float value
- :type fz: float
- :arg fw: fourth float value
- :type fw: float
-
- .. method:: setUniform4i(name, ix, iy, iz, iw)
-
- Set a uniform with 4 integer values
-
- :arg name: the uniform name
- :type name: string
- :arg ix: first integer value
- :type ix: integer
- :arg iy: second integer value
- :type iy: integer
- :arg iz: third integer value
- :type iz: integer
- :arg iw: fourth integer value
- :type iw: integer
-
- .. method:: setUniformDef(name, type)
-
- Define a new uniform
-
- :arg name: the uniform name
- :type name: string
- :arg type: uniform type
- :type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX
-
- .. method:: setUniformMatrix3(name, mat, transpose)
-
- Set a uniform with a 3x3 matrix value
-
- :arg name: the uniform name
- :type name: string
- :arg mat: A 3x3 matrix [[f, f, f], [f, f, f], [f, f, f]]
- :type mat: 3x3 matrix
- :arg transpose: set to True to transpose the matrix
- :type transpose: boolean
-
- .. method:: setUniformMatrix4(name, mat, transpose)
-
- Set a uniform with a 4x4 matrix value
-
- :arg name: the uniform name
- :type name: string
- :arg mat: A 4x4 matrix [[f, f, f, f], [f, f, f, f], [f, f, f, f], [f, f, f, f]]
- :type mat: 4x4 matrix
- :arg transpose: set to True to transpose the matrix
- :type transpose: boolean
-
- .. method:: setUniformiv(name, iList)
-
- Set a uniform with a list of integer values
-
- :arg name: the uniform name
- :type name: string
- :arg iList: a list (2, 3 or 4 elements) of integer values
- :type iList: list[integer]
-
- .. method:: validate()
-
- Validate the shader object.
-
-.. class:: BL_ShapeActionActuator(SCA_IActuator)
-
- ShapeAction Actuators apply an shape action to an mesh object.
-
- .. attribute:: action
-
- The name of the action to set as the current shape action.
-
- :type: string
-
- .. attribute:: frameStart
-
- Specifies the starting frame of the shape animation.
-
- :type: float
-
- .. attribute:: frameEnd
-
- Specifies the ending frame of the shape animation.
-
- :type: float
-
- .. attribute:: blendIn
-
- Specifies the number of frames of animation to generate when making transitions between actions.
-
- :type: float
-
- .. attribute:: priority
-
- Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers.
-
- :type: integer
-
- .. attribute:: frame
-
- Sets the current frame for the animation.
-
- :type: float
-
- .. attribute:: propName
-
- Sets the property to be used in FromProp playback mode.
-
- :type: string
-
- .. attribute:: blendTime
-
- Sets the internal frame timer. This property must be in the range from 0.0 to blendin.
-
- :type: float
-
- .. attribute:: mode
-
- The operation mode of the actuator. Can be one of :ref:`these constants<shape-action-actuator>`.
-
- :type: integer
-
- .. attribute:: framePropName
-
- The name of the property that is set to the current frame number.
-
- :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.
-
- As well as the normal index lookup (``val= clist[i]``), CListValue supports string lookups (``val= scene.objects["Cube"]``)
-
- Other operations such as ``len(clist)``, ``list(clist)``, ``clist[0:10]`` are also supported.
-
- .. method:: append(val)
-
- Add an item to the list (like pythons append)
-
- .. warning::
-
- Appending values to the list can cause crashes when the list is used internally by the game engine.
-
- .. method:: count(val)
-
- Count the number of instances of a value in the list.
-
- :return: number of instances
- :rtype: integer
-
- .. method:: index(val)
-
- Return the index of a value in the list.
-
- :return: The index of the value in the list.
- :rtype: integer
-
- .. method:: reverse()
-
- Reverse the order of the list.
-
- .. method:: get(key, default=None)
-
- Return the value matching key, or the default value if its not found.
-
- :return: The key value or a default.
-
- .. method:: from_id(id)
-
- This is a funtion especially for the game engine to return a value with a spesific id.
-
- Since object names are not always unique, the id of an object can be used to get an object from the CValueList.
-
- Example:
-
- .. code-block:: python
-
- myObID=id(gameObject)
- ob= scene.objects.from_id(myObID)
-
- Where ``myObID`` is an int or long from the id function.
-
- This has the advantage that you can store the id in places you could not store a gameObject.
-
- .. warning::
-
- The id is derived from a memory location and will be different each time the game engine starts.
-
- .. warning::
-
- The id can't be stored as an integer in game object properties, as those only have a limited range that the id may not be contained in. Instead an id can be stored as a string game property and converted back to an integer for use in from_id lookups.
-
-.. class:: KX_BlenderMaterial(PyObjectPlus)
-
- 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.
-
- :return: the material's shader
- :rtype: :class:`BL_Shader`
-
- .. method:: setBlending(src, dest)
-
- Set the pixel color arithmetic functions.
-
- :arg src: Specifies how the red, green, blue, and alpha source blending factors are computed.
- :type src: Value in...
-
- * GL_ZERO,
- * GL_ONE,
- * GL_SRC_COLOR,
- * GL_ONE_MINUS_SRC_COLOR,
- * GL_DST_COLOR,
- * GL_ONE_MINUS_DST_COLOR,
- * GL_SRC_ALPHA,
- * GL_ONE_MINUS_SRC_ALPHA,
- * GL_DST_ALPHA,
- * GL_ONE_MINUS_DST_ALPHA,
- * GL_SRC_ALPHA_SATURATE
-
- :arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed.
- :type dest: Value in...
-
- * GL_ZERO
- * GL_ONE
- * GL_SRC_COLOR
- * GL_ONE_MINUS_SRC_COLOR
- * GL_DST_COLOR
- * GL_ONE_MINUS_DST_COLOR
- * GL_SRC_ALPHA
- * GL_ONE_MINUS_SRC_ALPHA
- * GL_DST_ALPHA
- * GL_ONE_MINUS_DST_ALPHA
- * GL_SRC_ALPHA_SATURATE
-
- .. method:: getMaterialIndex()
-
- Returns the material's index.
-
- :return: the material's index
- :rtype: integer
-
-.. class:: KX_CameraActuator(SCA_IActuator)
-
- Applies changes to a camera.
-
- .. attribute:: damping
-
- 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.
-
- :type: float
-
- .. attribute:: max
-
- maximum distance to stay from the target object.
-
- :type: float
-
- .. attribute:: height
-
- height to stay above the target object.
-
- :type: float
-
- .. attribute:: object
-
- the object this actuator tracks.
-
- :type: :class:`KX_GameObject` or None
-
-.. class:: KX_ConstraintActuator(SCA_IActuator)
-
- A constraint actuator limits the position, rotation, distance or orientation of an object.
-
- .. attribute:: damp
-
- Time constant of the constraint expressed in frame (not use by Force field constraint).
-
- :type: integer
-
- .. attribute:: rotDamp
-
- Time constant for the rotation expressed in frame (only for the distance constraint), 0 = use damp for rotation as well.
-
- :type: integer
-
- .. attribute:: direction
-
- The reference direction in world coordinate for the orientation constraint.
-
- :type: 3-tuple of float: (x, y, z)
-
- .. attribute:: option
-
- Binary combination of :ref:`these constants <constraint-actuator-option>`
-
- :type: integer
-
- .. attribute:: time
-
- activation time of the actuator. The actuator disables itself after this many frame. If set to 0, the actuator is not limited in time.
-
- :type: integer
-
- .. attribute:: propName
-
- the name of the property or material for the ray detection of the distance constraint.
-
- :type: string
-
- .. attribute:: min
-
- The lower bound of the constraint. For the rotation and orientation constraint, it represents radiant.
-
- :type: float
-
- .. attribute:: distance
-
- the target distance of the distance constraint.
-
- :type: float
-
- .. attribute:: max
-
- the upper bound of the constraint. For rotation and orientation constraints, it represents radiant.
-
- :type: float
-
- .. attribute:: rayLength
-
- the length of the ray of the distance constraint.
-
- :type: float
-
- .. attribute:: limit
-
- type of constraint. Use one of the :ref:`these constants <constraint-actuator-limit>`
-
- :type: integer.
-
-
-.. class:: KX_ConstraintWrapper(PyObjectPlus)
-
- KX_ConstraintWrapper
-
- .. method:: getConstraintId(val)
-
- Returns the contraint's ID
-
- :return: the constraint's ID
- :rtype: integer
-
-.. class:: KX_GameActuator(SCA_IActuator)
-
- The game actuator loads a new .blend file, restarts the current .blend file or quits the game.
-
- .. attribute:: fileName
-
- the new .blend file to load.
-
- :type: string
-
- .. attribute:: mode
-
- The mode of this actuator. Can be on of :ref:`these constants <game-actuator>`
-
- :type: Int
-
-.. class:: KX_GameObject(SCA_IObject)
-
- All game objects are derived from this class.
-
- Properties assigned to game objects are accessible as attributes of this class.
-
- .. note::
-
- Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError,
- if an object may have been removed since last accessing it use the :data:`invalid` attribute to check.
-
- KX_GameObject can be subclassed to extend functionality. For example:
-
- .. code-block:: python
-
- import bge
-
- class CustomGameObject(bge.types.KX_GameObject):
- RATE = 0.05
-
- def __init__(self, old_owner):
- # "old_owner" can just be ignored. At this point, "self" is
- # already the object in the scene, and "old_owner" has been
- # destroyed.
-
- # New attributes can be defined - but we could also use a game
- # property, like "self['rate']".
- self.rate = CustomGameObject.RATE
-
- def update(self):
- self.worldPosition.z += self.rate
-
- # switch direction
- if self.worldPosition.z > 1.0:
- self.rate = -CustomGameObject.RATE
- elif self.worldPosition.z < 0.0:
- self.rate = CustomGameObject.RATE
-
- # Called first
- def mutate(cont):
- old_object = cont.owner
- mutated_object = CustomGameObject(cont.owner)
-
- # After calling the constructor above, references to the old object
- # should not be used.
- assert(old_object is not mutated_object)
- assert(old_object.invalid)
- assert(mutated_object is cont.owner)
-
- # Called later - note we are now working with the mutated object.
- def update(cont):
- cont.owner.update()
-
- When subclassing objects other than empties and meshes, the specific type
- should be used - e.g. inherit from :class:`BL_ArmatureObject` when the object
- to mutate is an armature.
-
- .. attribute:: name
-
- The object's name. (read-only).
-
- :type: string
-
- .. attribute:: mass
-
- The object's mass
-
- :type: float
-
- .. note::
-
- The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0.
-
- .. attribute:: linVelocityMin
-
- Enforces the object keeps moving at a minimum velocity.
-
- :type: float
-
- .. note::
-
- Applies to dynamic and rigid body objects only.
-
- .. note::
-
- A value of 0.0 disables this option.
-
- .. note::
-
- While objects are stationary the minimum velocity will not be applied.
-
- .. attribute:: linVelocityMax
-
- Clamp the maximum linear velocity to prevent objects moving beyond a set speed.
-
- :type: float
-
- .. note::
-
- Applies to dynamic and rigid body objects only.
-
- .. note::
-
- A value of 0.0 disables this option (rather then setting it stationary).
-
- .. attribute:: localInertia
-
- the object's inertia vector in local coordinates. Read only.
-
- :type: list [ix, iy, iz]
-
- .. attribute:: parent
-
- 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.
-
- :type: :class:`CListValue` of :class:`KX_GameObject` or None
-
- .. attribute:: groupObject
-
- Returns the group object that the object belongs to or None if the object is not part of a group.
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: scene
-
- The object's scene. (read-only).
-
- :type: :class:`KX_Scene` or None
-
- .. attribute:: visible
-
- visibility flag.
-
- :type: boolean
-
- .. note::
-
- Game logic will still run for invisible objects.
-
- .. attribute:: color
-
- The object color of the object. [r, g, b, a]
-
- :type: :class:`mathutils.Vector`
-
- .. attribute:: occlusion
-
- occlusion capability flag.
-
- :type: boolean
-
- .. attribute:: position
-
- The object's position. [x, y, z] On write: local position, on read: world position
-
- .. deprecated:: use :data:`localPosition` and :data:`worldPosition`.
-
- :type: :class:`mathutils.Vector`
-
- .. attribute:: orientation
-
- The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. On write: local orientation, on read: world orientation
-
- .. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`.
-
- :type: :class:`mathutils.Matrix`
-
- .. attribute:: scaling
-
- The object's scaling factor. [sx, sy, sz] On write: local scaling, on read: world scaling
-
- .. deprecated:: use :data:`localScale` and :data:`worldScale`.
-
- :type: :class:`mathutils.Vector`
-
- .. attribute:: localOrientation
-
- The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector.
-
- :type: :class:`mathutils.Matrix`
-
- .. attribute:: worldOrientation
-
- The object's world orientation. 3x3 Matrix.
-
- :type: :class:`mathutils.Matrix`
-
- .. attribute:: localScale
-
- The object's local scaling factor. [sx, sy, sz]
-
- :type: :class:`mathutils.Vector`
-
- .. attribute:: worldScale
-
- The object's world scaling factor. [sx, sy, sz]
-
- :type: :class:`mathutils.Vector`
-
- .. attribute:: localPosition
-
- The object's local position. [x, y, z]
-
- :type: :class:`mathutils.Vector`
-
- .. attribute:: worldPosition
-
- The object's world position. [x, y, z]
-
- :type: :class:`mathutils.Vector`
-
- .. attribute:: localTransform
-
- The object's local space transform matrix. 4x4 Matrix.
-
- :type: :class:`mathutils.Matrix`
-
- .. attribute:: worldTransform
-
- 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`
-
- .. attribute:: worldLinearVelocity
-
- The object's world linear velocity. [x, y, z]
-
- :type: :class:`mathutils.Vector`
-
- .. attribute:: localAngularVelocity
-
- The object's local angular velocity. [x, y, z]
-
- :type: :class:`mathutils.Vector`
-
- .. attribute:: worldAngularVelocity
-
- The object's world angular velocity. [x, y, z]
-
- :type: :class:`mathutils.Vector`
-
- .. attribute:: timeOffset
-
- adjust the slowparent delay at runtime.
-
- :type: float
-
- .. attribute:: state
-
- the game object's state bitmask, using the first 30 bits, one bit must always be set.
-
- :type: int
-
- .. attribute:: meshes
-
- a list meshes for this object.
-
- :type: list of :class:`KX_MeshProxy`
-
- .. note::
-
- Most objects use only 1 mesh.
-
- .. note::
-
- Changes to this list will not update the KX_GameObject.
-
- .. attribute:: sensors
-
- a sequence of :class:`SCA_ISensor` objects with string/index lookups and iterator support.
-
- :type: list
-
- .. note::
-
- This attribute is experemental and may be removed (but probably wont be).
-
- .. note::
-
- Changes to this list will not update the KX_GameObject.
-
- .. attribute:: controllers
-
- a sequence of :class:`SCA_IController` objects with string/index lookups and iterator support.
-
- :type: list of :class:`SCA_ISensor`
-
- .. note::
-
- This attribute is experemental and may be removed (but probably wont be).
-
- .. note::
-
- Changes to this list will not update the KX_GameObject.
-
- .. attribute:: actuators
-
- a list of :class:`SCA_IActuator` with string/index lookups and iterator support.
-
- :type: list
-
- .. note::
-
- This attribute is experemental and may be removed (but probably wont be).
-
- .. note::
-
- Changes to this list will not update the KX_GameObject.
-
- .. attribute:: attrDict
-
- get the objects internal python attribute dictionary for direct (faster) access.
-
- :type: dict
-
- .. attribute:: children
-
- direct children of this object, (read-only).
-
- :type: :class:`CListValue` of :class:`KX_GameObject`'s
-
- .. attribute:: childrenRecursive
-
- all children of this object including childrens children, (read-only).
-
- :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.
-
- The actual removal of the object from the scene is delayed.
-
- .. method:: replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False)
-
- Replace the mesh of this object with a new mesh. This works the same was as the actuator.
-
- :arg mesh: mesh to replace or the meshes name.
- :type mesh: :class:`MeshProxy` or string
- :arg useDisplayMesh: when enabled the display mesh will be replaced (optional argument).
- :type useDisplayMesh: boolean
- :arg usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument).
- :type usePhysicsMesh: boolean
-
- .. method:: setVisible(visible, recursive)
-
- Sets the game object's visible flag.
-
- :arg visible: the visible state to set.
- :type visible: boolean
- :arg recursive: optional argument to set all childrens visibility flag too.
- :type recursive: boolean
-
- .. method:: setOcclusion(occlusion, recursive)
-
- Sets the game object's occlusion capability.
-
- :arg occlusion: the state to set the occlusion to.
- :type occlusion: boolean
- :arg recursive: optional argument to set all childrens occlusion flag too.
- :type recursive: boolean
-
- .. method:: alignAxisToVect(vect, axis=2, factor=1.0)
-
- Aligns any of the game object's axis along the given vector.
-
-
- :arg vect: a vector to align the axis.
- :type vect: 3D vector
- :arg axis: The axis you want to align
-
- * 0: X axis
- * 1: Y axis
- * 2: Z axis
-
- :type axis: integer
- :arg factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0)
- :type factor: float
-
- .. method:: getAxisVect(vect)
-
- Returns the axis vector rotates by the objects worldspace orientation.
- This is the equivalent of multiplying the vector by the orientation matrix.
-
- :arg vect: a vector to align the axis.
- :type vect: 3D Vector
- :return: The vector in relation to the objects rotation.
- :rtype: 3d vector.
-
- .. method:: applyMovement(movement, local=False)
-
- Sets the game object's movement.
-
- :arg movement: movement vector.
- :type movement: 3D Vector
- :arg local:
- * False: you get the "global" movement ie: relative to world orientation.
- * True: you get the "local" movement ie: relative to object orientation.
- :arg local: boolean
-
- .. method:: applyRotation(rotation, local=False)
-
- Sets the game object's rotation.
-
- :arg rotation: rotation vector.
- :type rotation: 3D Vector
- :arg local:
- * False: you get the "global" rotation ie: relative to world orientation.
- * True: you get the "local" rotation ie: relative to object orientation.
- :arg local: boolean
-
- .. method:: applyForce(force, local=False)
-
- Sets the game object's force.
-
- This requires a dynamic object.
-
- :arg force: force vector.
- :type force: 3D Vector
- :arg local:
- * False: you get the "global" force ie: relative to world orientation.
- * True: you get the "local" force ie: relative to object orientation.
- :type local: boolean
-
- .. method:: applyTorque(torque, local=False)
-
- Sets the game object's torque.
-
- This requires a dynamic object.
-
- :arg torque: torque vector.
- :type torque: 3D Vector
- :arg local:
- * False: you get the "global" torque ie: relative to world orientation.
- * True: you get the "local" torque ie: relative to object orientation.
- :type local: boolean
-
- .. method:: getLinearVelocity(local=False)
-
- Gets the game object's linear velocity.
-
- This method returns the game object's velocity through it's centre of mass, ie no angular velocity component.
-
- :arg local:
- * False: you get the "global" velocity ie: relative to world orientation.
- * True: you get the "local" velocity ie: relative to object orientation.
- :type local: boolean
- :return: the object's linear velocity.
- :rtype: list [vx, vy, vz]
-
- .. method:: setLinearVelocity(velocity, local=False)
-
- Sets the game object's linear velocity.
-
- This method sets game object's velocity through it's centre of mass,
- ie no angular velocity component.
-
- This requires a dynamic object.
-
- :arg velocity: linear velocity vector.
- :type velocity: 3D Vector
- :arg local:
- * False: you get the "global" velocity ie: relative to world orientation.
- * True: you get the "local" velocity ie: relative to object orientation.
- :type local: boolean
-
- .. method:: getAngularVelocity(local=False)
-
- Gets the game object's angular velocity.
-
- :arg local:
- * False: you get the "global" velocity ie: relative to world orientation.
- * True: you get the "local" velocity ie: relative to object orientation.
- :type local: boolean
- :return: the object's angular velocity.
- :rtype: list [vx, vy, vz]
-
- .. method:: setAngularVelocity(velocity, local=False)
-
- Sets the game object's angular velocity.
-
- This requires a dynamic object.
-
- :arg velocity: angular velocity vector.
- :type velocity: boolean
- :arg local:
- * False: you get the "global" velocity ie: relative to world orientation.
- * True: you get the "local" velocity ie: relative to object orientation.
-
- .. method:: getVelocity(point=(0, 0, 0))
-
- Gets the game object's velocity at the specified point.
-
- Gets the game object's velocity at the specified point, including angular
- components.
-
- :arg point: optional point to return the velocity for, in local coordinates.
- :type point: 3D Vector
- :return: the velocity at the specified point.
- :rtype: list [vx, vy, vz]
-
- .. method:: getReactionForce()
-
- Gets the game object's reaction force.
-
- The reaction force is the force applied to this object over the last simulation timestep.
- This also includes impulses, eg from collisions.
-
- :return: the reaction force of this object.
- :rtype: list [fx, fy, fz]
-
- .. note::
-
- This is not implimented at the moment.
-
- .. method:: applyImpulse(point, impulse)
-
- Applies an impulse to the game object.
-
- This will apply the specified impulse to the game object at the specified point.
- If point != position, applyImpulse will also change the object's angular momentum.
- Otherwise, only linear momentum will change.
-
- :arg point: the point to apply the impulse to (in world coordinates)
- :type point: the point to apply the impulse to (in world coordinates)
-
- .. method:: suspendDynamics()
-
- Suspends physics for this object.
-
- .. method:: restoreDynamics()
-
- Resumes physics for this object.
-
- .. note::
-
- The objects linear velocity will be applied from when the dynamics were suspended.
-
- .. method:: enableRigidBody()
-
- Enables rigid body physics for this object.
-
- Rigid body physics allows the object to roll on collisions.
-
- .. method:: disableRigidBody()
-
- Disables rigid body physics for this object.
-
- .. method:: setParent(parent, compound=True, ghost=True)
-
- Sets this object's parent.
- Control the shape status with the optional compound and ghost parameters:
-
- In that case you can control if it should be ghost or not:
-
- :arg parent: new parent object.
- :type parent: :class:`KX_GameObject`
- :arg compound: whether the shape should be added to the parent compound shape.
-
- * True: the object shape should be added to the parent compound shape.
- * False: the object should keep its individual shape.
-
- :type compound: boolean
- :arg ghost: whether the object should be ghost while parented.
-
- * True: if the object should be made ghost while parented.
- * False: if the object should be solid while parented.
-
- :type ghost: boolean
-
- .. note::
-
- If the object type is sensor, it stays ghost regardless of ghost parameter
-
- .. method:: removeParent()
-
- Removes this objects parent.
-
- .. method:: getPhysicsId()
-
- Returns the user data object associated with this game object's physics controller.
-
- .. method:: getPropertyNames()
-
- Gets a list of all property names.
-
- :return: All property names for this object.
- :rtype: list
-
- .. method:: getDistanceTo(other)
-
- :arg other: a point or another :class:`KX_GameObject` to measure the distance to.
- :type other: :class:`KX_GameObject` or list [x, y, z]
- :return: distance to another object or point.
- :rtype: float
-
- .. method:: getVectTo(other)
-
- Returns the vector and the distance to another object or point.
- The vector is normalized unless the distance is 0, in which a zero length vector is returned.
-
- :arg other: a point or another :class:`KX_GameObject` to get the vector and distance to.
- :type other: :class:`KX_GameObject` or list [x, y, z]
- :return: (distance, globalVector(3), localVector(3))
- :rtype: 3-tuple (float, 3-tuple (x, y, z), 3-tuple (x, y, z))
-
- .. method:: rayCastTo(other, dist, prop)
-
- Look towards another point/object and find first object hit within dist that matches prop.
-
- The ray is always casted from the center of the object, ignoring the object itself.
- The ray is casted towards the center of another object or an explicit [x, y, z] point.
- Use rayCast() if you need to retrieve the hit point
-
- :arg other: [x, y, z] or object towards which the ray is casted
- :type other: :class:`KX_GameObject` or 3-tuple
- :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
- :type dist: float
- :arg prop: property name that object must have; can be omitted => detect any object
- :type prop: string
- :return: the first object hit or None if no object or object does not match prop
- :rtype: :class:`KX_GameObject`
-
- .. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly)
-
- Look from a point/object to another point/object and find first object hit within dist that matches prop.
- if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit.
- if poly is 1, returns a 4-tuple with in addition a :class:`KX_PolyProxy` as 4th element.
- if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element.
-
- .. code-block:: python
-
- # shoot along the axis gun-gunAim (gunAim should be collision-free)
- obj, point, normal = gun.rayCast(gunAim, None, 50)
- if obj:
- # do something
- pass
-
- The face paremeter determines the orientation of the normal.
-
- * 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
- * 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
-
- The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray.
- The prop and xray parameters interact as follow.
-
- * prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray.
- * prop off, xray on : idem.
- * prop on, xray off: return closest hit if it matches prop, no hit otherwise.
- * prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray.
-
- The :class:`KX_PolyProxy` 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray.
- If there is no hit or the hit object is not a static mesh, None is returned as 4th element.
-
- The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects.
-
- :arg objto: [x, y, z] or object to which the ray is casted
- :type objto: :class:`KX_GameObject` or 3-tuple
- :arg objfrom: [x, y, z] or object from which the ray is casted; None or omitted => use self object center
- :type objfrom: :class:`KX_GameObject` or 3-tuple or None
- :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to
- :type dist: float
- :arg prop: property name that object must have; can be omitted or "" => detect any object
- :type prop: string
- :arg face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin
- :type face: integer
- :arg xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object
- :type xray: integer
- :arg poly: polygon option: 0, 1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit.
-
- * 0 or omitted: return value is a 3-tuple (object, hitpoint, hitnormal) or (None, None, None) if no hit
- * 1: return value is a 4-tuple and the 4th element is a :class:`KX_PolyProxy` or None if no hit or the object doesn't use a mesh collision shape.
- * 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping.
-
- :type poly: integer
- :return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv).
-
- * object, hitpoint and hitnormal are None if no hit.
- * polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None
- * hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None
-
- :rtype:
-
- * 3-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz))
- * or 4-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`)
- * or 5-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`, 2-tuple (u, v))
-
- .. note::
-
- The ray ignores the object on which the method is called. It is casted from/to object center or explicit [x, y, z] points.
-
- .. method:: setCollisionMargin(margin)
-
- Set the objects collision margin.
-
- :arg margin: the collision margin distance in blender units.
- :type margin: float
-
- .. note::
-
- If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError.
-
- .. method:: sendMessage(subject, body="", to="")
-
- Sends a message.
-
- :arg subject: The subject of the message
- :type subject: string
- :arg body: The body of the message (optional)
- :type body: string
- :arg to: The name of the object to send the message to (optional)
- :type to: string
-
- .. method:: reinstancePhysicsMesh(gameObject, meshObject)
-
- Updates the physics system with the changed mesh.
-
- If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object.
-
- :arg gameObject: optional argument, set the physics shape from this gameObjets mesh.
- :type gameObject: string, :class:`KX_GameObject` or None
- :arg meshObject: optional argument, set the physics shape from this mesh.
- :type meshObject: string, :class:`MeshProxy` or None
-
- :return: True if reinstance succeeded, False if it failed.
- :rtype: boolean
-
- .. note::
-
- If this object has instances the other instances will be updated too.
-
- .. note::
-
- The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf).
-
- .. warning::
-
- Only triangle mesh type objects are supported currently (not convex hull)
-
- .. warning::
-
- If the object is a part of a combound object it will fail (parent or child)
-
- .. warning::
-
- Rebuilding the physics mesh can be slow, running many times per second will give a performance hit.
-
- .. method:: get(key, default=None)
-
- Return the value matching key, or the default value if its not found.
- :return: The key value or a default.
-
- .. method:: playAction(name, start_frame, end_frame, layer=0, priority=0, blendin=0, play_mode=ACT_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0)
-
- Plays an action.
-
- :arg name: the name of the action
- :type name: string
- :arg start: the start frame of the action
- :type start: float
- :arg end: the end frame of the action
- :type end: float
- :arg layer: the layer the action will play in (actions in different layers are added/blended together)
- :type layer: integer
- :arg priority: only play this action if there isn't an action currently playing in this layer with a higher (lower number) priority
- :type priority: integer
- :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: 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)
- :type ipo_flags: int bitfield
- :arg speed: the playback speed of the action as a factor (1.0 = normal speed, 2.0 = 2x speed, etc)
- :type speed: float
-
- .. method:: stopAction(layer=0)
-
- Stop playing the action on the given layer.
-
- :arg layer: The layer to stop playing.
- :type layer: integer
-
- .. method:: getActionFrame(layer=0)
-
- Gets the current frame of the action playing in the supplied layer.
-
- :arg layer: The layer that you want to get the frame from.
- :type layer: integer
-
- :return: The current frame of the action
- :rtype: float
-
- .. method:: setActionFrame(frame, layer=0)
-
- Set the current frame of the action playing in the supplied layer.
-
- :arg layer: The layer where you want to set the frame
- :type layer: integer
- :arg frame: The frame to set the action to
- :type frame: float
-
- .. method:: isPlayingAction(layer=0)
-
- Checks to see if there is an action playing in the given layer.
-
- :arg layer: The layer to check for a playing action.
- :type layer: integer
-
- :return: Whether or not the action is playing
- :rtype: boolean
-
-.. class:: KX_IpoActuator(SCA_IActuator)
-
- IPO actuator activates an animation.
-
- .. attribute:: frameStart
-
- Start frame.
-
- :type: float
-
- .. attribute:: frameEnd
-
- End frame.
-
- :type: float
-
- .. attribute:: propName
-
- Use this property to define the Ipo position.
-
- :type: string
-
- .. attribute:: framePropName
-
- Assign this property this action current frame number.
-
- :type: string
-
- .. attribute:: mode
-
- Play mode for the ipo. Can be on of :ref:`these constants <ipo-actuator>`
-
- :type: integer
-
- .. attribute:: useIpoAsForce
-
- Apply Ipo as a global or local force depending on the local option (dynamic objects only).
-
- :type: boolean
-
- .. attribute:: useIpoAdd
-
- Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag.
-
- :type: boolean
-
- .. attribute:: useIpoLocal
-
- Let the ipo acts in local coordinates, used in Force and Add mode.
-
- :type: boolean
-
- .. attribute:: useChildren
-
- Update IPO on all children Objects as well.
-
- :type: boolean
-
-.. class:: KX_LibLoadStatus(PyObjectPlus)
-
- An object providing information about a LibLoad() operation.
-
- .. code-block:: python
-
- # Print a message when an async LibLoad is done
- import bge
-
- def finished_cb(status):
- print("Library (%s) loaded in %.2fms." % (status.libraryName, status.timeTaken))
-
- bge.logic.LibLoad('myblend.blend', 'Scene', async=True).onFinish = finished_cb
-
- .. attribute:: onFinish
-
- A callback that gets called when the lib load is done.
-
- :type: callable
-
- .. attribute:: progress
-
- The current progress of the lib load as a normalized value from 0.0 to 1.0.
-
- :type: float
-
- .. attribute:: libraryName
-
- The name of the library being loaded (the first argument to LibLoad).
-
- :type: string
-
- .. attribute:: timeTaken
-
- The amount of time, in seconds, the lib load took (0 until the operation is complete).
-
- :type: float
-
-.. class:: KX_LightObject(KX_GameObject)
-
- A Light object.
-
- .. code-block:: python
-
- # Turn on a red alert light.
- import bge
-
- co = bge.logic.getCurrentController()
- light = co.owner
-
- light.energy = 1.0
- light.color = [1.0, 0.0, 0.0]
-
- .. data:: SPOT
-
- A spot light source. See attribute :data:`type`
-
- .. data:: SUN
-
- A point light source with no attenuation. See attribute :data:`type`
-
- .. data:: NORMAL
-
- A point light source. See attribute :data:`type`
-
- .. attribute:: type
-
- The type of light - must be SPOT, SUN or NORMAL
-
- .. attribute:: layer
-
- The layer mask that this light affects object on.
-
- :type: bitfield
-
- .. attribute:: energy
-
- The brightness of this light.
-
- :type: float
-
- .. attribute:: distance
-
- The maximum distance this light can illuminate. (SPOT and NORMAL lights only).
-
- :type: float
-
- .. attribute:: color
-
- The color of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
-
- :type: list [r, g, b]
-
- .. attribute:: lin_attenuation
-
- The linear component of this light's attenuation. (SPOT and NORMAL lights only).
-
- :type: float
-
- .. attribute:: quad_attenuation
-
- The quadratic component of this light's attenuation (SPOT and NORMAL lights only).
-
- :type: float
-
- .. attribute:: spotsize
-
- The cone angle of the spot light, in degrees (SPOT lights only).
-
- :type: float in [0 - 180].
-
- .. attribute:: spotblend
-
- Specifies the intensity distribution of the spot light (SPOT lights only).
-
- :type: float in [0 - 1]
-
- .. note::
-
- Higher values result in a more focused light source.
-
-.. class:: KX_MeshProxy(SCA_IObject)
-
- A mesh object.
-
- You can only change the vertex properties of a mesh object, not the mesh topology.
-
- To use mesh objects effectively, you should know a bit about how the game engine handles them.
-
- #. Mesh Objects are converted from Blender at scene load.
- #. The Converter groups polygons by Material. This means they can be sent to the renderer efficiently. A material holds:
-
- #. The texture.
- #. The Blender material.
- #. The Tile properties
- #. The face properties - (From the "Texture Face" panel)
- #. Transparency & z sorting
- #. Light layer
- #. Polygon shape (triangle/quad)
- #. Game Object
-
- #. Vertices will be split by face if necessary. Vertices can only be shared between faces if:
-
- #. They are at the same position
- #. UV coordinates are the same
- #. Their normals are the same (both polygons are "Set Smooth")
- #. They are the same color, for example: a cube has 24 vertices: 6 faces with 4 vertices per face.
-
- The correct method of iterating over every :class:`KX_VertexProxy` in a game object
-
- .. code-block:: python
-
- from bge import logic
-
- cont = logic.getCurrentController()
- object = cont.owner
-
- for mesh in object.meshes:
- for m_index in range(len(mesh.materials)):
- for v_index in range(mesh.getVertexArrayLength(m_index)):
- vertex = mesh.getVertex(m_index, v_index)
- # Do something with vertex here...
- # ... eg: color the vertex red.
- vertex.color = [1.0, 0.0, 0.0, 1.0]
-
- .. attribute:: materials
-
- :type: list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types
-
- .. attribute:: numPolygons
-
- :type: integer
-
- .. attribute:: numMaterials
-
- :type: integer
-
- .. method:: getMaterialName(matid)
-
- Gets the name of the specified material.
-
- :arg matid: the specified material.
- :type matid: integer
- :return: the attached material name.
- :rtype: string
-
- .. method:: getTextureName(matid)
-
- Gets the name of the specified material's texture.
-
- :arg matid: the specified material
- :type matid: integer
- :return: the attached material's texture name.
- :rtype: string
-
- .. method:: getVertexArrayLength(matid)
-
- Gets the length of the vertex array associated with the specified material.
-
- There is one vertex array for each material.
-
- :arg matid: the specified material
- :type matid: integer
- :return: the number of verticies in the vertex array.
- :rtype: integer
-
- .. method:: getVertex(matid, index)
-
- Gets the specified vertex from the mesh object.
-
- :arg matid: the specified material
- :type matid: integer
- :arg index: the index into the vertex array.
- :type index: integer
- :return: a vertex object.
- :rtype: :class:`KX_VertexProxy`
-
- .. method:: getPolygon(index)
-
- Gets the specified polygon from the mesh.
-
- :arg index: polygon number
- :type index: integer
- :return: a polygon object.
- :rtype: :class:`PolyProxy`
-
- .. method:: transform(matid, matrix)
-
- Transforms the vertices of a mesh.
-
- :arg matid: material index, -1 transforms all.
- :type matid: integer
- :arg matrix: transformation matrix.
- :type matrix: 4x4 matrix [[float]]
-
- .. method:: transformUV(matid, matrix, uv_index=-1, uv_index_from=-1)
-
- Transforms the vertices UV's of a mesh.
-
- :arg matid: material index, -1 transforms all.
- :type matid: integer
- :arg matrix: transformation matrix.
- :type matrix: 4x4 matrix [[float]]
- :arg uv_index: optional uv index, -1 for all, otherwise 0 or 1.
- :type uv_index: integer
- :arg uv_index_from: optional uv index to copy from, -1 to transform the current uv.
- :type uv_index_from: integer
-
-.. class:: SCA_MouseSensor(SCA_ISensor)
-
- Mouse Sensor logic brick.
-
- .. attribute:: position
-
- current [x, y] coordinates of the mouse, in frame coordinates (pixels).
-
- :type: [integer, interger]
-
- .. attribute:: mode
-
- sensor mode.
-
- :type: integer
-
- * KX_MOUSESENSORMODE_LEFTBUTTON(1)
- * KX_MOUSESENSORMODE_MIDDLEBUTTON(2)
- * KX_MOUSESENSORMODE_RIGHTBUTTON(3)
- * KX_MOUSESENSORMODE_WHEELUP(4)
- * KX_MOUSESENSORMODE_WHEELDOWN(5)
- * KX_MOUSESENSORMODE_MOVEMENT(6)
-
- .. method:: getButtonStatus(button)
-
- Get the mouse button status.
-
- :arg button: The code that represents the key you want to get the state of, use one of :ref:`these constants<mouse-keys>`
- :type button: int
- :return: The state of the given key, can be one of :ref:`these constants<input-status>`
- :rtype: int
-
-.. class:: KX_MouseFocusSensor(SCA_MouseSensor)
-
- The mouse focus sensor detects when the mouse is over the current game object.
-
- The mouse focus sensor works by transforming the mouse coordinates from 2d device
- space to 3d space then raycasting away from the camera.
-
- .. attribute:: raySource
-
- The worldspace source of the ray (the view position).
-
- :type: list (vector of 3 floats)
-
- .. attribute:: rayTarget
-
- The worldspace target of the ray.
-
- :type: list (vector of 3 floats)
-
- .. attribute:: rayDirection
-
- The :data:`rayTarget` - :class:`raySource` normalized.
-
- :type: list (normalized vector of 3 floats)
-
- .. attribute:: hitObject
-
- the last object the mouse was over.
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: hitPosition
-
- The worldspace position of the ray intersecton.
-
- :type: list (vector of 3 floats)
-
- .. attribute:: hitNormal
-
- the worldspace normal from the face at point of intersection.
-
- :type: list (normalized vector of 3 floats)
-
- .. attribute:: hitUV
-
- the UV coordinates at the point of intersection.
-
- :type: list (vector of 2 floats)
-
- If the object has no UV mapping, it returns [0, 0].
-
- The UV coordinates are not normalized, they can be < 0 or > 1 depending on the UV mapping.
-
- .. attribute:: usePulseFocus
-
- When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set).
-
- :type: boolean
-
-.. class:: KX_TouchSensor(SCA_ISensor)
-
- Touch sensor detects collisions between objects.
-
- .. attribute:: propName
-
- The property or material to collide with.
-
- :type: string
-
- .. attribute:: useMaterial
-
- Determines if the sensor is looking for a property or material. KX_True = Find material; KX_False = Find property.
-
- :type: boolean
-
- .. attribute:: usePulseCollision
-
- When enabled, changes to the set of colliding objects generate a pulse.
-
- :type: boolean
-
- .. attribute:: hitObject
-
- The last collided object. (read-only).
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: hitObjectList
-
- A list of colliding objects. (read-only).
-
- :type: :class:`CListValue` of :class:`KX_GameObject`
-
-.. class:: KX_NearSensor(KX_TouchSensor)
-
- A near sensor is a specialised form of touch sensor.
-
- .. attribute:: distance
-
- The near sensor activates when an object is within this distance.
-
- :type: float
-
- .. attribute:: resetDistance
-
- The near sensor deactivates when the object exceeds this distance.
-
- :type: float
-
-.. class:: KX_NetworkMessageActuator(SCA_IActuator)
-
- Message Actuator
-
- .. attribute:: propName
-
- Messages will only be sent to objects with the given property name.
-
- :type: string
-
- .. attribute:: subject
-
- The subject field of the message.
-
- :type: string
-
- .. attribute:: body
-
- The body of the message.
-
- :type: string
-
- .. attribute:: usePropBody
-
- Send a property instead of a regular body message.
-
- :type: boolean
-
-.. class:: KX_NetworkMessageSensor(SCA_ISensor)
-
- The Message Sensor logic brick.
-
- Currently only loopback (local) networks are supported.
-
- .. attribute:: subject
-
- The subject the sensor is looking for.
-
- :type: string
-
- .. attribute:: frameMessageCount
-
- The number of messages received since the last frame. (read-only).
-
- :type: integer
-
- .. attribute:: subjects
-
- The list of message subjects received. (read-only).
-
- :type: list of strings
-
- .. attribute:: bodies
-
- The list of message bodies received. (read-only).
-
- :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,
- velocity, or angular velocity to an object.
- Servo control allows to regulate force to achieve a certain speed target.
-
- .. attribute:: force
-
- The force applied by the actuator.
-
- :type: list [x, y, z]
-
- .. attribute:: useLocalForce
-
- A flag specifying if the force is local.
-
- :type: boolean
-
- .. attribute:: torque
-
- The torque applied by the actuator.
-
- :type: list [x, y, z]
-
- .. attribute:: useLocalTorque
-
- A flag specifying if the torque is local.
-
- :type: boolean
-
- .. attribute:: dLoc
-
- The displacement vector applied by the actuator.
-
- :type: list [x, y, z]
-
- .. attribute:: useLocalDLoc
-
- A flag specifying if the dLoc is local.
-
- :type: boolean
-
- .. attribute:: dRot
-
- The angular displacement vector applied by the actuator
-
- :type: list [x, y, z]
-
- .. note::
-
- Since the displacement is applied every frame, you must adjust the displacement based on the frame rate, or you game experience will depend on the player's computer speed.
-
- .. attribute:: useLocalDRot
-
- A flag specifying if the dRot is local.
-
- :type: boolean
-
- .. attribute:: linV
-
- The linear velocity applied by the actuator.
-
- :type: list [x, y, z]
-
- .. attribute:: useLocalLinV
-
- A flag specifying if the linear velocity is local.
-
- :type: boolean
-
- .. note::
-
- This is the target speed for servo controllers.
-
- .. attribute:: angV
-
- The angular velocity applied by the actuator.
-
- :type: list [x, y, z]
-
- .. attribute:: useLocalAngV
-
- A flag specifying if the angular velocity is local.
-
- :type: boolean
-
- .. attribute:: damping
-
- The damping parameter of the servo controller.
-
- :type: short
-
- .. attribute:: forceLimitX
-
- The min/max force limit along the X axis and activates or deactivates the limits in the servo controller.
-
- :type: list [min(float), max(float), bool]
-
- .. attribute:: forceLimitY
-
- The min/max force limit along the Y axis and activates or deactivates the limits in the servo controller.
-
- :type: list [min(float), max(float), bool]
-
- .. attribute:: forceLimitZ
-
- The min/max force limit along the Z axis and activates or deactivates the limits in the servo controller.
-
- :type: list [min(float), max(float), bool]
-
- .. attribute:: pid
-
- The PID coefficients of the servo controller.
-
- :type: list of floats [proportional, integral, derivate]
-
- .. attribute:: reference
-
- The object that is used as reference to compute the velocity for the servo controller.
-
- :type: :class:`KX_GameObject` or None
-
-.. class:: KX_ParentActuator(SCA_IActuator)
-
- The parent actuator can set or remove an objects parent object.
-
- .. attribute:: object
-
- the object this actuator sets the parent too.
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: mode
-
- The mode of this actuator.
-
- :type: integer from 0 to 1.
-
- .. attribute:: compound
-
- Whether the object shape should be added to the parent compound shape when parenting.
-
- Effective only if the parent is already a compound shape.
-
- :type: boolean
-
- .. attribute:: ghost
-
- Whether the object should be made ghost when parenting
- Effective only if the shape is not added to the parent compound shape.
-
- :type: boolean
-
-.. class:: KX_PolyProxy(SCA_IObject)
-
- A polygon holds the index of the vertex forming the poylgon.
-
- Note:
- The polygon attributes are read-only, you need to retrieve the vertex proxy if you want
- to change the vertex settings.
-
- .. attribute:: material_name
-
- The name of polygon material, empty if no material.
-
- :type: string
-
- .. attribute:: material
-
- The material of the polygon.
-
- :type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
-
- .. attribute:: texture_name
-
- The texture name of the polygon.
-
- :type: string
-
- .. attribute:: material_id
-
- The material index of the polygon, use this to retrieve vertex proxy from mesh proxy.
-
- :type: integer
-
- .. attribute:: v1
-
- vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy.
-
- :type: integer
-
- .. attribute:: v2
-
- vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy.
-
- :type: integer
-
- .. attribute:: v3
-
- vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy.
-
- :type: integer
-
- .. attribute:: v4
-
- Vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex
- Use this to retrieve vertex proxy from mesh proxy.
-
- :type: integer
-
- .. attribute:: visible
-
- visible state of the polygon: 1=visible, 0=invisible.
-
- :type: integer
-
- .. attribute:: collide
-
- collide state of the polygon: 1=receives collision, 0=collision free.
-
- :type: integer
-
- .. method:: getMaterialName()
-
- Returns the polygon material name with MA prefix
-
- :return: material name
- :rtype: string
-
- .. method:: getMaterial()
-
- :return: The polygon material
- :rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
-
- .. method:: getTextureName()
-
- :return: The texture name
- :rtype: string
-
- .. method:: getMaterialIndex()
-
- Returns the material bucket index of the polygon.
- This index and the ones returned by getVertexIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`.
-
- :return: the material index in the mesh
- :rtype: integer
-
- .. method:: getNumVertex()
-
- Returns the number of vertex of the polygon.
-
- :return: number of vertex, 3 or 4.
- :rtype: integer
-
- .. method:: isVisible()
-
- Returns whether the polygon is visible or not
-
- :return: 0=invisible, 1=visible
- :rtype: boolean
-
- .. method:: isCollider()
-
- Returns whether the polygon is receives collision or not
-
- :return: 0=collision free, 1=receives collision
- :rtype: integer
-
- .. method:: getVertexIndex(vertex)
-
- Returns the mesh vertex index of a polygon vertex
- This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`.
-
- :arg vertex: index of the vertex in the polygon: 0->3
- :arg vertex: integer
- :return: mesh vertex index
- :rtype: integer
-
- .. method:: getMesh()
-
- Returns a mesh proxy
-
- :return: mesh proxy
- :rtype: :class:`MeshProxy`
-
-.. class:: KX_PolygonMaterial(PyObjectPlus)
-
- This is the interface to materials in the game engine.
-
- Materials define the render state to be applied to mesh objects.
-
- .. warning::
-
- Some of the methods/variables are CObjects. If you mix these up, you will crash blender.
-
- .. code-block:: python
-
- from bge import logic
-
- vertex_shader = """
-
- void main(void)
- {
- // original vertex position, no changes
- gl_Position = ftransform();
- // coordinate of the 1st texture channel
- gl_TexCoord[0] = gl_MultiTexCoord0;
- // coordinate of the 2nd texture channel
- gl_TexCoord[1] = gl_MultiTexCoord1;
- }
- """
-
- fragment_shader ="""
-
- uniform sampler2D color_0;
- uniform sampler2D color_1;
- uniform float factor;
-
- void main(void)
- {
- vec4 color_0 = texture2D(color_0, gl_TexCoord[0].st);
- vec4 color_1 = texture2D(color_1, gl_TexCoord[1].st);
- gl_FragColor = mix(color_0, color_1, factor);
- }
- """
-
- object = logic.getCurrentController().owner
- object = cont.owner
- for mesh in object.meshes:
- for material in mesh.materials:
- shader = material.getShader()
- if shader != None:
- if not shader.isValid():
- shader.setSource(vertex_shader, fragment_shader, True)
-
- # get the first texture channel of the material
- shader.setSampler('color_0', 0)
- # get the second texture channel of the material
- shader.setSampler('color_1', 1)
- # pass another uniform to the shader
- shader.setUniform1f('factor', 0.3)
-
-
- .. attribute:: texture
-
- Texture name.
-
- :type: string (read-only)
-
- .. attribute:: gl_texture
-
- OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture).
-
- :type: integer (read-only)
-
- .. attribute:: material
-
- Material name.
-
- :type: string (read-only)
-
- .. attribute:: tface
-
- Texture face properties.
-
- :type: CObject (read-only)
-
- .. attribute:: tile
-
- Texture is tiling.
-
- :type: boolean
-
- .. attribute:: tilexrep
-
- Number of tile repetitions in x direction.
-
- :type: integer
-
- .. attribute:: tileyrep
-
- Number of tile repetitions in y direction.
-
- :type: integer
-
- .. attribute:: drawingmode
-
- Drawing mode for the material.
- - 2 (drawingmode & 4) Textured
- - 4 (drawingmode & 16) Light
- - 14 (drawingmode & 16384) 3d Polygon Text.
-
- :type: bitfield
-
- .. attribute:: transparent
-
- This material is transparent. All meshes with this
- material will be rendered after non transparent meshes from back
- to front.
-
- :type: boolean
-
- .. attribute:: zsort
-
- Transparent polygons in meshes with this material will be sorted back to
- front before rendering.
- Non-Transparent polygons will be sorted front to back before rendering.
-
- :type: boolean
-
- .. attribute:: diffuse
-
- The diffuse color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
-
- :type: list [r, g, b]
-
- .. attribute:: specular
-
- The specular color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
-
- :type: list [r, g, b]
-
- .. attribute:: shininess
-
- The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0.
-
- :type: float
-
- .. attribute:: specularity
-
- The amount of specular of the material. 0.0 <= specularity <= 1.0.
-
- :type: float
-
- .. method:: updateTexture(tface, rasty)
-
- Updates a realtime animation.
-
- :arg tface: Texture face (eg mat.tface)
- :type tface: CObject
- :arg rasty: Rasterizer
- :type rasty: CObject
-
- .. method:: setTexture(tface)
-
- Sets texture render state.
-
- :arg tface: Texture face
- :type tface: CObject
-
- .. code-block:: python
-
- mat.setTexture(mat.tface)
-
- .. method:: activate(rasty, cachingInfo)
-
- Sets material parameters for this object for rendering.
-
- Material Parameters set:
-
- #. Texture
- #. Backface culling
- #. Line drawing
- #. Specular Colour
- #. Shininess
- #. Diffuse Colour
- #. Polygon Offset.
-
- :arg rasty: Rasterizer instance.
- :type rasty: CObject
- :arg cachingInfo: Material cache instance.
- :type cachingInfo: CObject
-
- .. method:: setCustomMaterial(material)
-
- Sets the material state setup object.
-
- Using this method, you can extend or completely replace the gameengine material
- to do your own advanced multipass effects.
-
- Use this method to register your material class. Instead of the normal material,
- your class's activate method will be called just before rendering the mesh.
- This should setup the texture, material, and any other state you would like.
- It should return True to render the mesh, or False if you are finished. You should
- clean up any state Blender does not set before returning False.
-
- Activate Method Definition:
-
- .. code-block:: python
-
- def activate(self, rasty, cachingInfo, material):
-
- :arg material: The material object.
- :type material: instance
-
- .. code-block:: python
-
- class PyMaterial:
- def __init__(self):
- self.pass_no = -1
-
- def activate(self, rasty, cachingInfo, material):
- # Activate the material here.
- #
- # The activate method will be called until it returns False.
- # Every time the activate method returns True the mesh will
- # be rendered.
- #
- # rasty is a CObject for passing to material.updateTexture()
- # and material.activate()
- # cachingInfo is a CObject for passing to material.activate()
- # material is the KX_PolygonMaterial instance this material
- # was added to
-
- # default material properties:
- self.pass_no += 1
- if self.pass_no == 0:
- material.activate(rasty, cachingInfo)
- # Return True to do this pass
- return True
-
- # clean up and return False to finish.
- self.pass_no = -1
- return False
-
- # Create a new Python Material and pass it to the renderer.
- mat.setCustomMaterial(PyMaterial())
-
-.. class:: KX_RadarSensor(KX_NearSensor)
-
- Radar sensor is a near sensor with a conical sensor object.
-
- .. attribute:: coneOrigin
-
- The origin of the cone with which to test. The origin is in the middle of the cone. (read-only).
-
- :type: list of floats [x, y, z]
-
- .. attribute:: coneTarget
-
- The center of the bottom face of the cone with which to test. (read-only).
-
- :type: list of floats [x, y, z]
-
- .. attribute:: distance
-
- The height of the cone with which to test.
-
- :type: float
-
- .. attribute:: angle
-
- The angle of the cone (in degrees) with which to test.
-
- :type: float
-
- .. attribute:: axis
-
- The axis on which the radar cone is cast.
-
- :type: integer from 0 to 5
-
- KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z,
- KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z
-
-.. class:: KX_RaySensor(SCA_ISensor)
-
- A ray sensor detects the first object in a given direction.
-
- .. attribute:: propName
-
- The property the ray is looking for.
-
- :type: string
-
- .. attribute:: range
-
- The distance of the ray.
-
- :type: float
-
- .. attribute:: useMaterial
-
- Whether or not to look for a material (false = property).
-
- :type: boolean
-
- .. attribute:: useXRay
-
- Whether or not to use XRay.
-
- :type: boolean
-
- .. attribute:: hitObject
-
- The game object that was hit by the ray. (read-only).
-
- :type: :class:`KX_GameObject`
-
- .. attribute:: hitPosition
-
- The position (in worldcoordinates) where the object was hit by the ray. (read-only).
-
- :type: list [x, y, z]
-
- .. attribute:: hitNormal
-
- The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (read-only).
-
- :type: list [x, y, z]
-
- .. attribute:: rayDirection
-
- The direction from the ray (in worldcoordinates). (read-only).
-
- :type: list [x, y, z]
-
- .. attribute:: axis
-
- The axis the ray is pointing on.
-
- :type: integer from 0 to 5
-
- * KX_RAY_AXIS_POS_X
- * KX_RAY_AXIS_POS_Y
- * KX_RAY_AXIS_POS_Z
- * KX_RAY_AXIS_NEG_X
- * KX_RAY_AXIS_NEG_Y
- * KX_RAY_AXIS_NEG_Z
-
-.. class:: KX_SCA_AddObjectActuator(SCA_IActuator)
-
- Edit Object Actuator (in Add Object Mode)
-
- .. warning::
-
- An Add Object actuator will be ignored if at game start, the linked object doesn't exist (or is empty) or the linked object is in an active layer.
-
- .. code-block:: none
-
- Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer)
-
- .. attribute:: object
-
- the object this actuator adds.
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: objectLastCreated
-
- the last added object from this actuator (read-only).
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: time
-
- the lifetime of added objects, in frames. Set to 0 to disable automatic deletion.
-
- :type: integer
-
- .. attribute:: linearVelocity
-
- the initial linear velocity of added objects.
-
- :type: list [vx, vy, vz]
-
- .. attribute:: angularVelocity
-
- the initial angular velocity of added objects.
-
- :type: list [vx, vy, vz]
-
- .. method:: instantAddObject()
-
- adds the object without needing to calling SCA_PythonController.activate()
-
- .. note:: Use objectLastCreated to get the newly created object.
-
-.. class:: KX_SCA_DynamicActuator(SCA_IActuator)
-
- Dynamic Actuator.
-
- .. attribute:: mode
-
- :type: integer
-
- the type of operation of the actuator, 0-4
-
- * KX_DYN_RESTORE_DYNAMICS(0)
- * KX_DYN_DISABLE_DYNAMICS(1)
- * KX_DYN_ENABLE_RIGID_BODY(2)
- * KX_DYN_DISABLE_RIGID_BODY(3)
- * KX_DYN_SET_MASS(4)
-
- .. attribute:: mass
-
- the mass value for the KX_DYN_SET_MASS operation.
-
- :type: float
-
-.. class:: KX_SCA_EndObjectActuator(SCA_IActuator)
-
- Edit Object Actuator (in End Object mode)
-
- This actuator has no python methods.
-
-.. class:: KX_SCA_ReplaceMeshActuator(SCA_IActuator)
-
- Edit Object actuator, in Replace Mesh mode.
-
- .. warning::
-
- Replace mesh actuators will be ignored if at game start, the named mesh doesn't exist.
-
- This will generate a warning in the console
-
- .. code-block:: none
-
- Error: GameObject 'Name' ReplaceMeshActuator 'ActuatorName' without object
-
- .. code-block:: python
-
- # Level-of-detail
- # Switch a game object's mesh based on its depth in the camera view.
- # +----------+ +-----------+ +-------------------------------------+
- # | Always +-----+ Python +-----+ Edit Object (Replace Mesh) LOD.Mesh |
- # +----------+ +-----------+ +-------------------------------------+
- from bge import logic
-
- # List detail meshes here
- # Mesh (name, near, far)
- # Meshes overlap so that they don't 'pop' when on the edge of the distance.
- meshes = ((".Hi", 0.0, -20.0),
- (".Med", -15.0, -50.0),
- (".Lo", -40.0, -100.0)
- )
-
- cont = logic.getCurrentController()
- object = cont.owner
- actuator = cont.actuators["LOD." + obj.name]
- camera = logic.getCurrentScene().active_camera
-
- def Depth(pos, plane):
- return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3]
-
- # Depth is negative and decreasing further from the camera
- depth = Depth(object.position, camera.world_to_camera[2])
-
- newmesh = None
- curmesh = None
- # Find the lowest detail mesh for depth
- for mesh in meshes:
- if depth < mesh[1] and depth > mesh[2]:
- newmesh = mesh
- if "ME" + object.name + mesh[0] == actuator.getMesh():
- curmesh = mesh
-
- if newmesh != None and "ME" + object.name + newmesh[0] != actuator.mesh:
- # The mesh is a different mesh - switch it.
- # Check the current mesh is not a better fit.
- if curmesh == None or curmesh[1] < depth or curmesh[2] > depth:
- actuator.mesh = object.name + newmesh[0]
- cont.activate(actuator)
-
- .. attribute:: mesh
-
- :class:`MeshProxy` or the name of the mesh that will replace the current one.
-
- Set to None to disable actuator.
-
- :type: :class:`MeshProxy` or None if no mesh is set
-
- .. attribute:: useDisplayMesh
-
- when true the displayed mesh is replaced.
-
- :type: boolean
-
- .. attribute:: usePhysicsMesh
-
- when true the physics mesh is replaced.
-
- :type: boolean
-
- .. method:: instantReplaceMesh()
-
- Immediately replace mesh without delay.
-
-.. class:: KX_Scene(PyObjectPlus)
-
- An active scene that gives access to objects, cameras, lights and scene attributes.
-
- The activity culling stuff is supposed to disable logic bricks when their owner gets too far
- from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows
- what it does!
-
- .. code-block:: python
-
- from bge import logic
-
- # get the scene
- scene = logic.getCurrentScene()
-
- # print all the objects in the scene
- for object in scene.objects:
- print(object.name)
-
- # get an object named 'Cube'
- object = scene.objects["Cube"]
-
- # get the first object in the scene.
- object = scene.objects[0]
-
- .. code-block:: python
-
- # Get the depth of an object in the camera view.
- from bge import logic
-
- object = logic.getCurrentController().owner
- cam = logic.getCurrentScene().active_camera
-
- # Depth is negative and decreasing further from the camera
- depth = object.position[0]*cam.world_to_camera[2][0] + object.position[1]*cam.world_to_camera[2][1] + object.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3]
-
- @bug: All attributes are read only at the moment.
-
- .. attribute:: name
-
- The scene's name, (read-only).
-
- :type: string
-
- .. attribute:: objects
-
- A list of objects in the scene, (read-only).
-
- :type: :class:`CListValue` of :class:`KX_GameObject`
-
- .. attribute:: objectsInactive
-
- A list of objects on background layers (used for the addObject actuator), (read-only).
-
- :type: :class:`CListValue` of :class:`KX_GameObject`
-
- .. attribute:: lights
-
- A list of lights in the scene, (read-only).
-
- :type: :class:`CListValue` of :class:`KX_LightObject`
-
- .. attribute:: cameras
-
- A list of cameras in the scene, (read-only).
-
- :type: :class:`CListValue` of :class:`KX_Camera`
-
- .. attribute:: active_camera
-
- The current active camera.
-
- :type: :class:`KX_Camera`
-
- .. note::
-
- This can be set directly from python to avoid using the :class:`KX_SceneActuator`.
-
- .. attribute:: suspended
-
- True if the scene is suspended, (read-only).
-
- :type: boolean
-
- .. attribute:: activity_culling
-
- True if the scene is activity culling.
-
- :type: boolean
-
- .. attribute:: activity_culling_radius
-
- The distance outside which to do activity culling. Measured in manhattan distance.
-
- :type: float
-
- .. attribute:: dbvt_culling
-
- True when Dynamic Bounding box Volume Tree is set (read-only).
-
- :type: boolean
-
- .. attribute:: pre_draw
-
- A list of callables to be run before the render step.
-
- :type: list
-
- .. attribute:: post_draw
-
- A list of callables to be run after the render step.
-
- :type: list
-
- .. attribute:: gravity
-
- The scene gravity using the world x, y and z axis.
-
- :type: list [fx, fy, fz]
-
- .. method:: addObject(object, other, time=0)
-
- Adds an object to the scene like the Add Object Actuator would.
-
- :arg object: The object to add
- :type object: :class:`KX_GameObject` or string
- :arg other: The object's center to use when adding the object
- :type other: :class:`KX_GameObject` or string
- :arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever.
- :type time: integer
- :return: The newly added object.
- :rtype: :class:`KX_GameObject`
-
- .. method:: end()
-
- Removes the scene from the game.
-
- .. method:: restart()
-
- Restarts the scene.
-
- .. method:: replace(scene)
-
- Replaces this scene with another one.
-
- :arg scene: The name of the scene to replace this scene with.
- :type scene: string
-
- .. method:: suspend()
-
- Suspends this scene.
-
- .. method:: resume()
-
- Resume this scene.
-
- .. method:: get(key, default=None)
-
- 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.
-
- .. warning::
-
- Scene actuators that use a scene name will be ignored if at game start, the named scene doesn't exist or is empty
-
- This will generate a warning in the console:
-
- .. code-block:: none
-
- Error: GameObject 'Name' has a SceneActuator 'ActuatorName' (SetScene) without scene
-
- .. attribute:: scene
-
- the name of the scene to change to/overlay/underlay/remove/suspend/resume.
-
- :type: string
-
- .. attribute:: camera
-
- the camera to change to.
-
- :type: :class:`KX_Camera` on read, string or :class:`KX_Camera` on write
-
- .. note::
-
- When setting the attribute, you can use either a :class:`KX_Camera` or the name of the camera.
-
- .. attribute:: useRestart
-
- Set flag to True to restart the sene.
-
- :type: boolean
-
- .. attribute:: mode
-
- The mode of the actuator.
-
- :type: integer from 0 to 5.
-
-.. class:: KX_SoundActuator(SCA_IActuator)
-
- Sound Actuator.
-
- 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:: volume
-
- The volume (gain) of the sound.
-
- :type: float
-
- .. attribute:: time
-
- The current position in the audio stream (in seconds).
-
- :type: float
-
- .. attribute:: pitch
-
- The pitch of the sound.
-
- :type: float
-
- .. attribute:: mode
-
- The operation mode of the actuator. Can be one of :ref:`these constants<logic-sound-actuator>`
-
- :type: integer
-
- .. 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:: volume_minimum
-
- The minimum gain of the sound, no matter how far it is away.
-
- :type: float
-
- .. attribute:: distance_reference
-
- The distance where the sound has a gain of 1.0.
-
- :type: float
-
- .. attribute:: distance_maximum
-
- The maximum distance at which you can hear the sound.
-
- :type: float
-
- .. attribute:: attenuation
-
- The influence factor on volume depending on distance.
-
- :type: float
-
- .. attribute:: cone_angle_inner
-
- The angle of the inner cone.
-
- :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)
-
- State actuator changes the state mask of parent object.
-
- .. attribute:: operation
-
- Type of bit operation to be applied on object state mask.
-
- You can use one of :ref:`these constants <state-actuator-operation>`
-
- :type: integer
-
- .. attribute:: mask
-
- Value that defines the bits that will be modified by the operation.
-
- The bits that are 1 in the mask will be updated in the object state.
-
- The bits that are 0 are will be left unmodified expect for the Copy operation which copies the mask to the object state.
-
- :type: integer
-
-.. class:: KX_TrackToActuator(SCA_IActuator)
-
- Edit Object actuator in Track To mode.
-
- .. warning::
-
- Track To Actuators will be ignored if at game start, the object to track to is invalid.
-
- This will generate a warning in the console:
-
- .. code-block:: none
-
- GameObject 'Name' no object in EditObjectActuator 'ActuatorName'
-
- .. attribute:: object
-
- the object this actuator tracks.
-
- :type: :class:`KX_GameObject` or None
-
- .. attribute:: time
-
- the time in frames with which to delay the tracking motion.
-
- :type: integer
-
- .. attribute:: use3D
-
- the tracking motion to use 3D.
-
- :type: boolean
-
-.. class:: KX_VehicleWrapper(PyObjectPlus)
-
- KX_VehicleWrapper
-
- TODO - description
-
- .. method:: addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering)
-
- Add a wheel to the vehicle
-
- :arg wheel: The object to use as a wheel.
- :type wheel: :class:`KX_GameObject` or a KX_GameObject name
- :arg attachPos: The position that this wheel will attach to.
- :type attachPos: vector of 3 floats
- :arg attachDir: The direction this wheel points.
- :type attachDir: vector of 3 floats
- :arg axleDir: The direction of this wheels axle.
- :type axleDir: vector of 3 floats
- :arg suspensionRestLength: TODO - Description
- :type suspensionRestLength: float
- :arg wheelRadius: The size of the wheel.
- :type wheelRadius: float
-
- .. method:: applyBraking(force, wheelIndex)
-
- Apply a braking force to the specified wheel
-
- :arg force: the brake force
- :type force: float
-
- :arg wheelIndex: index of the wheel where the force needs to be applied
- :type wheelIndex: integer
-
- .. method:: applyEngineForce(force, wheelIndex)
-
- Apply an engine force to the specified wheel
-
- :arg force: the engine force
- :type force: float
-
- :arg wheelIndex: index of the wheel where the force needs to be applied
- :type wheelIndex: integer
-
- .. method:: getConstraintId()
-
- Get the constraint ID
-
- :return: the constraint id
- :rtype: integer
-
- .. method:: getConstraintType()
-
- Returns the constraint type.
-
- :return: constraint type
- :rtype: integer
-
- .. method:: getNumWheels()
-
- Returns the number of wheels.
-
- :return: the number of wheels for this vehicle
- :rtype: integer
-
- .. method:: getWheelOrientationQuaternion(wheelIndex)
-
- Returns the wheel orientation as a quaternion.
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- :return: TODO Description
- :rtype: TODO - type should be quat as per method name but from the code it looks like a matrix
-
- .. method:: getWheelPosition(wheelIndex)
-
- Returns the position of the specified wheel
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
- :return: position vector
- :rtype: list[x, y, z]
-
- .. method:: getWheelRotation(wheelIndex)
-
- Returns the rotation of the specified wheel
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- :return: the wheel rotation
- :rtype: float
-
- .. method:: setRollInfluence(rollInfluece, wheelIndex)
-
- Set the specified wheel's roll influence.
- The higher the roll influence the more the vehicle will tend to roll over in corners.
-
- :arg rollInfluece: the wheel roll influence
- :type rollInfluece: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- .. method:: setSteeringValue(steering, wheelIndex)
-
- Set the specified wheel's steering
-
- :arg steering: the wheel steering
- :type steering: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- .. method:: setSuspensionCompression(compression, wheelIndex)
-
- Set the specified wheel's compression
-
- :arg compression: the wheel compression
- :type compression: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- .. method:: setSuspensionDamping(damping, wheelIndex)
-
- Set the specified wheel's damping
-
- :arg damping: the wheel damping
- :type damping: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- .. method:: setSuspensionStiffness(stiffness, wheelIndex)
-
- Set the specified wheel's stiffness
-
- :arg stiffness: the wheel stiffness
- :type stiffness: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
- .. method:: setTyreFriction(friction, wheelIndex)
-
- Set the specified wheel's tyre friction
-
- :arg friction: the tyre friction
- :type friction: float
-
- :arg wheelIndex: the wheel index
- :type wheelIndex: integer
-
-.. class:: KX_CharacterWrapper(PyObjectPlus)
-
- A wrapper to expose character physics options.
-
- .. attribute:: onGround
-
- Whether or not the character is on the ground. (read-only)
-
- :type: boolean
-
- .. attribute:: gravity
-
- The gravity value used for the character.
-
- :type: float
-
- .. attribute:: maxJumps
-
- The maximum number of jumps a character can perform before having to touch the ground. By default this is set to 1. 2 allows for a double jump, etc.
-
- :type: int
-
- .. attribute:: jumpCount
-
- The current jump count. This can be used to have different logic for a single jump versus a double jump. For example, a different animation for the second jump.
-
- :type: int
-
- .. method:: jump()
-
- The character jumps based on it's jump speed.
-
-.. class:: KX_VertexProxy(SCA_IObject)
-
- A vertex holds position, UV, color and normal information.
-
- Note:
- The physics simulation is NOT currently updated - physics will not respond
- to changes in the vertex position.
-
- .. attribute:: XYZ
-
- The position of the vertex.
-
- :type: list [x, y, z]
-
- .. attribute:: UV
-
- The texture coordinates of the vertex.
-
- :type: list [u, v]
-
- .. attribute:: normal
-
- The normal of the vertex.
-
- :type: list [nx, ny, nz]
-
- .. attribute:: color
-
- The color of the vertex.
-
- :type: list [r, g, b, a]
-
- Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
-
- .. attribute:: x
-
- The x coordinate of the vertex.
-
- :type: float
-
- .. attribute:: y
-
- The y coordinate of the vertex.
-
- :type: float
-
- .. attribute:: z
-
- The z coordinate of the vertex.
-
- :type: float
-
- .. attribute:: u
-
- The u texture coordinate of the vertex.
-
- :type: float
-
- .. attribute:: v
-
- The v texture coordinate of the vertex.
-
- :type: float
-
- .. attribute:: u2
-
- The second u texture coordinate of the vertex.
-
- :type: float
-
- .. attribute:: v2
-
- The second v texture coordinate of the vertex.
-
- :type: float
-
- .. attribute:: r
-
- The red component of the vertex color. 0.0 <= r <= 1.0.
-
- :type: float
-
- .. attribute:: g
-
- The green component of the vertex color. 0.0 <= g <= 1.0.
-
- :type: float
-
- .. attribute:: b
-
- The blue component of the vertex color. 0.0 <= b <= 1.0.
-
- :type: float
-
- .. attribute:: a
-
- The alpha component of the vertex color. 0.0 <= a <= 1.0.
-
- :type: float
-
- .. method:: getXYZ()
-
- Gets the position of this vertex.
-
- :return: this vertexes position in local coordinates.
- :rtype: list [x, y, z]
-
- .. method:: setXYZ(pos)
-
- Sets the position of this vertex.
-
- :type: list [x, y, z]
-
- :arg pos: the new position for this vertex in local coordinates.
-
- .. method:: getUV()
-
- Gets the UV (texture) coordinates of this vertex.
-
- :return: this vertexes UV (texture) coordinates.
- :rtype: list [u, v]
-
- .. method:: setUV(uv)
-
- Sets the UV (texture) coordinates of this vertex.
-
- :type: list [u, v]
-
- .. method:: getUV2()
-
- Gets the 2nd UV (texture) coordinates of this vertex.
-
- :return: this vertexes UV (texture) coordinates.
- :rtype: list [u, v]
-
- .. method:: setUV2(uv, unit)
-
- Sets the 2nd UV (texture) coordinates of this vertex.
-
- :type: list [u, v]
-
- :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
- :arg unit: integer
-
- .. method:: getRGBA()
-
- Gets the color of this vertex.
-
- The color is represented as four bytes packed into an integer value. The color is
- packed as RGBA.
-
- Since Python offers no way to get each byte without shifting, you must use the struct module to
- access color in an machine independent way.
-
- Because of this, it is suggested you use the r, g, b and a attributes or the color attribute instead.
-
- .. code-block:: python
-
- import struct;
- col = struct.unpack('4B', struct.pack('I', v.getRGBA()))
- # col = (r, g, b, a)
- # black = ( 0, 0, 0, 255)
- # white = (255, 255, 255, 255)
-
- :return: packed color. 4 byte integer with one byte per color channel in RGBA format.
- :rtype: integer
-
- .. method:: setRGBA(col)
-
- Sets the color of this vertex.
-
- See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes
- or the color attribute instead.
-
- setRGBA() also accepts a four component list as argument col. The list represents the color as [r, g, b, a]
- with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0]
-
- .. code-block:: python
-
- v.setRGBA(0xff0000ff) # Red
- v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian
- v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red
- v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms.
-
- :arg col: the new color of this vertex in packed RGBA format.
- :type col: integer or list [r, g, b, a]
-
- .. method:: getNormal()
-
- Gets the normal vector of this vertex.
-
- :return: normalized normal vector.
- :rtype: list [nx, ny, nz]
-
- .. method:: setNormal(normal)
-
- Sets the normal vector of this vertex.
-
- :type: sequence of floats [r, g, b]
-
- :arg normal: the new normal of this vertex.
-
-.. class:: KX_VisibilityActuator(SCA_IActuator)
-
- Visibility Actuator.
-
- .. attribute:: visibility
-
- whether the actuator makes its parent object visible or invisible.
-
- :type: boolean
-
- .. attribute:: useOcclusion
-
- whether the actuator makes its parent object an occluder or not.
-
- :type: boolean
-
- .. attribute:: useRecursion
-
- whether the visibility/occlusion should be propagated to all children of the object.
-
- :type: boolean
-
-.. class:: SCA_2DFilterActuator(SCA_IActuator)
-
- Create, enable and disable 2D filters
-
- The following properties don't have an immediate effect.
- You must active the actuator to get the result.
- The actuator is not persistent: it automatically stops itself after setting up the filter
- but the filter remains active. To stop a filter you must activate the actuator with 'type'
- set to :data:`~bge.logic.RAS_2DFILTER_DISABLED` or :data:`~bge.logic.RAS_2DFILTER_NOFILTER`.
-
- .. attribute:: shaderText
-
- shader source code for custom shader.
-
- :type: string
-
- .. attribute:: disableMotionBlur
-
- action on motion blur: 0=enable, 1=disable.
-
- :type: integer
-
- .. attribute:: mode
-
- Type of 2D filter, use one of :ref:`these constants <Two-D-FilterActuator-mode>`
-
- :type: integer
-
- .. attribute:: passNumber
-
- order number of filter in the stack of 2D filters. Filters are executed in increasing order of passNb.
-
- Only be one filter can be defined per passNb.
-
- :type: integer (0-100)
-
- .. attribute:: value
-
- argument for motion blur filter.
-
- :type: float (0.0-100.0)
-
-.. class:: SCA_ANDController(SCA_IController)
-
- An AND controller activates only when all linked sensors are activated.
-
- There are no special python methods for this controller.
-
-.. class:: SCA_ActuatorSensor(SCA_ISensor)
-
- Actuator sensor detect change in actuator state of the parent object.
- It generates a positive pulse if the corresponding actuator is activated
- and a negative pulse if the actuator is deactivated.
-
- .. attribute:: actuator
-
- the name of the actuator that the sensor is monitoring.
-
- :type: string
-
-.. class:: SCA_AlwaysSensor(SCA_ISensor)
-
- This sensor is always activated.
-
-.. class:: SCA_DelaySensor(SCA_ISensor)
-
- The Delay sensor generates positive and negative triggers at precise time,
- expressed in number of frames. The delay parameter defines the length of the initial OFF period. A positive trigger is generated at the end of this period.
-
- The duration parameter defines the length of the ON period following the OFF period.
- There is a negative trigger at the end of the ON period. If duration is 0, the sensor stays ON and there is no negative trigger.
-
- The sensor runs the OFF-ON cycle once unless the repeat option is set: the OFF-ON cycle repeats indefinately (or the OFF cycle if duration is 0).
-
- Use :class:`SCA_ISensor.reset` at any time to restart sensor.
-
- .. attribute:: delay
-
- length of the initial OFF period as number of frame, 0 for immediate trigger.
-
- :type: integer.
-
- .. attribute:: duration
-
- length of the ON period in number of frame after the initial OFF period.
-
- If duration is greater than 0, a negative trigger is sent at the end of the ON pulse.
-
- :type: integer
-
- .. attribute:: repeat
-
- 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once.
-
- :type: integer
-
-.. class:: SCA_JoystickSensor(SCA_ISensor)
-
- This sensor detects player joystick events.
-
- .. attribute:: axisValues
-
- The state of the joysticks axis as a list of values :data:`numAxis` long. (read-only).
-
- :type: list of ints.
-
- Each specifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing.
- The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
-
- * left:[-32767, 0, ...]
- * right:[32767, 0, ...]
- * up:[0, -32767, ...]
- * down:[0, 32767, ...]
-
- .. attribute:: axisSingle
-
- like :data:`axisValues` but returns a single axis value that is set by the sensor. (read-only).
-
- :type: integer
-
- .. note::
-
- Only use this for "Single Axis" type sensors otherwise it will raise an error.
-
- .. attribute:: hatValues
-
- The state of the joysticks hats as a list of values :data:`numHats` long. (read-only).
-
- :type: list of ints
-
- Each specifying the direction of the hat from 1 to 12, 0 when inactive.
-
- Hat directions are as follows...
-
- * 0:None
- * 1:Up
- * 2:Right
- * 4:Down
- * 8:Left
- * 3:Up - Right
- * 6:Down - Right
- * 12:Down - Left
- * 9:Up - Left
-
- .. attribute:: hatSingle
-
- Like :data:`hatValues` but returns a single hat direction value that is set by the sensor. (read-only).
-
- :type: integer
-
- .. attribute:: numAxis
-
- The number of axes for the joystick at this index. (read-only).
-
- :type: integer
-
- .. attribute:: numButtons
-
- The number of buttons for the joystick at this index. (read-only).
-
- :type: integer
-
- .. attribute:: numHats
-
- The number of hats for the joystick at this index. (read-only).
-
- :type: integer
-
- .. attribute:: connected
-
- True if a joystick is connected at this joysticks index. (read-only).
-
- :type: boolean
-
- .. attribute:: index
-
- The joystick index to use (from 0 to 7). The first joystick is always 0.
-
- :type: integer
-
- .. attribute:: threshold
-
- Axis threshold. Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive.
-
- :type: integer
-
- .. attribute:: button
-
- The button index the sensor reacts to (first button = 0). When the "All Events" toggle is set, this option has no effect.
-
- :type: integer
-
- .. attribute:: axis
-
- The axis this sensor reacts to, as a list of two values [axisIndex, axisDirection]
-
- * axisIndex: the axis index to use when detecting axis movement, 1=primary directional control, 2=secondary directional control.
- * axisDirection: 0=right, 1=up, 2=left, 3=down.
-
- :type: [integer, integer]
-
- .. attribute:: hat
-
- The hat the sensor reacts to, as a list of two values: [hatIndex, hatDirection]
-
- * hatIndex: the hat index to use when detecting hat movement, 1=primary hat, 2=secondary hat (4 max).
- * hatDirection: 1-12.
-
- :type: [integer, integer]
-
- .. method:: getButtonActiveList()
-
- :return: A list containing the indicies of the currently pressed buttons.
- :rtype: list
-
- .. method:: getButtonStatus(buttonIndex)
-
- :arg buttonIndex: the button index, 0=first button
- :type buttonIndex: integer
- :return: The current pressed state of the specified button.
- :rtype: boolean
-
-.. class:: SCA_KeyboardSensor(SCA_ISensor)
-
- A keyboard sensor detects player key presses.
-
- See module :mod:`bge.events` for keycode values.
-
- .. attribute:: key
-
- The key code this sensor is looking for.
-
- :type: keycode from :mod:`bge.events` module
-
- .. attribute:: hold1
-
- The key code for the first modifier this sensor is looking for.
-
- :type: keycode from :mod:`bge.events` module
-
- .. attribute:: hold2
-
- The key code for the second modifier this sensor is looking for.
-
- :type: keycode from :mod:`bge.events` module
-
- .. attribute:: toggleProperty
-
- The name of the property that indicates whether or not to log keystrokes as a string.
-
- :type: string
-
- .. attribute:: targetProperty
-
- The name of the property that receives keystrokes in case in case a string is logged.
-
- :type: string
-
- .. attribute:: useAllKeys
-
- Flag to determine whether or not to accept all keys.
-
- :type: boolean
-
- .. attribute:: events
-
- a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only).
-
- :type: list [[:ref:`keycode<keyboard-keys>`, :ref:`status<input-status>`], ...]
-
- .. method:: getKeyStatus(keycode)
-
- Get the status of a key.
-
- :arg keycode: The code that represents the key you want to get the state of, use one of :ref:`these constants<keyboard-keys>`
- :type keycode: integer
- :return: The state of the given key, can be one of :ref:`these constants<input-status>`
- :rtype: int
-
-.. class:: SCA_NANDController(SCA_IController)
-
- An NAND controller activates when all linked sensors are not active.
-
- There are no special python methods for this controller.
-
-.. class:: SCA_NORController(SCA_IController)
-
- An NOR controller activates only when all linked sensors are de-activated.
-
- There are no special python methods for this controller.
-
-.. class:: SCA_ORController(SCA_IController)
-
- An OR controller activates when any connected sensor activates.
-
- There are no special python methods for this controller.
-
-.. class:: SCA_PropertyActuator(SCA_IActuator)
-
- Property Actuator
-
- .. attribute:: propName
-
- the property on which to operate.
-
- :type: string
-
- .. attribute:: value
-
- the value with which the actuator operates.
-
- :type: string
-
- .. attribute:: mode
-
- TODO - add constants to game logic dict!.
-
- :type: integer
-
-.. class:: SCA_PropertySensor(SCA_ISensor)
-
- Activates when the game object property matches.
-
- .. attribute:: mode
-
- Type of check on the property. Can be one of :ref:`these constants <logic-property-sensor>`
-
- :type: integer.
-
- .. attribute:: propName
-
- the property the sensor operates.
-
- :type: string
-
- .. attribute:: value
-
- the value with which the sensor compares to the value of the property.
-
- :type: string
-
- .. attribute:: min
-
- the minimum value of the range used to evaluate the property when in interval mode.
-
- :type: string
-
- .. attribute:: max
-
- the maximum value of the range used to evaluate the property when in interval mode.
-
- :type: string
-
-.. class:: SCA_PythonController(SCA_IController)
-
- A Python controller uses a Python script to activate it's actuators,
- based on it's sensors.
-
- .. attribute:: script
-
- The value of this variable depends on the execution methid.
-
- * When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts.
- * When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts.
-
- :type: string
-
- .. note::
-
- Once this is set the script name given for warnings will remain unchanged.
-
- .. attribute:: mode
-
- the execution mode for this controller (read-only).
-
- * Script: 0, Execite the :data:`script` as a python code.
- * Module: 1, Execite the :data:`script` as a module and function.
-
- :type: integer
-
- .. method:: activate(actuator)
-
- Activates an actuator attached to this controller.
-
- :arg actuator: The actuator to operate on.
- :type actuator: actuator or the actuator name as a string
-
- .. method:: deactivate(actuator)
-
- Deactivates an actuator attached to this controller.
-
- :arg actuator: The actuator to operate on.
- :type actuator: actuator or the actuator name as a string
-
-.. class:: SCA_RandomActuator(SCA_IActuator)
-
- Random Actuator
-
- .. attribute:: seed
-
- Seed of the random number generator.
-
- :type: integer.
-
- Equal seeds produce equal series. If the seed is 0, the generator will produce the same value on every call.
-
- .. attribute:: para1
-
- the first parameter of the active distribution.
-
- :type: float, read-only.
-
- Refer to the documentation of the generator types for the meaning of this value.
-
- .. attribute:: para2
-
- the second parameter of the active distribution.
-
- :type: float, read-only
-
- Refer to the documentation of the generator types for the meaning of this value.
-
- .. attribute:: distribution
-
- Distribution type. (read-only). Can be one of :ref:`these constants <logic-random-distributions>`
-
- :type: integer
-
- .. attribute:: propName
-
- the name of the property to set with the random value.
-
- :type: string
-
- If the generator and property types do not match, the assignment is ignored.
-
- .. method:: setBoolConst(value)
-
- Sets this generator to produce a constant boolean value.
-
- :arg value: The value to return.
- :type value: boolean
-
- .. method:: setBoolUniform()
-
- Sets this generator to produce a uniform boolean distribution.
-
- The generator will generate True or False with 50% chance.
-
- .. method:: setBoolBernouilli(value)
-
- Sets this generator to produce a Bernouilli distribution.
-
- :arg value: Specifies the proportion of False values to produce.
-
- * 0.0: Always generate True
- * 1.0: Always generate False
- :type value: float
-
- .. method:: setIntConst(value)
-
- Sets this generator to always produce the given value.
-
- :arg value: the value this generator produces.
- :type value: integer
-
- .. method:: setIntUniform(lower_bound, upper_bound)
-
- Sets this generator to produce a random value between the given lower and
- upper bounds (inclusive).
-
- :type lower_bound: integer
- :type upper_bound: integer
-
- .. method:: setIntPoisson(value)
-
- Generate a Poisson-distributed number.
-
- This performs a series of Bernouilli tests with parameter value.
- It returns the number of tries needed to achieve succes.
-
- :type value: float
-
- .. method:: setFloatConst(value)
-
- Always generate the given value.
-
- :type value: float
-
- .. method:: setFloatUniform(lower_bound, upper_bound)
-
- Generates a random float between lower_bound and upper_bound with a
- uniform distribution.
-
- :type lower_bound: float
- :type upper_bound: float
-
- .. method:: setFloatNormal(mean, standard_deviation)
-
- Generates a random float from the given normal distribution.
-
- :arg mean: The mean (average) value of the generated numbers
- :type mean: float
- :arg standard_deviation: The standard deviation of the generated numbers.
- :type standard_deviation: float
-
- .. method:: setFloatNegativeExponential(half_life)
-
- Generate negative-exponentially distributed numbers.
-
- The half-life 'time' is characterized by half_life.
-
- :type half_life: float
-
-.. class:: SCA_RandomSensor(SCA_ISensor)
-
- This sensor activates randomly.
-
- .. attribute:: lastDraw
-
- The seed of the random number generator.
-
- :type: integer
-
- .. attribute:: seed
-
- The seed of the random number generator.
-
- :type: integer
-
-.. class:: SCA_XNORController(SCA_IController)
-
- An XNOR controller activates when all linked sensors are the same (activated or inative).
-
- There are no special python methods for this controller.
-
-.. class:: SCA_XORController(SCA_IController)
-
- An XOR controller activates when there is the input is mixed, but not when all are on or off.
-
- There are no special python methods for this controller.
-
-.. class:: KX_Camera(KX_GameObject)
-
- A Camera object.
-
- .. data:: INSIDE
-
- See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
-
- .. data:: INTERSECT
-
- See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
-
- .. data:: OUTSIDE
-
- See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
-
- .. attribute:: lens
-
- The camera's lens value.
-
- :type: float
-
- .. attribute:: ortho_scale
-
- The camera's view scale when in orthographic mode.
-
- :type: float
-
- .. attribute:: near
-
- The camera's near clip distance.
-
- :type: float
-
- .. attribute:: far
-
- The camera's far clip distance.
-
- :type: float
-
- .. attribute:: perspective
-
- True if this camera has a perspective transform, False for an orthographic projection.
-
- :type: boolean
-
- .. attribute:: frustum_culling
-
- True if this camera is frustum culling.
-
- :type: boolean
-
- .. 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).
-
- :type: 4x4 Matrix [[float]]
-
- .. attribute:: modelview_matrix
-
- This camera's 4x4 model view matrix. (read-only).
-
- :type: 4x4 Matrix [[float]]
-
- .. note::
-
- This matrix is regenerated every frame from the camera's position and orientation. Also, this is the identity matrix prior to rendering the first frame (any Python done on frame 1).
-
- .. attribute:: camera_to_world
-
- This camera's camera to world transform. (read-only).
-
- :type: 4x4 Matrix [[float]]
-
- .. note::
-
- This matrix is regenerated every frame from the camera's position and orientation.
-
- .. attribute:: world_to_camera
-
- This camera's world to camera transform. (read-only).
-
- :type: 4x4 Matrix [[float]]
-
- .. note::
-
- Regenerated every frame from the camera's position and orientation.
-
- .. note::
-
- This is camera_to_world inverted.
-
- .. attribute:: useViewport
-
- True when the camera is used as a viewport, set True to enable a viewport for this camera.
-
- :type: boolean
-
- .. method:: sphereInsideFrustum(centre, radius)
-
- Tests the given sphere against the view frustum.
-
- :arg centre: The centre of the sphere (in world coordinates.)
- :type centre: list [x, y, z]
- :arg radius: the radius of the sphere
- :type radius: float
- :return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT`
- :rtype: integer
-
- .. note::
-
- When the camera is first initialized the result will be invalid because the projection matrix has not been set.
-
- .. code-block:: python
-
- from bge import logic
- cont = logic.getCurrentController()
- cam = cont.owner
-
- # A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]
- if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):
- # Sphere is inside frustum !
- # Do something useful !
- else:
- # Sphere is outside frustum
-
- .. method:: boxInsideFrustum(box)
-
- Tests the given box against the view frustum.
-
- :arg box: Eight (8) corner points of the box (in world coordinates.)
- :type box: list of lists
- :return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT`
-
- .. note::
-
- When the camera is first initialized the result will be invalid because the projection matrix has not been set.
-
- .. code-block:: python
-
- from bge import logic
- cont = logic.getCurrentController()
- cam = cont.owner
-
- # Box to test...
- box = []
- box.append([-1.0, -1.0, -1.0])
- box.append([-1.0, -1.0, 1.0])
- box.append([-1.0, 1.0, -1.0])
- box.append([-1.0, 1.0, 1.0])
- box.append([ 1.0, -1.0, -1.0])
- box.append([ 1.0, -1.0, 1.0])
- box.append([ 1.0, 1.0, -1.0])
- box.append([ 1.0, 1.0, 1.0])
-
- if (cam.boxInsideFrustum(box) != cam.OUTSIDE):
- # Box is inside/intersects frustum !
- # Do something useful !
- else:
- # Box is outside the frustum !
-
- .. method:: pointInsideFrustum(point)
-
- Tests the given point against the view frustum.
-
- :arg point: The point to test (in world coordinates.)
- :type point: 3D Vector
- :return: True if the given point is inside this camera's viewing frustum.
- :rtype: boolean
-
- .. note::
-
- When the camera is first initialized the result will be invalid because the projection matrix has not been set.
-
- .. code-block:: python
-
- from bge import logic
- cont = logic.getCurrentController()
- cam = cont.owner
-
- # Test point [0.0, 0.0, 0.0]
- if (cam.pointInsideFrustum([0.0, 0.0, 0.0])):
- # Point is inside frustum !
- # Do something useful !
- else:
- # Box is outside the frustum !
-
- .. method:: getCameraToWorld()
-
- Returns the camera-to-world transform.
-
- :return: the camera-to-world transform matrix.
- :rtype: matrix (4x4 list)
-
- .. method:: getWorldToCamera()
-
- Returns the world-to-camera transform.
-
- This returns the inverse matrix of getCameraToWorld().
-
- :return: the world-to-camera transform matrix.
- :rtype: matrix (4x4 list)
-
- .. method:: setOnTop()
-
- Set this cameras viewport ontop of all other viewport.
-
- .. method:: setViewport(left, bottom, right, top)
-
- Sets the region of this viewport on the screen in pixels.
-
- Use :data:`bge.render.getWindowHeight` and :data:`bge.render.getWindowWidth` to calculate values relative to the entire display.
-
- :arg left: left pixel coordinate of this viewport
- :type left: integer
- :arg bottom: bottom pixel coordinate of this viewport
- :type bottom: integer
- :arg right: right pixel coordinate of this viewport
- :type right: integer
- :arg top: top pixel coordinate of this viewport
- :type top: integer
-
- .. method:: getScreenPosition(object)
-
- Gets the position of an object projected on screen space.
-
- .. code-block:: python
-
- # For an object in the middle of the screen, coord = [0.5, 0.5]
- coord = camera.getScreenPosition(object)
-
- :arg object: object name or list [x, y, z]
- :type object: :class:`KX_GameObject` or 3D Vector
- :return: the object's position in screen coordinates.
- :rtype: list [x, y]
-
- .. method:: getScreenVect(x, y)
-
- Gets the vector from the camera position in the screen coordinate direction.
-
- :arg x: X Axis
- :type x: float
- :arg y: Y Axis
- :type y: float
- :rtype: 3D Vector
- :return: The vector from screen coordinate.
-
- .. code-block:: python
-
- # Gets the vector of the camera front direction:
- m_vect = camera.getScreenVect(0.5, 0.5)
-
- .. method:: getScreenRay(x, y, dist=inf, property=None)
-
- Look towards a screen coordinate (x, y) and find first object hit within dist that matches prop.
- The ray is similar to KX_GameObject->rayCastTo.
-
- :arg x: X Axis
- :type x: float
- :arg y: Y Axis
- :type y: float
- :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
- :type dist: float
- :arg property: property name that object must have; can be omitted => detect any object
- :type property: string
- :rtype: :class:`KX_GameObject`
- :return: the first object hit or None if no object or object does not match prop
-
- .. code-block:: python
-
- # Gets an object with a property "wall" in front of the camera within a distance of 100:
- target = camera.getScreenRay(0.5, 0.5, 100, "wall")
-
-.. class:: BL_ArmatureObject(KX_GameObject)
-
- An armature object.
-
- .. attribute:: constraints
-
- The list of armature constraint defined on this armature.
- Elements of the list can be accessed by index or string.
- The key format for string access is '<bone_name>:<constraint_name>'.
-
- :type: list of :class:`BL_ArmatureConstraint`
-
- .. attribute:: channels
-
- The list of armature channels.
- Elements of the list can be accessed by index or name the bone.
-
- :type: list of :class:`BL_ArmatureChannel`
-
- .. method:: update()
-
- Ensures that the armature will be updated on next graphic frame.
-
- This action is unecessary if a KX_ArmatureActuator with mode run is active
- or if an action is playing. Use this function in other cases. It must be called
- on each frame to ensure that the armature is updated continously.
-
-.. class:: BL_ArmatureActuator(SCA_IActuator)
-
- Armature Actuators change constraint condition on armatures.
-
- .. attribute:: type
-
- The type of action that the actuator executes when it is active.
-
- Can be one of :ref:`these constants <armatureactuator-constants-type>`
-
- :type: integer
-
- .. attribute:: constraint
-
- The constraint object this actuator is controlling.
-
- :type: :class:`BL_ArmatureConstraint`
-
- .. attribute:: target
-
- The object that this actuator will set as primary target to the constraint it controls.
-
- :type: :class:`KX_GameObject`
-
- .. attribute:: subtarget
-
- The object that this actuator will set as secondary target to the constraint it controls.
-
- :type: :class:`KX_GameObject`.
-
- .. note::
-
- Currently, the only secondary target is the pole target for IK constraint.
-
- .. attribute:: weight
-
- The weight this actuator will set on the constraint it controls.
-
- :type: float.
-
- .. note::
-
- Currently only the IK constraint has a weight. It must be a value between 0 and 1.
-
- .. note::
-
- A weight of 0 disables a constraint while still updating constraint runtime values (see :class:`BL_ArmatureConstraint`)
-
- .. attribute:: influence
-
- The influence this actuator will set on the constraint it controls.
-
- :type: float.
-
-.. class:: KX_ArmatureSensor(SCA_ISensor)
-
- Armature sensor detect conditions on armatures.
-
- .. attribute:: type
-
- The type of measurement that the sensor make when it is active.
-
- Can be one of :ref:`these constants <armaturesensor-type>`
-
- :type: integer.
-
- .. attribute:: constraint
-
- The constraint object this sensor is watching.
-
- :type: :class:`BL_ArmatureConstraint`
-
- .. attribute:: value
-
- The threshold used in the comparison with the constraint error
- The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver
- The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver
- The linear error on CopyPose is always >= 0: it is the norm of the distance between the target and the bone
- The rotation error on CopyPose is always >= 0: it is the norm of the equivalent rotation vector between the bone and the target orientations
- The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller.
-
- :type: float
-
-.. class:: BL_ArmatureConstraint(PyObjectPlus)
-
- Proxy to Armature Constraint. Allows to change constraint on the fly.
- Obtained through :class:`BL_ArmatureObject`.constraints.
-
- .. note::
-
- Not all armature constraints are supported in the GE.
-
-
- .. attribute:: type
-
- Type of constraint, (read-only).
-
- Use one of :ref:`these constants<armatureconstraint-constants-type>`.
-
- :type: integer, one of CONSTRAINT_TYPE_* constants
-
- .. attribute:: name
-
- Name of constraint constructed as <bone_name>:<constraint_name>. constraints list.
-
- :type: string
-
- This name is also the key subscript on :class:`BL_ArmatureObject`.
-
- .. attribute:: enforce
-
- fraction of constraint effect that is enforced. Between 0 and 1.
-
- :type: float
-
- .. attribute:: headtail
-
- Position of target between head and tail of the target bone: 0=head, 1=tail.
-
- :type: float.
-
- .. note::
-
- Only used if the target is a bone (i.e target object is an armature.
-
- .. attribute:: lin_error
-
- runtime linear error (in Blender units) on constraint at the current frame.
-
- This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver.
-
- :type: float
-
- .. attribute:: rot_error
-
- Runtime rotation error (in radiant) on constraint at the current frame.
-
- :type: float.
-
- This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver.
-
- It is only set if the constraint has a rotation part, for example, a CopyPose+Rotation IK constraint.
-
- .. attribute:: target
-
- Primary target object for the constraint. The position of this object in the GE will be used as target for the constraint.
-
- :type: :class:`KX_GameObject`.
-
- .. attribute:: subtarget
-
- Secondary target object for the constraint. The position of this object in the GE will be used as secondary target for the constraint.
-
- :type: :class:`KX_GameObject`.
-
- Currently this is only used for pole target on IK constraint.
-
- .. attribute:: active
-
- True if the constraint is active.
-
- :type: boolean
-
- .. note::
-
- An inactive constraint does not update lin_error and rot_error.
-
- .. attribute:: ik_weight
-
- Weight of the IK constraint between 0 and 1.
-
- Only defined for IK constraint.
-
- :type: float
-
- .. attribute:: ik_type
-
- Type of IK constraint, (read-only).
-
- Use one of :ref:`these constants<armatureconstraint-constants-ik-type>`.
-
- :type: integer.
-
- .. attribute:: ik_flag
-
- Combination of IK constraint option flags, read-only.
-
- Use one of :ref:`these constants<armatureconstraint-constants-ik-flag>`.
-
- :type: integer
-
- .. attribute:: ik_dist
-
- Distance the constraint is trying to maintain with target, only used when ik_type=CONSTRAINT_IK_DISTANCE.
-
- :type: float
-
- .. attribute:: ik_mode
-
- Use one of :ref:`these constants<armatureconstraint-constants-ik-mode>`.
-
- Additional mode for IK constraint. Currently only used for Distance constraint:
-
- :type: integer
-
-.. class:: BL_ArmatureChannel(PyObjectPlus)
-
- 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.
-
- .. attribute:: name
-
- channel name (=bone name), read-only.
-
- :type: string
-
- .. attribute:: bone
-
- return the bone object corresponding to this pose channel, read-only.
-
- :type: :class:`BL_ArmatureBone`
-
- .. attribute:: parent
-
- return the parent channel object, None if root channel, read-only.
-
- :type: :class:`BL_ArmatureChannel`
-
- .. attribute:: has_ik
-
- true if the bone is part of an active IK chain, read-only.
- This flag is not set when an IK constraint is defined but not enabled (miss target information for example).
-
- :type: boolean
-
- .. attribute:: ik_dof_x
-
- true if the bone is free to rotation in the X axis, read-only.
-
- :type: boolean
-
- .. attribute:: ik_dof_y
-
- true if the bone is free to rotation in the Y axis, read-only.
-
- :type: boolean
-
- .. attribute:: ik_dof_z
-
- true if the bone is free to rotation in the Z axis, read-only.
-
- :type: boolean
-
- .. attribute:: ik_limit_x
-
- true if a limit is imposed on X rotation, read-only.
-
- :type: boolean
-
- .. attribute:: ik_limit_y
-
- true if a limit is imposed on Y rotation, read-only.
-
- :type: boolean
-
- .. attribute:: ik_limit_z
-
- true if a limit is imposed on Z rotation, read-only.
-
- :type: boolean
-
- .. attribute:: ik_rot_control
-
- true if channel rotation should applied as IK constraint, read-only.
-
- :type: boolean
-
- .. attribute:: ik_lin_control
-
- true if channel size should applied as IK constraint, read-only.
-
- :type: boolean
-
- .. attribute:: location
-
- displacement of the bone head in armature local space, read-write.
-
- :type: vector [X, Y, Z].
-
- .. note::
-
- You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
-
- .. note::
-
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`).
-
- .. attribute:: scale
-
- scale of the bone relative to its parent, read-write.
-
- :type: vector [sizeX, sizeY, sizeZ].
-
- .. note::
-
- An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
-
- .. note::
-
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
-
- .. attribute:: rotation_quaternion
-
- rotation of the bone relative to its parent expressed as a quaternion, read-write.
-
- :type: vector [qr, qi, qj, qk].
-
- .. note::
-
- This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
-
- .. note::
-
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
-
- .. attribute:: rotation_euler
-
- rotation of the bone relative to its parent expressed as a set of euler angles, read-write.
-
- :type: vector [X, Y, Z].
-
- .. note::
-
- This field is only used if rotation_mode is > 0. You must always pass the angles in [X, Y, Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation.
-
- .. note::
-
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
-
- .. attribute:: rotation_mode
-
- Method of updating the bone rotation, read-write.
-
- :type: integer (one of :ref:`these constants <armaturechannel-constants-rotation-mode>`)
-
- .. attribute:: channel_matrix
-
- pose matrix in bone space (deformation of the bone due to action, constraint, etc), Read-only.
- This field is updated after the graphic render, it represents the current pose.
-
- :type: matrix [4][4]
-
- .. attribute:: pose_matrix
-
- pose matrix in armature space, read-only,
- This field is updated after the graphic render, it represents the current pose.
-
- :type: matrix [4][4]
-
- .. attribute:: pose_head
-
- position of bone head in armature space, read-only.
-
- :type: vector [x, y, z]
-
- .. attribute:: pose_tail
-
- position of bone tail in armature space, read-only.
-
- :type: vector [x, y, z]
-
- .. attribute:: ik_min_x
-
- minimum value of X rotation in degree (<= 0) when X rotation is limited (see ik_limit_x), read-only.
-
- :type: float
-
- .. attribute:: ik_max_x
-
- maximum value of X rotation in degree (>= 0) when X rotation is limited (see ik_limit_x), read-only.
-
- :type: float
-
- .. attribute:: ik_min_y
-
- minimum value of Y rotation in degree (<= 0) when Y rotation is limited (see ik_limit_y), read-only.
-
- :type: float
-
- .. attribute:: ik_max_y
-
- maximum value of Y rotation in degree (>= 0) when Y rotation is limited (see ik_limit_y), read-only.
-
- :type: float
-
- .. attribute:: ik_min_z
-
- minimum value of Z rotation in degree (<= 0) when Z rotation is limited (see ik_limit_z), read-only.
-
- :type: float
-
- .. attribute:: ik_max_z
-
- maximum value of Z rotation in degree (>= 0) when Z rotation is limited (see ik_limit_z), read-only.
-
- :type: float
-
- .. attribute:: ik_stiffness_x
-
- bone rotation stiffness in X axis, read-only.
-
- :type: float between 0 and 1
-
- .. attribute:: ik_stiffness_y
-
- bone rotation stiffness in Y axis, read-only.
-
- :type: float between 0 and 1
-
- .. attribute:: ik_stiffness_z
-
- bone rotation stiffness in Z axis, read-only.
-
- :type: float between 0 and 1
-
- .. attribute:: ik_stretch
-
- ratio of scale change that is allowed, 0=bone can't change size, read-only.
-
- :type: float
-
- .. attribute:: ik_rot_weight
-
- weight of rotation constraint when ik_rot_control is set, read-write.
-
- :type: float between 0 and 1
-
- .. attribute:: ik_lin_weight
-
- weight of size constraint when ik_lin_control is set, read-write.
-
- :type: float between 0 and 1
-
- .. attribute:: joint_rotation
-
- Control bone rotation in term of joint angle (for robotic applications), read-write.
-
- When writing to this attribute, you pass a [x, y, z] vector and an appropriate set of euler angles or quaternion is calculated according to the rotation_mode.
-
- When you read this attribute, the current pose matrix is converted into a [x, y, z] vector representing the joint angles.
-
- The value and the meaning of the x, y, z depends on the ik_dof_x/ik_dof_y/ik_dof_z attributes:
-
- * 1DoF joint X, Y or Z: the corresponding x, y, or z value is used an a joint angle in radiant
- * 2DoF joint X+Y or Z+Y: treated as 2 successive 1DoF joints: first X or Z, then Y. The x or z value is used as a joint angle in radiant along the X or Z axis, followed by a rotation along the new Y axis of y radiants.
- * 2DoF joint X+Z: treated as a 2DoF joint with rotation axis on the X/Z plane. The x and z values are used as the coordinates of the rotation vector in the X/Z plane.
- * 3DoF joint X+Y+Z: treated as a revolute joint. The [x, y, z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose.
-
- :type: vector [x, y, z]
-
- .. note::
-
- The bone must be part of an IK chain if you want to set the ik_dof_x/ik_dof_y/ik_dof_z attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target) the IK solver will not run but the IK panel will show up on the UI for each bone in the chain.
-
- .. note::
-
- [0, 0, 0] always corresponds to the rest pose.
-
- .. note::
-
- You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see :data:`BL_ArmatureObject.update`).
-
- .. note::
-
- You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute.
-
-.. class:: BL_ArmatureBone(PyObjectPlus)
-
- Proxy to Blender bone structure. All fields are read-only and comply to RNA names.
- All space attribute correspond to the rest pose.
-
- .. attribute:: name
-
- bone name.
-
- :type: string
-
- .. attribute:: connected
-
- true when the bone head is struck to the parent's tail.
-
- :type: boolean
-
- .. attribute:: hinge
-
- true when bone doesn't inherit rotation or scale from parent bone.
-
- :type: boolean
-
- .. attribute:: inherit_scale
-
- true when bone inherits scaling from parent bone.
-
- :type: boolean
-
- .. attribute:: bbone_segments
-
- number of B-bone segments.
-
- :type: integer
-
- .. attribute:: roll
-
- bone rotation around head-tail axis.
-
- :type: float
-
- .. attribute:: head
-
- location of head end of the bone in parent bone space.
-
- :type: vector [x, y, z]
-
- .. attribute:: tail
-
- location of head end of the bone in parent bone space.
-
- :type: vector [x, y, z]
-
- .. attribute:: length
-
- bone length.
-
- :type: float
-
- .. attribute:: arm_head
-
- location of head end of the bone in armature space.
-
- :type: vector [x, y, z]
-
- .. attribute:: arm_tail
-
- location of tail end of the bone in armature space.
-
- :type: vector [x, y, z]
-
- .. attribute:: arm_mat
-
- matrix of the bone head in armature space.
-
- :type: matrix [4][4]
-
- .. note::
-
- This matrix has no scale part.
-
- .. attribute:: bone_mat
-
- rotation matrix of the bone in parent bone space.
-
- :type: matrix [3][3]
-
- .. attribute:: parent
-
- parent bone, or None for root bone.
-
- :type: :class:`BL_ArmatureBone`
-
- .. attribute:: children
-
- list of bone's children.
-
- :type: list of :class:`BL_ArmatureBone`
diff --git a/doc/python_api/rst/bge_types/bge.types.BL_ActionActuator.rst b/doc/python_api/rst/bge_types/bge.types.BL_ActionActuator.rst
new file mode 100644
index 00000000000..9b95a5ba611
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.BL_ActionActuator.rst
@@ -0,0 +1,78 @@
+BL_ActionActuator(SCA_IActuator)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: BL_ActionActuator(SCA_IActuator)
+
+ Action Actuators apply an action to an actor.
+
+ .. attribute:: action
+
+ The name of the action to set as the current action.
+
+ :type: string
+
+ .. attribute:: frameStart
+
+ Specifies the starting frame of the animation.
+
+ :type: float
+
+ .. attribute:: frameEnd
+
+ Specifies the ending frame of the animation.
+
+ :type: float
+
+ .. attribute:: blendIn
+
+ Specifies the number of frames of animation to generate when making transitions between actions.
+
+ :type: float
+
+ .. attribute:: priority
+
+ Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers.
+
+ :type: integer
+
+ .. attribute:: frame
+
+ Sets the current frame for the animation.
+
+ :type: float
+
+ .. attribute:: propName
+
+ Sets the property to be used in FromProp playback mode.
+
+ :type: string
+
+ .. attribute:: blendTime
+
+ Sets the internal frame timer. This property must be in the range from 0.0 to blendIn.
+
+ :type: float
+
+ .. attribute:: mode
+
+ The operation mode of the actuator. Can be one of :ref:`these constants<action-actuator>`.
+
+ :type: integer
+
+ .. attribute:: useContinue
+
+ The actions continue option, True or False. When True, the action will always play from where last left off,
+ otherwise negative events to this actuator will reset it to its start frame.
+
+ :type: boolean
+
+ .. attribute:: framePropName
+
+ The name of the property that is set to the current frame number.
+
+ :type: string
+
diff --git a/doc/python_api/rst/bge_types/bge.types.BL_ArmatureActuator.rst b/doc/python_api/rst/bge_types/bge.types.BL_ArmatureActuator.rst
new file mode 100644
index 00000000000..579186ac1d6
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.BL_ArmatureActuator.rst
@@ -0,0 +1,61 @@
+BL_ArmatureActuator(SCA_IActuator)
+==================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: BL_ArmatureActuator(SCA_IActuator)
+
+ Armature Actuators change constraint condition on armatures.
+
+ .. attribute:: type
+
+ The type of action that the actuator executes when it is active.
+
+ Can be one of :ref:`these constants <armatureactuator-constants-type>`
+
+ :type: integer
+
+ .. attribute:: constraint
+
+ The constraint object this actuator is controlling.
+
+ :type: :class:`BL_ArmatureConstraint`
+
+ .. attribute:: target
+
+ The object that this actuator will set as primary target to the constraint it controls.
+
+ :type: :class:`KX_GameObject`
+
+ .. attribute:: subtarget
+
+ The object that this actuator will set as secondary target to the constraint it controls.
+
+ :type: :class:`KX_GameObject`.
+
+ .. note::
+
+ Currently, the only secondary target is the pole target for IK constraint.
+
+ .. attribute:: weight
+
+ The weight this actuator will set on the constraint it controls.
+
+ :type: float.
+
+ .. note::
+
+ Currently only the IK constraint has a weight. It must be a value between 0 and 1.
+
+ .. note::
+
+ A weight of 0 disables a constraint while still updating constraint runtime values (see :class:`BL_ArmatureConstraint`)
+
+ .. attribute:: influence
+
+ The influence this actuator will set on the constraint it controls.
+
+ :type: float.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.BL_ArmatureBone.rst b/doc/python_api/rst/bge_types/bge.types.BL_ArmatureBone.rst
new file mode 100644
index 00000000000..14a9ebe9ef3
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.BL_ArmatureBone.rst
@@ -0,0 +1,105 @@
+BL_ArmatureBone(PyObjectPlus)
+=============================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: BL_ArmatureBone(PyObjectPlus)
+
+ Proxy to Blender bone structure. All fields are read-only and comply to RNA names.
+ All space attribute correspond to the rest pose.
+
+ .. attribute:: name
+
+ bone name.
+
+ :type: string
+
+ .. attribute:: connected
+
+ true when the bone head is struck to the parent's tail.
+
+ :type: boolean
+
+ .. attribute:: hinge
+
+ true when bone doesn't inherit rotation or scale from parent bone.
+
+ :type: boolean
+
+ .. attribute:: inherit_scale
+
+ true when bone inherits scaling from parent bone.
+
+ :type: boolean
+
+ .. attribute:: bbone_segments
+
+ number of B-bone segments.
+
+ :type: integer
+
+ .. attribute:: roll
+
+ bone rotation around head-tail axis.
+
+ :type: float
+
+ .. attribute:: head
+
+ location of head end of the bone in parent bone space.
+
+ :type: vector [x, y, z]
+
+ .. attribute:: tail
+
+ location of head end of the bone in parent bone space.
+
+ :type: vector [x, y, z]
+
+ .. attribute:: length
+
+ bone length.
+
+ :type: float
+
+ .. attribute:: arm_head
+
+ location of head end of the bone in armature space.
+
+ :type: vector [x, y, z]
+
+ .. attribute:: arm_tail
+
+ location of tail end of the bone in armature space.
+
+ :type: vector [x, y, z]
+
+ .. attribute:: arm_mat
+
+ matrix of the bone head in armature space.
+
+ :type: matrix [4][4]
+
+ .. note::
+
+ This matrix has no scale part.
+
+ .. attribute:: bone_mat
+
+ rotation matrix of the bone in parent bone space.
+
+ :type: matrix [3][3]
+
+ .. attribute:: parent
+
+ parent bone, or None for root bone.
+
+ :type: :class:`BL_ArmatureBone`
+
+ .. attribute:: children
+
+ list of bone's children.
+
+ :type: list of :class:`BL_ArmatureBone`
diff --git a/doc/python_api/rst/bge_types/bge.types.BL_ArmatureChannel.rst b/doc/python_api/rst/bge_types/bge.types.BL_ArmatureChannel.rst
new file mode 100644
index 00000000000..07220534b28
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.BL_ArmatureChannel.rst
@@ -0,0 +1,278 @@
+BL_ArmatureChannel(PyObjectPlus)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: BL_ArmatureChannel(PyObjectPlus)
+
+ 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.
+
+ .. attribute:: name
+
+ channel name (=bone name), read-only.
+
+ :type: string
+
+ .. attribute:: bone
+
+ return the bone object corresponding to this pose channel, read-only.
+
+ :type: :class:`BL_ArmatureBone`
+
+ .. attribute:: parent
+
+ return the parent channel object, None if root channel, read-only.
+
+ :type: :class:`BL_ArmatureChannel`
+
+ .. attribute:: has_ik
+
+ true if the bone is part of an active IK chain, read-only.
+ This flag is not set when an IK constraint is defined but not enabled (miss target information for example).
+
+ :type: boolean
+
+ .. attribute:: ik_dof_x
+
+ true if the bone is free to rotation in the X axis, read-only.
+
+ :type: boolean
+
+ .. attribute:: ik_dof_y
+
+ true if the bone is free to rotation in the Y axis, read-only.
+
+ :type: boolean
+
+ .. attribute:: ik_dof_z
+
+ true if the bone is free to rotation in the Z axis, read-only.
+
+ :type: boolean
+
+ .. attribute:: ik_limit_x
+
+ true if a limit is imposed on X rotation, read-only.
+
+ :type: boolean
+
+ .. attribute:: ik_limit_y
+
+ true if a limit is imposed on Y rotation, read-only.
+
+ :type: boolean
+
+ .. attribute:: ik_limit_z
+
+ true if a limit is imposed on Z rotation, read-only.
+
+ :type: boolean
+
+ .. attribute:: ik_rot_control
+
+ true if channel rotation should applied as IK constraint, read-only.
+
+ :type: boolean
+
+ .. attribute:: ik_lin_control
+
+ true if channel size should applied as IK constraint, read-only.
+
+ :type: boolean
+
+ .. attribute:: location
+
+ displacement of the bone head in armature local space, read-write.
+
+ :type: vector [X, Y, Z].
+
+ .. note::
+
+ You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
+
+ .. note::
+
+ Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`).
+
+ .. attribute:: scale
+
+ scale of the bone relative to its parent, read-write.
+
+ :type: vector [sizeX, sizeY, sizeZ].
+
+ .. note::
+
+ An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
+
+ .. note::
+
+ Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
+
+ .. attribute:: rotation_quaternion
+
+ rotation of the bone relative to its parent expressed as a quaternion, read-write.
+
+ :type: vector [qr, qi, qj, qk].
+
+ .. note::
+
+ This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
+
+ .. note::
+
+ Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
+
+ .. attribute:: rotation_euler
+
+ rotation of the bone relative to its parent expressed as a set of euler angles, read-write.
+
+ :type: vector [X, Y, Z].
+
+ .. note::
+
+ This field is only used if rotation_mode is > 0. You must always pass the angles in [X, Y, Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation.
+
+ .. note::
+
+ Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
+
+ .. attribute:: rotation_mode
+
+ Method of updating the bone rotation, read-write.
+
+ :type: integer (one of :ref:`these constants <armaturechannel-constants-rotation-mode>`)
+
+ .. attribute:: channel_matrix
+
+ pose matrix in bone space (deformation of the bone due to action, constraint, etc), Read-only.
+ This field is updated after the graphic render, it represents the current pose.
+
+ :type: matrix [4][4]
+
+ .. attribute:: pose_matrix
+
+ pose matrix in armature space, read-only,
+ This field is updated after the graphic render, it represents the current pose.
+
+ :type: matrix [4][4]
+
+ .. attribute:: pose_head
+
+ position of bone head in armature space, read-only.
+
+ :type: vector [x, y, z]
+
+ .. attribute:: pose_tail
+
+ position of bone tail in armature space, read-only.
+
+ :type: vector [x, y, z]
+
+ .. attribute:: ik_min_x
+
+ minimum value of X rotation in degree (<= 0) when X rotation is limited (see ik_limit_x), read-only.
+
+ :type: float
+
+ .. attribute:: ik_max_x
+
+ maximum value of X rotation in degree (>= 0) when X rotation is limited (see ik_limit_x), read-only.
+
+ :type: float
+
+ .. attribute:: ik_min_y
+
+ minimum value of Y rotation in degree (<= 0) when Y rotation is limited (see ik_limit_y), read-only.
+
+ :type: float
+
+ .. attribute:: ik_max_y
+
+ maximum value of Y rotation in degree (>= 0) when Y rotation is limited (see ik_limit_y), read-only.
+
+ :type: float
+
+ .. attribute:: ik_min_z
+
+ minimum value of Z rotation in degree (<= 0) when Z rotation is limited (see ik_limit_z), read-only.
+
+ :type: float
+
+ .. attribute:: ik_max_z
+
+ maximum value of Z rotation in degree (>= 0) when Z rotation is limited (see ik_limit_z), read-only.
+
+ :type: float
+
+ .. attribute:: ik_stiffness_x
+
+ bone rotation stiffness in X axis, read-only.
+
+ :type: float between 0 and 1
+
+ .. attribute:: ik_stiffness_y
+
+ bone rotation stiffness in Y axis, read-only.
+
+ :type: float between 0 and 1
+
+ .. attribute:: ik_stiffness_z
+
+ bone rotation stiffness in Z axis, read-only.
+
+ :type: float between 0 and 1
+
+ .. attribute:: ik_stretch
+
+ ratio of scale change that is allowed, 0=bone can't change size, read-only.
+
+ :type: float
+
+ .. attribute:: ik_rot_weight
+
+ weight of rotation constraint when ik_rot_control is set, read-write.
+
+ :type: float between 0 and 1
+
+ .. attribute:: ik_lin_weight
+
+ weight of size constraint when ik_lin_control is set, read-write.
+
+ :type: float between 0 and 1
+
+ .. attribute:: joint_rotation
+
+ Control bone rotation in term of joint angle (for robotic applications), read-write.
+
+ When writing to this attribute, you pass a [x, y, z] vector and an appropriate set of euler angles or quaternion is calculated according to the rotation_mode.
+
+ When you read this attribute, the current pose matrix is converted into a [x, y, z] vector representing the joint angles.
+
+ The value and the meaning of the x, y, z depends on the ik_dof_x/ik_dof_y/ik_dof_z attributes:
+
+ * 1DoF joint X, Y or Z: the corresponding x, y, or z value is used an a joint angle in radiant
+ * 2DoF joint X+Y or Z+Y: treated as 2 successive 1DoF joints: first X or Z, then Y. The x or z value is used as a joint angle in radiant along the X or Z axis, followed by a rotation along the new Y axis of y radiants.
+ * 2DoF joint X+Z: treated as a 2DoF joint with rotation axis on the X/Z plane. The x and z values are used as the coordinates of the rotation vector in the X/Z plane.
+ * 3DoF joint X+Y+Z: treated as a revolute joint. The [x, y, z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose.
+
+ :type: vector [x, y, z]
+
+ .. note::
+
+ The bone must be part of an IK chain if you want to set the ik_dof_x/ik_dof_y/ik_dof_z attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target) the IK solver will not run but the IK panel will show up on the UI for each bone in the chain.
+
+ .. note::
+
+ [0, 0, 0] always corresponds to the rest pose.
+
+ .. note::
+
+ You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see :data:`BL_ArmatureObject.update`).
+
+ .. note::
+
+ You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.BL_ArmatureConstraint.rst b/doc/python_api/rst/bge_types/bge.types.BL_ArmatureConstraint.rst
new file mode 100644
index 00000000000..1a4370945c1
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.BL_ArmatureConstraint.rst
@@ -0,0 +1,129 @@
+BL_ArmatureConstraint(PyObjectPlus)
+===================================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: BL_ArmatureConstraint(PyObjectPlus)
+
+ Proxy to Armature Constraint. Allows to change constraint on the fly.
+ Obtained through :class:`BL_ArmatureObject`.constraints.
+
+ .. note::
+
+ Not all armature constraints are supported in the GE.
+
+
+ .. attribute:: type
+
+ Type of constraint, (read-only).
+
+ Use one of :ref:`these constants<armatureconstraint-constants-type>`.
+
+ :type: integer, one of CONSTRAINT_TYPE_* constants
+
+ .. attribute:: name
+
+ Name of constraint constructed as <bone_name>:<constraint_name>. constraints list.
+
+ :type: string
+
+ This name is also the key subscript on :class:`BL_ArmatureObject`.
+
+ .. attribute:: enforce
+
+ fraction of constraint effect that is enforced. Between 0 and 1.
+
+ :type: float
+
+ .. attribute:: headtail
+
+ Position of target between head and tail of the target bone: 0=head, 1=tail.
+
+ :type: float.
+
+ .. note::
+
+ Only used if the target is a bone (i.e target object is an armature.
+
+ .. attribute:: lin_error
+
+ runtime linear error (in Blender units) on constraint at the current frame.
+
+ This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver.
+
+ :type: float
+
+ .. attribute:: rot_error
+
+ Runtime rotation error (in radiant) on constraint at the current frame.
+
+ :type: float.
+
+ This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver.
+
+ It is only set if the constraint has a rotation part, for example, a CopyPose+Rotation IK constraint.
+
+ .. attribute:: target
+
+ Primary target object for the constraint. The position of this object in the GE will be used as target for the constraint.
+
+ :type: :class:`KX_GameObject`.
+
+ .. attribute:: subtarget
+
+ Secondary target object for the constraint. The position of this object in the GE will be used as secondary target for the constraint.
+
+ :type: :class:`KX_GameObject`.
+
+ Currently this is only used for pole target on IK constraint.
+
+ .. attribute:: active
+
+ True if the constraint is active.
+
+ :type: boolean
+
+ .. note::
+
+ An inactive constraint does not update lin_error and rot_error.
+
+ .. attribute:: ik_weight
+
+ Weight of the IK constraint between 0 and 1.
+
+ Only defined for IK constraint.
+
+ :type: float
+
+ .. attribute:: ik_type
+
+ Type of IK constraint, (read-only).
+
+ Use one of :ref:`these constants<armatureconstraint-constants-ik-type>`.
+
+ :type: integer.
+
+ .. attribute:: ik_flag
+
+ Combination of IK constraint option flags, read-only.
+
+ Use one of :ref:`these constants<armatureconstraint-constants-ik-flag>`.
+
+ :type: integer
+
+ .. attribute:: ik_dist
+
+ Distance the constraint is trying to maintain with target, only used when ik_type=CONSTRAINT_IK_DISTANCE.
+
+ :type: float
+
+ .. attribute:: ik_mode
+
+ Use one of :ref:`these constants<armatureconstraint-constants-ik-mode>`.
+
+ Additional mode for IK constraint. Currently only used for Distance constraint:
+
+ :type: integer
+
diff --git a/doc/python_api/rst/bge_types/bge.types.BL_ArmatureObject.rst b/doc/python_api/rst/bge_types/bge.types.BL_ArmatureObject.rst
new file mode 100644
index 00000000000..8389affe8a9
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.BL_ArmatureObject.rst
@@ -0,0 +1,34 @@
+BL_ArmatureObject(KX_GameObject)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`KX_GameObject`
+
+.. class:: BL_ArmatureObject(KX_GameObject)
+
+ An armature object.
+
+ .. attribute:: constraints
+
+ The list of armature constraint defined on this armature.
+ Elements of the list can be accessed by index or string.
+ The key format for string access is '<bone_name>:<constraint_name>'.
+
+ :type: list of :class:`BL_ArmatureConstraint`
+
+ .. attribute:: channels
+
+ The list of armature channels.
+ Elements of the list can be accessed by index or name the bone.
+
+ :type: list of :class:`BL_ArmatureChannel`
+
+ .. method:: update()
+
+ Ensures that the armature will be updated on next graphic frame.
+
+ This action is unecessary if a KX_ArmatureActuator with mode run is active
+ or if an action is playing. Use this function in other cases. It must be called
+ on each frame to ensure that the armature is updated continously.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst b/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst
new file mode 100644
index 00000000000..f4f5c0d62ba
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst
@@ -0,0 +1,220 @@
+BL_Shader(PyObjectPlus)
+=======================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: BL_Shader(PyObjectPlus)
+
+ BL_Shader GLSL shaders.
+
+ TODO - Description
+
+ .. method:: setUniformfv(name, fList)
+
+ Set a uniform with a list of float values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg fList: a list (2, 3 or 4 elements) of float values
+ :type fList: list[float]
+
+ .. method:: delSource()
+
+ Clear the shader. Use this method before the source is changed with :data:`setSource`.
+
+ .. method:: getFragmentProg()
+
+ Returns the fragment program.
+
+ :return: The fragment program.
+ :rtype: string
+
+ .. method:: getVertexProg()
+
+ Get the vertex program.
+
+ :return: The vertex program.
+ :rtype: string
+
+ .. method:: isValid()
+
+ Check if the shader is valid.
+
+ :return: True if the shader is valid
+ :rtype: boolean
+
+ .. method:: setAttrib(enum)
+
+ Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.)
+
+ :arg enum: attribute location value
+ :type enum: integer
+
+ .. method:: setNumberOfPasses( max_pass )
+
+ Set the maximum number of passes. Not used a.t.m.
+
+ :arg max_pass: the maximum number of passes
+ :type max_pass: integer
+
+ .. method:: setSampler(name, index)
+
+ Set uniform texture sample index.
+
+ :arg name: Uniform name
+ :type name: string
+ :arg index: Texture sample index.
+ :type index: integer
+
+ .. method:: setSource(vertexProgram, fragmentProgram)
+
+ Set the vertex and fragment programs
+
+ :arg vertexProgram: Vertex program
+ :type vertexProgram: string
+ :arg fragmentProgram: Fragment program
+ :type fragmentProgram: string
+
+ .. method:: setUniform1f(name, fx)
+
+ Set a uniform with 1 float value.
+
+ :arg name: the uniform name
+ :type name: string
+ :arg fx: Uniform value
+ :type fx: float
+
+ .. method:: setUniform1i(name, ix)
+
+ Set a uniform with an integer value.
+
+ :arg name: the uniform name
+ :type name: string
+ :arg ix: the uniform value
+ :type ix: integer
+
+ .. method:: setUniform2f(name, fx, fy)
+
+ Set a uniform with 2 float values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg fx: first float value
+ :type fx: float
+
+ :arg fy: second float value
+ :type fy: float
+
+ .. method:: setUniform2i(name, ix, iy)
+
+ Set a uniform with 2 integer values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg ix: first integer value
+ :type ix: integer
+ :arg iy: second integer value
+ :type iy: integer
+
+ .. method:: setUniform3f(name, fx, fy, fz)
+
+ Set a uniform with 3 float values.
+
+ :arg name: the uniform name
+ :type name: string
+ :arg fx: first float value
+ :type fx: float
+ :arg fy: second float value
+ :type fy: float
+ :arg fz: third float value
+ :type fz: float
+
+ .. method:: setUniform3i(name, ix, iy, iz)
+
+ Set a uniform with 3 integer values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg ix: first integer value
+ :type ix: integer
+ :arg iy: second integer value
+ :type iy: integer
+ :arg iz: third integer value
+ :type iz: integer
+
+ .. method:: setUniform4f(name, fx, fy, fz, fw)
+
+ Set a uniform with 4 float values.
+
+ :arg name: the uniform name
+ :type name: string
+ :arg fx: first float value
+ :type fx: float
+ :arg fy: second float value
+ :type fy: float
+ :arg fz: third float value
+ :type fz: float
+ :arg fw: fourth float value
+ :type fw: float
+
+ .. method:: setUniform4i(name, ix, iy, iz, iw)
+
+ Set a uniform with 4 integer values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg ix: first integer value
+ :type ix: integer
+ :arg iy: second integer value
+ :type iy: integer
+ :arg iz: third integer value
+ :type iz: integer
+ :arg iw: fourth integer value
+ :type iw: integer
+
+ .. method:: setUniformDef(name, type)
+
+ Define a new uniform
+
+ :arg name: the uniform name
+ :type name: string
+ :arg type: uniform type
+ :type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX
+
+ .. method:: setUniformMatrix3(name, mat, transpose)
+
+ Set a uniform with a 3x3 matrix value
+
+ :arg name: the uniform name
+ :type name: string
+ :arg mat: A 3x3 matrix [[f, f, f], [f, f, f], [f, f, f]]
+ :type mat: 3x3 matrix
+ :arg transpose: set to True to transpose the matrix
+ :type transpose: boolean
+
+ .. method:: setUniformMatrix4(name, mat, transpose)
+
+ Set a uniform with a 4x4 matrix value
+
+ :arg name: the uniform name
+ :type name: string
+ :arg mat: A 4x4 matrix [[f, f, f, f], [f, f, f, f], [f, f, f, f], [f, f, f, f]]
+ :type mat: 4x4 matrix
+ :arg transpose: set to True to transpose the matrix
+ :type transpose: boolean
+
+ .. method:: setUniformiv(name, iList)
+
+ Set a uniform with a list of integer values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg iList: a list (2, 3 or 4 elements) of integer values
+ :type iList: list[integer]
+
+ .. method:: validate()
+
+ Validate the shader object.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.BL_ShapeActionActuator.rst b/doc/python_api/rst/bge_types/bge.types.BL_ShapeActionActuator.rst
new file mode 100644
index 00000000000..d08a761ed95
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.BL_ShapeActionActuator.rst
@@ -0,0 +1,72 @@
+BL_ShapeActionActuator(SCA_IActuator)
+=====================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: BL_ShapeActionActuator(SCA_IActuator)
+
+ ShapeAction Actuators apply an shape action to an mesh object.
+
+ .. attribute:: action
+
+ The name of the action to set as the current shape action.
+
+ :type: string
+
+ .. attribute:: frameStart
+
+ Specifies the starting frame of the shape animation.
+
+ :type: float
+
+ .. attribute:: frameEnd
+
+ Specifies the ending frame of the shape animation.
+
+ :type: float
+
+ .. attribute:: blendIn
+
+ Specifies the number of frames of animation to generate when making transitions between actions.
+
+ :type: float
+
+ .. attribute:: priority
+
+ Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers.
+
+ :type: integer
+
+ .. attribute:: frame
+
+ Sets the current frame for the animation.
+
+ :type: float
+
+ .. attribute:: propName
+
+ Sets the property to be used in FromProp playback mode.
+
+ :type: string
+
+ .. attribute:: blendTime
+
+ Sets the internal frame timer. This property must be in the range from 0.0 to blendin.
+
+ :type: float
+
+ .. attribute:: mode
+
+ The operation mode of the actuator. Can be one of :ref:`these constants<shape-action-actuator>`.
+
+ :type: integer
+
+ .. attribute:: framePropName
+
+ The name of the property that is set to the current frame number.
+
+ :type: string
+
+
diff --git a/doc/python_api/rst/bge_types/bge.types.CListValue.rst b/doc/python_api/rst/bge_types/bge.types.CListValue.rst
new file mode 100644
index 00000000000..ca4cdc44bf5
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.CListValue.rst
@@ -0,0 +1,72 @@
+CListValue(CPropValue)
+======================
+
+.. module:: bge.types
+
+base class --- :class:`CPropValue`
+
+.. 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.
+
+ As well as the normal index lookup (``val= clist[i]``), CListValue supports string lookups (``val= scene.objects["Cube"]``)
+
+ Other operations such as ``len(clist)``, ``list(clist)``, ``clist[0:10]`` are also supported.
+
+ .. method:: append(val)
+
+ Add an item to the list (like pythons append)
+
+ .. warning::
+
+ Appending values to the list can cause crashes when the list is used internally by the game engine.
+
+ .. method:: count(val)
+
+ Count the number of instances of a value in the list.
+
+ :return: number of instances
+ :rtype: integer
+
+ .. method:: index(val)
+
+ Return the index of a value in the list.
+
+ :return: The index of the value in the list.
+ :rtype: integer
+
+ .. method:: reverse()
+
+ Reverse the order of the list.
+
+ .. method:: get(key, default=None)
+
+ Return the value matching key, or the default value if its not found.
+
+ :return: The key value or a default.
+
+ .. method:: from_id(id)
+
+ This is a funtion especially for the game engine to return a value with a spesific id.
+
+ Since object names are not always unique, the id of an object can be used to get an object from the CValueList.
+
+ Example:
+
+ .. code-block:: python
+
+ myObID=id(gameObject)
+ ob= scene.objects.from_id(myObID)
+
+ Where ``myObID`` is an int or long from the id function.
+
+ This has the advantage that you can store the id in places you could not store a gameObject.
+
+ .. warning::
+
+ The id is derived from a memory location and will be different each time the game engine starts.
+
+ .. warning::
+
+ The id can't be stored as an integer in game object properties, as those only have a limited range that the id may not be contained in. Instead an id can be stored as a string game property and converted back to an integer for use in from_id lookups.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.CPropValue.rst b/doc/python_api/rst/bge_types/bge.types.CPropValue.rst
new file mode 100644
index 00000000000..7be28c1e006
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.CPropValue.rst
@@ -0,0 +1,11 @@
+CPropValue(CValue)
+==================
+
+.. module:: bge.types
+
+base class --- :class:`CValue`
+
+.. class:: CPropValue(CValue)
+
+ This class has no python functions
+
diff --git a/doc/python_api/rst/bge_types/bge.types.CValue.rst b/doc/python_api/rst/bge_types/bge.types.CValue.rst
new file mode 100644
index 00000000000..52906de5576
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.CValue.rst
@@ -0,0 +1,17 @@
+CValue(PyObjectPlus)
+====================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: CValue(PyObjectPlus)
+
+ This class is a basis for other classes.
+
+ .. attribute:: name
+
+ The name of this CValue derived object (read-only).
+
+ :type: string
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_ArmatureSensor.rst b/doc/python_api/rst/bge_types/bge.types.KX_ArmatureSensor.rst
new file mode 100644
index 00000000000..a7123eb5c9d
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_ArmatureSensor.rst
@@ -0,0 +1,36 @@
+KX_ArmatureSensor(SCA_ISensor)
+==============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: KX_ArmatureSensor(SCA_ISensor)
+
+ Armature sensor detect conditions on armatures.
+
+ .. attribute:: type
+
+ The type of measurement that the sensor make when it is active.
+
+ Can be one of :ref:`these constants <armaturesensor-type>`
+
+ :type: integer.
+
+ .. attribute:: constraint
+
+ The constraint object this sensor is watching.
+
+ :type: :class:`BL_ArmatureConstraint`
+
+ .. attribute:: value
+
+ The threshold used in the comparison with the constraint error
+ The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver
+ The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver
+ The linear error on CopyPose is always >= 0: it is the norm of the distance between the target and the bone
+ The rotation error on CopyPose is always >= 0: it is the norm of the equivalent rotation vector between the bone and the target orientations
+ The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller.
+
+ :type: float
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_BlenderMaterial.rst b/doc/python_api/rst/bge_types/bge.types.KX_BlenderMaterial.rst
new file mode 100644
index 00000000000..0dfc7a10d13
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_BlenderMaterial.rst
@@ -0,0 +1,77 @@
+KX_BlenderMaterial(PyObjectPlus)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: KX_BlenderMaterial(PyObjectPlus)
+
+ 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.
+
+ :return: the material's shader
+ :rtype: :class:`BL_Shader`
+
+ .. method:: setBlending(src, dest)
+
+ Set the pixel color arithmetic functions.
+
+ :arg src: Specifies how the red, green, blue, and alpha source blending factors are computed.
+ :type src: Value in...
+
+ * GL_ZERO,
+ * GL_ONE,
+ * GL_SRC_COLOR,
+ * GL_ONE_MINUS_SRC_COLOR,
+ * GL_DST_COLOR,
+ * GL_ONE_MINUS_DST_COLOR,
+ * GL_SRC_ALPHA,
+ * GL_ONE_MINUS_SRC_ALPHA,
+ * GL_DST_ALPHA,
+ * GL_ONE_MINUS_DST_ALPHA,
+ * GL_SRC_ALPHA_SATURATE
+
+ :arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed.
+ :type dest: Value in...
+
+ * GL_ZERO
+ * GL_ONE
+ * GL_SRC_COLOR
+ * GL_ONE_MINUS_SRC_COLOR
+ * GL_DST_COLOR
+ * GL_ONE_MINUS_DST_COLOR
+ * GL_SRC_ALPHA
+ * GL_ONE_MINUS_SRC_ALPHA
+ * GL_DST_ALPHA
+ * GL_ONE_MINUS_DST_ALPHA
+ * GL_SRC_ALPHA_SATURATE
+
+ .. method:: getMaterialIndex()
+
+ Returns the material's index.
+
+ :return: the material's index
+ :rtype: integer
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_Camera.rst b/doc/python_api/rst/bge_types/bge.types.KX_Camera.rst
new file mode 100644
index 00000000000..baf60ec0c97
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_Camera.rst
@@ -0,0 +1,284 @@
+KX_Camera(KX_GameObject)
+========================
+
+.. module:: bge.types
+
+base class --- :class:`KX_GameObject`
+
+.. class:: KX_Camera(KX_GameObject)
+
+ A Camera object.
+
+ .. data:: INSIDE
+
+ See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
+
+ .. data:: INTERSECT
+
+ See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
+
+ .. data:: OUTSIDE
+
+ See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
+
+ .. attribute:: lens
+
+ The camera's lens value.
+
+ :type: float
+
+ .. attribute:: ortho_scale
+
+ The camera's view scale when in orthographic mode.
+
+ :type: float
+
+ .. attribute:: near
+
+ The camera's near clip distance.
+
+ :type: float
+
+ .. attribute:: far
+
+ The camera's far clip distance.
+
+ :type: float
+
+ .. attribute:: perspective
+
+ True if this camera has a perspective transform, False for an orthographic projection.
+
+ :type: boolean
+
+ .. attribute:: frustum_culling
+
+ True if this camera is frustum culling.
+
+ :type: boolean
+
+ .. 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).
+
+ :type: 4x4 Matrix [[float]]
+
+ .. attribute:: modelview_matrix
+
+ This camera's 4x4 model view matrix. (read-only).
+
+ :type: 4x4 Matrix [[float]]
+
+ .. note::
+
+ This matrix is regenerated every frame from the camera's position and orientation. Also, this is the identity matrix prior to rendering the first frame (any Python done on frame 1).
+
+ .. attribute:: camera_to_world
+
+ This camera's camera to world transform. (read-only).
+
+ :type: 4x4 Matrix [[float]]
+
+ .. note::
+
+ This matrix is regenerated every frame from the camera's position and orientation.
+
+ .. attribute:: world_to_camera
+
+ This camera's world to camera transform. (read-only).
+
+ :type: 4x4 Matrix [[float]]
+
+ .. note::
+
+ Regenerated every frame from the camera's position and orientation.
+
+ .. note::
+
+ This is camera_to_world inverted.
+
+ .. attribute:: useViewport
+
+ True when the camera is used as a viewport, set True to enable a viewport for this camera.
+
+ :type: boolean
+
+ .. method:: sphereInsideFrustum(centre, radius)
+
+ Tests the given sphere against the view frustum.
+
+ :arg centre: The centre of the sphere (in world coordinates.)
+ :type centre: list [x, y, z]
+ :arg radius: the radius of the sphere
+ :type radius: float
+ :return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT`
+ :rtype: integer
+
+ .. note::
+
+ When the camera is first initialized the result will be invalid because the projection matrix has not been set.
+
+ .. code-block:: python
+
+ from bge import logic
+ cont = logic.getCurrentController()
+ cam = cont.owner
+
+ # A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]
+ if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):
+ # Sphere is inside frustum !
+ # Do something useful !
+ else:
+ # Sphere is outside frustum
+
+ .. method:: boxInsideFrustum(box)
+
+ Tests the given box against the view frustum.
+
+ :arg box: Eight (8) corner points of the box (in world coordinates.)
+ :type box: list of lists
+ :return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT`
+
+ .. note::
+
+ When the camera is first initialized the result will be invalid because the projection matrix has not been set.
+
+ .. code-block:: python
+
+ from bge import logic
+ cont = logic.getCurrentController()
+ cam = cont.owner
+
+ # Box to test...
+ box = []
+ box.append([-1.0, -1.0, -1.0])
+ box.append([-1.0, -1.0, 1.0])
+ box.append([-1.0, 1.0, -1.0])
+ box.append([-1.0, 1.0, 1.0])
+ box.append([ 1.0, -1.0, -1.0])
+ box.append([ 1.0, -1.0, 1.0])
+ box.append([ 1.0, 1.0, -1.0])
+ box.append([ 1.0, 1.0, 1.0])
+
+ if (cam.boxInsideFrustum(box) != cam.OUTSIDE):
+ # Box is inside/intersects frustum !
+ # Do something useful !
+ else:
+ # Box is outside the frustum !
+
+ .. method:: pointInsideFrustum(point)
+
+ Tests the given point against the view frustum.
+
+ :arg point: The point to test (in world coordinates.)
+ :type point: 3D Vector
+ :return: True if the given point is inside this camera's viewing frustum.
+ :rtype: boolean
+
+ .. note::
+
+ When the camera is first initialized the result will be invalid because the projection matrix has not been set.
+
+ .. code-block:: python
+
+ from bge import logic
+ cont = logic.getCurrentController()
+ cam = cont.owner
+
+ # Test point [0.0, 0.0, 0.0]
+ if (cam.pointInsideFrustum([0.0, 0.0, 0.0])):
+ # Point is inside frustum !
+ # Do something useful !
+ else:
+ # Box is outside the frustum !
+
+ .. method:: getCameraToWorld()
+
+ Returns the camera-to-world transform.
+
+ :return: the camera-to-world transform matrix.
+ :rtype: matrix (4x4 list)
+
+ .. method:: getWorldToCamera()
+
+ Returns the world-to-camera transform.
+
+ This returns the inverse matrix of getCameraToWorld().
+
+ :return: the world-to-camera transform matrix.
+ :rtype: matrix (4x4 list)
+
+ .. method:: setOnTop()
+
+ Set this cameras viewport ontop of all other viewport.
+
+ .. method:: setViewport(left, bottom, right, top)
+
+ Sets the region of this viewport on the screen in pixels.
+
+ Use :data:`bge.render.getWindowHeight` and :data:`bge.render.getWindowWidth` to calculate values relative to the entire display.
+
+ :arg left: left pixel coordinate of this viewport
+ :type left: integer
+ :arg bottom: bottom pixel coordinate of this viewport
+ :type bottom: integer
+ :arg right: right pixel coordinate of this viewport
+ :type right: integer
+ :arg top: top pixel coordinate of this viewport
+ :type top: integer
+
+ .. method:: getScreenPosition(object)
+
+ Gets the position of an object projected on screen space.
+
+ .. code-block:: python
+
+ # For an object in the middle of the screen, coord = [0.5, 0.5]
+ coord = camera.getScreenPosition(object)
+
+ :arg object: object name or list [x, y, z]
+ :type object: :class:`KX_GameObject` or 3D Vector
+ :return: the object's position in screen coordinates.
+ :rtype: list [x, y]
+
+ .. method:: getScreenVect(x, y)
+
+ Gets the vector from the camera position in the screen coordinate direction.
+
+ :arg x: X Axis
+ :type x: float
+ :arg y: Y Axis
+ :type y: float
+ :rtype: 3D Vector
+ :return: The vector from screen coordinate.
+
+ .. code-block:: python
+
+ # Gets the vector of the camera front direction:
+ m_vect = camera.getScreenVect(0.5, 0.5)
+
+ .. method:: getScreenRay(x, y, dist=inf, property=None)
+
+ Look towards a screen coordinate (x, y) and find first object hit within dist that matches prop.
+ The ray is similar to KX_GameObject->rayCastTo.
+
+ :arg x: X Axis
+ :type x: float
+ :arg y: Y Axis
+ :type y: float
+ :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
+ :type dist: float
+ :arg property: property name that object must have; can be omitted => detect any object
+ :type property: string
+ :rtype: :class:`KX_GameObject`
+ :return: the first object hit or None if no object or object does not match prop
+
+ .. code-block:: python
+
+ # Gets an object with a property "wall" in front of the camera within a distance of 100:
+ target = camera.getScreenRay(0.5, 0.5, 100, "wall")
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_CameraActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_CameraActuator.rst
new file mode 100644
index 00000000000..bc5efed4b08
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_CameraActuator.rst
@@ -0,0 +1,47 @@
+KX_CameraActuator(SCA_IActuator)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_CameraActuator(SCA_IActuator)
+
+ Applies changes to a camera.
+
+ .. attribute:: damping
+
+ 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.
+
+ :type: float
+
+ .. attribute:: max
+
+ maximum distance to stay from the target object.
+
+ :type: float
+
+ .. attribute:: height
+
+ height to stay above the target object.
+
+ :type: float
+
+ .. attribute:: object
+
+ the object this actuator tracks.
+
+ :type: :class:`KX_GameObject` or None
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_CharacterWrapper.rst b/doc/python_api/rst/bge_types/bge.types.KX_CharacterWrapper.rst
new file mode 100644
index 00000000000..32e5c3eaad8
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_CharacterWrapper.rst
@@ -0,0 +1,45 @@
+KX_CharacterWrapper(PyObjectPlus)
+=================================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: KX_CharacterWrapper(PyObjectPlus)
+
+ A wrapper to expose character physics options.
+
+ .. attribute:: onGround
+
+ Whether or not the character is on the ground. (read-only)
+
+ :type: boolean
+
+ .. attribute:: gravity
+
+ The gravity value used for the character.
+
+ :type: float
+
+ .. attribute:: maxJumps
+
+ The maximum number of jumps a character can perform before having to touch the ground. By default this is set to 1. 2 allows for a double jump, etc.
+
+ :type: int
+
+ .. attribute:: jumpCount
+
+ The current jump count. This can be used to have different logic for a single jump versus a double jump. For example, a different animation for the second jump.
+
+ :type: int
+
+ .. attribute:: walkDirection
+
+ The speed and direction the character is traveling in using world coordinates. This should be used instead of applyMovement() to properly move the character.
+
+ :type: list [x, y, z]
+
+ .. method:: jump()
+
+ The character jumps based on it's jump speed.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_ConstraintActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_ConstraintActuator.rst
new file mode 100644
index 00000000000..498990449fe
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_ConstraintActuator.rst
@@ -0,0 +1,78 @@
+KX_ConstraintActuator(SCA_IActuator)
+====================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_ConstraintActuator(SCA_IActuator)
+
+ A constraint actuator limits the position, rotation, distance or orientation of an object.
+
+ .. attribute:: damp
+
+ Time constant of the constraint expressed in frame (not use by Force field constraint).
+
+ :type: integer
+
+ .. attribute:: rotDamp
+
+ Time constant for the rotation expressed in frame (only for the distance constraint), 0 = use damp for rotation as well.
+
+ :type: integer
+
+ .. attribute:: direction
+
+ The reference direction in world coordinate for the orientation constraint.
+
+ :type: 3-tuple of float: (x, y, z)
+
+ .. attribute:: option
+
+ Binary combination of :ref:`these constants <constraint-actuator-option>`
+
+ :type: integer
+
+ .. attribute:: time
+
+ activation time of the actuator. The actuator disables itself after this many frame. If set to 0, the actuator is not limited in time.
+
+ :type: integer
+
+ .. attribute:: propName
+
+ the name of the property or material for the ray detection of the distance constraint.
+
+ :type: string
+
+ .. attribute:: min
+
+ The lower bound of the constraint. For the rotation and orientation constraint, it represents radiant.
+
+ :type: float
+
+ .. attribute:: distance
+
+ the target distance of the distance constraint.
+
+ :type: float
+
+ .. attribute:: max
+
+ the upper bound of the constraint. For rotation and orientation constraints, it represents radiant.
+
+ :type: float
+
+ .. attribute:: rayLength
+
+ the length of the ray of the distance constraint.
+
+ :type: float
+
+ .. attribute:: limit
+
+ type of constraint. Use one of the :ref:`these constants <constraint-actuator-limit>`
+
+ :type: integer.
+
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_ConstraintWrapper.rst b/doc/python_api/rst/bge_types/bge.types.KX_ConstraintWrapper.rst
new file mode 100644
index 00000000000..c26675147ac
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_ConstraintWrapper.rst
@@ -0,0 +1,18 @@
+KX_ConstraintWrapper(PyObjectPlus)
+==================================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: KX_ConstraintWrapper(PyObjectPlus)
+
+ KX_ConstraintWrapper
+
+ .. method:: getConstraintId(val)
+
+ Returns the contraint's ID
+
+ :return: the constraint's ID
+ :rtype: integer
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_FontObject.rst b/doc/python_api/rst/bge_types/bge.types.KX_FontObject.rst
new file mode 100644
index 00000000000..1961f5e3e92
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_FontObject.rst
@@ -0,0 +1,12 @@
+KX_FontObject(KX_GameObject)
+============================
+
+.. module:: bge.types
+
+base class --- :class:`KX_GameObject`
+
+.. class:: KX_FontObject(KX_GameObject)
+
+ TODO.
+
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_GameActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_GameActuator.rst
new file mode 100644
index 00000000000..54702c5318d
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_GameActuator.rst
@@ -0,0 +1,23 @@
+KX_GameActuator(SCA_IActuator)
+==============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_GameActuator(SCA_IActuator)
+
+ The game actuator loads a new .blend file, restarts the current .blend file or quits the game.
+
+ .. attribute:: fileName
+
+ the new .blend file to load.
+
+ :type: string
+
+ .. attribute:: mode
+
+ The mode of this actuator. Can be on of :ref:`these constants <game-actuator>`
+
+ :type: Int
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_GameObject.rst b/doc/python_api/rst/bge_types/bge.types.KX_GameObject.rst
new file mode 100644
index 00000000000..a9c91735f91
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_GameObject.rst
@@ -0,0 +1,839 @@
+KX_GameObject(SCA_IObject)
+==========================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IObject`
+
+.. class:: KX_GameObject(SCA_IObject)
+
+ All game objects are derived from this class.
+
+ Properties assigned to game objects are accessible as attributes of this class.
+
+ .. note::
+
+ Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError,
+ if an object may have been removed since last accessing it use the :data:`invalid` attribute to check.
+
+ KX_GameObject can be subclassed to extend functionality. For example:
+
+ .. code-block:: python
+
+ import bge
+
+ class CustomGameObject(bge.types.KX_GameObject):
+ RATE = 0.05
+
+ def __init__(self, old_owner):
+ # "old_owner" can just be ignored. At this point, "self" is
+ # already the object in the scene, and "old_owner" has been
+ # destroyed.
+
+ # New attributes can be defined - but we could also use a game
+ # property, like "self['rate']".
+ self.rate = CustomGameObject.RATE
+
+ def update(self):
+ self.worldPosition.z += self.rate
+
+ # switch direction
+ if self.worldPosition.z > 1.0:
+ self.rate = -CustomGameObject.RATE
+ elif self.worldPosition.z < 0.0:
+ self.rate = CustomGameObject.RATE
+
+ # Called first
+ def mutate(cont):
+ old_object = cont.owner
+ mutated_object = CustomGameObject(cont.owner)
+
+ # After calling the constructor above, references to the old object
+ # should not be used.
+ assert(old_object is not mutated_object)
+ assert(old_object.invalid)
+ assert(mutated_object is cont.owner)
+
+ # Called later - note we are now working with the mutated object.
+ def update(cont):
+ cont.owner.update()
+
+ When subclassing objects other than empties and meshes, the specific type
+ should be used - e.g. inherit from :class:`BL_ArmatureObject` when the object
+ to mutate is an armature.
+
+ .. attribute:: name
+
+ The object's name. (read-only).
+
+ :type: string
+
+ .. attribute:: mass
+
+ The object's mass
+
+ :type: float
+
+ .. note::
+
+ The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0.
+
+ .. attribute:: linVelocityMin
+
+ Enforces the object keeps moving at a minimum velocity.
+
+ :type: float
+
+ .. note::
+
+ Applies to dynamic and rigid body objects only.
+
+ .. note::
+
+ A value of 0.0 disables this option.
+
+ .. note::
+
+ While objects are stationary the minimum velocity will not be applied.
+
+ .. attribute:: linVelocityMax
+
+ Clamp the maximum linear velocity to prevent objects moving beyond a set speed.
+
+ :type: float
+
+ .. note::
+
+ Applies to dynamic and rigid body objects only.
+
+ .. note::
+
+ A value of 0.0 disables this option (rather then setting it stationary).
+
+ .. attribute:: localInertia
+
+ the object's inertia vector in local coordinates. Read only.
+
+ :type: list [ix, iy, iz]
+
+ .. attribute:: parent
+
+ 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.
+
+ :type: :class:`CListValue` of :class:`KX_GameObject` or None
+
+ .. attribute:: groupObject
+
+ Returns the group object that the object belongs to or None if the object is not part of a group.
+
+ :type: :class:`KX_GameObject` or None
+
+ .. attribute:: scene
+
+ The object's scene. (read-only).
+
+ :type: :class:`KX_Scene` or None
+
+ .. attribute:: visible
+
+ visibility flag.
+
+ :type: boolean
+
+ .. note::
+
+ Game logic will still run for invisible objects.
+
+ .. attribute:: color
+
+ The object color of the object. [r, g, b, a]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: occlusion
+
+ occlusion capability flag.
+
+ :type: boolean
+
+ .. attribute:: position
+
+ The object's position. [x, y, z] On write: local position, on read: world position
+
+ .. deprecated:: use :data:`localPosition` and :data:`worldPosition`.
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: orientation
+
+ The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. On write: local orientation, on read: world orientation
+
+ .. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`.
+
+ :type: :class:`mathutils.Matrix`
+
+ .. attribute:: scaling
+
+ The object's scaling factor. [sx, sy, sz] On write: local scaling, on read: world scaling
+
+ .. deprecated:: use :data:`localScale` and :data:`worldScale`.
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: localOrientation
+
+ The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector.
+
+ :type: :class:`mathutils.Matrix`
+
+ .. attribute:: worldOrientation
+
+ The object's world orientation. 3x3 Matrix.
+
+ :type: :class:`mathutils.Matrix`
+
+ .. attribute:: localScale
+
+ The object's local scaling factor. [sx, sy, sz]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: worldScale
+
+ The object's world scaling factor. [sx, sy, sz]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: localPosition
+
+ The object's local position. [x, y, z]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: worldPosition
+
+ The object's world position. [x, y, z]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: localTransform
+
+ The object's local space transform matrix. 4x4 Matrix.
+
+ :type: :class:`mathutils.Matrix`
+
+ .. attribute:: worldTransform
+
+ 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`
+
+ .. attribute:: worldLinearVelocity
+
+ The object's world linear velocity. [x, y, z]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: localAngularVelocity
+
+ The object's local angular velocity. [x, y, z]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: worldAngularVelocity
+
+ The object's world angular velocity. [x, y, z]
+
+ :type: :class:`mathutils.Vector`
+
+ .. attribute:: timeOffset
+
+ adjust the slowparent delay at runtime.
+
+ :type: float
+
+ .. attribute:: state
+
+ the game object's state bitmask, using the first 30 bits, one bit must always be set.
+
+ :type: int
+
+ .. attribute:: meshes
+
+ a list meshes for this object.
+
+ :type: list of :class:`KX_MeshProxy`
+
+ .. note::
+
+ Most objects use only 1 mesh.
+
+ .. note::
+
+ Changes to this list will not update the KX_GameObject.
+
+ .. attribute:: sensors
+
+ a sequence of :class:`SCA_ISensor` objects with string/index lookups and iterator support.
+
+ :type: list
+
+ .. note::
+
+ This attribute is experemental and may be removed (but probably wont be).
+
+ .. note::
+
+ Changes to this list will not update the KX_GameObject.
+
+ .. attribute:: controllers
+
+ a sequence of :class:`SCA_IController` objects with string/index lookups and iterator support.
+
+ :type: list of :class:`SCA_ISensor`
+
+ .. note::
+
+ This attribute is experemental and may be removed (but probably wont be).
+
+ .. note::
+
+ Changes to this list will not update the KX_GameObject.
+
+ .. attribute:: actuators
+
+ a list of :class:`SCA_IActuator` with string/index lookups and iterator support.
+
+ :type: list
+
+ .. note::
+
+ This attribute is experemental and may be removed (but probably wont be).
+
+ .. note::
+
+ Changes to this list will not update the KX_GameObject.
+
+ .. attribute:: attrDict
+
+ get the objects internal python attribute dictionary for direct (faster) access.
+
+ :type: dict
+
+ .. attribute:: children
+
+ direct children of this object, (read-only).
+
+ :type: :class:`CListValue` of :class:`KX_GameObject`'s
+
+ .. attribute:: childrenRecursive
+
+ all children of this object including childrens children, (read-only).
+
+ :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.
+
+ The actual removal of the object from the scene is delayed.
+
+ .. method:: replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False)
+
+ Replace the mesh of this object with a new mesh. This works the same was as the actuator.
+
+ :arg mesh: mesh to replace or the meshes name.
+ :type mesh: :class:`MeshProxy` or string
+ :arg useDisplayMesh: when enabled the display mesh will be replaced (optional argument).
+ :type useDisplayMesh: boolean
+ :arg usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument).
+ :type usePhysicsMesh: boolean
+
+ .. method:: setVisible(visible, recursive)
+
+ Sets the game object's visible flag.
+
+ :arg visible: the visible state to set.
+ :type visible: boolean
+ :arg recursive: optional argument to set all childrens visibility flag too.
+ :type recursive: boolean
+
+ .. method:: setOcclusion(occlusion, recursive)
+
+ Sets the game object's occlusion capability.
+
+ :arg occlusion: the state to set the occlusion to.
+ :type occlusion: boolean
+ :arg recursive: optional argument to set all childrens occlusion flag too.
+ :type recursive: boolean
+
+ .. method:: alignAxisToVect(vect, axis=2, factor=1.0)
+
+ Aligns any of the game object's axis along the given vector.
+
+
+ :arg vect: a vector to align the axis.
+ :type vect: 3D vector
+ :arg axis: The axis you want to align
+
+ * 0: X axis
+ * 1: Y axis
+ * 2: Z axis
+
+ :type axis: integer
+ :arg factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0)
+ :type factor: float
+
+ .. method:: getAxisVect(vect)
+
+ Returns the axis vector rotates by the objects worldspace orientation.
+ This is the equivalent of multiplying the vector by the orientation matrix.
+
+ :arg vect: a vector to align the axis.
+ :type vect: 3D Vector
+ :return: The vector in relation to the objects rotation.
+ :rtype: 3d vector.
+
+ .. method:: applyMovement(movement, local=False)
+
+ Sets the game object's movement.
+
+ :arg movement: movement vector.
+ :type movement: 3D Vector
+ :arg local:
+ * False: you get the "global" movement ie: relative to world orientation.
+ * True: you get the "local" movement ie: relative to object orientation.
+ :arg local: boolean
+
+ .. method:: applyRotation(rotation, local=False)
+
+ Sets the game object's rotation.
+
+ :arg rotation: rotation vector.
+ :type rotation: 3D Vector
+ :arg local:
+ * False: you get the "global" rotation ie: relative to world orientation.
+ * True: you get the "local" rotation ie: relative to object orientation.
+ :arg local: boolean
+
+ .. method:: applyForce(force, local=False)
+
+ Sets the game object's force.
+
+ This requires a dynamic object.
+
+ :arg force: force vector.
+ :type force: 3D Vector
+ :arg local:
+ * False: you get the "global" force ie: relative to world orientation.
+ * True: you get the "local" force ie: relative to object orientation.
+ :type local: boolean
+
+ .. method:: applyTorque(torque, local=False)
+
+ Sets the game object's torque.
+
+ This requires a dynamic object.
+
+ :arg torque: torque vector.
+ :type torque: 3D Vector
+ :arg local:
+ * False: you get the "global" torque ie: relative to world orientation.
+ * True: you get the "local" torque ie: relative to object orientation.
+ :type local: boolean
+
+ .. method:: getLinearVelocity(local=False)
+
+ Gets the game object's linear velocity.
+
+ This method returns the game object's velocity through it's centre of mass, ie no angular velocity component.
+
+ :arg local:
+ * False: you get the "global" velocity ie: relative to world orientation.
+ * True: you get the "local" velocity ie: relative to object orientation.
+ :type local: boolean
+ :return: the object's linear velocity.
+ :rtype: list [vx, vy, vz]
+
+ .. method:: setLinearVelocity(velocity, local=False)
+
+ Sets the game object's linear velocity.
+
+ This method sets game object's velocity through it's centre of mass,
+ ie no angular velocity component.
+
+ This requires a dynamic object.
+
+ :arg velocity: linear velocity vector.
+ :type velocity: 3D Vector
+ :arg local:
+ * False: you get the "global" velocity ie: relative to world orientation.
+ * True: you get the "local" velocity ie: relative to object orientation.
+ :type local: boolean
+
+ .. method:: getAngularVelocity(local=False)
+
+ Gets the game object's angular velocity.
+
+ :arg local:
+ * False: you get the "global" velocity ie: relative to world orientation.
+ * True: you get the "local" velocity ie: relative to object orientation.
+ :type local: boolean
+ :return: the object's angular velocity.
+ :rtype: list [vx, vy, vz]
+
+ .. method:: setAngularVelocity(velocity, local=False)
+
+ Sets the game object's angular velocity.
+
+ This requires a dynamic object.
+
+ :arg velocity: angular velocity vector.
+ :type velocity: boolean
+ :arg local:
+ * False: you get the "global" velocity ie: relative to world orientation.
+ * True: you get the "local" velocity ie: relative to object orientation.
+
+ .. method:: getVelocity(point=(0, 0, 0))
+
+ Gets the game object's velocity at the specified point.
+
+ Gets the game object's velocity at the specified point, including angular
+ components.
+
+ :arg point: optional point to return the velocity for, in local coordinates.
+ :type point: 3D Vector
+ :return: the velocity at the specified point.
+ :rtype: list [vx, vy, vz]
+
+ .. method:: getReactionForce()
+
+ Gets the game object's reaction force.
+
+ The reaction force is the force applied to this object over the last simulation timestep.
+ This also includes impulses, eg from collisions.
+
+ :return: the reaction force of this object.
+ :rtype: list [fx, fy, fz]
+
+ .. note::
+
+ This is not implimented at the moment.
+
+ .. method:: applyImpulse(point, impulse)
+
+ Applies an impulse to the game object.
+
+ This will apply the specified impulse to the game object at the specified point.
+ If point != position, applyImpulse will also change the object's angular momentum.
+ Otherwise, only linear momentum will change.
+
+ :arg point: the point to apply the impulse to (in world coordinates)
+ :type point: the point to apply the impulse to (in world coordinates)
+
+ .. method:: suspendDynamics()
+
+ Suspends physics for this object.
+
+ .. method:: restoreDynamics()
+
+ Resumes physics for this object.
+
+ .. note::
+
+ The objects linear velocity will be applied from when the dynamics were suspended.
+
+ .. method:: enableRigidBody()
+
+ Enables rigid body physics for this object.
+
+ Rigid body physics allows the object to roll on collisions.
+
+ .. method:: disableRigidBody()
+
+ Disables rigid body physics for this object.
+
+ .. method:: setParent(parent, compound=True, ghost=True)
+
+ Sets this object's parent.
+ Control the shape status with the optional compound and ghost parameters:
+
+ In that case you can control if it should be ghost or not:
+
+ :arg parent: new parent object.
+ :type parent: :class:`KX_GameObject`
+ :arg compound: whether the shape should be added to the parent compound shape.
+
+ * True: the object shape should be added to the parent compound shape.
+ * False: the object should keep its individual shape.
+
+ :type compound: boolean
+ :arg ghost: whether the object should be ghost while parented.
+
+ * True: if the object should be made ghost while parented.
+ * False: if the object should be solid while parented.
+
+ :type ghost: boolean
+
+ .. note::
+
+ If the object type is sensor, it stays ghost regardless of ghost parameter
+
+ .. method:: removeParent()
+
+ Removes this objects parent.
+
+ .. method:: getPhysicsId()
+
+ Returns the user data object associated with this game object's physics controller.
+
+ .. method:: getPropertyNames()
+
+ Gets a list of all property names.
+
+ :return: All property names for this object.
+ :rtype: list
+
+ .. method:: getDistanceTo(other)
+
+ :arg other: a point or another :class:`KX_GameObject` to measure the distance to.
+ :type other: :class:`KX_GameObject` or list [x, y, z]
+ :return: distance to another object or point.
+ :rtype: float
+
+ .. method:: getVectTo(other)
+
+ Returns the vector and the distance to another object or point.
+ The vector is normalized unless the distance is 0, in which a zero length vector is returned.
+
+ :arg other: a point or another :class:`KX_GameObject` to get the vector and distance to.
+ :type other: :class:`KX_GameObject` or list [x, y, z]
+ :return: (distance, globalVector(3), localVector(3))
+ :rtype: 3-tuple (float, 3-tuple (x, y, z), 3-tuple (x, y, z))
+
+ .. method:: rayCastTo(other, dist, prop)
+
+ Look towards another point/object and find first object hit within dist that matches prop.
+
+ The ray is always casted from the center of the object, ignoring the object itself.
+ The ray is casted towards the center of another object or an explicit [x, y, z] point.
+ Use rayCast() if you need to retrieve the hit point
+
+ :arg other: [x, y, z] or object towards which the ray is casted
+ :type other: :class:`KX_GameObject` or 3-tuple
+ :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
+ :type dist: float
+ :arg prop: property name that object must have; can be omitted => detect any object
+ :type prop: string
+ :return: the first object hit or None if no object or object does not match prop
+ :rtype: :class:`KX_GameObject`
+
+ .. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly)
+
+ Look from a point/object to another point/object and find first object hit within dist that matches prop.
+ if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit.
+ if poly is 1, returns a 4-tuple with in addition a :class:`KX_PolyProxy` as 4th element.
+ if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element.
+
+ .. code-block:: python
+
+ # shoot along the axis gun-gunAim (gunAim should be collision-free)
+ obj, point, normal = gun.rayCast(gunAim, None, 50)
+ if obj:
+ # do something
+ pass
+
+ The face paremeter determines the orientation of the normal.
+
+ * 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
+ * 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
+
+ The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray.
+ The prop and xray parameters interact as follow.
+
+ * prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray.
+ * prop off, xray on : idem.
+ * prop on, xray off: return closest hit if it matches prop, no hit otherwise.
+ * prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray.
+
+ The :class:`KX_PolyProxy` 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray.
+ If there is no hit or the hit object is not a static mesh, None is returned as 4th element.
+
+ The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects.
+
+ :arg objto: [x, y, z] or object to which the ray is casted
+ :type objto: :class:`KX_GameObject` or 3-tuple
+ :arg objfrom: [x, y, z] or object from which the ray is casted; None or omitted => use self object center
+ :type objfrom: :class:`KX_GameObject` or 3-tuple or None
+ :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to
+ :type dist: float
+ :arg prop: property name that object must have; can be omitted or "" => detect any object
+ :type prop: string
+ :arg face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin
+ :type face: integer
+ :arg xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object
+ :type xray: integer
+ :arg poly: polygon option: 0, 1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit.
+
+ * 0 or omitted: return value is a 3-tuple (object, hitpoint, hitnormal) or (None, None, None) if no hit
+ * 1: return value is a 4-tuple and the 4th element is a :class:`KX_PolyProxy` or None if no hit or the object doesn't use a mesh collision shape.
+ * 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping.
+
+ :type poly: integer
+ :return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv).
+
+ * object, hitpoint and hitnormal are None if no hit.
+ * polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None
+ * hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None
+
+ :rtype:
+
+ * 3-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz))
+ * or 4-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`)
+ * or 5-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`, 2-tuple (u, v))
+
+ .. note::
+
+ The ray ignores the object on which the method is called. It is casted from/to object center or explicit [x, y, z] points.
+
+ .. method:: setCollisionMargin(margin)
+
+ Set the objects collision margin.
+
+ :arg margin: the collision margin distance in blender units.
+ :type margin: float
+
+ .. note::
+
+ If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError.
+
+ .. method:: sendMessage(subject, body="", to="")
+
+ Sends a message.
+
+ :arg subject: The subject of the message
+ :type subject: string
+ :arg body: The body of the message (optional)
+ :type body: string
+ :arg to: The name of the object to send the message to (optional)
+ :type to: string
+
+ .. method:: reinstancePhysicsMesh(gameObject, meshObject)
+
+ Updates the physics system with the changed mesh.
+
+ If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object.
+
+ :arg gameObject: optional argument, set the physics shape from this gameObjets mesh.
+ :type gameObject: string, :class:`KX_GameObject` or None
+ :arg meshObject: optional argument, set the physics shape from this mesh.
+ :type meshObject: string, :class:`MeshProxy` or None
+
+ :return: True if reinstance succeeded, False if it failed.
+ :rtype: boolean
+
+ .. note::
+
+ If this object has instances the other instances will be updated too.
+
+ .. note::
+
+ The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf).
+
+ .. warning::
+
+ Only triangle mesh type objects are supported currently (not convex hull)
+
+ .. warning::
+
+ If the object is a part of a combound object it will fail (parent or child)
+
+ .. warning::
+
+ Rebuilding the physics mesh can be slow, running many times per second will give a performance hit.
+
+ .. method:: get(key, default=None)
+
+ Return the value matching key, or the default value if its not found.
+ :return: The key value or a default.
+
+ .. method:: playAction(name, start_frame, end_frame, layer=0, priority=0, blendin=0, play_mode=ACT_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0)
+
+ Plays an action.
+
+ :arg name: the name of the action
+ :type name: string
+ :arg start: the start frame of the action
+ :type start: float
+ :arg end: the end frame of the action
+ :type end: float
+ :arg layer: the layer the action will play in (actions in different layers are added/blended together)
+ :type layer: integer
+ :arg priority: only play this action if there isn't an action currently playing in this layer with a higher (lower number) priority
+ :type priority: integer
+ :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: 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)
+ :type ipo_flags: int bitfield
+ :arg speed: the playback speed of the action as a factor (1.0 = normal speed, 2.0 = 2x speed, etc)
+ :type speed: float
+
+ .. method:: stopAction(layer=0)
+
+ Stop playing the action on the given layer.
+
+ :arg layer: The layer to stop playing.
+ :type layer: integer
+
+ .. method:: getActionFrame(layer=0)
+
+ Gets the current frame of the action playing in the supplied layer.
+
+ :arg layer: The layer that you want to get the frame from.
+ :type layer: integer
+
+ :return: The current frame of the action
+ :rtype: float
+
+ .. method:: setActionFrame(frame, layer=0)
+
+ Set the current frame of the action playing in the supplied layer.
+
+ :arg layer: The layer where you want to set the frame
+ :type layer: integer
+ :arg frame: The frame to set the action to
+ :type frame: float
+
+ .. method:: isPlayingAction(layer=0)
+
+ Checks to see if there is an action playing in the given layer.
+
+ :arg layer: The layer to check for a playing action.
+ :type layer: integer
+
+ :return: Whether or not the action is playing
+ :rtype: boolean
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_IpoActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_IpoActuator.rst
new file mode 100644
index 00000000000..2cae4fb3b1a
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_IpoActuator.rst
@@ -0,0 +1,65 @@
+KX_IpoActuator(SCA_IActuator)
+=============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_IpoActuator(SCA_IActuator)
+
+ IPO actuator activates an animation.
+
+ .. attribute:: frameStart
+
+ Start frame.
+
+ :type: float
+
+ .. attribute:: frameEnd
+
+ End frame.
+
+ :type: float
+
+ .. attribute:: propName
+
+ Use this property to define the Ipo position.
+
+ :type: string
+
+ .. attribute:: framePropName
+
+ Assign this property this action current frame number.
+
+ :type: string
+
+ .. attribute:: mode
+
+ Play mode for the ipo. Can be on of :ref:`these constants <ipo-actuator>`
+
+ :type: integer
+
+ .. attribute:: useIpoAsForce
+
+ Apply Ipo as a global or local force depending on the local option (dynamic objects only).
+
+ :type: boolean
+
+ .. attribute:: useIpoAdd
+
+ Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag.
+
+ :type: boolean
+
+ .. attribute:: useIpoLocal
+
+ Let the ipo acts in local coordinates, used in Force and Add mode.
+
+ :type: boolean
+
+ .. attribute:: useChildren
+
+ Update IPO on all children Objects as well.
+
+ :type: boolean
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_LibLoadStatus.rst b/doc/python_api/rst/bge_types/bge.types.KX_LibLoadStatus.rst
new file mode 100644
index 00000000000..a5b7aaf5dee
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_LibLoadStatus.rst
@@ -0,0 +1,45 @@
+KX_LibLoadStatus(PyObjectPlus)
+==============================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: KX_LibLoadStatus(PyObjectPlus)
+
+ An object providing information about a LibLoad() operation.
+
+ .. code-block:: python
+
+ # Print a message when an async LibLoad is done
+ import bge
+
+ def finished_cb(status):
+ print("Library (%s) loaded in %.2fms." % (status.libraryName, status.timeTaken))
+
+ bge.logic.LibLoad('myblend.blend', 'Scene', async=True).onFinish = finished_cb
+
+ .. attribute:: onFinish
+
+ A callback that gets called when the lib load is done.
+
+ :type: callable
+
+ .. attribute:: progress
+
+ The current progress of the lib load as a normalized value from 0.0 to 1.0.
+
+ :type: float
+
+ .. attribute:: libraryName
+
+ The name of the library being loaded (the first argument to LibLoad).
+
+ :type: string
+
+ .. attribute:: timeTaken
+
+ The amount of time, in seconds, the lib load took (0 until the operation is complete).
+
+ :type: float
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_LightObject.rst b/doc/python_api/rst/bge_types/bge.types.KX_LightObject.rst
new file mode 100644
index 00000000000..2b2bdf76b4f
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_LightObject.rst
@@ -0,0 +1,90 @@
+KX_LightObject(KX_GameObject)
+=============================
+
+.. module:: bge.types
+
+base class --- :class:`KX_GameObject`
+
+.. class:: KX_LightObject(KX_GameObject)
+
+ A Light object.
+
+ .. code-block:: python
+
+ # Turn on a red alert light.
+ import bge
+
+ co = bge.logic.getCurrentController()
+ light = co.owner
+
+ light.energy = 1.0
+ light.color = [1.0, 0.0, 0.0]
+
+ .. data:: SPOT
+
+ A spot light source. See attribute :data:`type`
+
+ .. data:: SUN
+
+ A point light source with no attenuation. See attribute :data:`type`
+
+ .. data:: NORMAL
+
+ A point light source. See attribute :data:`type`
+
+ .. attribute:: type
+
+ The type of light - must be SPOT, SUN or NORMAL
+
+ .. attribute:: layer
+
+ The layer mask that this light affects object on.
+
+ :type: bitfield
+
+ .. attribute:: energy
+
+ The brightness of this light.
+
+ :type: float
+
+ .. attribute:: distance
+
+ The maximum distance this light can illuminate. (SPOT and NORMAL lights only).
+
+ :type: float
+
+ .. attribute:: color
+
+ The color of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
+
+ :type: list [r, g, b]
+
+ .. attribute:: lin_attenuation
+
+ The linear component of this light's attenuation. (SPOT and NORMAL lights only).
+
+ :type: float
+
+ .. attribute:: quad_attenuation
+
+ The quadratic component of this light's attenuation (SPOT and NORMAL lights only).
+
+ :type: float
+
+ .. attribute:: spotsize
+
+ The cone angle of the spot light, in degrees (SPOT lights only).
+
+ :type: float in [0 - 180].
+
+ .. attribute:: spotblend
+
+ Specifies the intensity distribution of the spot light (SPOT lights only).
+
+ :type: float in [0 - 1]
+
+ .. note::
+
+ Higher values result in a more focused light source.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_MeshProxy.rst b/doc/python_api/rst/bge_types/bge.types.KX_MeshProxy.rst
new file mode 100644
index 00000000000..2ec8b8ece5c
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_MeshProxy.rst
@@ -0,0 +1,134 @@
+KX_MeshProxy(SCA_IObject)
+=========================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IObject`
+
+.. class:: KX_MeshProxy(SCA_IObject)
+
+ A mesh object.
+
+ You can only change the vertex properties of a mesh object, not the mesh topology.
+
+ To use mesh objects effectively, you should know a bit about how the game engine handles them.
+
+ #. Mesh Objects are converted from Blender at scene load.
+ #. The Converter groups polygons by Material. This means they can be sent to the renderer efficiently. A material holds:
+
+ #. The texture.
+ #. The Blender material.
+ #. The Tile properties
+ #. The face properties - (From the "Texture Face" panel)
+ #. Transparency & z sorting
+ #. Light layer
+ #. Polygon shape (triangle/quad)
+ #. Game Object
+
+ #. Vertices will be split by face if necessary. Vertices can only be shared between faces if:
+
+ #. They are at the same position
+ #. UV coordinates are the same
+ #. Their normals are the same (both polygons are "Set Smooth")
+ #. They are the same color, for example: a cube has 24 vertices: 6 faces with 4 vertices per face.
+
+ The correct method of iterating over every :class:`KX_VertexProxy` in a game object
+
+ .. code-block:: python
+
+ from bge import logic
+
+ cont = logic.getCurrentController()
+ object = cont.owner
+
+ for mesh in object.meshes:
+ for m_index in range(len(mesh.materials)):
+ for v_index in range(mesh.getVertexArrayLength(m_index)):
+ vertex = mesh.getVertex(m_index, v_index)
+ # Do something with vertex here...
+ # ... eg: color the vertex red.
+ vertex.color = [1.0, 0.0, 0.0, 1.0]
+
+ .. attribute:: materials
+
+ :type: list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types
+
+ .. attribute:: numPolygons
+
+ :type: integer
+
+ .. attribute:: numMaterials
+
+ :type: integer
+
+ .. method:: getMaterialName(matid)
+
+ Gets the name of the specified material.
+
+ :arg matid: the specified material.
+ :type matid: integer
+ :return: the attached material name.
+ :rtype: string
+
+ .. method:: getTextureName(matid)
+
+ Gets the name of the specified material's texture.
+
+ :arg matid: the specified material
+ :type matid: integer
+ :return: the attached material's texture name.
+ :rtype: string
+
+ .. method:: getVertexArrayLength(matid)
+
+ Gets the length of the vertex array associated with the specified material.
+
+ There is one vertex array for each material.
+
+ :arg matid: the specified material
+ :type matid: integer
+ :return: the number of verticies in the vertex array.
+ :rtype: integer
+
+ .. method:: getVertex(matid, index)
+
+ Gets the specified vertex from the mesh object.
+
+ :arg matid: the specified material
+ :type matid: integer
+ :arg index: the index into the vertex array.
+ :type index: integer
+ :return: a vertex object.
+ :rtype: :class:`KX_VertexProxy`
+
+ .. method:: getPolygon(index)
+
+ Gets the specified polygon from the mesh.
+
+ :arg index: polygon number
+ :type index: integer
+ :return: a polygon object.
+ :rtype: :class:`PolyProxy`
+
+ .. method:: transform(matid, matrix)
+
+ Transforms the vertices of a mesh.
+
+ :arg matid: material index, -1 transforms all.
+ :type matid: integer
+ :arg matrix: transformation matrix.
+ :type matrix: 4x4 matrix [[float]]
+
+ .. method:: transformUV(matid, matrix, uv_index=-1, uv_index_from=-1)
+
+ Transforms the vertices UV's of a mesh.
+
+ :arg matid: material index, -1 transforms all.
+ :type matid: integer
+ :arg matrix: transformation matrix.
+ :type matrix: 4x4 matrix [[float]]
+ :arg uv_index: optional uv index, -1 for all, otherwise 0 or 1.
+ :type uv_index: integer
+ :arg uv_index_from: optional uv index to copy from, -1 to transform the current uv.
+ :type uv_index_from: integer
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_MouseFocusSensor.rst b/doc/python_api/rst/bge_types/bge.types.KX_MouseFocusSensor.rst
new file mode 100644
index 00000000000..dda73eadb52
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_MouseFocusSensor.rst
@@ -0,0 +1,66 @@
+KX_MouseFocusSensor(SCA_MouseSensor)
+====================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_MouseSensor`
+
+.. class:: KX_MouseFocusSensor(SCA_MouseSensor)
+
+ The mouse focus sensor detects when the mouse is over the current game object.
+
+ The mouse focus sensor works by transforming the mouse coordinates from 2d device
+ space to 3d space then raycasting away from the camera.
+
+ .. attribute:: raySource
+
+ The worldspace source of the ray (the view position).
+
+ :type: list (vector of 3 floats)
+
+ .. attribute:: rayTarget
+
+ The worldspace target of the ray.
+
+ :type: list (vector of 3 floats)
+
+ .. attribute:: rayDirection
+
+ The :data:`rayTarget` - :class:`raySource` normalized.
+
+ :type: list (normalized vector of 3 floats)
+
+ .. attribute:: hitObject
+
+ the last object the mouse was over.
+
+ :type: :class:`KX_GameObject` or None
+
+ .. attribute:: hitPosition
+
+ The worldspace position of the ray intersecton.
+
+ :type: list (vector of 3 floats)
+
+ .. attribute:: hitNormal
+
+ the worldspace normal from the face at point of intersection.
+
+ :type: list (normalized vector of 3 floats)
+
+ .. attribute:: hitUV
+
+ the UV coordinates at the point of intersection.
+
+ :type: list (vector of 2 floats)
+
+ If the object has no UV mapping, it returns [0, 0].
+
+ The UV coordinates are not normalized, they can be < 0 or > 1 depending on the UV mapping.
+
+ .. attribute:: usePulseFocus
+
+ When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set).
+
+ :type: boolean
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_NavMeshObject.rst b/doc/python_api/rst/bge_types/bge.types.KX_NavMeshObject.rst
new file mode 100644
index 00000000000..5c73d0aa1d3
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_NavMeshObject.rst
@@ -0,0 +1,47 @@
+KX_NavMeshObject(KX_GameObject)
+===============================
+
+.. module:: bge.types
+
+base class --- :class:`KX_GameObject`
+
+.. 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
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_NearSensor.rst b/doc/python_api/rst/bge_types/bge.types.KX_NearSensor.rst
new file mode 100644
index 00000000000..995e645b979
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_NearSensor.rst
@@ -0,0 +1,23 @@
+KX_NearSensor(KX_TouchSensor)
+=============================
+
+.. module:: bge.types
+
+base class --- :class:`KX_TouchSensor`
+
+.. class:: KX_NearSensor(KX_TouchSensor)
+
+ A near sensor is a specialised form of touch sensor.
+
+ .. attribute:: distance
+
+ The near sensor activates when an object is within this distance.
+
+ :type: float
+
+ .. attribute:: resetDistance
+
+ The near sensor deactivates when the object exceeds this distance.
+
+ :type: float
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_NetworkMessageActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_NetworkMessageActuator.rst
new file mode 100644
index 00000000000..b8dcd01fe43
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_NetworkMessageActuator.rst
@@ -0,0 +1,35 @@
+KX_NetworkMessageActuator(SCA_IActuator)
+========================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_NetworkMessageActuator(SCA_IActuator)
+
+ Message Actuator
+
+ .. attribute:: propName
+
+ Messages will only be sent to objects with the given property name.
+
+ :type: string
+
+ .. attribute:: subject
+
+ The subject field of the message.
+
+ :type: string
+
+ .. attribute:: body
+
+ The body of the message.
+
+ :type: string
+
+ .. attribute:: usePropBody
+
+ Send a property instead of a regular body message.
+
+ :type: boolean
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_NetworkMessageSensor.rst b/doc/python_api/rst/bge_types/bge.types.KX_NetworkMessageSensor.rst
new file mode 100644
index 00000000000..a6b1082a4fe
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_NetworkMessageSensor.rst
@@ -0,0 +1,38 @@
+KX_NetworkMessageSensor(SCA_ISensor)
+====================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: KX_NetworkMessageSensor(SCA_ISensor)
+
+ The Message Sensor logic brick.
+
+ Currently only loopback (local) networks are supported.
+
+ .. attribute:: subject
+
+ The subject the sensor is looking for.
+
+ :type: string
+
+ .. attribute:: frameMessageCount
+
+ The number of messages received since the last frame. (read-only).
+
+ :type: integer
+
+ .. attribute:: subjects
+
+ The list of message subjects received. (read-only).
+
+ :type: list of strings
+
+ .. attribute:: bodies
+
+ The list of message bodies received. (read-only).
+
+ :type: list of strings
+
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_ObjectActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_ObjectActuator.rst
new file mode 100644
index 00000000000..f10f101a4cc
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_ObjectActuator.rst
@@ -0,0 +1,129 @@
+KX_ObjectActuator(SCA_IActuator)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_ObjectActuator(SCA_IActuator)
+
+ The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement,
+ velocity, or angular velocity to an object.
+ Servo control allows to regulate force to achieve a certain speed target.
+
+ .. attribute:: force
+
+ The force applied by the actuator.
+
+ :type: list [x, y, z]
+
+ .. attribute:: useLocalForce
+
+ A flag specifying if the force is local.
+
+ :type: boolean
+
+ .. attribute:: torque
+
+ The torque applied by the actuator.
+
+ :type: list [x, y, z]
+
+ .. attribute:: useLocalTorque
+
+ A flag specifying if the torque is local.
+
+ :type: boolean
+
+ .. attribute:: dLoc
+
+ The displacement vector applied by the actuator.
+
+ :type: list [x, y, z]
+
+ .. attribute:: useLocalDLoc
+
+ A flag specifying if the dLoc is local.
+
+ :type: boolean
+
+ .. attribute:: dRot
+
+ The angular displacement vector applied by the actuator
+
+ :type: list [x, y, z]
+
+ .. note::
+
+ Since the displacement is applied every frame, you must adjust the displacement based on the frame rate, or you game experience will depend on the player's computer speed.
+
+ .. attribute:: useLocalDRot
+
+ A flag specifying if the dRot is local.
+
+ :type: boolean
+
+ .. attribute:: linV
+
+ The linear velocity applied by the actuator.
+
+ :type: list [x, y, z]
+
+ .. attribute:: useLocalLinV
+
+ A flag specifying if the linear velocity is local.
+
+ :type: boolean
+
+ .. note::
+
+ This is the target speed for servo controllers.
+
+ .. attribute:: angV
+
+ The angular velocity applied by the actuator.
+
+ :type: list [x, y, z]
+
+ .. attribute:: useLocalAngV
+
+ A flag specifying if the angular velocity is local.
+
+ :type: boolean
+
+ .. attribute:: damping
+
+ The damping parameter of the servo controller.
+
+ :type: short
+
+ .. attribute:: forceLimitX
+
+ The min/max force limit along the X axis and activates or deactivates the limits in the servo controller.
+
+ :type: list [min(float), max(float), bool]
+
+ .. attribute:: forceLimitY
+
+ The min/max force limit along the Y axis and activates or deactivates the limits in the servo controller.
+
+ :type: list [min(float), max(float), bool]
+
+ .. attribute:: forceLimitZ
+
+ The min/max force limit along the Z axis and activates or deactivates the limits in the servo controller.
+
+ :type: list [min(float), max(float), bool]
+
+ .. attribute:: pid
+
+ The PID coefficients of the servo controller.
+
+ :type: list of floats [proportional, integral, derivate]
+
+ .. attribute:: reference
+
+ The object that is used as reference to compute the velocity for the servo controller.
+
+ :type: :class:`KX_GameObject` or None
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_ParentActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_ParentActuator.rst
new file mode 100644
index 00000000000..77dcb907d6a
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_ParentActuator.rst
@@ -0,0 +1,38 @@
+KX_ParentActuator(SCA_IActuator)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_ParentActuator(SCA_IActuator)
+
+ The parent actuator can set or remove an objects parent object.
+
+ .. attribute:: object
+
+ the object this actuator sets the parent too.
+
+ :type: :class:`KX_GameObject` or None
+
+ .. attribute:: mode
+
+ The mode of this actuator.
+
+ :type: integer from 0 to 1.
+
+ .. attribute:: compound
+
+ Whether the object shape should be added to the parent compound shape when parenting.
+
+ Effective only if the parent is already a compound shape.
+
+ :type: boolean
+
+ .. attribute:: ghost
+
+ Whether the object should be made ghost when parenting
+ Effective only if the shape is not added to the parent compound shape.
+
+ :type: boolean
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_PolyProxy.rst b/doc/python_api/rst/bge_types/bge.types.KX_PolyProxy.rst
new file mode 100644
index 00000000000..534f6deedc0
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_PolyProxy.rst
@@ -0,0 +1,139 @@
+KX_PolyProxy(SCA_IObject)
+=========================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IObject`
+
+.. class:: KX_PolyProxy(SCA_IObject)
+
+ A polygon holds the index of the vertex forming the poylgon.
+
+ Note:
+ The polygon attributes are read-only, you need to retrieve the vertex proxy if you want
+ to change the vertex settings.
+
+ .. attribute:: material_name
+
+ The name of polygon material, empty if no material.
+
+ :type: string
+
+ .. attribute:: material
+
+ The material of the polygon.
+
+ :type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
+
+ .. attribute:: texture_name
+
+ The texture name of the polygon.
+
+ :type: string
+
+ .. attribute:: material_id
+
+ The material index of the polygon, use this to retrieve vertex proxy from mesh proxy.
+
+ :type: integer
+
+ .. attribute:: v1
+
+ vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy.
+
+ :type: integer
+
+ .. attribute:: v2
+
+ vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy.
+
+ :type: integer
+
+ .. attribute:: v3
+
+ vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy.
+
+ :type: integer
+
+ .. attribute:: v4
+
+ Vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex
+ Use this to retrieve vertex proxy from mesh proxy.
+
+ :type: integer
+
+ .. attribute:: visible
+
+ visible state of the polygon: 1=visible, 0=invisible.
+
+ :type: integer
+
+ .. attribute:: collide
+
+ collide state of the polygon: 1=receives collision, 0=collision free.
+
+ :type: integer
+
+ .. method:: getMaterialName()
+
+ Returns the polygon material name with MA prefix
+
+ :return: material name
+ :rtype: string
+
+ .. method:: getMaterial()
+
+ :return: The polygon material
+ :rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
+
+ .. method:: getTextureName()
+
+ :return: The texture name
+ :rtype: string
+
+ .. method:: getMaterialIndex()
+
+ Returns the material bucket index of the polygon.
+ This index and the ones returned by getVertexIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`.
+
+ :return: the material index in the mesh
+ :rtype: integer
+
+ .. method:: getNumVertex()
+
+ Returns the number of vertex of the polygon.
+
+ :return: number of vertex, 3 or 4.
+ :rtype: integer
+
+ .. method:: isVisible()
+
+ Returns whether the polygon is visible or not
+
+ :return: 0=invisible, 1=visible
+ :rtype: boolean
+
+ .. method:: isCollider()
+
+ Returns whether the polygon is receives collision or not
+
+ :return: 0=collision free, 1=receives collision
+ :rtype: integer
+
+ .. method:: getVertexIndex(vertex)
+
+ Returns the mesh vertex index of a polygon vertex
+ This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`.
+
+ :arg vertex: index of the vertex in the polygon: 0->3
+ :arg vertex: integer
+ :return: mesh vertex index
+ :rtype: integer
+
+ .. method:: getMesh()
+
+ Returns a mesh proxy
+
+ :return: mesh proxy
+ :rtype: :class:`MeshProxy`
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_PolygonMaterial.rst b/doc/python_api/rst/bge_types/bge.types.KX_PolygonMaterial.rst
new file mode 100644
index 00000000000..3421e194d77
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_PolygonMaterial.rst
@@ -0,0 +1,250 @@
+KX_PolygonMaterial(PyObjectPlus)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: KX_PolygonMaterial(PyObjectPlus)
+
+ This is the interface to materials in the game engine.
+
+ Materials define the render state to be applied to mesh objects.
+
+ .. warning::
+
+ Some of the methods/variables are CObjects. If you mix these up, you will crash blender.
+
+ .. code-block:: python
+
+ from bge import logic
+
+ vertex_shader = """
+
+ void main(void)
+ {
+ // original vertex position, no changes
+ gl_Position = ftransform();
+ // coordinate of the 1st texture channel
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+ // coordinate of the 2nd texture channel
+ gl_TexCoord[1] = gl_MultiTexCoord1;
+ }
+ """
+
+ fragment_shader ="""
+
+ uniform sampler2D color_0;
+ uniform sampler2D color_1;
+ uniform float factor;
+
+ void main(void)
+ {
+ vec4 color_0 = texture2D(color_0, gl_TexCoord[0].st);
+ vec4 color_1 = texture2D(color_1, gl_TexCoord[1].st);
+ gl_FragColor = mix(color_0, color_1, factor);
+ }
+ """
+
+ object = logic.getCurrentController().owner
+ object = cont.owner
+ for mesh in object.meshes:
+ for material in mesh.materials:
+ shader = material.getShader()
+ if shader != None:
+ if not shader.isValid():
+ shader.setSource(vertex_shader, fragment_shader, True)
+
+ # get the first texture channel of the material
+ shader.setSampler('color_0', 0)
+ # get the second texture channel of the material
+ shader.setSampler('color_1', 1)
+ # pass another uniform to the shader
+ shader.setUniform1f('factor', 0.3)
+
+
+ .. attribute:: texture
+
+ Texture name.
+
+ :type: string (read-only)
+
+ .. attribute:: gl_texture
+
+ OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture).
+
+ :type: integer (read-only)
+
+ .. attribute:: material
+
+ Material name.
+
+ :type: string (read-only)
+
+ .. attribute:: tface
+
+ Texture face properties.
+
+ :type: CObject (read-only)
+
+ .. attribute:: tile
+
+ Texture is tiling.
+
+ :type: boolean
+
+ .. attribute:: tilexrep
+
+ Number of tile repetitions in x direction.
+
+ :type: integer
+
+ .. attribute:: tileyrep
+
+ Number of tile repetitions in y direction.
+
+ :type: integer
+
+ .. attribute:: drawingmode
+
+ Drawing mode for the material.
+ - 2 (drawingmode & 4) Textured
+ - 4 (drawingmode & 16) Light
+ - 14 (drawingmode & 16384) 3d Polygon Text.
+
+ :type: bitfield
+
+ .. attribute:: transparent
+
+ This material is transparent. All meshes with this
+ material will be rendered after non transparent meshes from back
+ to front.
+
+ :type: boolean
+
+ .. attribute:: zsort
+
+ Transparent polygons in meshes with this material will be sorted back to
+ front before rendering.
+ Non-Transparent polygons will be sorted front to back before rendering.
+
+ :type: boolean
+
+ .. attribute:: diffuse
+
+ The diffuse color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
+
+ :type: list [r, g, b]
+
+ .. attribute:: specular
+
+ The specular color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
+
+ :type: list [r, g, b]
+
+ .. attribute:: shininess
+
+ The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0.
+
+ :type: float
+
+ .. attribute:: specularity
+
+ The amount of specular of the material. 0.0 <= specularity <= 1.0.
+
+ :type: float
+
+ .. method:: updateTexture(tface, rasty)
+
+ Updates a realtime animation.
+
+ :arg tface: Texture face (eg mat.tface)
+ :type tface: CObject
+ :arg rasty: Rasterizer
+ :type rasty: CObject
+
+ .. method:: setTexture(tface)
+
+ Sets texture render state.
+
+ :arg tface: Texture face
+ :type tface: CObject
+
+ .. code-block:: python
+
+ mat.setTexture(mat.tface)
+
+ .. method:: activate(rasty, cachingInfo)
+
+ Sets material parameters for this object for rendering.
+
+ Material Parameters set:
+
+ #. Texture
+ #. Backface culling
+ #. Line drawing
+ #. Specular Colour
+ #. Shininess
+ #. Diffuse Colour
+ #. Polygon Offset.
+
+ :arg rasty: Rasterizer instance.
+ :type rasty: CObject
+ :arg cachingInfo: Material cache instance.
+ :type cachingInfo: CObject
+
+ .. method:: setCustomMaterial(material)
+
+ Sets the material state setup object.
+
+ Using this method, you can extend or completely replace the gameengine material
+ to do your own advanced multipass effects.
+
+ Use this method to register your material class. Instead of the normal material,
+ your class's activate method will be called just before rendering the mesh.
+ This should setup the texture, material, and any other state you would like.
+ It should return True to render the mesh, or False if you are finished. You should
+ clean up any state Blender does not set before returning False.
+
+ Activate Method Definition:
+
+ .. code-block:: python
+
+ def activate(self, rasty, cachingInfo, material):
+
+ :arg material: The material object.
+ :type material: instance
+
+ .. code-block:: python
+
+ class PyMaterial:
+ def __init__(self):
+ self.pass_no = -1
+
+ def activate(self, rasty, cachingInfo, material):
+ # Activate the material here.
+ #
+ # The activate method will be called until it returns False.
+ # Every time the activate method returns True the mesh will
+ # be rendered.
+ #
+ # rasty is a CObject for passing to material.updateTexture()
+ # and material.activate()
+ # cachingInfo is a CObject for passing to material.activate()
+ # material is the KX_PolygonMaterial instance this material
+ # was added to
+
+ # default material properties:
+ self.pass_no += 1
+ if self.pass_no == 0:
+ material.activate(rasty, cachingInfo)
+ # Return True to do this pass
+ return True
+
+ # clean up and return False to finish.
+ self.pass_no = -1
+ return False
+
+ # Create a new Python Material and pass it to the renderer.
+ mat.setCustomMaterial(PyMaterial())
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_RadarSensor.rst b/doc/python_api/rst/bge_types/bge.types.KX_RadarSensor.rst
new file mode 100644
index 00000000000..4274c1142f4
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_RadarSensor.rst
@@ -0,0 +1,44 @@
+KX_RadarSensor(KX_NearSensor)
+=============================
+
+.. module:: bge.types
+
+base class --- :class:`KX_NearSensor`
+
+.. class:: KX_RadarSensor(KX_NearSensor)
+
+ Radar sensor is a near sensor with a conical sensor object.
+
+ .. attribute:: coneOrigin
+
+ The origin of the cone with which to test. The origin is in the middle of the cone. (read-only).
+
+ :type: list of floats [x, y, z]
+
+ .. attribute:: coneTarget
+
+ The center of the bottom face of the cone with which to test. (read-only).
+
+ :type: list of floats [x, y, z]
+
+ .. attribute:: distance
+
+ The height of the cone with which to test.
+
+ :type: float
+
+ .. attribute:: angle
+
+ The angle of the cone (in degrees) with which to test.
+
+ :type: float
+
+ .. attribute:: axis
+
+ The axis on which the radar cone is cast.
+
+ :type: integer from 0 to 5
+
+ KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z,
+ KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_RaySensor.rst b/doc/python_api/rst/bge_types/bge.types.KX_RaySensor.rst
new file mode 100644
index 00000000000..2ff989729f5
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_RaySensor.rst
@@ -0,0 +1,72 @@
+KX_RaySensor(SCA_ISensor)
+=========================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: KX_RaySensor(SCA_ISensor)
+
+ A ray sensor detects the first object in a given direction.
+
+ .. attribute:: propName
+
+ The property the ray is looking for.
+
+ :type: string
+
+ .. attribute:: range
+
+ The distance of the ray.
+
+ :type: float
+
+ .. attribute:: useMaterial
+
+ Whether or not to look for a material (false = property).
+
+ :type: boolean
+
+ .. attribute:: useXRay
+
+ Whether or not to use XRay.
+
+ :type: boolean
+
+ .. attribute:: hitObject
+
+ The game object that was hit by the ray. (read-only).
+
+ :type: :class:`KX_GameObject`
+
+ .. attribute:: hitPosition
+
+ The position (in worldcoordinates) where the object was hit by the ray. (read-only).
+
+ :type: list [x, y, z]
+
+ .. attribute:: hitNormal
+
+ The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (read-only).
+
+ :type: list [x, y, z]
+
+ .. attribute:: rayDirection
+
+ The direction from the ray (in worldcoordinates). (read-only).
+
+ :type: list [x, y, z]
+
+ .. attribute:: axis
+
+ The axis the ray is pointing on.
+
+ :type: integer from 0 to 5
+
+ * KX_RAY_AXIS_POS_X
+ * KX_RAY_AXIS_POS_Y
+ * KX_RAY_AXIS_POS_Z
+ * KX_RAY_AXIS_NEG_X
+ * KX_RAY_AXIS_NEG_Y
+ * KX_RAY_AXIS_NEG_Z
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_SCA_AddObjectActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_SCA_AddObjectActuator.rst
new file mode 100644
index 00000000000..fecc863909d
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_SCA_AddObjectActuator.rst
@@ -0,0 +1,55 @@
+KX_SCA_AddObjectActuator(SCA_IActuator)
+=======================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_SCA_AddObjectActuator(SCA_IActuator)
+
+ Edit Object Actuator (in Add Object Mode)
+
+ .. warning::
+
+ An Add Object actuator will be ignored if at game start, the linked object doesn't exist (or is empty) or the linked object is in an active layer.
+
+ .. code-block:: none
+
+ Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer)
+
+ .. attribute:: object
+
+ the object this actuator adds.
+
+ :type: :class:`KX_GameObject` or None
+
+ .. attribute:: objectLastCreated
+
+ the last added object from this actuator (read-only).
+
+ :type: :class:`KX_GameObject` or None
+
+ .. attribute:: time
+
+ the lifetime of added objects, in frames. Set to 0 to disable automatic deletion.
+
+ :type: integer
+
+ .. attribute:: linearVelocity
+
+ the initial linear velocity of added objects.
+
+ :type: list [vx, vy, vz]
+
+ .. attribute:: angularVelocity
+
+ the initial angular velocity of added objects.
+
+ :type: list [vx, vy, vz]
+
+ .. method:: instantAddObject()
+
+ adds the object without needing to calling SCA_PythonController.activate()
+
+ .. note:: Use objectLastCreated to get the newly created object.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_SCA_DynamicActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_SCA_DynamicActuator.rst
new file mode 100644
index 00000000000..055c4098253
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_SCA_DynamicActuator.rst
@@ -0,0 +1,29 @@
+KX_SCA_DynamicActuator(SCA_IActuator)
+=====================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_SCA_DynamicActuator(SCA_IActuator)
+
+ Dynamic Actuator.
+
+ .. attribute:: mode
+
+ :type: integer
+
+ the type of operation of the actuator, 0-4
+
+ * KX_DYN_RESTORE_DYNAMICS(0)
+ * KX_DYN_DISABLE_DYNAMICS(1)
+ * KX_DYN_ENABLE_RIGID_BODY(2)
+ * KX_DYN_DISABLE_RIGID_BODY(3)
+ * KX_DYN_SET_MASS(4)
+
+ .. attribute:: mass
+
+ the mass value for the KX_DYN_SET_MASS operation.
+
+ :type: float
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_SCA_EndObjectActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_SCA_EndObjectActuator.rst
new file mode 100644
index 00000000000..8d9221febb0
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_SCA_EndObjectActuator.rst
@@ -0,0 +1,13 @@
+KX_SCA_EndObjectActuator(SCA_IActuator)
+=======================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_SCA_EndObjectActuator(SCA_IActuator)
+
+ Edit Object Actuator (in End Object mode)
+
+ This actuator has no python methods.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_SCA_ReplaceMeshActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_SCA_ReplaceMeshActuator.rst
new file mode 100644
index 00000000000..137c63ea829
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_SCA_ReplaceMeshActuator.rst
@@ -0,0 +1,89 @@
+KX_SCA_ReplaceMeshActuator(SCA_IActuator)
+=========================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_SCA_ReplaceMeshActuator(SCA_IActuator)
+
+ Edit Object actuator, in Replace Mesh mode.
+
+ .. warning::
+
+ Replace mesh actuators will be ignored if at game start, the named mesh doesn't exist.
+
+ This will generate a warning in the console
+
+ .. code-block:: none
+
+ Error: GameObject 'Name' ReplaceMeshActuator 'ActuatorName' without object
+
+ .. code-block:: python
+
+ # Level-of-detail
+ # Switch a game object's mesh based on its depth in the camera view.
+ # +----------+ +-----------+ +-------------------------------------+
+ # | Always +-----+ Python +-----+ Edit Object (Replace Mesh) LOD.Mesh |
+ # +----------+ +-----------+ +-------------------------------------+
+ from bge import logic
+
+ # List detail meshes here
+ # Mesh (name, near, far)
+ # Meshes overlap so that they don't 'pop' when on the edge of the distance.
+ meshes = ((".Hi", 0.0, -20.0),
+ (".Med", -15.0, -50.0),
+ (".Lo", -40.0, -100.0)
+ )
+
+ cont = logic.getCurrentController()
+ object = cont.owner
+ actuator = cont.actuators["LOD." + obj.name]
+ camera = logic.getCurrentScene().active_camera
+
+ def Depth(pos, plane):
+ return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3]
+
+ # Depth is negative and decreasing further from the camera
+ depth = Depth(object.position, camera.world_to_camera[2])
+
+ newmesh = None
+ curmesh = None
+ # Find the lowest detail mesh for depth
+ for mesh in meshes:
+ if depth < mesh[1] and depth > mesh[2]:
+ newmesh = mesh
+ if "ME" + object.name + mesh[0] == actuator.getMesh():
+ curmesh = mesh
+
+ if newmesh != None and "ME" + object.name + newmesh[0] != actuator.mesh:
+ # The mesh is a different mesh - switch it.
+ # Check the current mesh is not a better fit.
+ if curmesh == None or curmesh[1] < depth or curmesh[2] > depth:
+ actuator.mesh = object.name + newmesh[0]
+ cont.activate(actuator)
+
+ .. attribute:: mesh
+
+ :class:`MeshProxy` or the name of the mesh that will replace the current one.
+
+ Set to None to disable actuator.
+
+ :type: :class:`MeshProxy` or None if no mesh is set
+
+ .. attribute:: useDisplayMesh
+
+ when true the displayed mesh is replaced.
+
+ :type: boolean
+
+ .. attribute:: usePhysicsMesh
+
+ when true the physics mesh is replaced.
+
+ :type: boolean
+
+ .. method:: instantReplaceMesh()
+
+ Immediately replace mesh without delay.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_Scene.rst b/doc/python_api/rst/bge_types/bge.types.KX_Scene.rst
new file mode 100644
index 00000000000..75630ae4d26
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_Scene.rst
@@ -0,0 +1,172 @@
+KX_Scene(PyObjectPlus)
+======================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: KX_Scene(PyObjectPlus)
+
+ An active scene that gives access to objects, cameras, lights and scene attributes.
+
+ The activity culling stuff is supposed to disable logic bricks when their owner gets too far
+ from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows
+ what it does!
+
+ .. code-block:: python
+
+ from bge import logic
+
+ # get the scene
+ scene = logic.getCurrentScene()
+
+ # print all the objects in the scene
+ for object in scene.objects:
+ print(object.name)
+
+ # get an object named 'Cube'
+ object = scene.objects["Cube"]
+
+ # get the first object in the scene.
+ object = scene.objects[0]
+
+ .. code-block:: python
+
+ # Get the depth of an object in the camera view.
+ from bge import logic
+
+ object = logic.getCurrentController().owner
+ cam = logic.getCurrentScene().active_camera
+
+ # Depth is negative and decreasing further from the camera
+ depth = object.position[0]*cam.world_to_camera[2][0] + object.position[1]*cam.world_to_camera[2][1] + object.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3]
+
+ @bug: All attributes are read only at the moment.
+
+ .. attribute:: name
+
+ The scene's name, (read-only).
+
+ :type: string
+
+ .. attribute:: objects
+
+ A list of objects in the scene, (read-only).
+
+ :type: :class:`CListValue` of :class:`KX_GameObject`
+
+ .. attribute:: objectsInactive
+
+ A list of objects on background layers (used for the addObject actuator), (read-only).
+
+ :type: :class:`CListValue` of :class:`KX_GameObject`
+
+ .. attribute:: lights
+
+ A list of lights in the scene, (read-only).
+
+ :type: :class:`CListValue` of :class:`KX_LightObject`
+
+ .. attribute:: cameras
+
+ A list of cameras in the scene, (read-only).
+
+ :type: :class:`CListValue` of :class:`KX_Camera`
+
+ .. attribute:: active_camera
+
+ The current active camera.
+
+ :type: :class:`KX_Camera`
+
+ .. note::
+
+ This can be set directly from python to avoid using the :class:`KX_SceneActuator`.
+
+ .. attribute:: suspended
+
+ True if the scene is suspended, (read-only).
+
+ :type: boolean
+
+ .. attribute:: activity_culling
+
+ True if the scene is activity culling.
+
+ :type: boolean
+
+ .. attribute:: activity_culling_radius
+
+ The distance outside which to do activity culling. Measured in manhattan distance.
+
+ :type: float
+
+ .. attribute:: dbvt_culling
+
+ True when Dynamic Bounding box Volume Tree is set (read-only).
+
+ :type: boolean
+
+ .. attribute:: pre_draw
+
+ A list of callables to be run before the render step.
+
+ :type: list
+
+ .. attribute:: post_draw
+
+ A list of callables to be run after the render step.
+
+ :type: list
+
+ .. attribute:: gravity
+
+ The scene gravity using the world x, y and z axis.
+
+ :type: list [fx, fy, fz]
+
+ .. method:: addObject(object, other, time=0)
+
+ Adds an object to the scene like the Add Object Actuator would.
+
+ :arg object: The object to add
+ :type object: :class:`KX_GameObject` or string
+ :arg other: The object's center to use when adding the object
+ :type other: :class:`KX_GameObject` or string
+ :arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever.
+ :type time: integer
+ :return: The newly added object.
+ :rtype: :class:`KX_GameObject`
+
+ .. method:: end()
+
+ Removes the scene from the game.
+
+ .. method:: restart()
+
+ Restarts the scene.
+
+ .. method:: replace(scene)
+
+ Replaces this scene with another one.
+
+ :arg scene: The name of the scene to replace this scene with.
+ :type scene: string
+
+ .. method:: suspend()
+
+ Suspends this scene.
+
+ .. method:: resume()
+
+ Resume this scene.
+
+ .. method:: get(key, default=None)
+
+ 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.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_SceneActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_SceneActuator.rst
new file mode 100644
index 00000000000..9d073ff5b19
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_SceneActuator.rst
@@ -0,0 +1,49 @@
+KX_SceneActuator(SCA_IActuator)
+===============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_SceneActuator(SCA_IActuator)
+
+ Scene Actuator logic brick.
+
+ .. warning::
+
+ Scene actuators that use a scene name will be ignored if at game start, the named scene doesn't exist or is empty
+
+ This will generate a warning in the console:
+
+ .. code-block:: none
+
+ Error: GameObject 'Name' has a SceneActuator 'ActuatorName' (SetScene) without scene
+
+ .. attribute:: scene
+
+ the name of the scene to change to/overlay/underlay/remove/suspend/resume.
+
+ :type: string
+
+ .. attribute:: camera
+
+ the camera to change to.
+
+ :type: :class:`KX_Camera` on read, string or :class:`KX_Camera` on write
+
+ .. note::
+
+ When setting the attribute, you can use either a :class:`KX_Camera` or the name of the camera.
+
+ .. attribute:: useRestart
+
+ Set flag to True to restart the sene.
+
+ :type: boolean
+
+ .. attribute:: mode
+
+ The mode of the actuator.
+
+ :type: integer from 0 to 5.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_SoundActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_SoundActuator.rst
new file mode 100644
index 00000000000..aa85bd663b8
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_SoundActuator.rst
@@ -0,0 +1,115 @@
+KX_SoundActuator(SCA_IActuator)
+===============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_SoundActuator(SCA_IActuator)
+
+ Sound Actuator.
+
+ 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:: volume
+
+ The volume (gain) of the sound.
+
+ :type: float
+
+ .. attribute:: time
+
+ The current position in the audio stream (in seconds).
+
+ :type: float
+
+ .. attribute:: pitch
+
+ The pitch of the sound.
+
+ :type: float
+
+ .. attribute:: mode
+
+ The operation mode of the actuator. Can be one of :ref:`these constants<logic-sound-actuator>`
+
+ :type: integer
+
+ .. 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:: volume_minimum
+
+ The minimum gain of the sound, no matter how far it is away.
+
+ :type: float
+
+ .. attribute:: distance_reference
+
+ The distance where the sound has a gain of 1.0.
+
+ :type: float
+
+ .. attribute:: distance_maximum
+
+ The maximum distance at which you can hear the sound.
+
+ :type: float
+
+ .. attribute:: attenuation
+
+ The influence factor on volume depending on distance.
+
+ :type: float
+
+ .. attribute:: cone_angle_inner
+
+ The angle of the inner cone.
+
+ :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
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_StateActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_StateActuator.rst
new file mode 100644
index 00000000000..c9d08457cc6
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_StateActuator.rst
@@ -0,0 +1,29 @@
+KX_StateActuator(SCA_IActuator)
+===============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_StateActuator(SCA_IActuator)
+
+ State actuator changes the state mask of parent object.
+
+ .. attribute:: operation
+
+ Type of bit operation to be applied on object state mask.
+
+ You can use one of :ref:`these constants <state-actuator-operation>`
+
+ :type: integer
+
+ .. attribute:: mask
+
+ Value that defines the bits that will be modified by the operation.
+
+ The bits that are 1 in the mask will be updated in the object state.
+
+ The bits that are 0 are will be left unmodified expect for the Copy operation which copies the mask to the object state.
+
+ :type: integer
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_SteeringActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_SteeringActuator.rst
new file mode 100644
index 00000000000..f0ce248f069
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_SteeringActuator.rst
@@ -0,0 +1,71 @@
+KX_SteeringActuator(SCA_IActuator)
+==================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. 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
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_TouchSensor.rst b/doc/python_api/rst/bge_types/bge.types.KX_TouchSensor.rst
new file mode 100644
index 00000000000..fd8f319f6f3
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_TouchSensor.rst
@@ -0,0 +1,41 @@
+KX_TouchSensor(SCA_ISensor)
+===========================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: KX_TouchSensor(SCA_ISensor)
+
+ Touch sensor detects collisions between objects.
+
+ .. attribute:: propName
+
+ The property or material to collide with.
+
+ :type: string
+
+ .. attribute:: useMaterial
+
+ Determines if the sensor is looking for a property or material. KX_True = Find material; KX_False = Find property.
+
+ :type: boolean
+
+ .. attribute:: usePulseCollision
+
+ When enabled, changes to the set of colliding objects generate a pulse.
+
+ :type: boolean
+
+ .. attribute:: hitObject
+
+ The last collided object. (read-only).
+
+ :type: :class:`KX_GameObject` or None
+
+ .. attribute:: hitObjectList
+
+ A list of colliding objects. (read-only).
+
+ :type: :class:`CListValue` of :class:`KX_GameObject`
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_TrackToActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_TrackToActuator.rst
new file mode 100644
index 00000000000..070243c6a05
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_TrackToActuator.rst
@@ -0,0 +1,39 @@
+KX_TrackToActuator(SCA_IActuator)
+=================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_TrackToActuator(SCA_IActuator)
+
+ Edit Object actuator in Track To mode.
+
+ .. warning::
+
+ Track To Actuators will be ignored if at game start, the object to track to is invalid.
+
+ This will generate a warning in the console:
+
+ .. code-block:: none
+
+ GameObject 'Name' no object in EditObjectActuator 'ActuatorName'
+
+ .. attribute:: object
+
+ the object this actuator tracks.
+
+ :type: :class:`KX_GameObject` or None
+
+ .. attribute:: time
+
+ the time in frames with which to delay the tracking motion.
+
+ :type: integer
+
+ .. attribute:: use3D
+
+ the tracking motion to use 3D.
+
+ :type: boolean
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_VehicleWrapper.rst b/doc/python_api/rst/bge_types/bge.types.KX_VehicleWrapper.rst
new file mode 100644
index 00000000000..9340d33f8a9
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_VehicleWrapper.rst
@@ -0,0 +1,161 @@
+KX_VehicleWrapper(PyObjectPlus)
+===============================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: KX_VehicleWrapper(PyObjectPlus)
+
+ KX_VehicleWrapper
+
+ TODO - description
+
+ .. method:: addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering)
+
+ Add a wheel to the vehicle
+
+ :arg wheel: The object to use as a wheel.
+ :type wheel: :class:`KX_GameObject` or a KX_GameObject name
+ :arg attachPos: The position that this wheel will attach to.
+ :type attachPos: vector of 3 floats
+ :arg attachDir: The direction this wheel points.
+ :type attachDir: vector of 3 floats
+ :arg axleDir: The direction of this wheels axle.
+ :type axleDir: vector of 3 floats
+ :arg suspensionRestLength: TODO - Description
+ :type suspensionRestLength: float
+ :arg wheelRadius: The size of the wheel.
+ :type wheelRadius: float
+
+ .. method:: applyBraking(force, wheelIndex)
+
+ Apply a braking force to the specified wheel
+
+ :arg force: the brake force
+ :type force: float
+
+ :arg wheelIndex: index of the wheel where the force needs to be applied
+ :type wheelIndex: integer
+
+ .. method:: applyEngineForce(force, wheelIndex)
+
+ Apply an engine force to the specified wheel
+
+ :arg force: the engine force
+ :type force: float
+
+ :arg wheelIndex: index of the wheel where the force needs to be applied
+ :type wheelIndex: integer
+
+ .. method:: getConstraintId()
+
+ Get the constraint ID
+
+ :return: the constraint id
+ :rtype: integer
+
+ .. method:: getConstraintType()
+
+ Returns the constraint type.
+
+ :return: constraint type
+ :rtype: integer
+
+ .. method:: getNumWheels()
+
+ Returns the number of wheels.
+
+ :return: the number of wheels for this vehicle
+ :rtype: integer
+
+ .. method:: getWheelOrientationQuaternion(wheelIndex)
+
+ Returns the wheel orientation as a quaternion.
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ :return: TODO Description
+ :rtype: TODO - type should be quat as per method name but from the code it looks like a matrix
+
+ .. method:: getWheelPosition(wheelIndex)
+
+ Returns the position of the specified wheel
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+ :return: position vector
+ :rtype: list[x, y, z]
+
+ .. method:: getWheelRotation(wheelIndex)
+
+ Returns the rotation of the specified wheel
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ :return: the wheel rotation
+ :rtype: float
+
+ .. method:: setRollInfluence(rollInfluece, wheelIndex)
+
+ Set the specified wheel's roll influence.
+ The higher the roll influence the more the vehicle will tend to roll over in corners.
+
+ :arg rollInfluece: the wheel roll influence
+ :type rollInfluece: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ .. method:: setSteeringValue(steering, wheelIndex)
+
+ Set the specified wheel's steering
+
+ :arg steering: the wheel steering
+ :type steering: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ .. method:: setSuspensionCompression(compression, wheelIndex)
+
+ Set the specified wheel's compression
+
+ :arg compression: the wheel compression
+ :type compression: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ .. method:: setSuspensionDamping(damping, wheelIndex)
+
+ Set the specified wheel's damping
+
+ :arg damping: the wheel damping
+ :type damping: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ .. method:: setSuspensionStiffness(stiffness, wheelIndex)
+
+ Set the specified wheel's stiffness
+
+ :arg stiffness: the wheel stiffness
+ :type stiffness: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ .. method:: setTyreFriction(friction, wheelIndex)
+
+ Set the specified wheel's tyre friction
+
+ :arg friction: the tyre friction
+ :type friction: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst b/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst
new file mode 100644
index 00000000000..9c0d1169d49
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst
@@ -0,0 +1,209 @@
+KX_VertexProxy(SCA_IObject)
+===========================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IObject`
+
+.. class:: KX_VertexProxy(SCA_IObject)
+
+ A vertex holds position, UV, color and normal information.
+
+ Note:
+ The physics simulation is NOT currently updated - physics will not respond
+ to changes in the vertex position.
+
+ .. attribute:: XYZ
+
+ The position of the vertex.
+
+ :type: list [x, y, z]
+
+ .. attribute:: UV
+
+ The texture coordinates of the vertex.
+
+ :type: list [u, v]
+
+ .. attribute:: normal
+
+ The normal of the vertex.
+
+ :type: list [nx, ny, nz]
+
+ .. attribute:: color
+
+ The color of the vertex.
+
+ :type: list [r, g, b, a]
+
+ Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
+
+ .. attribute:: x
+
+ The x coordinate of the vertex.
+
+ :type: float
+
+ .. attribute:: y
+
+ The y coordinate of the vertex.
+
+ :type: float
+
+ .. attribute:: z
+
+ The z coordinate of the vertex.
+
+ :type: float
+
+ .. attribute:: u
+
+ The u texture coordinate of the vertex.
+
+ :type: float
+
+ .. attribute:: v
+
+ The v texture coordinate of the vertex.
+
+ :type: float
+
+ .. attribute:: u2
+
+ The second u texture coordinate of the vertex.
+
+ :type: float
+
+ .. attribute:: v2
+
+ The second v texture coordinate of the vertex.
+
+ :type: float
+
+ .. attribute:: r
+
+ The red component of the vertex color. 0.0 <= r <= 1.0.
+
+ :type: float
+
+ .. attribute:: g
+
+ The green component of the vertex color. 0.0 <= g <= 1.0.
+
+ :type: float
+
+ .. attribute:: b
+
+ The blue component of the vertex color. 0.0 <= b <= 1.0.
+
+ :type: float
+
+ .. attribute:: a
+
+ The alpha component of the vertex color. 0.0 <= a <= 1.0.
+
+ :type: float
+
+ .. method:: getXYZ()
+
+ Gets the position of this vertex.
+
+ :return: this vertexes position in local coordinates.
+ :rtype: list [x, y, z]
+
+ .. method:: setXYZ(pos)
+
+ Sets the position of this vertex.
+
+ :type: list [x, y, z]
+
+ :arg pos: the new position for this vertex in local coordinates.
+
+ .. method:: getUV()
+
+ Gets the UV (texture) coordinates of this vertex.
+
+ :return: this vertexes UV (texture) coordinates.
+ :rtype: list [u, v]
+
+ .. method:: setUV(uv)
+
+ Sets the UV (texture) coordinates of this vertex.
+
+ :type: list [u, v]
+
+ .. method:: getUV2()
+
+ Gets the 2nd UV (texture) coordinates of this vertex.
+
+ :return: this vertexes UV (texture) coordinates.
+ :rtype: list [u, v]
+
+ .. method:: setUV2(uv, unit)
+
+ Sets the 2nd UV (texture) coordinates of this vertex.
+
+ :type: list [u, v]
+
+ :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
+ :arg unit: integer
+
+ .. method:: getRGBA()
+
+ Gets the color of this vertex.
+
+ The color is represented as four bytes packed into an integer value. The color is
+ packed as RGBA.
+
+ Since Python offers no way to get each byte without shifting, you must use the struct module to
+ access color in an machine independent way.
+
+ Because of this, it is suggested you use the r, g, b and a attributes or the color attribute instead.
+
+ .. code-block:: python
+
+ import struct;
+ col = struct.unpack('4B', struct.pack('I', v.getRGBA()))
+ # col = (r, g, b, a)
+ # black = ( 0, 0, 0, 255)
+ # white = (255, 255, 255, 255)
+
+ :return: packed color. 4 byte integer with one byte per color channel in RGBA format.
+ :rtype: integer
+
+ .. method:: setRGBA(col)
+
+ Sets the color of this vertex.
+
+ See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes
+ or the color attribute instead.
+
+ setRGBA() also accepts a four component list as argument col. The list represents the color as [r, g, b, a]
+ with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0]
+
+ .. code-block:: python
+
+ v.setRGBA(0xff0000ff) # Red
+ v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian
+ v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red
+ v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms.
+
+ :arg col: the new color of this vertex in packed RGBA format.
+ :type col: integer or list [r, g, b, a]
+
+ .. method:: getNormal()
+
+ Gets the normal vector of this vertex.
+
+ :return: normalized normal vector.
+ :rtype: list [nx, ny, nz]
+
+ .. method:: setNormal(normal)
+
+ Sets the normal vector of this vertex.
+
+ :type: sequence of floats [r, g, b]
+
+ :arg normal: the new normal of this vertex.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_VisibilityActuator.rst b/doc/python_api/rst/bge_types/bge.types.KX_VisibilityActuator.rst
new file mode 100644
index 00000000000..4beb6539e0e
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.KX_VisibilityActuator.rst
@@ -0,0 +1,29 @@
+KX_VisibilityActuator(SCA_IActuator)
+====================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: KX_VisibilityActuator(SCA_IActuator)
+
+ Visibility Actuator.
+
+ .. attribute:: visibility
+
+ whether the actuator makes its parent object visible or invisible.
+
+ :type: boolean
+
+ .. attribute:: useOcclusion
+
+ whether the actuator makes its parent object an occluder or not.
+
+ :type: boolean
+
+ .. attribute:: useRecursion
+
+ whether the visibility/occlusion should be propagated to all children of the object.
+
+ :type: boolean
+
diff --git a/doc/python_api/rst/bge_types/bge.types.PyObjectPlus.rst b/doc/python_api/rst/bge_types/bge.types.PyObjectPlus.rst
new file mode 100644
index 00000000000..e035f457a96
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.PyObjectPlus.rst
@@ -0,0 +1,21 @@
+PyObjectPlus
+============
+
+.. module:: bge.types
+
+.. class:: PyObjectPlus
+
+ PyObjectPlus base class of most other types in the Game Engine.
+
+ .. attribute:: invalid
+
+ Test if the object has been freed by the game engine and is no longer valid.
+
+ Normally this is not a problem but when storing game engine data in the GameLogic module,
+ KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data.
+ Calling an attribute or method on an invalid object will raise a SystemError.
+
+ The invalid attribute allows testing for this case without exception handling.
+
+ :type: boolean
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_2DFilterActuator.rst b/doc/python_api/rst/bge_types/bge.types.SCA_2DFilterActuator.rst
new file mode 100644
index 00000000000..291ee8426cf
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_2DFilterActuator.rst
@@ -0,0 +1,49 @@
+SCA_2DFilterActuator(SCA_IActuator)
+===================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: SCA_2DFilterActuator(SCA_IActuator)
+
+ Create, enable and disable 2D filters
+
+ The following properties don't have an immediate effect.
+ You must active the actuator to get the result.
+ The actuator is not persistent: it automatically stops itself after setting up the filter
+ but the filter remains active. To stop a filter you must activate the actuator with 'type'
+ set to :data:`~bge.logic.RAS_2DFILTER_DISABLED` or :data:`~bge.logic.RAS_2DFILTER_NOFILTER`.
+
+ .. attribute:: shaderText
+
+ shader source code for custom shader.
+
+ :type: string
+
+ .. attribute:: disableMotionBlur
+
+ action on motion blur: 0=enable, 1=disable.
+
+ :type: integer
+
+ .. attribute:: mode
+
+ Type of 2D filter, use one of :ref:`these constants <Two-D-FilterActuator-mode>`
+
+ :type: integer
+
+ .. attribute:: passNumber
+
+ order number of filter in the stack of 2D filters. Filters are executed in increasing order of passNb.
+
+ Only be one filter can be defined per passNb.
+
+ :type: integer (0-100)
+
+ .. attribute:: value
+
+ argument for motion blur filter.
+
+ :type: float (0.0-100.0)
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_ANDController.rst b/doc/python_api/rst/bge_types/bge.types.SCA_ANDController.rst
new file mode 100644
index 00000000000..0942f715231
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_ANDController.rst
@@ -0,0 +1,13 @@
+SCA_ANDController(SCA_IController)
+==================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IController`
+
+.. class:: SCA_ANDController(SCA_IController)
+
+ An AND controller activates only when all linked sensors are activated.
+
+ There are no special python methods for this controller.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_ActuatorSensor.rst b/doc/python_api/rst/bge_types/bge.types.SCA_ActuatorSensor.rst
new file mode 100644
index 00000000000..54916389298
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_ActuatorSensor.rst
@@ -0,0 +1,19 @@
+SCA_ActuatorSensor(SCA_ISensor)
+===============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: SCA_ActuatorSensor(SCA_ISensor)
+
+ Actuator sensor detect change in actuator state of the parent object.
+ It generates a positive pulse if the corresponding actuator is activated
+ and a negative pulse if the actuator is deactivated.
+
+ .. attribute:: actuator
+
+ the name of the actuator that the sensor is monitoring.
+
+ :type: string
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_AlwaysSensor.rst b/doc/python_api/rst/bge_types/bge.types.SCA_AlwaysSensor.rst
new file mode 100644
index 00000000000..a217b114d62
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_AlwaysSensor.rst
@@ -0,0 +1,11 @@
+SCA_AlwaysSensor(SCA_ISensor)
+=============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: SCA_AlwaysSensor(SCA_ISensor)
+
+ This sensor is always activated.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_DelaySensor.rst b/doc/python_api/rst/bge_types/bge.types.SCA_DelaySensor.rst
new file mode 100644
index 00000000000..ce2b8e52eec
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_DelaySensor.rst
@@ -0,0 +1,39 @@
+SCA_DelaySensor(SCA_ISensor)
+============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: SCA_DelaySensor(SCA_ISensor)
+
+ The Delay sensor generates positive and negative triggers at precise time,
+ expressed in number of frames. The delay parameter defines the length of the initial OFF period. A positive trigger is generated at the end of this period.
+
+ The duration parameter defines the length of the ON period following the OFF period.
+ There is a negative trigger at the end of the ON period. If duration is 0, the sensor stays ON and there is no negative trigger.
+
+ The sensor runs the OFF-ON cycle once unless the repeat option is set: the OFF-ON cycle repeats indefinately (or the OFF cycle if duration is 0).
+
+ Use :class:`SCA_ISensor.reset` at any time to restart sensor.
+
+ .. attribute:: delay
+
+ length of the initial OFF period as number of frame, 0 for immediate trigger.
+
+ :type: integer.
+
+ .. attribute:: duration
+
+ length of the ON period in number of frame after the initial OFF period.
+
+ If duration is greater than 0, a negative trigger is sent at the end of the ON pulse.
+
+ :type: integer
+
+ .. attribute:: repeat
+
+ 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once.
+
+ :type: integer
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_IActuator.rst b/doc/python_api/rst/bge_types/bge.types.SCA_IActuator.rst
new file mode 100644
index 00000000000..1432d5166ef
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_IActuator.rst
@@ -0,0 +1,11 @@
+SCA_IActuator(SCA_ILogicBrick)
+==============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ILogicBrick`
+
+.. class:: SCA_IActuator(SCA_ILogicBrick)
+
+ Base class for all actuator logic bricks.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_IController.rst b/doc/python_api/rst/bge_types/bge.types.SCA_IController.rst
new file mode 100644
index 00000000000..5eb225ed329
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_IController.rst
@@ -0,0 +1,55 @@
+SCA_IController(SCA_ILogicBrick)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ILogicBrick`
+
+.. class:: SCA_IController(SCA_ILogicBrick)
+
+ Base class for all controller logic bricks.
+
+ .. attribute:: state
+
+ The controllers state bitmask. This can be used with the GameObject's state to test if the controller is active.
+
+ :type: int bitmask
+
+ .. attribute:: sensors
+
+ A list of sensors linked to this controller.
+
+ :type: sequence supporting index/string lookups and iteration.
+
+ .. note::
+
+ The sensors are not necessarily owned by the same object.
+
+ .. note::
+
+ When objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
+
+ .. attribute:: actuators
+
+ A list of actuators linked to this controller.
+
+ :type: sequence supporting index/string lookups and iteration.
+
+ .. note::
+
+ The sensors are not necessarily owned by the same object.
+
+ .. note::
+
+ When objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
+
+ .. attribute:: useHighPriority
+
+ When set the controller executes always before all other controllers that dont have this set.
+
+ :type: boolen
+
+ .. note::
+
+ Order of execution between high priority controllers is not guaranteed.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_ILogicBrick.rst b/doc/python_api/rst/bge_types/bge.types.SCA_ILogicBrick.rst
new file mode 100644
index 00000000000..5ed44c4bb38
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_ILogicBrick.rst
@@ -0,0 +1,29 @@
+SCA_ILogicBrick(CValue)
+=======================
+
+.. module:: bge.types
+
+base class --- :class:`CValue`
+
+.. class:: SCA_ILogicBrick(CValue)
+
+ Base class for all logic bricks.
+
+ .. attribute:: executePriority
+
+ This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first).
+
+ :type: executePriority: int
+
+ .. attribute:: owner
+
+ The game object this logic brick is attached to (read-only).
+
+ :type: :class:`KX_GameObject` or None in exceptional cases.
+
+ .. attribute:: name
+
+ The name of this logic brick (read-only).
+
+ :type: string
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_IObject.rst b/doc/python_api/rst/bge_types/bge.types.SCA_IObject.rst
new file mode 100644
index 00000000000..22065944542
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_IObject.rst
@@ -0,0 +1,11 @@
+SCA_IObject(CValue)
+===================
+
+.. module:: bge.types
+
+base class --- :class:`CValue`
+
+.. class:: SCA_IObject(CValue)
+
+ This class has no python functions
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_ISensor.rst b/doc/python_api/rst/bge_types/bge.types.SCA_ISensor.rst
new file mode 100644
index 00000000000..9efd2e2d63a
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_ISensor.rst
@@ -0,0 +1,95 @@
+SCA_ISensor(SCA_ILogicBrick)
+============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ILogicBrick`
+
+.. class:: SCA_ISensor(SCA_ILogicBrick)
+
+ Base class for all sensor logic bricks.
+
+ .. attribute:: usePosPulseMode
+
+ Flag to turn positive pulse mode on and off.
+
+ :type: boolean
+
+ .. attribute:: useNegPulseMode
+
+ Flag to turn negative pulse mode on and off.
+
+ :type: boolean
+
+ .. attribute:: frequency
+
+ The frequency for pulse mode sensors.
+
+ :type: integer
+
+ .. attribute:: level
+
+ level Option whether to detect level or edge transition when entering a state.
+ It makes a difference only in case of logic state transition (state actuator).
+ A level detector will immediately generate a pulse, negative or positive
+ depending on the sensor condition, as soon as the state is activated.
+ A edge detector will wait for a state change before generating a pulse.
+ note: mutually exclusive with :data:`tap`, enabling will disable :data:`tap`.
+
+ :type: boolean
+
+ .. attribute:: tap
+
+ When enabled only sensors that are just activated will send a positive event,
+ after this they will be detected as negative by the controllers.
+ This will make a key thats held act as if its only tapped for an instant.
+ note: mutually exclusive with :data:`level`, enabling will disable :data:`level`.
+
+ :type: boolean
+
+ .. attribute:: invert
+
+ Flag to set if this sensor activates on positive or negative events.
+
+ :type: boolean
+
+ .. attribute:: triggered
+
+ True if this sensor brick is in a positive state. (read-only).
+
+ :type: boolean
+
+ .. attribute:: positive
+
+ True if this sensor brick is in a positive state. (read-only).
+
+ :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>`.
+
+ :type: int
+
+ .. note::
+
+ This convenient attribute combines the values of triggered and positive attributes.
+
+ .. method:: reset()
+
+ Reset sensor internal state, effect depends on the type of sensor and settings.
+
+ The sensor is put in its initial state as if it was just activated.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_JoystickSensor.rst b/doc/python_api/rst/bge_types/bge.types.SCA_JoystickSensor.rst
new file mode 100644
index 00000000000..5b6628f60be
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_JoystickSensor.rst
@@ -0,0 +1,133 @@
+SCA_JoystickSensor(SCA_ISensor)
+===============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: SCA_JoystickSensor(SCA_ISensor)
+
+ This sensor detects player joystick events.
+
+ .. attribute:: axisValues
+
+ The state of the joysticks axis as a list of values :data:`numAxis` long. (read-only).
+
+ :type: list of ints.
+
+ Each specifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing.
+ The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
+
+ * left:[-32767, 0, ...]
+ * right:[32767, 0, ...]
+ * up:[0, -32767, ...]
+ * down:[0, 32767, ...]
+
+ .. attribute:: axisSingle
+
+ like :data:`axisValues` but returns a single axis value that is set by the sensor. (read-only).
+
+ :type: integer
+
+ .. note::
+
+ Only use this for "Single Axis" type sensors otherwise it will raise an error.
+
+ .. attribute:: hatValues
+
+ The state of the joysticks hats as a list of values :data:`numHats` long. (read-only).
+
+ :type: list of ints
+
+ Each specifying the direction of the hat from 1 to 12, 0 when inactive.
+
+ Hat directions are as follows...
+
+ * 0:None
+ * 1:Up
+ * 2:Right
+ * 4:Down
+ * 8:Left
+ * 3:Up - Right
+ * 6:Down - Right
+ * 12:Down - Left
+ * 9:Up - Left
+
+ .. attribute:: hatSingle
+
+ Like :data:`hatValues` but returns a single hat direction value that is set by the sensor. (read-only).
+
+ :type: integer
+
+ .. attribute:: numAxis
+
+ The number of axes for the joystick at this index. (read-only).
+
+ :type: integer
+
+ .. attribute:: numButtons
+
+ The number of buttons for the joystick at this index. (read-only).
+
+ :type: integer
+
+ .. attribute:: numHats
+
+ The number of hats for the joystick at this index. (read-only).
+
+ :type: integer
+
+ .. attribute:: connected
+
+ True if a joystick is connected at this joysticks index. (read-only).
+
+ :type: boolean
+
+ .. attribute:: index
+
+ The joystick index to use (from 0 to 7). The first joystick is always 0.
+
+ :type: integer
+
+ .. attribute:: threshold
+
+ Axis threshold. Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive.
+
+ :type: integer
+
+ .. attribute:: button
+
+ The button index the sensor reacts to (first button = 0). When the "All Events" toggle is set, this option has no effect.
+
+ :type: integer
+
+ .. attribute:: axis
+
+ The axis this sensor reacts to, as a list of two values [axisIndex, axisDirection]
+
+ * axisIndex: the axis index to use when detecting axis movement, 1=primary directional control, 2=secondary directional control.
+ * axisDirection: 0=right, 1=up, 2=left, 3=down.
+
+ :type: [integer, integer]
+
+ .. attribute:: hat
+
+ The hat the sensor reacts to, as a list of two values: [hatIndex, hatDirection]
+
+ * hatIndex: the hat index to use when detecting hat movement, 1=primary hat, 2=secondary hat (4 max).
+ * hatDirection: 1-12.
+
+ :type: [integer, integer]
+
+ .. method:: getButtonActiveList()
+
+ :return: A list containing the indicies of the currently pressed buttons.
+ :rtype: list
+
+ .. method:: getButtonStatus(buttonIndex)
+
+ :arg buttonIndex: the button index, 0=first button
+ :type buttonIndex: integer
+ :return: The current pressed state of the specified button.
+ :rtype: boolean
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_KeyboardSensor.rst b/doc/python_api/rst/bge_types/bge.types.SCA_KeyboardSensor.rst
new file mode 100644
index 00000000000..91613068ad0
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_KeyboardSensor.rst
@@ -0,0 +1,64 @@
+SCA_KeyboardSensor(SCA_ISensor)
+===============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: SCA_KeyboardSensor(SCA_ISensor)
+
+ A keyboard sensor detects player key presses.
+
+ See module :mod:`bge.events` for keycode values.
+
+ .. attribute:: key
+
+ The key code this sensor is looking for.
+
+ :type: keycode from :mod:`bge.events` module
+
+ .. attribute:: hold1
+
+ The key code for the first modifier this sensor is looking for.
+
+ :type: keycode from :mod:`bge.events` module
+
+ .. attribute:: hold2
+
+ The key code for the second modifier this sensor is looking for.
+
+ :type: keycode from :mod:`bge.events` module
+
+ .. attribute:: toggleProperty
+
+ The name of the property that indicates whether or not to log keystrokes as a string.
+
+ :type: string
+
+ .. attribute:: targetProperty
+
+ The name of the property that receives keystrokes in case in case a string is logged.
+
+ :type: string
+
+ .. attribute:: useAllKeys
+
+ Flag to determine whether or not to accept all keys.
+
+ :type: boolean
+
+ .. attribute:: events
+
+ a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only).
+
+ :type: list [[:ref:`keycode<keyboard-keys>`, :ref:`status<input-status>`], ...]
+
+ .. method:: getKeyStatus(keycode)
+
+ Get the status of a key.
+
+ :arg keycode: The code that represents the key you want to get the state of, use one of :ref:`these constants<keyboard-keys>`
+ :type keycode: integer
+ :return: The state of the given key, can be one of :ref:`these constants<input-status>`
+ :rtype: int
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_MouseSensor.rst b/doc/python_api/rst/bge_types/bge.types.SCA_MouseSensor.rst
new file mode 100644
index 00000000000..bbc695e4cbf
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_MouseSensor.rst
@@ -0,0 +1,39 @@
+SCA_MouseSensor(SCA_ISensor)
+============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: SCA_MouseSensor(SCA_ISensor)
+
+ Mouse Sensor logic brick.
+
+ .. attribute:: position
+
+ current [x, y] coordinates of the mouse, in frame coordinates (pixels).
+
+ :type: [integer, interger]
+
+ .. attribute:: mode
+
+ sensor mode.
+
+ :type: integer
+
+ * KX_MOUSESENSORMODE_LEFTBUTTON(1)
+ * KX_MOUSESENSORMODE_MIDDLEBUTTON(2)
+ * KX_MOUSESENSORMODE_RIGHTBUTTON(3)
+ * KX_MOUSESENSORMODE_WHEELUP(4)
+ * KX_MOUSESENSORMODE_WHEELDOWN(5)
+ * KX_MOUSESENSORMODE_MOVEMENT(6)
+
+ .. method:: getButtonStatus(button)
+
+ Get the mouse button status.
+
+ :arg button: The code that represents the key you want to get the state of, use one of :ref:`these constants<mouse-keys>`
+ :type button: int
+ :return: The state of the given key, can be one of :ref:`these constants<input-status>`
+ :rtype: int
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_NANDController.rst b/doc/python_api/rst/bge_types/bge.types.SCA_NANDController.rst
new file mode 100644
index 00000000000..4bd67fb22ee
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_NANDController.rst
@@ -0,0 +1,13 @@
+SCA_NANDController(SCA_IController)
+===================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IController`
+
+.. class:: SCA_NANDController(SCA_IController)
+
+ An NAND controller activates when all linked sensors are not active.
+
+ There are no special python methods for this controller.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_NORController.rst b/doc/python_api/rst/bge_types/bge.types.SCA_NORController.rst
new file mode 100644
index 00000000000..5a567c84ece
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_NORController.rst
@@ -0,0 +1,13 @@
+SCA_NORController(SCA_IController)
+==================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IController`
+
+.. class:: SCA_NORController(SCA_IController)
+
+ An NOR controller activates only when all linked sensors are de-activated.
+
+ There are no special python methods for this controller.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_ORController.rst b/doc/python_api/rst/bge_types/bge.types.SCA_ORController.rst
new file mode 100644
index 00000000000..ed57b0dbaf2
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_ORController.rst
@@ -0,0 +1,13 @@
+SCA_ORController(SCA_IController)
+=================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IController`
+
+.. class:: SCA_ORController(SCA_IController)
+
+ An OR controller activates when any connected sensor activates.
+
+ There are no special python methods for this controller.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_PropertyActuator.rst b/doc/python_api/rst/bge_types/bge.types.SCA_PropertyActuator.rst
new file mode 100644
index 00000000000..36a4ea7fefe
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_PropertyActuator.rst
@@ -0,0 +1,29 @@
+SCA_PropertyActuator(SCA_IActuator)
+===================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: SCA_PropertyActuator(SCA_IActuator)
+
+ Property Actuator
+
+ .. attribute:: propName
+
+ the property on which to operate.
+
+ :type: string
+
+ .. attribute:: value
+
+ the value with which the actuator operates.
+
+ :type: string
+
+ .. attribute:: mode
+
+ TODO - add constants to game logic dict!.
+
+ :type: integer
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_PropertySensor.rst b/doc/python_api/rst/bge_types/bge.types.SCA_PropertySensor.rst
new file mode 100644
index 00000000000..3c41e4679db
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_PropertySensor.rst
@@ -0,0 +1,41 @@
+SCA_PropertySensor(SCA_ISensor)
+===============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: SCA_PropertySensor(SCA_ISensor)
+
+ Activates when the game object property matches.
+
+ .. attribute:: mode
+
+ Type of check on the property. Can be one of :ref:`these constants <logic-property-sensor>`
+
+ :type: integer.
+
+ .. attribute:: propName
+
+ the property the sensor operates.
+
+ :type: string
+
+ .. attribute:: value
+
+ the value with which the sensor compares to the value of the property.
+
+ :type: string
+
+ .. attribute:: min
+
+ the minimum value of the range used to evaluate the property when in interval mode.
+
+ :type: string
+
+ .. attribute:: max
+
+ the maximum value of the range used to evaluate the property when in interval mode.
+
+ :type: string
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_PythonController.rst b/doc/python_api/rst/bge_types/bge.types.SCA_PythonController.rst
new file mode 100644
index 00000000000..a00e9c29ad4
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_PythonController.rst
@@ -0,0 +1,48 @@
+SCA_PythonController(SCA_IController)
+=====================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IController`
+
+.. class:: SCA_PythonController(SCA_IController)
+
+ A Python controller uses a Python script to activate it's actuators,
+ based on it's sensors.
+
+ .. attribute:: script
+
+ The value of this variable depends on the execution methid.
+
+ * When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts.
+ * When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts.
+
+ :type: string
+
+ .. note::
+
+ Once this is set the script name given for warnings will remain unchanged.
+
+ .. attribute:: mode
+
+ the execution mode for this controller (read-only).
+
+ * Script: 0, Execite the :data:`script` as a python code.
+ * Module: 1, Execite the :data:`script` as a module and function.
+
+ :type: integer
+
+ .. method:: activate(actuator)
+
+ Activates an actuator attached to this controller.
+
+ :arg actuator: The actuator to operate on.
+ :type actuator: actuator or the actuator name as a string
+
+ .. method:: deactivate(actuator)
+
+ Deactivates an actuator attached to this controller.
+
+ :arg actuator: The actuator to operate on.
+ :type actuator: actuator or the actuator name as a string
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_PythonJoystick.rst b/doc/python_api/rst/bge_types/bge.types.SCA_PythonJoystick.rst
new file mode 100644
index 00000000000..2b97b5939e2
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_PythonJoystick.rst
@@ -0,0 +1,75 @@
+SCA_PythonJoystick(PyObjectPlus)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: SCA_PythonJoystick(PyObjectPlus)
+
+ A Python interface to a joystick.
+
+ .. attribute:: name
+
+ The name assigned to the joystick by the operating system. (read-only)
+
+ :type: string
+
+ .. attribute:: activeButtons
+
+ A list of active button values. (read-only)
+
+ :type: list
+
+ .. attribute:: axisValues
+
+ The state of the joysticks axis as a list of values :data:`numAxis` long. (read-only).
+
+ :type: list of ints.
+
+ Each specifying the value of an axis between -1.0 and 1.0 depending on how far the axis is pushed, 0 for nothing.
+ The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
+
+ * left:[-1.0, 0.0, ...]
+ * right:[1.0, 0.0, ...]
+ * up:[0.0, -1.0, ...]
+ * down:[0.0, 1.0, ...]
+
+ .. attribute:: hatValues
+
+ The state of the joysticks hats as a list of values :data:`numHats` long. (read-only).
+
+ :type: list of ints
+
+ Each specifying the direction of the hat from 1 to 12, 0 when inactive.
+
+ Hat directions are as follows...
+
+ * 0:None
+ * 1:Up
+ * 2:Right
+ * 4:Down
+ * 8:Left
+ * 3:Up - Right
+ * 6:Down - Right
+ * 12:Down - Left
+ * 9:Up - Left
+
+ .. attribute:: numAxis
+
+ The number of axes for the joystick at this index. (read-only).
+
+ :type: integer
+
+ .. attribute:: numButtons
+
+ The number of buttons for the joystick at this index. (read-only).
+
+ :type: integer
+
+ .. attribute:: numHats
+
+ The number of hats for the joystick at this index. (read-only).
+
+ :type: integer
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_PythonKeyboard.rst b/doc/python_api/rst/bge_types/bge.types.SCA_PythonKeyboard.rst
new file mode 100644
index 00000000000..6cfef2f80f1
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_PythonKeyboard.rst
@@ -0,0 +1,37 @@
+SCA_PythonKeyboard(PyObjectPlus)
+================================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: SCA_PythonKeyboard(PyObjectPlus)
+
+ The current keyboard.
+
+ .. attribute:: events
+
+ A dictionary containing the status of each keyboard event or key. (read-only).
+
+ :type: dictionary {:ref:`keycode<keyboard-keys>`::ref:`status<input-status>`, ...}
+
+ .. attribute:: active_events
+
+ A dictionary containing the status of only the active keyboard events or keys. (read-only).
+
+ :type: dictionary {:ref:`keycode<keyboard-keys>`::ref:`status<input-status>`, ...}
+
+
+ .. function:: getClipboard()
+
+ Gets the clipboard text.
+
+ :rtype: string
+
+ .. function:: setClipboard(text)
+
+ Sets the clipboard text.
+
+ :arg text: New clipboard text
+ :type text: string
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_PythonMouse.rst b/doc/python_api/rst/bge_types/bge.types.SCA_PythonMouse.rst
new file mode 100644
index 00000000000..b1c6e5d1487
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_PythonMouse.rst
@@ -0,0 +1,35 @@
+SCA_PythonMouse(PyObjectPlus)
+=============================
+
+.. module:: bge.types
+
+base class --- :class:`PyObjectPlus`
+
+.. class:: SCA_PythonMouse(PyObjectPlus)
+
+ The current mouse.
+
+ .. attribute:: events
+
+ a dictionary containing the status of each mouse event. (read-only).
+
+ :type: dictionary {:ref:`keycode<mouse-keys>`::ref:`status<input-status>`, ...}
+
+ .. attribute:: active_events
+
+ a dictionary containing the status of only the active mouse events. (read-only).
+
+ :type: dictionary {:ref:`keycode<mouse-keys>`::ref:`status<input-status>`, ...}
+
+ .. attribute:: position
+
+ The normalized x and y position of the mouse cursor.
+
+ :type: list [x, y]
+
+ .. attribute:: visible
+
+ The visibility of the mouse cursor.
+
+ :type: boolean
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_RandomActuator.rst b/doc/python_api/rst/bge_types/bge.types.SCA_RandomActuator.rst
new file mode 100644
index 00000000000..68357229262
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_RandomActuator.rst
@@ -0,0 +1,127 @@
+SCA_RandomActuator(SCA_IActuator)
+=================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IActuator`
+
+.. class:: SCA_RandomActuator(SCA_IActuator)
+
+ Random Actuator
+
+ .. attribute:: seed
+
+ Seed of the random number generator.
+
+ :type: integer.
+
+ Equal seeds produce equal series. If the seed is 0, the generator will produce the same value on every call.
+
+ .. attribute:: para1
+
+ the first parameter of the active distribution.
+
+ :type: float, read-only.
+
+ Refer to the documentation of the generator types for the meaning of this value.
+
+ .. attribute:: para2
+
+ the second parameter of the active distribution.
+
+ :type: float, read-only
+
+ Refer to the documentation of the generator types for the meaning of this value.
+
+ .. attribute:: distribution
+
+ Distribution type. (read-only). Can be one of :ref:`these constants <logic-random-distributions>`
+
+ :type: integer
+
+ .. attribute:: propName
+
+ the name of the property to set with the random value.
+
+ :type: string
+
+ If the generator and property types do not match, the assignment is ignored.
+
+ .. method:: setBoolConst(value)
+
+ Sets this generator to produce a constant boolean value.
+
+ :arg value: The value to return.
+ :type value: boolean
+
+ .. method:: setBoolUniform()
+
+ Sets this generator to produce a uniform boolean distribution.
+
+ The generator will generate True or False with 50% chance.
+
+ .. method:: setBoolBernouilli(value)
+
+ Sets this generator to produce a Bernouilli distribution.
+
+ :arg value: Specifies the proportion of False values to produce.
+
+ * 0.0: Always generate True
+ * 1.0: Always generate False
+ :type value: float
+
+ .. method:: setIntConst(value)
+
+ Sets this generator to always produce the given value.
+
+ :arg value: the value this generator produces.
+ :type value: integer
+
+ .. method:: setIntUniform(lower_bound, upper_bound)
+
+ Sets this generator to produce a random value between the given lower and
+ upper bounds (inclusive).
+
+ :type lower_bound: integer
+ :type upper_bound: integer
+
+ .. method:: setIntPoisson(value)
+
+ Generate a Poisson-distributed number.
+
+ This performs a series of Bernouilli tests with parameter value.
+ It returns the number of tries needed to achieve succes.
+
+ :type value: float
+
+ .. method:: setFloatConst(value)
+
+ Always generate the given value.
+
+ :type value: float
+
+ .. method:: setFloatUniform(lower_bound, upper_bound)
+
+ Generates a random float between lower_bound and upper_bound with a
+ uniform distribution.
+
+ :type lower_bound: float
+ :type upper_bound: float
+
+ .. method:: setFloatNormal(mean, standard_deviation)
+
+ Generates a random float from the given normal distribution.
+
+ :arg mean: The mean (average) value of the generated numbers
+ :type mean: float
+ :arg standard_deviation: The standard deviation of the generated numbers.
+ :type standard_deviation: float
+
+ .. method:: setFloatNegativeExponential(half_life)
+
+ Generate negative-exponentially distributed numbers.
+
+ The half-life 'time' is characterized by half_life.
+
+ :type half_life: float
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_RandomSensor.rst b/doc/python_api/rst/bge_types/bge.types.SCA_RandomSensor.rst
new file mode 100644
index 00000000000..05e61ccf118
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_RandomSensor.rst
@@ -0,0 +1,23 @@
+SCA_RandomSensor(SCA_ISensor)
+=============================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_ISensor`
+
+.. class:: SCA_RandomSensor(SCA_ISensor)
+
+ This sensor activates randomly.
+
+ .. attribute:: lastDraw
+
+ The seed of the random number generator.
+
+ :type: integer
+
+ .. attribute:: seed
+
+ The seed of the random number generator.
+
+ :type: integer
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_XNORController.rst b/doc/python_api/rst/bge_types/bge.types.SCA_XNORController.rst
new file mode 100644
index 00000000000..d0235f29a20
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_XNORController.rst
@@ -0,0 +1,13 @@
+SCA_XNORController(SCA_IController)
+===================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IController`
+
+.. class:: SCA_XNORController(SCA_IController)
+
+ An XNOR controller activates when all linked sensors are the same (activated or inative).
+
+ There are no special python methods for this controller.
+
diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_XORController.rst b/doc/python_api/rst/bge_types/bge.types.SCA_XORController.rst
new file mode 100644
index 00000000000..98ccf142f63
--- /dev/null
+++ b/doc/python_api/rst/bge_types/bge.types.SCA_XORController.rst
@@ -0,0 +1,13 @@
+SCA_XORController(SCA_IController)
+==================================
+
+.. module:: bge.types
+
+base class --- :class:`SCA_IController`
+
+.. class:: SCA_XORController(SCA_IController)
+
+ An XOR controller activates when there is the input is mixed, but not when all are on or off.
+
+ There are no special python methods for this controller.
+
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 4311ae56f8e..a1e88983a03 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -698,6 +698,8 @@ def pyprop2sphinx(ident, fw, identifier, py_prop):
write_indented_lines(ident + " ", fw, py_prop.__doc__)
if py_prop.fset is None:
fw(ident + " (readonly)\n\n")
+ else:
+ fw("\n")
def pymodule2sphinx(basepath, module_name, module, title):
@@ -1717,7 +1719,6 @@ def copy_handwritten_rsts(basepath):
# TODO put this docs in blender's code and use import as per modules above
handwritten_modules = [
- "bge.types",
"bge.logic",
"bge.render",
"bge.texture",
@@ -1736,6 +1737,14 @@ def copy_handwritten_rsts(basepath):
# copy2 keeps time/date stamps
shutil.copy2(os.path.join(RST_DIR, "%s.rst" % mod_name), basepath)
+ if "bge.types" not in EXCLUDE_MODULES:
+ shutil.copy2(os.path.join(RST_DIR, "bge.types.rst"), basepath)
+
+ bge_types_dir = os.path.join(RST_DIR, "bge_types")
+
+ for i in os.listdir(bge_types_dir):
+ shutil.copy2(os.path.join(bge_types_dir, i), basepath)
+
# changelog
shutil.copy2(os.path.join(RST_DIR, "change_log.rst"), basepath)
@@ -1823,8 +1832,19 @@ def refactor_sphinx_log(sphinx_logfile):
refactored_logfile.write("%-12s %s\n %s\n" % log)
+def monkey_patch():
+ filepath = os.path.join(SCRIPT_DIR, "sphinx_doc_gen_monkeypatch.py")
+ global_namespace = {"__file__": filepath, "__name__": "__main__"}
+ file = open(filepath, 'rb')
+ exec(compile(file.read(), filepath, 'exec'), global_namespace)
+ file.close()
+
+
def main():
+ # first monkey patch to load in fake members
+ monkey_patch()
+
# eventually, create the dirs
for dir_path in [ARGS.output_dir, SPHINX_IN]:
if not os.path.exists(dir_path):
diff --git a/doc/python_api/sphinx_doc_gen_monkeypatch.py b/doc/python_api/sphinx_doc_gen_monkeypatch.py
new file mode 100644
index 00000000000..1167ece05b7
--- /dev/null
+++ b/doc/python_api/sphinx_doc_gen_monkeypatch.py
@@ -0,0 +1,47 @@
+ # ***** 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): Campbell Barton
+ #
+ # #**** END GPL LICENSE BLOCK #****
+
+# <pep8 compliant>
+
+bpy_types_Operator_bl_property__doc__ = (
+"""
+The name of a property to use as this operators primary property.
+Currently this is only used to select the default property when
+expanding an operator into a menu.
+:type: string
+""")
+
+
+def main():
+ import bpy
+ from bpy.types import Operator
+
+ def dummy_func(test):
+ pass
+
+ kw_dummy = dict(fget=dummy_func, fset=dummy_func, fdel=dummy_func)
+
+ # bpy registration handles this,
+ # but its only checked for and not existing in the base class.
+ Operator.bl_property = property(doc=bpy_types_Operator_bl_property__doc__, **kw_dummy)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/extern/bullet2/CMakeLists.txt b/extern/bullet2/CMakeLists.txt
index c57474f99f2..3d757947980 100644
--- a/extern/bullet2/CMakeLists.txt
+++ b/extern/bullet2/CMakeLists.txt
@@ -242,14 +242,15 @@ set(SRC
src/BulletCollision/CollisionShapes/btUniformScalingShape.h
src/BulletCollision/Gimpact/btBoxCollision.h
src/BulletCollision/Gimpact/btClipPolygon.h
+ src/BulletCollision/Gimpact/btCompoundFromGimpact.h
src/BulletCollision/Gimpact/btContactProcessing.h
- src/BulletCollision/Gimpact/btGenericPoolAllocator.h
- src/BulletCollision/Gimpact/btGeometryOperations.h
src/BulletCollision/Gimpact/btGImpactBvh.h
src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h
src/BulletCollision/Gimpact/btGImpactMassUtil.h
src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h
src/BulletCollision/Gimpact/btGImpactShape.h
+ src/BulletCollision/Gimpact/btGenericPoolAllocator.h
+ src/BulletCollision/Gimpact/btGeometryOperations.h
src/BulletCollision/Gimpact/btQuantization.h
src/BulletCollision/Gimpact/btTriangleShapeEx.h
src/BulletCollision/Gimpact/gim_array.h
diff --git a/extern/carve/lib/intersect_face_division.cpp b/extern/carve/lib/intersect_face_division.cpp
index c74b52dd557..c5d5d8c5152 100644
--- a/extern/carve/lib/intersect_face_division.cpp
+++ b/extern/carve/lib/intersect_face_division.cpp
@@ -719,6 +719,10 @@ namespace {
unassigned--;
}
}
+
+ if (!removed.size())
+ throw carve::exception("Failed to merge holes");
+
for (std::set<int>::iterator f = removed.begin(); f != removed.end(); ++f) {
for (unsigned i = 0; i < containing_faces.size(); ++i) {
containing_faces[i].erase(std::remove(containing_faces[i].begin(),
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index be797c45ba1..bb8cd7aaf70 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -69,6 +69,14 @@ if(WITH_INTERNATIONAL)
add_subdirectory(locale)
endif()
+if(WITH_BULLET)
+ add_subdirectory(rigidbody)
+endif()
+
+if(WITH_COMPOSITOR)
+ add_subdirectory(opencl)
+endif()
+
# only windows needs utf16 converter
if(WIN32)
add_subdirectory(utfconv)
diff --git a/intern/SConscript b/intern/SConscript
index a35c99bbbaa..828c1adc20d 100644
--- a/intern/SConscript
+++ b/intern/SConscript
@@ -59,6 +59,12 @@ if env['WITH_BF_BOOLEAN']:
if env['WITH_BF_INTERNATIONAL']:
SConscript(['locale/SConscript'])
+if env['WITH_BF_BULLET']:
+ SConscript (['rigidbody/SConscript'])
+
+if env['WITH_BF_COMPOSITOR']:
+ SConscript (['opencl/SConscript'])
+
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
SConscript(['utfconv/SConscript'])
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 048a2a50a7f..226218ae512 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -13,10 +13,12 @@ if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
endif()
if(WIN32 AND MSVC)
- set(CYCLES_OPTIMIZED_KERNEL_FLAGS "/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc")
+ set(CYCLES_SSE2_KERNEL_FLAGS "/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc")
+ set(CYCLES_SSE3_KERNEL_FLAGS "/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /EHsc")
elseif(CMAKE_COMPILER_IS_GNUCC)
- set(CYCLES_OPTIMIZED_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mfpmath=sse")
+ set(CYCLES_SSE2_KERNEL_FLAGS "-ffast-math -msse -msse2 -mfpmath=sse")
+ set(CYCLES_SSE3_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mfpmath=sse")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
endif()
@@ -44,6 +46,7 @@ endif()
if(WITH_CYCLES_OSL)
add_definitions(-DWITH_OSL)
+ add_definitions(-DOSL_STATIC_LIBRARY)
include_directories(${OSL_INCLUDES})
endif()
diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript
index 44a17ac0cd6..8a8ef9cce39 100644
--- a/intern/cycles/SConscript
+++ b/intern/cycles/SConscript
@@ -36,7 +36,8 @@ sources = cycles.Glob('bvh/*.cpp') + cycles.Glob('device/*.cpp') + cycles.Glob('
sources.remove(path.join('util', 'util_view.cpp'))
sources.remove(path.join('render', 'film_response.cpp'))
-sources.remove(path.join('kernel', 'kernel_optimized.cpp'))
+sources.remove(path.join('kernel', 'kernel_sse2.cpp'))
+sources.remove(path.join('kernel', 'kernel_sse3.cpp'))
incs = []
defs = []
@@ -51,6 +52,7 @@ defs.append('WITH_CUDA')
if env['WITH_BF_CYCLES_OSL']:
defs.append('WITH_OSL')
+ defs.append('OSL_STATIC_LIBRARY')
incs.append(cycles['BF_OSL_INC'])
incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split())
@@ -72,21 +74,29 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
# optimized kernel
if env['WITH_BF_RAYOPTIMIZATION']:
- optim_cxxflags = Split(env['CXXFLAGS'])
+ sse2_cxxflags = Split(env['CXXFLAGS'])
+ sse3_cxxflags = Split(env['CXXFLAGS'])
if env['OURPLATFORM'] == 'win32-vc':
- optim_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
+ sse2_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
+ sse3_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
elif env['OURPLATFORM'] == 'win64-vc':
- optim_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
+ sse2_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
+ sse3_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
else:
- optim_cxxflags.append('-ffast-math -msse -msse2 -msse3 -mfpmath=sse'.split())
+ sse2_cxxflags.append('-ffast-math -msse -msse2 -mfpmath=sse'.split())
+ sse3_cxxflags.append('-ffast-math -msse -msse2 -msse3 -mfpmath=sse'.split())
defs.append('WITH_OPTIMIZED_KERNEL')
optim_defs = defs[:]
- optim_sources = [path.join('kernel', 'kernel_optimized.cpp')]
- cycles_optim = cycles.Clone()
- cycles_optim.BlenderLib('bf_intern_cycles_optimized', optim_sources, incs, optim_defs, libtype=['intern'], priority=[10], cxx_compileflags=optim_cxxflags)
+ cycles_sse3 = cycles.Clone()
+ sse3_sources = [path.join('kernel', 'kernel_sse3.cpp')]
+ cycles_sse3.BlenderLib('bf_intern_cycles_sse3', sse3_sources, incs, optim_defs, libtype=['intern'], priority=[10], cxx_compileflags=sse3_cxxflags)
+
+ cycles_sse2 = cycles.Clone()
+ sse2_sources = [path.join('kernel', 'kernel_sse2.cpp')]
+ cycles_sse2.BlenderLib('bf_intern_cycles_sse2', sse2_sources, incs, optim_defs, libtype=['intern'], priority=[10], cxx_compileflags=sse2_cxxflags)
cycles.BlenderLib('bf_intern_cycles', sources, incs, defs, libtype=['intern'], priority=[0], cxx_compileflags=cxxflags)
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 3661274ae43..65f245fba69 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -66,9 +66,11 @@ enum_panorama_types = (
enum_curve_presets = (
('CUSTOM', "Custom", "Set general parameters"),
- ('TANGENT_SHADING', "Tangent Normal", "Use planar geometry and tangent normals"),
- ('TRUE_NORMAL', "True Normal", "Use true normals (good for thin strands)"),
- ('ACCURATE_PRESET', "Accurate", "Use best settings (suitable for glass materials)"),
+ ('FAST_PLANES', "Fast Planes", "Use camera facing triangles (fast but memory intensive)"),
+ ('TANGENT_SHADING', "Tangent Normal", "Use planar line segments and tangent normals"),
+ ('TRUE_NORMAL', "True Normal", "Use true normals with line segments(good for thin strands)"),
+ ('ACCURATE_PRESET', "Accurate", "Use best line segment settings (suitable for glass materials)"),
+ ('SMOOTH_CURVES', "Smooth Curves", "Use smooth cardinal curves (slowest)"),
)
enum_curve_primitives = (
@@ -462,8 +464,8 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
type=cls,
)
cls.sample_as_light = BoolProperty(
- name="Sample as Lamp",
- description="Use direct light sampling for this material, "
+ name="Multiple Importance Sample",
+ description="Use multiple importance sampling for this material, "
"disabling may reduce overall noise for large "
"objects that emit little light compared to other light sources",
default=True,
@@ -499,6 +501,12 @@ class CyclesLampSettings(bpy.types.PropertyGroup):
min=1, max=10000,
default=1,
)
+ cls.use_multiple_importance_sampling = BoolProperty(
+ name="Multiple Importance Sample",
+ description="Use multiple importance sampling for the lamp, "
+ "reduces noise for area lamps and sharp glossy materials",
+ default=False,
+ )
@classmethod
def unregister(cls):
@@ -514,8 +522,8 @@ class CyclesWorldSettings(bpy.types.PropertyGroup):
type=cls,
)
cls.sample_as_light = BoolProperty(
- name="Sample as Lamp",
- description="Use direct light sampling for the environment, "
+ name="Multiple Importance Sample",
+ description="Use multiple importance sampling for the environment, "
"enabling for non-solid colors is recommended",
default=False,
)
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 9d0b6d96f47..b9fbb85581e 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -168,6 +168,19 @@ class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
if cscene.filter_type != 'BOX':
sub.prop(cscene, "filter_width", text="Width")
+ layout.separator()
+
+ rd = scene.render
+ col = layout.column()
+
+ split = col.split(percentage=0.40)
+ split.prop(rd, "use_antialiasing", "OpenGL AA")
+ row = split.row()
+ row.active = rd.use_antialiasing
+ row.prop(rd, "antialiasing_samples", expand=True)
+
+ col.prop(rd, "alpha_mode", text="OpenGL Alpha")
+
class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
bl_label = "Performance"
@@ -552,6 +565,19 @@ def panel_node_draw(layout, id_data, output_type, input_name):
return True
+class CyclesLamp_PT_preview(CyclesButtonsPanel, Panel):
+ bl_label = "Preview"
+ bl_context = "data"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.lamp and CyclesButtonsPanel.poll(context)
+
+ def draw(self, context):
+ self.layout.template_preview(context.lamp)
+
+
class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
bl_label = "Lamp"
bl_context = "data"
@@ -591,6 +617,8 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
col = split.column()
col.prop(clamp, "cast_shadow")
+ layout.prop(clamp, "use_multiple_importance_sampling")
+
if lamp.type == 'HEMI':
layout.label(text="Not supported, interpreted as sun lamp.")
@@ -636,6 +664,19 @@ class CyclesLamp_PT_spot(CyclesButtonsPanel, Panel):
col.prop(lamp, "show_cone")
+class CyclesWorld_PT_preview(CyclesButtonsPanel, Panel):
+ bl_label = "Preview"
+ bl_context = "world"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.world and CyclesButtonsPanel.poll(context)
+
+ def draw(self, context):
+ self.layout.template_preview(context.world)
+
+
class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
bl_label = "Surface"
bl_context = "world"
@@ -722,6 +763,19 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
sub.prop(cworld, "samples")
+class CyclesMaterial_PT_preview(CyclesButtonsPanel, Panel):
+ bl_label = "Preview"
+ bl_context = "material"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.material and CyclesButtonsPanel.poll(context)
+
+ def draw(self, context):
+ self.layout.template_preview(context.material)
+
+
class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
bl_label = "Surface"
bl_context = "material"
@@ -798,9 +852,10 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
col.prop(mat, "diffuse_color", text="Viewport Color")
col = split.column()
- col.prop(cmat, "sample_as_light")
col.prop(mat, "pass_index")
+ layout.prop(cmat, "sample_as_light")
+
class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
bl_label = ""
@@ -838,24 +893,8 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
split = layout.split(percentage=0.2)
split.label(text="Type:")
split.prop(tex, "type", text="")
-
-
-class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel):
- bl_label = "Nodes"
- bl_context = "texture"
-
- @classmethod
- def poll(cls, context):
- tex = context.texture
- return (tex and tex.use_nodes) and CyclesButtonsPanel.poll(context)
-
- def draw(self, context):
- layout = self.layout
-
- tex = context.texture
- panel_node_draw(layout, tex, 'OUTPUT_TEXTURE', 'Color')
-
-
+
+
class CyclesTexture_PT_node(CyclesButtonsPanel, Panel):
bl_label = "Node"
bl_context = "texture"
@@ -879,14 +918,12 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
- tex = context.texture
node = context.texture_node
- return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
+ return node and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
-
- # tex = context.texture
+
node = context.texture_node
mapping = node.texture_mapping
@@ -912,15 +949,13 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
- # tex = context.texture
# node = context.texture_node
return False
- #return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
+ #return node and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
-
- # tex = context.texture
+
node = context.texture_node
mapping = node.color_mapping
@@ -1141,12 +1176,14 @@ def get_panels():
types.RENDER_PT_stamp,
types.SCENE_PT_scene,
types.SCENE_PT_color_management,
+ types.SCENE_PT_custom_props,
types.SCENE_PT_audio,
types.SCENE_PT_unit,
types.SCENE_PT_keying_sets,
types.SCENE_PT_keying_set_paths,
types.SCENE_PT_physics,
types.WORLD_PT_context_world,
+ types.WORLD_PT_custom_props,
types.DATA_PT_context_mesh,
types.DATA_PT_context_camera,
types.DATA_PT_context_lamp,
@@ -1169,6 +1206,11 @@ def get_panels():
types.DATA_PT_custom_props_camera,
types.DATA_PT_custom_props_lamp,
types.DATA_PT_custom_props_speaker,
+ types.DATA_PT_custom_props_arm,
+ types.DATA_PT_custom_props_curve,
+ types.DATA_PT_custom_props_lattice,
+ types.DATA_PT_custom_props_metaball,
+ types.TEXTURE_PT_custom_props,
types.TEXTURE_PT_clouds,
types.TEXTURE_PT_wood,
types.TEXTURE_PT_marble,
@@ -1188,6 +1230,7 @@ def get_panels():
types.TEXTURE_PT_influence,
types.TEXTURE_PT_colors,
types.PARTICLE_PT_context_particles,
+ types.PARTICLE_PT_custom_props,
types.PARTICLE_PT_emission,
types.PARTICLE_PT_hair_dynamics,
types.PARTICLE_PT_cache,
@@ -1204,10 +1247,9 @@ def get_panels():
types.PARTICLE_PT_field_weights,
types.PARTICLE_PT_force_fields,
types.PARTICLE_PT_vertexgroups,
- types.PARTICLE_PT_custom_props,
- types.MATERIAL_PT_preview,
- types.DATA_PT_preview,
- types.WORLD_PT_preview,
+ types.MATERIAL_PT_custom_props,
+ types.BONE_PT_custom_props,
+ types.OBJECT_PT_custom_props,
)
diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp
index cf2c018f1a2..5b8d495084d 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -37,14 +37,15 @@ void curveinterp_v3_v3v3v3v3(float3 *p, float3 *v1, float3 *v2, float3 *v3, floa
void interp_weights(float t, float data[4], int type);
float shaperadius(float shape, float root, float tip, float time);
void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyloc, float *time, ParticleCurveData *CData, int interpolation);
-bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents, int uv_num);
-bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents, int vcol_num);
-bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents);
+bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents, bool background, int uv_num);
+bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents, bool background, int vcol_num);
+bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents, bool background);
+void ExportCurveSegments(Mesh *mesh, ParticleCurveData *CData, int interpolation, int segments);
void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData, int interpolation, bool use_smooth, int segments, float3 RotCam);
void ExportCurveTriangleRibbons(Mesh *mesh, ParticleCurveData *CData, int interpolation, bool use_smooth, int segments);
void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int interpolation, bool use_smooth, int resolution, int segments);
-void ExportCurveSegments(Mesh *mesh, ParticleCurveData *CData, int interpolation, int segments);
-void ExportCurveTriangleUVs(Mesh *mesh, ParticleCurveData *CData, int interpolation, bool use_smooth, int segments, int vert_offset, int resol);
+void ExportCurveTriangleUV(Mesh *mesh, ParticleCurveData *CData, int interpolation, int segments, int vert_offset, int resol, float3 *uvdata);
+void ExportCurveTriangleVcol(Mesh *mesh, ParticleCurveData *CData, int interpolation, int segments, int vert_offset, int resol, float3 *fdata);
ParticleCurveData::ParticleCurveData()
{
@@ -151,7 +152,7 @@ void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyl
curveinterp_v3_v3v3v3v3(keyloc, &ckey_loc1, &ckey_loc2, &ckey_loc3, &ckey_loc4, t);
}
-bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents)
+bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents, bool background)
{
int curvenum = 0;
@@ -176,12 +177,10 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
int mi = clamp(b_psys.settings().material()-1, 0, mesh->used_shaders.size()-1);
int shader = mesh->used_shaders[mi];
- int draw_step = b_psys.settings().draw_step();
+ int draw_step = background ? b_psys.settings().render_step() : b_psys.settings().draw_step();
int ren_step = (int)pow((float)2.0f,(float)draw_step);
- /*b_psys.settings().render_step(draw_step);*/
-
int totparts = b_psys.particles.length();
- int totchild = b_psys.child_particles.length() * b_psys.settings().draw_percentage() / 100;
+ int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_psys.settings().draw_percentage() / 100.0f);
int totcurves = totchild;
if(use_parents || b_psys.settings().child_type() == 0)
@@ -240,7 +239,7 @@ bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
}
-bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents, int uv_num)
+bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents, bool background, int uv_num)
{
#if 0
int keyno = 0;
@@ -269,13 +268,10 @@ bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Parti
#if 0
int mi = clamp(b_psys.settings().material()-1, 0, mesh->used_shaders.size()-1);
int shader = mesh->used_shaders[mi];
- int draw_step = b_psys.settings().draw_step();
- int ren_step = (int)pow((float)2.0f,(float)draw_step);
- b_psys.settings().render_step(draw_step);
#endif
int totparts = b_psys.particles.length();
- int totchild = b_psys.child_particles.length() * b_psys.settings().draw_percentage() / 100;
+ int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_psys.settings().draw_percentage() / 100.0f);
int totcurves = totchild;
if (use_parents || b_psys.settings().child_type() == 0)
@@ -314,7 +310,7 @@ bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Parti
}
-bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents, int vcol_num)
+bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool use_parents, bool background, int vcol_num)
{
#if 0
int keyno = 0;
@@ -342,12 +338,9 @@ bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
#if 0
int mi = clamp(b_psys.settings().material()-1, 0, mesh->used_shaders.size()-1);
int shader = mesh->used_shaders[mi];
- int draw_step = b_psys.settings().draw_step();
- int ren_step = (int)pow((float)2.0f,(float)draw_step);
- b_psys.settings().render_step(draw_step);
#endif
int totparts = b_psys.particles.length();
- int totchild = b_psys.child_particles.length() * b_psys.settings().draw_percentage() / 100;
+ int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_psys.settings().draw_percentage() / 100.0f);
int totcurves = totchild;
if (use_parents || b_psys.settings().child_type() == 0)
@@ -386,6 +379,18 @@ bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, Par
}
+static void set_resolution(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, BL::Scene *scene, bool render)
+{
+ BL::Object::modifiers_iterator b_mod;
+ for(b_ob->modifiers.begin(b_mod); b_mod != b_ob->modifiers.end(); ++b_mod) {
+ if ((b_mod->type() == b_mod->type_PARTICLE_SYSTEM) && (b_mod->show_viewport()) && (b_mod->show_render())) {
+ BL::ParticleSystemModifier psmd((const PointerRNA)b_mod->ptr);
+ BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
+ b_psys.set_resolution(*scene, *b_ob, (render)? 2: 1);
+ }
+ }
+}
+
void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData, int interpolation, bool use_smooth, int segments, float3 RotCam)
{
int vertexno = mesh->verts.size();
@@ -423,13 +428,13 @@ void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData, int interpo
float radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], CData->psys_tipradius[sys], time);
- if(CData->psys_closetip[sys] && (subv == segments) && (curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1))
- radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], 0.0f, 0.95f);
-
- if((curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1) && (subv == segments))
+ if((curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 2) && (subv == segments))
radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], CData->psys_tipradius[sys], 0.95f);
- xbasis = normalize(cross(v1,RotCam - ickey_loc));
+ if(CData->psys_closetip[sys] && (subv == segments) && (curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 2))
+ radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], 0.0f, 0.95f);
+
+ xbasis = normalize(cross(RotCam - ickey_loc,v1));
float3 ickey_loc_shfl = ickey_loc - radius * xbasis;
float3 ickey_loc_shfr = ickey_loc + radius * xbasis;
mesh->verts.push_back(ickey_loc_shfl);
@@ -537,12 +542,12 @@ void ExportCurveTriangleRibbons(Mesh *mesh, ParticleCurveData *CData, int interp
float radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], CData->psys_tipradius[sys], time);
- if(CData->psys_closetip[sys] && (subv == segments) && (curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1))
- radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], 0.0f, 0.95f);
-
- if((curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1) && (subv == segments))
+ if((curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 2) && (subv == segments))
radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], CData->psys_tipradius[sys], 0.95f);
+ if(CData->psys_closetip[sys] && (subv == segments) && (curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 2))
+ radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], 0.0f, 0.95f);
+
float3 ickey_loc_shfl = ickey_loc - radius * xbasis;
float3 ickey_loc_shfr = ickey_loc + radius * xbasis;
mesh->verts.push_back(ickey_loc_shfl);
@@ -654,12 +659,12 @@ void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int inter
float radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], CData->psys_tipradius[sys], time);
- if(CData->psys_closetip[sys] && (subv == segments) && (curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1))
- radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], 0.0f, 0.95f);
-
- if((curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1) && (subv == segments))
+ if((curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 2) && (subv == segments))
radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], CData->psys_tipradius[sys], 0.95f);
+ if(CData->psys_closetip[sys] && (subv == segments) && (curvekey == CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 2))
+ radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], 0.0f, 0.95f);
+
float angle = 2 * M_PI_F / (float)resolution;
for(int section = 0 ; section < resolution; section++) {
float3 ickey_loc_shf = ickey_loc + radius * (cosf(angle * section) * xbasis + sinf(angle * section) * ybasis);
@@ -759,17 +764,14 @@ static void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CDa
}
}
-void ExportCurveTriangleUVs(Mesh *mesh, ParticleCurveData *CData, int interpolation, bool use_smooth, int segments, int vert_offset, int resol)
+void ExportCurveTriangleUV(Mesh *mesh, ParticleCurveData *CData, int interpolation, int segments, int vert_offset, int resol, float3 *uvdata)
{
+ if(uvdata == NULL)
+ return;
+
float time = 0.0f;
float prevtime = 0.0f;
- Attribute *attr = mesh->attributes.find(ATTR_STD_UV);
- if (attr == NULL)
- return;
-
- float3 *uvdata = attr->data_float3();
-
int vertexindex = vert_offset;
for( int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
@@ -818,6 +820,58 @@ void ExportCurveTriangleUVs(Mesh *mesh, ParticleCurveData *CData, int interpolat
}
}
+
+void ExportCurveTriangleVcol(Mesh *mesh, ParticleCurveData *CData, int interpolation, int segments, int vert_offset, int resol, float3 *fdata)
+{
+ if(fdata == NULL)
+ return;
+
+ float time = 0.0f;
+// float prevtime = 0.0f; // UNUSED
+
+ int vertexindex = vert_offset;
+
+ for( int sys = 0; sys < CData->psys_firstcurve.size() ; sys++) {
+ for( int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys] ; curve++) {
+
+ for( int curvekey = CData->curve_firstkey[curve]; curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1; curvekey++) {
+
+ int subv = 1;
+
+ if (curvekey == CData->curve_firstkey[curve])
+ subv = 0;
+
+ for (; subv <= segments; subv++) {
+
+ float3 ickey_loc = make_float3(0.0f,0.0f,0.0f);
+
+ InterpolateKeySegments(subv, segments, curvekey, curve, &ickey_loc, &time, CData , interpolation);
+
+ if(subv!=0) {
+ for(int section = 0 ; section < resol; section++) {
+ fdata[vertexindex] = color_srgb_to_scene_linear(CData->curve_vcol[curve]);
+ vertexindex++;
+ fdata[vertexindex] = color_srgb_to_scene_linear(CData->curve_vcol[curve]);
+ vertexindex++;
+ fdata[vertexindex] = color_srgb_to_scene_linear(CData->curve_vcol[curve]);
+ vertexindex++;
+ fdata[vertexindex] = color_srgb_to_scene_linear(CData->curve_vcol[curve]);
+ vertexindex++;
+ fdata[vertexindex] = color_srgb_to_scene_linear(CData->curve_vcol[curve]);
+ vertexindex++;
+ fdata[vertexindex] = color_srgb_to_scene_linear(CData->curve_vcol[curve]);
+ vertexindex++;
+ }
+ }
+
+ // prevtime = time; // UNUSED
+ }
+ }
+ }
+ }
+
+}
+
/* Hair Curve Sync */
void BlenderSync::sync_curve_settings()
@@ -863,6 +917,13 @@ void BlenderSync::sync_curve_settings()
curve_system_manager->use_joined = false;
switch(preset) {
+ case CURVE_FAST_PLANES:
+ /*camera facing planes*/
+ curve_system_manager->primitive = CURVE_TRIANGLES;
+ curve_system_manager->triangle_method = CURVE_CAMERA_TRIANGLES;
+ curve_system_manager->use_smooth = true;
+ curve_system_manager->resolution = 1;
+ break;
case CURVE_TANGENT_SHADING:
/*tangent shading*/
curve_system_manager->line_method = CURVE_UNCORRECTED;
@@ -890,6 +951,12 @@ void BlenderSync::sync_curve_settings()
curve_system_manager->use_tangent_normal_geometry = false;
curve_system_manager->use_tangent_normal_correction = false;
break;
+ case CURVE_SMOOTH_CURVES:
+ /*Cardinal curves preset*/
+ curve_system_manager->primitive = CURVE_SEGMENTS;
+ curve_system_manager->use_backfacing = true;
+ curve_system_manager->subdivisions = 4;
+ break;
}
}
@@ -940,14 +1007,20 @@ void BlenderSync::sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool
bool use_smooth = scene->curve_system_manager->use_smooth;
bool use_parents = scene->curve_system_manager->use_parents;
bool export_tgs = scene->curve_system_manager->use_joined;
+ size_t vert_num = mesh->verts.size();
+ size_t tri_num = mesh->triangles.size();
+ int used_res = 1;
/* extract particle hair data - should be combined with connecting to mesh later*/
ParticleCurveData CData;
- ObtainCacheParticleData(mesh, &b_mesh, &b_ob, &CData, use_parents);
+ if(!preview)
+ set_resolution(mesh, &b_mesh, &b_ob, &b_scene, true);
+
+ ObtainCacheParticleData(mesh, &b_mesh, &b_ob, &CData, use_parents, !preview);
- /* attach strands to mesh */
+ /* obtain camera parameters */
BL::Object b_CamOb = b_scene.camera();
float3 RotCam = make_float3(0.0f, 0.0f, 0.0f);
if(b_CamOb) {
@@ -957,22 +1030,16 @@ void BlenderSync::sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool
RotCam = transform_point(&itfm, make_float3(ctfm.x.w, ctfm.y.w, ctfm.z.w));
}
+ /* add hair geometry to mesh */
if(primitive == CURVE_TRIANGLES){
- int vert_num = mesh->triangles.size() * 3;
- ObtainCacheParticleUV(mesh, &b_mesh, &b_ob, &CData, use_parents, 0);
- if(triangle_method == CURVE_CAMERA_TRIANGLES) {
+ if(triangle_method == CURVE_CAMERA_TRIANGLES)
ExportCurveTrianglePlanes(mesh, &CData, interpolation, use_smooth, segments, RotCam);
- ExportCurveTriangleUVs(mesh, &CData, interpolation, use_smooth, segments, vert_num, 1);
- }
- else if(triangle_method == CURVE_RIBBON_TRIANGLES) {
+ else if(triangle_method == CURVE_RIBBON_TRIANGLES)
ExportCurveTriangleRibbons(mesh, &CData, interpolation, use_smooth, segments);
- ExportCurveTriangleUVs(mesh, &CData, interpolation, use_smooth, segments, vert_num, 1);
- }
else {
ExportCurveTriangleGeometry(mesh, &CData, interpolation, use_smooth, resolution, segments);
- ExportCurveTriangleUVs(mesh, &CData, interpolation, use_smooth, segments, vert_num, resolution);
+ used_res = resolution;
}
-
}
else {
ExportCurveSegments(scene, mesh, &CData, interpolation, segments);
@@ -990,14 +1057,24 @@ void BlenderSync::sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool
data_tangent[ck] = tg;
}
}
+ }
+
- /* generated coordinates from first key. we should ideally get this from
- * blender to handle deforming objects */
- {
- if(mesh->need_attribute(scene, ATTR_STD_GENERATED)) {
- float3 loc, size;
- mesh_texture_space(b_mesh, loc, size);
+ /* generated coordinates from first key. we should ideally get this from
+ * blender to handle deforming objects */
+ {
+ if(mesh->need_attribute(scene, ATTR_STD_GENERATED)) {
+ float3 loc, size;
+ mesh_texture_space(b_mesh, loc, size);
+ if(primitive == CURVE_TRIANGLES) {
+ Attribute *attr_generated = mesh->attributes.add(ATTR_STD_GENERATED);
+ float3 *generated = attr_generated->data_float3();
+
+ for(size_t i = vert_num; i < mesh->verts.size(); i++)
+ generated[i] = mesh->verts[i]*size - loc;
+ }
+ else {
Attribute *attr_generated = mesh->curve_attributes.add(ATTR_STD_GENERATED);
float3 *generated = attr_generated->data_float3();
size_t i = 0;
@@ -1008,63 +1085,88 @@ void BlenderSync::sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool
}
}
}
+ }
- /* create vertex color attributes */
- {
- BL::Mesh::tessface_vertex_colors_iterator l;
- int vcol_num = 0;
+ /* create vertex color attributes */
+ {
+ BL::Mesh::tessface_vertex_colors_iterator l;
+ int vcol_num = 0;
- for(b_mesh.tessface_vertex_colors.begin(l); l != b_mesh.tessface_vertex_colors.end(); ++l, vcol_num++) {
- if(!mesh->need_attribute(scene, ustring(l->name().c_str())))
- continue;
+ for(b_mesh.tessface_vertex_colors.begin(l); l != b_mesh.tessface_vertex_colors.end(); ++l, vcol_num++) {
+ if(!mesh->need_attribute(scene, ustring(l->name().c_str())))
+ continue;
+
+ ObtainCacheParticleVcol(mesh, &b_mesh, &b_ob, &CData, use_parents, !preview, vcol_num);
+
+ if(primitive == CURVE_TRIANGLES) {
+
+ Attribute *attr_vcol = mesh->attributes.add(
+ ustring(l->name().c_str()), TypeDesc::TypeColor, ATTR_ELEMENT_CORNER);
+
+ float3 *fdata = attr_vcol->data_float3();
+ ExportCurveTriangleVcol(mesh, &CData, interpolation, segments, tri_num * 3, used_res, fdata);
+ }
+ else {
Attribute *attr_vcol = mesh->curve_attributes.add(
ustring(l->name().c_str()), TypeDesc::TypeColor, ATTR_ELEMENT_CURVE);
- ObtainCacheParticleVcol(mesh, &b_mesh, &b_ob, &CData, use_parents, vcol_num);
-
- float3 *vcol = attr_vcol->data_float3();
+ float3 *fdata = attr_vcol->data_float3();
- if(vcol) {
+ if(fdata) {
for(size_t curve = 0; curve < CData.curve_vcol.size() ;curve++)
- vcol[curve] = color_srgb_to_scene_linear(CData.curve_vcol[curve]);
+ fdata[curve] = color_srgb_to_scene_linear(CData.curve_vcol[curve]);
}
}
}
+ }
- /* create uv map attributes */
- {
- BL::Mesh::tessface_uv_textures_iterator l;
- int uv_num = 0;
+ /* create UV attributes */
+ {
+ BL::Mesh::tessface_uv_textures_iterator l;
+ int uv_num = 0;
- for(b_mesh.tessface_uv_textures.begin(l); l != b_mesh.tessface_uv_textures.end(); ++l, uv_num++) {
- bool active_render = l->active_render();
- AttributeStandard std = (active_render)? ATTR_STD_UV: ATTR_STD_NONE;
- ustring name = ustring(l->name().c_str());
+ for(b_mesh.tessface_uv_textures.begin(l); l != b_mesh.tessface_uv_textures.end(); ++l, uv_num++) {
+ bool active_render = l->active_render();
+ AttributeStandard std = (active_render)? ATTR_STD_UV: ATTR_STD_NONE;
+ ustring name = ustring(l->name().c_str());
- /* UV map */
- if(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)) {
- Attribute *attr;
+ /* UV map */
+ if(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)) {
+ Attribute *attr_uv;
+ ObtainCacheParticleUV(mesh, &b_mesh, &b_ob, &CData, use_parents, !preview, uv_num);
+
+ if(primitive == CURVE_TRIANGLES) {
if(active_render)
- attr = mesh->curve_attributes.add(std, name);
+ attr_uv = mesh->attributes.add(std, name);
else
- attr = mesh->curve_attributes.add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
+ attr_uv = mesh->attributes.add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CORNER);
- ObtainCacheParticleUV(mesh, &b_mesh, &b_ob, &CData, use_parents, uv_num);
+ float3 *uv = attr_uv->data_float3();
- float3 *uv = attr->data_float3();
+ ExportCurveTriangleUV(mesh, &CData, interpolation, segments, tri_num * 3, used_res, uv);
+ }
+ else {
+ if(active_render)
+ attr_uv = mesh->curve_attributes.add(std, name);
+ else
+ attr_uv = mesh->curve_attributes.add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
+
+ float3 *uv = attr_uv->data_float3();
if(uv) {
- for(size_t curve = 0; curve < CData.curve_uv.size() ;curve++)
+ for(size_t curve = 0; curve < CData.curve_uv.size(); curve++)
uv[curve] = CData.curve_uv[curve];
}
- }
+ }
}
}
-
}
+ if(!preview)
+ set_resolution(mesh, &b_mesh, &b_ob, &b_scene, false);
+
mesh->compute_bounds();
}
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index 1dd7800dfa4..c61a7fafb57 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -313,7 +313,7 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
std = (active_render)? ATTR_STD_UV_TANGENT: ATTR_STD_NONE;
name = ustring((string(l->name().c_str()) + ".tangent").c_str());
- if(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)) {
+ if(mesh->need_attribute(scene, name) || (active_render && mesh->need_attribute(scene, std))) {
std = (active_render)? ATTR_STD_UV_TANGENT_SIGN: ATTR_STD_NONE;
name = ustring((string(l->name().c_str()) + ".tangent_sign").c_str());
bool need_sign = (mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std));
@@ -435,7 +435,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
mesh_synced.insert(mesh);
/* create derived mesh */
- BL::Mesh b_mesh = object_to_mesh(b_ob, b_scene, true, !preview);
+ BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview);
PointerRNA cmesh = RNA_pointer_get(&b_ob_data.ptr, "cycles");
vector<Mesh::Triangle> oldtriangle = mesh->triangles;
@@ -507,7 +507,7 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion)
return;
/* get derived mesh */
- BL::Mesh b_mesh = object_to_mesh(b_ob, b_scene, true, !preview);
+ BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview);
if(b_mesh) {
BL::Mesh::vertices_iterator v;
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index e9bcea70ab6..a9d37dbed99 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -156,6 +156,7 @@ void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSI
/* shadow */
PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
light->cast_shadow = get_boolean(clamp, "cast_shadow");
+ light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling");
light->samples = get_int(clamp, "samples");
/* tag */
diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp
index 676fba76ddf..a10f3b63033 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -54,7 +54,7 @@ static PyObject *create_func(PyObject *self, PyObject *args)
PyObject *pyengine, *pyuserpref, *pydata, *pyscene, *pyregion, *pyv3d, *pyrv3d;
int preview_osl;
- if(!PyArg_ParseTuple(args, "OOOOOOOp", &pyengine, &pyuserpref, &pydata, &pyscene, &pyregion, &pyv3d, &pyrv3d, &preview_osl))
+ if(!PyArg_ParseTuple(args, "OOOOOOOi", &pyengine, &pyuserpref, &pydata, &pyscene, &pyregion, &pyv3d, &pyrv3d, &preview_osl))
return NULL;
/* RNA */
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 650d3d387ee..951f7022a10 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -111,9 +111,9 @@ void BlenderSession::create_session()
b_engine.use_highlight_tiles(session_params.progressive_refine == false);
/* setup callbacks for builtin image support */
- scene->image_manager->builtin_image_info_cb = function_bind(&BlenderSession::builtin_image_info, this, _1, _2, _3, _4, _5);
- scene->image_manager->builtin_image_pixels_cb = function_bind(&BlenderSession::builtin_image_pixels, this, _1, _2);
- scene->image_manager->builtin_image_float_pixels_cb = function_bind(&BlenderSession::builtin_image_float_pixels, this, _1, _2);
+ scene->image_manager->builtin_image_info_cb = function_bind(&BlenderSession::builtin_image_info, this, _1, _2, _3, _4, _5, _6);
+ scene->image_manager->builtin_image_pixels_cb = function_bind(&BlenderSession::builtin_image_pixels, this, _1, _2, _3);
+ scene->image_manager->builtin_image_float_pixels_cb = function_bind(&BlenderSession::builtin_image_float_pixels, this, _1, _2, _3);
}
void BlenderSession::reset_session(BL::BlendData b_data_, BL::Scene b_scene_)
@@ -493,11 +493,10 @@ bool BlenderSession::draw(int w, int h)
}
else {
/* update camera from 3d view */
- bool need_update = scene->camera->need_update;
sync->sync_view(b_v3d, b_rv3d, w, h);
- if(scene->camera->need_update && !need_update)
+ if(scene->camera->need_update)
reset = true;
session->scene->mutex.unlock();
@@ -622,23 +621,19 @@ void BlenderSession::test_cancel()
/* builtin image file name is actually an image datablock name with
* absolute sequence frame number concatenated via '@' character
*
- * this function splits image id name and frame number from a
- * builtin image name
+ * this function splits frame from builtin name
*/
-void BlenderSession::builtin_name_split(const string &builtin_name, string &name, int &frame)
+int BlenderSession::builtin_image_frame(const string &builtin_name)
{
int last = builtin_name.find_last_of('@');
- name = builtin_name.substr(0, last);
- frame = atoi(builtin_name.substr(last + 1, builtin_name.size() - last - 1).c_str());
+ return atoi(builtin_name.substr(last + 1, builtin_name.size() - last - 1).c_str());
}
-void BlenderSession::builtin_image_info(const string &builtin_name, bool &is_float, int &width, int &height, int &channels)
+void BlenderSession::builtin_image_info(const string &builtin_name, void *builtin_data, bool &is_float, int &width, int &height, int &channels)
{
- string name;
- int frame;
- builtin_name_split(builtin_name, name, frame);
-
- BL::Image b_image = b_data.images[name];
+ PointerRNA ptr;
+ RNA_id_pointer_create((ID*)builtin_data, &ptr);
+ BL::Image b_image(ptr);
if(b_image) {
is_float = b_image.is_float();
@@ -654,13 +649,13 @@ void BlenderSession::builtin_image_info(const string &builtin_name, bool &is_flo
}
}
-bool BlenderSession::builtin_image_pixels(const string &builtin_name, unsigned char *pixels)
+bool BlenderSession::builtin_image_pixels(const string &builtin_name, void *builtin_data, unsigned char *pixels)
{
- string name;
- int frame;
- builtin_name_split(builtin_name, name, frame);
+ int frame = builtin_image_frame(builtin_name);
- BL::Image b_image = b_data.images[name];
+ PointerRNA ptr;
+ RNA_id_pointer_create((ID*)builtin_data, &ptr);
+ BL::Image b_image(ptr);
if(b_image) {
int width = b_image.size()[0];
@@ -696,13 +691,13 @@ bool BlenderSession::builtin_image_pixels(const string &builtin_name, unsigned c
return false;
}
-bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, float *pixels)
+bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void *builtin_data, float *pixels)
{
- string name;
- int frame;
- builtin_name_split(builtin_name, name, frame);
+ int frame = builtin_image_frame(builtin_name);
- BL::Image b_image = b_data.images[name];
+ PointerRNA ptr;
+ RNA_id_pointer_create((ID*)builtin_data, &ptr);
+ BL::Image b_image(ptr);
if(b_image) {
int width = b_image.size()[0];
diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h
index 686ff3d1be9..0210df9c044 100644
--- a/intern/cycles/blender/blender_session.h
+++ b/intern/cycles/blender/blender_session.h
@@ -94,10 +94,10 @@ protected:
void do_write_update_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile, bool do_update_only);
void do_write_update_render_tile(RenderTile& rtile, bool do_update_only);
- void builtin_name_split(const string &builtin_name, string &name, int &frame);
- void builtin_image_info(const string &builtin_name, bool &is_float, int &width, int &height, int &channels);
- bool builtin_image_pixels(const string &builtin_name, unsigned char *pixels);
- bool builtin_image_float_pixels(const string &builtin_name, float *pixels);
+ int builtin_image_frame(const string &builtin_name);
+ void builtin_image_info(const string &builtin_name, void *builtin_data, bool &is_float, int &width, int &height, int &channels);
+ bool builtin_image_pixels(const string &builtin_name, void *builtin_data, unsigned char *pixels);
+ bool builtin_image_float_pixels(const string &builtin_name, void *builtin_data, float *pixels);
};
CCL_NAMESPACE_END
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index b1eaedba47a..0f7dc15db19 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -529,11 +529,11 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
int scene_frame = b_scene.frame_current();
int image_frame = image_user_frame_number(b_image_node.image_user(), scene_frame);
image->filename = b_image.name() + "@" + string_printf("%d", image_frame);
- image->is_builtin = true;
+ image->builtin_data = b_image.ptr.data;
}
else {
image->filename = image_user_file_path(b_image_node.image_user(), b_image, b_scene.frame_current());
- image->is_builtin = false;
+ image->builtin_data = NULL;
}
image->animated = b_image_node.image_user().use_auto_refresh();
@@ -558,11 +558,12 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
int scene_frame = b_scene.frame_current();
int image_frame = image_user_frame_number(b_env_node.image_user(), scene_frame);
env->filename = b_image.name() + "@" + string_printf("%d", image_frame);
- env->is_builtin = true;
+ env->builtin_data = b_image.ptr.data;
}
else {
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->builtin_data = NULL;
}
}
env->color_space = EnvironmentTextureNode::color_space_enum[(int)b_env_node.color_space()];
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index f134416f2d0..0947b5a2e9d 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -39,9 +39,9 @@ float *BKE_image_get_float_pixels_for_frame(void *image, int frame);
CCL_NAMESPACE_BEGIN
-static inline BL::Mesh object_to_mesh(BL::Object self, BL::Scene scene, bool apply_modifiers, bool render)
+static inline BL::Mesh object_to_mesh(BL::BlendData data, BL::Object object, BL::Scene scene, bool apply_modifiers, bool render)
{
- return self.to_mesh(scene, apply_modifiers, (render)? 2: 1);
+ return data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1);
}
static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)
diff --git a/intern/cycles/device/CMakeLists.txt b/intern/cycles/device/CMakeLists.txt
index 661d43ab036..fe2368b7ea8 100644
--- a/intern/cycles/device/CMakeLists.txt
+++ b/intern/cycles/device/CMakeLists.txt
@@ -23,7 +23,9 @@ set(SRC
)
if(WITH_NETWORK)
- list(APPEND SRC device_network.cpp)
+ list(APPEND SRC
+ device_network.cpp
+ )
endif()
set(SRC_HEADERS
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index a1d7706a34e..1915245bb55 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -58,7 +58,8 @@ public:
#endif
/* do now to avoid thread issues */
- system_cpu_support_optimized();
+ system_cpu_support_sse2();
+ system_cpu_support_sse3();
}
~CPUDevice()
@@ -170,7 +171,7 @@ public:
int end_sample = tile.start_sample + tile.num_samples;
#ifdef WITH_OPTIMIZED_KERNEL
- if(system_cpu_support_optimized()) {
+ if(system_cpu_support_sse2()) {
for(int sample = start_sample; sample < end_sample; sample++) {
if (task.get_cancel() || task_pool.cancelled()) {
if(task.need_finish_queue == false)
@@ -179,7 +180,26 @@ public:
for(int y = tile.y; y < tile.y + tile.h; y++) {
for(int x = tile.x; x < tile.x + tile.w; x++) {
- kernel_cpu_optimized_path_trace(&kg, render_buffer, rng_state,
+ kernel_cpu_sse2_path_trace(&kg, render_buffer, rng_state,
+ sample, x, y, tile.offset, tile.stride);
+ }
+ }
+
+ tile.sample = sample + 1;
+
+ task.update_progress(tile);
+ }
+ }
+ else if(system_cpu_support_sse3()) {
+ for(int sample = start_sample; sample < end_sample; sample++) {
+ if (task.get_cancel() || task_pool.cancelled()) {
+ if(task.need_finish_queue == false)
+ break;
+ }
+
+ for(int y = tile.y; y < tile.y + tile.h; y++) {
+ for(int x = tile.x; x < tile.x + tile.w; x++) {
+ kernel_cpu_sse3_path_trace(&kg, render_buffer, rng_state,
sample, x, y, tile.offset, tile.stride);
}
}
@@ -227,10 +247,16 @@ public:
void thread_tonemap(DeviceTask& task)
{
#ifdef WITH_OPTIMIZED_KERNEL
- if(system_cpu_support_optimized()) {
+ if(system_cpu_support_sse2()) {
+ for(int y = task.y; y < task.y + task.h; y++)
+ for(int x = task.x; x < task.x + task.w; x++)
+ kernel_cpu_sse2_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer,
+ task.sample, task.resolution, x, y, task.offset, task.stride);
+ }
+ else if(system_cpu_support_sse3()) {
for(int y = task.y; y < task.y + task.h; y++)
for(int x = task.x; x < task.x + task.w; x++)
- kernel_cpu_optimized_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer,
+ kernel_cpu_sse3_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer,
task.sample, task.resolution, x, y, task.offset, task.stride);
}
else
@@ -252,9 +278,17 @@ public:
#endif
#ifdef WITH_OPTIMIZED_KERNEL
- if(system_cpu_support_optimized()) {
+ if(system_cpu_support_sse2()) {
+ for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) {
+ kernel_cpu_sse2_shader(&kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
+
+ if(task_pool.cancelled())
+ break;
+ }
+ }
+ else if(system_cpu_support_sse3()) {
for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) {
- kernel_cpu_optimized_shader(&kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
+ kernel_cpu_sse3_shader(&kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
if(task_pool.cancelled())
break;
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 6d5b9a063a0..e83756b7c8a 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -12,7 +12,8 @@ set(INC_SYS
set(SRC
kernel.cpp
- kernel_optimized.cpp
+ kernel_sse2.cpp
+ kernel_sse3.cpp
kernel.cl
kernel.cu
)
@@ -149,7 +150,8 @@ include_directories(SYSTEM ${INC_SYS})
add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_SVM_HEADERS})
if(WITH_CYCLES_OPTIMIZED_KERNEL)
- set_source_files_properties(kernel_optimized.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_OPTIMIZED_KERNEL_FLAGS}")
+ set_source_files_properties(kernel_sse2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE2_KERNEL_FLAGS}")
+ set_source_files_properties(kernel_sse3.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE3_KERNEL_FLAGS}")
endif()
if(WITH_CYCLES_CUDA)
diff --git a/intern/cycles/kernel/kernel.h b/intern/cycles/kernel/kernel.h
index 26c0bcd6d1a..20ea5a61906 100644
--- a/intern/cycles/kernel/kernel.h
+++ b/intern/cycles/kernel/kernel.h
@@ -44,11 +44,18 @@ void kernel_cpu_shader(KernelGlobals *kg, uint4 *input, float4 *output,
int type, int i);
#ifdef WITH_OPTIMIZED_KERNEL
-void kernel_cpu_optimized_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
+void kernel_cpu_sse2_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
int sample, int x, int y, int offset, int stride);
-void kernel_cpu_optimized_tonemap(KernelGlobals *kg, uchar4 *rgba, float *buffer,
+void kernel_cpu_sse2_tonemap(KernelGlobals *kg, uchar4 *rgba, float *buffer,
int sample, int resolution, int x, int y, int offset, int stride);
-void kernel_cpu_optimized_shader(KernelGlobals *kg, uint4 *input, float4 *output,
+void kernel_cpu_sse2_shader(KernelGlobals *kg, uint4 *input, float4 *output,
+ int type, int i);
+
+void kernel_cpu_sse3_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
+ int sample, int x, int y, int offset, int stride);
+void kernel_cpu_sse3_tonemap(KernelGlobals *kg, uchar4 *rgba, float *buffer,
+ int sample, int resolution, int x, int y, int offset, int stride);
+void kernel_cpu_sse3_shader(KernelGlobals *kg, uint4 *input, float4 *output,
int type, int i);
#endif
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index 86177301357..1cf230634fc 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -220,7 +220,7 @@ __device_inline void path_radiance_accum_ao(PathRadiance *L, float3 throughput,
#endif
}
-__device_inline void path_radiance_accum_light(PathRadiance *L, float3 throughput, BsdfEval *bsdf_eval, float3 shadow, int bounce, bool is_lamp)
+__device_inline void path_radiance_accum_light(PathRadiance *L, float3 throughput, BsdfEval *bsdf_eval, float3 shadow, float shadow_fac, int bounce, bool is_lamp)
{
#ifdef __PASSES__
if(L->use_light_pass) {
@@ -233,9 +233,9 @@ __device_inline void path_radiance_accum_light(PathRadiance *L, float3 throughpu
if(is_lamp) {
float3 sum = throughput*(bsdf_eval->diffuse + bsdf_eval->glossy + bsdf_eval->transmission);
- L->shadow.x += shadow.x;
- L->shadow.y += shadow.y;
- L->shadow.z += shadow.z;
+ L->shadow.x += shadow.x*shadow_fac;
+ L->shadow.y += shadow.y*shadow_fac;
+ L->shadow.z += shadow.z*shadow_fac;
L->shadow.w += average(sum);
}
}
diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h
index 1a85b5bbefd..2b9ebf35d0c 100644
--- a/intern/cycles/kernel/kernel_bvh.h
+++ b/intern/cycles/kernel/kernel_bvh.h
@@ -126,21 +126,21 @@ __device_inline void bvh_node_intersect(KernelGlobals *kg,
/* intersect ray against child nodes */
float3 ood = P * idir;
- float c0lox = n0xy.x * idir.x - ood.x;
- float c0hix = n0xy.y * idir.x - ood.x;
- float c0loy = n0xy.z * idir.y - ood.y;
- float c0hiy = n0xy.w * idir.y - ood.y;
- float c0loz = nz.x * idir.z - ood.z;
- float c0hiz = nz.y * idir.z - ood.z;
+ NO_EXTENDED_PRECISION float c0lox = n0xy.x * idir.x - ood.x;
+ NO_EXTENDED_PRECISION float c0hix = n0xy.y * idir.x - ood.x;
+ NO_EXTENDED_PRECISION float c0loy = n0xy.z * idir.y - ood.y;
+ NO_EXTENDED_PRECISION float c0hiy = n0xy.w * idir.y - ood.y;
+ NO_EXTENDED_PRECISION float c0loz = nz.x * idir.z - ood.z;
+ NO_EXTENDED_PRECISION float c0hiz = nz.y * idir.z - ood.z;
NO_EXTENDED_PRECISION float c0min = max4(min(c0lox, c0hix), min(c0loy, c0hiy), min(c0loz, c0hiz), 0.0f);
NO_EXTENDED_PRECISION float c0max = min4(max(c0lox, c0hix), max(c0loy, c0hiy), max(c0loz, c0hiz), t);
- float c1loz = nz.z * idir.z - ood.z;
- float c1hiz = nz.w * idir.z - ood.z;
- float c1lox = n1xy.x * idir.x - ood.x;
- float c1hix = n1xy.y * idir.x - ood.x;
- float c1loy = n1xy.z * idir.y - ood.y;
- float c1hiy = n1xy.w * idir.y - ood.y;
+ NO_EXTENDED_PRECISION float c1loz = nz.z * idir.z - ood.z;
+ NO_EXTENDED_PRECISION float c1hiz = nz.w * idir.z - ood.z;
+ NO_EXTENDED_PRECISION float c1lox = n1xy.x * idir.x - ood.x;
+ NO_EXTENDED_PRECISION float c1hix = n1xy.y * idir.x - ood.x;
+ NO_EXTENDED_PRECISION float c1loy = n1xy.z * idir.y - ood.y;
+ NO_EXTENDED_PRECISION float c1hiy = n1xy.w * idir.y - ood.y;
NO_EXTENDED_PRECISION float c1min = max4(min(c1lox, c1hix), min(c1loy, c1hiy), min(c1loz, c1hiz), 0.0f);
NO_EXTENDED_PRECISION float c1max = min4(max(c1lox, c1hix), max(c1loy, c1hiy), max(c1loz, c1hiz), t);
diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h
index 54bc0717b60..4048bbd9dfc 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -76,7 +76,7 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando,
__device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
float randt, float rando, float randu, float randv, Ray *ray, BsdfEval *eval,
- int *lamp)
+ bool *is_lamp)
{
LightSample ls;
@@ -92,12 +92,6 @@ __device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
light_sample(kg, randt, randu, randv, sd->time, sd->P, &ls);
}
- /* return lamp index for MIS */
- if(ls.use_mis)
- *lamp = ls.lamp;
- else
- *lamp= ~0;
-
if(ls.pdf == 0.0f)
return false;
@@ -114,7 +108,7 @@ __device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
shader_bsdf_eval(kg, sd, ls.D, eval, &bsdf_pdf);
- if(ls.use_mis) {
+ if(ls.shader & SHADER_USE_MIS) {
/* multiple importance sampling */
float mis_weight = power_heuristic(ls.pdf, bsdf_pdf);
light_eval *= mis_weight;
@@ -146,6 +140,9 @@ __device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
ray->t = 0.0f;
}
+ /* return if it's a lamp for shadow pass */
+ *is_lamp = (ls.prim == ~0);
+
return true;
}
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index 6ba3e439329..10a32226f17 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -31,7 +31,6 @@ typedef struct LightSample {
int prim; /* primitive id for triangle/curve ligths */
int shader; /* shader id */
int lamp; /* lamp id */
- int use_mis; /* for lamps with size zero */
LightType type; /* type of light */
} LightSample;
@@ -218,11 +217,10 @@ __device void lamp_light_sample(KernelGlobals *kg, int lamp,
LightType type = (LightType)__float_as_int(data0.x);
ls->type = type;
-#ifdef __LAMP_MIS__
- ls->use_mis = true;
-#else
- ls->use_mis = false;
-#endif
+ ls->shader = __float_as_int(data1.x);
+ ls->object = ~0;
+ ls->prim = ~0;
+ ls->lamp = lamp;
if(type == LIGHT_DISTANT) {
/* distant light */
@@ -233,10 +231,6 @@ __device void lamp_light_sample(KernelGlobals *kg, int lamp,
if(radius > 0.0f)
D = distant_light_sample(D, radius, randu, randv);
-#ifdef __LAMP_MIS__
- else
- ls->use_mis = false;
-#endif
ls->P = D;
ls->Ng = D;
@@ -257,9 +251,6 @@ __device void lamp_light_sample(KernelGlobals *kg, int lamp,
ls->D = -D;
ls->t = FLT_MAX;
ls->eval_fac = 1.0f;
-#ifndef __LAMP_MIS__
- ls->use_mis = true;
-#endif
}
#endif
else {
@@ -271,10 +262,6 @@ __device void lamp_light_sample(KernelGlobals *kg, int lamp,
if(radius > 0.0f)
/* sphere light */
ls->P += sphere_light_sample(P, ls->P, radius, randu, randv);
-#ifdef __LAMP_MIS__
- else
- ls->use_mis = false;
-#endif
ls->D = normalize_len(ls->P - P, &ls->t);
ls->Ng = -ls->D;
@@ -304,13 +291,6 @@ __device void lamp_light_sample(KernelGlobals *kg, int lamp,
float invarea = data2.x;
- if(invarea == 0.0f) {
-#ifdef __LAMP_MIS__
- ls->use_mis = false;
-#endif
- invarea = 1.0f;
- }
-
ls->eval_fac = 0.25f*invarea;
ls->pdf = invarea;
}
@@ -318,11 +298,6 @@ __device void lamp_light_sample(KernelGlobals *kg, int lamp,
ls->eval_fac *= kernel_data.integrator.inv_pdf_lights;
ls->pdf *= lamp_light_pdf(kg, ls->Ng, -ls->D, ls->t);
}
-
- ls->shader = __float_as_int(data1.x);
- ls->object = ~0;
- ls->prim = ~0;
- ls->lamp = lamp;
}
__device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D, float t, LightSample *ls)
@@ -336,7 +311,9 @@ __device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D, f
ls->object = ~0;
ls->prim = ~0;
ls->lamp = lamp;
- ls->use_mis = false; /* flag not used for eval */
+
+ if(!(ls->shader & SHADER_USE_MIS))
+ return false;
if(type == LIGHT_DISTANT) {
/* distant light */
@@ -475,7 +452,7 @@ __device void triangle_light_sample(KernelGlobals *kg, int prim, int object,
ls->object = object;
ls->prim = prim;
ls->lamp = ~0;
- ls->use_mis = true;
+ ls->shader |= SHADER_USE_MIS;
ls->t = 0.0f;
ls->type = LIGHT_AREA;
ls->eval_fac = 1.0f;
@@ -529,11 +506,10 @@ __device void curve_segment_light_sample(KernelGlobals *kg, int prim, int object
ls->object = object;
ls->prim = prim;
ls->lamp = ~0;
- ls->use_mis = true;
ls->t = 0.0f;
ls->type = LIGHT_STRAND;
ls->eval_fac = 1.0f;
- ls->shader = __float_as_int(v00.z);
+ ls->shader = __float_as_int(v00.z) | SHADER_USE_MIS;
object_transform_light_sample(kg, ls, object, time);
}
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index 1a5df66e6c2..9b13f4d2a42 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -254,7 +254,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
bool hit = scene_intersect(kg, &ray, visibility, &isect);
#ifdef __LAMP_MIS__
- if(kernel_data.integrator.pdf_lights > 0.0f && !(state.flag & PATH_RAY_CAMERA)) {
+ if(kernel_data.integrator.use_lamp_mis && !(state.flag & PATH_RAY_CAMERA)) {
/* ray starting from previous non-transparent bounce */
Ray light_ray;
@@ -399,20 +399,19 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
Ray light_ray;
BsdfEval L_light;
- int lamp;
+ bool is_lamp;
#ifdef __OBJECT_MOTION__
light_ray.time = sd.time;
#endif
- if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &lamp)) {
+ if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp)) {
/* trace shadow ray */
float3 shadow;
if(!shadow_blocked(kg, &state, &light_ray, &shadow)) {
/* accumulate */
- bool is_lamp = (lamp != ~0);
- path_radiance_accum_light(&L, throughput, &L_light, shadow, state.bounce, is_lamp);
+ path_radiance_accum_light(&L, throughput, &L_light, shadow, 1.0f, state.bounce, is_lamp);
}
}
}
@@ -501,7 +500,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
bool hit = scene_intersect(kg, &ray, visibility, &isect);
#ifdef __LAMP_MIS__
- if(kernel_data.integrator.pdf_lights > 0.0f && !(state.flag & PATH_RAY_CAMERA)) {
+ if(kernel_data.integrator.use_lamp_mis && !(state.flag & PATH_RAY_CAMERA)) {
/* ray starting from previous non-transparent bounce */
Ray light_ray;
@@ -612,21 +611,20 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
Ray light_ray;
BsdfEval L_light;
- int lamp;
+ bool is_lamp;
#ifdef __OBJECT_MOTION__
light_ray.time = sd.time;
#endif
/* sample random light */
- if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &lamp)) {
+ if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp)) {
/* trace shadow ray */
float3 shadow;
if(!shadow_blocked(kg, &state, &light_ray, &shadow)) {
/* accumulate */
- bool is_lamp = (lamp != ~0);
- path_radiance_accum_light(L, throughput, &L_light, shadow, state.bounce, is_lamp);
+ path_radiance_accum_light(L, throughput, &L_light, shadow, 1.0f, state.bounce, is_lamp);
}
}
}
@@ -819,7 +817,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
if(sd.flag & SD_BSDF_HAS_EVAL) {
Ray light_ray;
BsdfEval L_light;
- int lamp;
+ bool is_lamp;
#ifdef __OBJECT_MOTION__
light_ray.time = sd.time;
@@ -837,14 +835,13 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
float light_u = path_rng(kg, rng, sample*num_samples + j, rng_offset + PRNG_LIGHT_U);
float light_v = path_rng(kg, rng, sample*num_samples + j, rng_offset + PRNG_LIGHT_V);
- if(direct_emission(kg, &sd, i, 0.0f, 0.0f, light_u, light_v, &light_ray, &L_light, &lamp)) {
+ if(direct_emission(kg, &sd, i, 0.0f, 0.0f, light_u, light_v, &light_ray, &L_light, &is_lamp)) {
/* trace shadow ray */
float3 shadow;
if(!shadow_blocked(kg, &state, &light_ray, &shadow)) {
/* accumulate */
- bool is_lamp = (lamp != ~0);
- path_radiance_accum_light(&L, throughput*num_samples_inv, &L_light, shadow, state.bounce, is_lamp);
+ path_radiance_accum_light(&L, throughput*num_samples_inv, &L_light, shadow, num_samples_inv, state.bounce, is_lamp);
}
}
}
@@ -867,14 +864,13 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
if(kernel_data.integrator.num_all_lights)
light_t = 0.5f*light_t;
- if(direct_emission(kg, &sd, -1, light_t, 0.0f, light_u, light_v, &light_ray, &L_light, &lamp)) {
+ if(direct_emission(kg, &sd, -1, light_t, 0.0f, light_u, light_v, &light_ray, &L_light, &is_lamp)) {
/* trace shadow ray */
float3 shadow;
if(!shadow_blocked(kg, &state, &light_ray, &shadow)) {
/* accumulate */
- bool is_lamp = (lamp != ~0);
- path_radiance_accum_light(&L, throughput*num_samples_inv, &L_light, shadow, state.bounce, is_lamp);
+ path_radiance_accum_light(&L, throughput*num_samples_inv, &L_light, shadow, num_samples_inv, state.bounce, is_lamp);
}
}
}
diff --git a/intern/cycles/kernel/kernel_sse2.cpp b/intern/cycles/kernel/kernel_sse2.cpp
new file mode 100644
index 00000000000..e9d482ae5cf
--- /dev/null
+++ b/intern/cycles/kernel/kernel_sse2.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * 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.
+ */
+
+/* Optimized CPU kernel entry points. This file is compiled with SSE2
+ * optimization flags and nearly all functions inlined, while kernel.cpp
+ * is compiled without for other CPU's. */
+
+#ifdef WITH_OPTIMIZED_KERNEL
+
+#include "kernel.h"
+#include "kernel_compat_cpu.h"
+#include "kernel_math.h"
+#include "kernel_types.h"
+#include "kernel_globals.h"
+#include "kernel_film.h"
+#include "kernel_path.h"
+#include "kernel_displace.h"
+
+CCL_NAMESPACE_BEGIN
+
+/* Path Tracing */
+
+void kernel_cpu_sse2_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
+{
+ kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
+}
+
+/* Tonemapping */
+
+void kernel_cpu_sse2_tonemap(KernelGlobals *kg, uchar4 *rgba, float *buffer, int sample, int resolution, int x, int y, int offset, int stride)
+{
+ kernel_film_tonemap(kg, rgba, buffer, sample, resolution, x, y, offset, stride);
+}
+
+/* Shader Evaluate */
+
+void kernel_cpu_sse2_shader(KernelGlobals *kg, uint4 *input, float4 *output, int type, int i)
+{
+ kernel_shader_evaluate(kg, input, output, (ShaderEvalType)type, i);
+}
+
+CCL_NAMESPACE_END
+
+#endif
+
diff --git a/intern/cycles/kernel/kernel_optimized.cpp b/intern/cycles/kernel/kernel_sse3.cpp
index 0b662095133..9a8b389cf68 100644
--- a/intern/cycles/kernel/kernel_optimized.cpp
+++ b/intern/cycles/kernel/kernel_sse3.cpp
@@ -35,21 +35,21 @@ CCL_NAMESPACE_BEGIN
/* Path Tracing */
-void kernel_cpu_optimized_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
+void kernel_cpu_sse3_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
{
kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
}
/* Tonemapping */
-void kernel_cpu_optimized_tonemap(KernelGlobals *kg, uchar4 *rgba, float *buffer, int sample, int resolution, int x, int y, int offset, int stride)
+void kernel_cpu_sse3_tonemap(KernelGlobals *kg, uchar4 *rgba, float *buffer, int sample, int resolution, int x, int y, int offset, int stride)
{
kernel_film_tonemap(kg, rgba, buffer, sample, resolution, x, y, offset, stride);
}
/* Shader Evaluate */
-void kernel_cpu_optimized_shader(KernelGlobals *kg, uint4 *input, float4 *output, int type, int i)
+void kernel_cpu_sse3_shader(KernelGlobals *kg, uint4 *input, float4 *output, int type, int i)
{
kernel_shader_evaluate(kg, input, output, (ShaderEvalType)type, i);
}
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 1236f43e018..52bdddc72fb 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -44,7 +44,6 @@ CCL_NAMESPACE_BEGIN
#define __KERNEL_SHADING__
#define __KERNEL_ADV_SHADING__
#define __NON_PROGRESSIVE__
-#define __LAMP_MIS__
#define __HAIR__
#ifdef WITH_OSL
#define __OSL__
@@ -56,9 +55,6 @@ CCL_NAMESPACE_BEGIN
#if __CUDA_ARCH__ >= 200
#define __KERNEL_ADV_SHADING__
#endif
-#if __CUDA_ARCH__ >= 210
-#define __LAMP_MIS__
-#endif
#endif
#ifdef __KERNEL_OPENCL__
@@ -116,6 +112,7 @@ CCL_NAMESPACE_BEGIN
#define __TRANSPARENT_SHADOWS__
#define __PASSES__
#define __BACKGROUND_MIS__
+#define __LAMP_MIS__
#define __AO__
#define __ANISOTROPIC__
#define __CAMERA_MOTION__
@@ -288,8 +285,9 @@ typedef enum ShaderFlag {
SHADER_SMOOTH_NORMAL = (1 << 31),
SHADER_CAST_SHADOW = (1 << 30),
SHADER_AREA_LIGHT = (1 << 29),
+ SHADER_USE_MIS = (1 << 28),
- SHADER_MASK = ~(SHADER_SMOOTH_NORMAL|SHADER_CAST_SHADOW|SHADER_AREA_LIGHT)
+ SHADER_MASK = ~(SHADER_SMOOTH_NORMAL|SHADER_CAST_SHADOW|SHADER_AREA_LIGHT|SHADER_USE_MIS)
} ShaderFlag;
/* Light Type */
@@ -680,7 +678,7 @@ typedef struct KernelIntegrator {
int transmission_samples;
int ao_samples;
int mesh_light_samples;
- int pad1;
+ int use_lamp_mis;
} KernelIntegrator;
typedef struct KernelBVH {
diff --git a/intern/cycles/kernel/osl/SConscript b/intern/cycles/kernel/osl/SConscript
index fe7fec463a7..09899567128 100644
--- a/intern/cycles/kernel/osl/SConscript
+++ b/intern/cycles/kernel/osl/SConscript
@@ -46,6 +46,7 @@ defs.append('WITH_OSL')
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
cxxflags.append('-DBOOST_NO_RTTI -DBOOST_NO_TYPEID'.split())
incs.append(env['BF_PTHREADS_INC'])
+ defs.append('OSL_STATIC_LIBRARY')
else:
cxxflags.append('-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID'.split())
diff --git a/intern/cycles/kernel/shaders/node_musgrave_texture.osl b/intern/cycles/kernel/shaders/node_musgrave_texture.osl
index 38232ea0aeb..8675c23d0d8 100644
--- a/intern/cycles/kernel/shaders/node_musgrave_texture.osl
+++ b/intern/cycles/kernel/shaders/node_musgrave_texture.osl
@@ -37,14 +37,14 @@ float noise_musgrave_fBm(point p, string basis, float H, float lacunarity, float
int i;
for (i = 0; i < (int)octaves; i++) {
- value += safe_noise(p) * pwr;
+ value += safe_noise(p, 0) * pwr;
pwr *= pwHL;
p *= lacunarity;
}
rmd = octaves - floor(octaves);
if (rmd != 0.0)
- value += rmd * safe_noise(p) * pwr;
+ value += rmd * safe_noise(p, 0) * pwr;
return value;
}
@@ -65,14 +65,14 @@ float noise_musgrave_multi_fractal(point p, string basis, float H, float lacunar
int i;
for (i = 0; i < (int)octaves; i++) {
- value *= (pwr * safe_noise(p) + 1.0);
+ value *= (pwr * safe_noise(p, 0) + 1.0);
pwr *= pwHL;
p *= lacunarity;
}
rmd = octaves - floor(octaves);
if (rmd != 0.0)
- value *= (rmd * pwr * safe_noise(p) + 1.0); /* correct? */
+ value *= (rmd * pwr * safe_noise(p, 0) + 1.0); /* correct? */
return value;
}
@@ -93,11 +93,11 @@ float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacuna
int i;
/* first unscaled octave of function; later octaves are scaled */
- value = offset + safe_noise(p);
+ value = offset + safe_noise(p, 0);
p *= lacunarity;
for (i = 1; i < (int)octaves; i++) {
- increment = (safe_noise(p) + offset) * pwr * value;
+ increment = (safe_noise(p, 0) + offset) * pwr * value;
value += increment;
pwr *= pwHL;
p *= lacunarity;
@@ -105,7 +105,7 @@ float noise_musgrave_hetero_terrain(point p, string basis, float H, float lacuna
rmd = octaves - floor(octaves);
if (rmd != 0.0) {
- increment = (safe_noise(p) + offset) * pwr * value;
+ increment = (safe_noise(p, 0) + offset) * pwr * value;
value += rmd * increment;
}
@@ -128,7 +128,7 @@ float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H,
float pwr = pwHL;
int i;
- result = safe_noise(p) + offset;
+ result = safe_noise(p, 0) + offset;
weight = gain * result;
p *= lacunarity;
@@ -136,7 +136,7 @@ float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H,
if (weight > 1.0)
weight = 1.0;
- signal = (safe_noise(p) + offset) * pwr;
+ signal = (safe_noise(p, 0) + offset) * pwr;
pwr *= pwHL;
result += weight * signal;
weight *= gain * signal;
@@ -145,7 +145,7 @@ float noise_musgrave_hybrid_multi_fractal(point p, string basis, float H,
rmd = octaves - floor(octaves);
if (rmd != 0.0)
- result += rmd * ((safe_noise(p) + offset) * pwr);
+ result += rmd * ((safe_noise(p, 0) + offset) * pwr);
return result;
}
@@ -166,7 +166,7 @@ float noise_musgrave_ridged_multi_fractal(point p, string basis, float H,
float pwr = pwHL;
int i;
- signal = offset - fabs(safe_noise(p));
+ signal = offset - fabs(safe_noise(p, 0));
signal *= signal;
result = signal;
weight = 1.0;
@@ -174,7 +174,7 @@ float noise_musgrave_ridged_multi_fractal(point p, string basis, float H,
for (i = 1; i < (int)octaves; i++) {
p *= lacunarity;
weight = clamp(signal * gain, 0.0, 1.0);
- signal = offset - fabs(safe_noise(p));
+ signal = offset - fabs(safe_noise(p, 0));
signal *= signal;
signal *= weight;
result += signal * pwr;
diff --git a/intern/cycles/kernel/shaders/node_texture.h b/intern/cycles/kernel/shaders/node_texture.h
index 2de0fc0ea57..463c68a6c27 100644
--- a/intern/cycles/kernel/shaders/node_texture.h
+++ b/intern/cycles/kernel/shaders/node_texture.h
@@ -151,9 +151,17 @@ float voronoi_CrS(point p) { return 2.0 * voronoi_Cr(p) - 1.0; }
/* Noise Bases */
-float safe_noise(point p)
+float safe_noise(point p, int type)
{
- float f = noise(p);
+ float f = 0.0;
+
+ /* Perlin noise in range -1..1 */
+ if (type == 0)
+ f = noise("perlin", p);
+
+ /* Perlin noise in range 0..1 */
+ else
+ f = noise(p);
/* can happen for big coordinates, things even out to 0.5 then anyway */
if(!isfinite(f))
@@ -167,7 +175,7 @@ float noise_basis(point p, string basis)
float result = 0.0;
if (basis == "Perlin")
- result = safe_noise(p); /* returns perlin noise in range 0..1 */
+ result = safe_noise(p, 1);
if (basis == "Voronoi F1")
result = voronoi_F1S(p);
if (basis == "Voronoi F2")
diff --git a/intern/cycles/render/curves.h b/intern/cycles/render/curves.h
index 3a12d33d0a7..3527998339c 100644
--- a/intern/cycles/render/curves.h
+++ b/intern/cycles/render/curves.h
@@ -33,9 +33,11 @@ void curvebounds(float *lower, float *upper, float3 *p, int dim);
typedef enum curve_presets {
CURVE_CUSTOM,
+ CURVE_FAST_PLANES,
CURVE_TANGENT_SHADING,
CURVE_TRUE_NORMAL,
- CURVE_ACCURATE_PRESET
+ CURVE_ACCURATE_PRESET,
+ CURVE_SMOOTH_CURVES
} curve_presets;
typedef enum curve_primitives {
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index e6f8ab4a5d9..6bfaf48c0c9 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -85,14 +85,14 @@ bool ImageManager::set_animation_frame_update(int frame)
return false;
}
-bool ImageManager::is_float_image(const string& filename, bool is_builtin)
+bool ImageManager::is_float_image(const string& filename, void *builtin_data)
{
bool is_float = false;
- if(is_builtin) {
+ if(builtin_data) {
if(builtin_image_info_cb) {
int width, height, channels;
- builtin_image_info_cb(filename, is_float, width, height, channels);
+ builtin_image_info_cb(filename, builtin_data, is_float, width, height, channels);
}
return is_float;
@@ -123,13 +123,13 @@ bool ImageManager::is_float_image(const string& filename, bool is_builtin)
return is_float;
}
-int ImageManager::add_image(const string& filename, bool is_builtin, bool animated, bool& is_float)
+int ImageManager::add_image(const string& filename, void *builtin_data, bool animated, bool& is_float)
{
Image *img;
size_t slot;
/* load image info and find out if we need a float texture */
- is_float = (pack_images)? false: is_float_image(filename, is_builtin);
+ is_float = (pack_images)? false: is_float_image(filename, builtin_data);
if(is_float) {
/* find existing image */
@@ -160,7 +160,7 @@ int ImageManager::add_image(const string& filename, bool is_builtin, bool animat
/* add new image */
img = new Image();
img->filename = filename;
- img->is_builtin = is_builtin;
+ img->builtin_data = builtin_data;
img->need_load = true;
img->animated = animated;
img->users = 1;
@@ -195,7 +195,7 @@ int ImageManager::add_image(const string& filename, bool is_builtin, bool animat
/* add new image */
img = new Image();
img->filename = filename;
- img->is_builtin = is_builtin;
+ img->builtin_data = builtin_data;
img->need_load = true;
img->animated = animated;
img->users = 1;
@@ -209,12 +209,12 @@ int ImageManager::add_image(const string& filename, bool is_builtin, bool animat
return slot;
}
-void ImageManager::remove_image(const string& filename, bool is_builtin)
+void ImageManager::remove_image(const string& filename, void *builtin_data)
{
size_t slot;
for(slot = 0; slot < images.size(); slot++) {
- if(images[slot] && images[slot]->filename == filename && images[slot]->is_builtin == is_builtin) {
+ if(images[slot] && images[slot]->filename == filename && images[slot]->builtin_data == builtin_data) {
/* decrement user count */
images[slot]->users--;
assert(images[slot]->users >= 0);
@@ -232,7 +232,7 @@ void ImageManager::remove_image(const string& filename, bool is_builtin)
if(slot == images.size()) {
/* see if it's in a float texture slot */
for(slot = 0; slot < float_images.size(); slot++) {
- if(float_images[slot] && float_images[slot]->filename == filename && float_images[slot]->is_builtin == is_builtin) {
+ if(float_images[slot] && float_images[slot]->filename == filename && float_images[slot]->builtin_data == builtin_data) {
/* decrement user count */
float_images[slot]->users--;
assert(float_images[slot]->users >= 0);
@@ -257,7 +257,7 @@ bool ImageManager::file_load_image(Image *img, device_vector<uchar4>& tex_img)
ImageInput *in = NULL;
int width, height, components;
- if(!img->is_builtin) {
+ if(!img->builtin_data) {
/* load image from file through OIIO */
in = ImageInput::create(img->filename);
@@ -281,7 +281,7 @@ bool ImageManager::file_load_image(Image *img, device_vector<uchar4>& tex_img)
return false;
bool is_float;
- builtin_image_info_cb(img->filename, is_float, width, height, components);
+ builtin_image_info_cb(img->filename, img->builtin_data, is_float, width, height, components);
}
/* we only handle certain number of components */
@@ -309,7 +309,7 @@ bool ImageManager::file_load_image(Image *img, device_vector<uchar4>& tex_img)
delete in;
}
else {
- builtin_image_pixels_cb(img->filename, pixels);
+ builtin_image_pixels_cb(img->filename, img->builtin_data, pixels);
}
if(components == 3) {
@@ -340,7 +340,7 @@ bool ImageManager::file_load_float_image(Image *img, device_vector<float4>& tex_
ImageInput *in = NULL;
int width, height, components;
- if(!img->is_builtin) {
+ if(!img->builtin_data) {
/* load image from file through OIIO */
in = ImageInput::create(img->filename);
@@ -365,7 +365,7 @@ bool ImageManager::file_load_float_image(Image *img, device_vector<float4>& tex_
return false;
bool is_float;
- builtin_image_info_cb(img->filename, is_float, width, height, components);
+ builtin_image_info_cb(img->filename, img->builtin_data, is_float, width, height, components);
}
if(!(components == 1 || components == 3 || components == 4)) {
@@ -391,7 +391,7 @@ bool ImageManager::file_load_float_image(Image *img, device_vector<float4>& tex_
delete in;
}
else {
- builtin_image_float_pixels_cb(img->filename, pixels);
+ builtin_image_float_pixels_cb(img->filename, img->builtin_data, pixels);
}
if(components == 3) {
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index e39ac14b60f..464b87ff530 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -51,9 +51,9 @@ public:
ImageManager();
~ImageManager();
- int add_image(const string& filename, bool is_builtin, bool animated, bool& is_float);
- void remove_image(const string& filename, bool is_builtin);
- bool is_float_image(const string& filename, bool is_builtin);
+ int add_image(const string& filename, void *builtin_data, bool animated, bool& is_float);
+ void remove_image(const string& filename, void *builtin_data);
+ bool is_float_image(const string& filename, void *builtin_data);
void device_update(Device *device, DeviceScene *dscene, Progress& progress);
void device_free(Device *device, DeviceScene *dscene);
@@ -65,9 +65,9 @@ public:
bool need_update;
- boost::function<void(const string &filename, bool &is_float, int &width, int &height, int &channels)> builtin_image_info_cb;
- boost::function<bool(const string &filename, unsigned char *pixels)> builtin_image_pixels_cb;
- boost::function<bool(const string &filename, float *pixels)> builtin_image_float_pixels_cb;
+ boost::function<void(const string &filename, void *data, bool &is_float, int &width, int &height, int &channels)> builtin_image_info_cb;
+ boost::function<bool(const string &filename, void *data, unsigned char *pixels)> builtin_image_pixels_cb;
+ boost::function<bool(const string &filename, void *data, float *pixels)> builtin_image_float_pixels_cb;
private:
int tex_num_images;
int tex_num_float_images;
@@ -77,7 +77,7 @@ private:
struct Image {
string filename;
- bool is_builtin;
+ void *builtin_data;
bool need_load;
bool animated;
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 04fea1953e7..e7fb9514371 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -115,6 +115,8 @@ Light::Light()
spot_smooth = 0.0f;
cast_shadow = true;
+ use_mis = false;
+
shader = 0;
samples = 1;
}
@@ -291,13 +293,19 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
/* point lights */
float lightarea = (totarea > 0.0f)? totarea/scene->lights.size(): 1.0f;
+ bool use_lamp_mis = false;
for(int i = 0; i < scene->lights.size(); i++, offset++) {
+ Light *light = scene->lights[i];
+
distribution[offset].x = totarea;
distribution[offset].y = __int_as_float(~(int)i);
distribution[offset].z = 1.0f;
- distribution[offset].w = scene->lights[i]->size;
+ distribution[offset].w = light->size;
totarea += lightarea;
+
+ if(light->size > 0.0f && light->use_mis)
+ use_lamp_mis = true;
}
/* normalize cumulative distribution functions */
@@ -344,6 +352,8 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
kintegrator->inv_pdf_lights = 1.0f/kintegrator->pdf_lights;
}
+ kintegrator->use_lamp_mis = use_lamp_mis;
+
/* CDF */
device->tex_alloc("__light_distribution", dscene->light_distribution);
}
@@ -355,6 +365,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
kintegrator->pdf_triangles = 0.0f;
kintegrator->pdf_lights = 0.0f;
kintegrator->inv_pdf_lights = 0.0f;
+ kintegrator->use_lamp_mis = false;
}
}
@@ -484,6 +495,9 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce
float radius = light->size;
float invarea = (radius > 0.0f)? 1.0f/(M_PI_F*radius*radius): 1.0f;
+ if(light->use_mis && radius > 0.0f)
+ shader_id |= SHADER_USE_MIS;
+
light_data[i*LIGHT_SIZE + 0] = make_float4(__int_as_float(light->type), co.x, co.y, co.z);
light_data[i*LIGHT_SIZE + 1] = make_float4(__int_as_float(shader_id), radius, invarea, 0.0f);
light_data[i*LIGHT_SIZE + 2] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
@@ -498,6 +512,9 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce
float area = M_PI_F*radius*radius;
float invarea = (area > 0.0f)? 1.0f/area: 1.0f;
+ if(light->use_mis && area > 0.0f)
+ shader_id |= SHADER_USE_MIS;
+
light_data[i*LIGHT_SIZE + 0] = make_float4(__int_as_float(light->type), dir.x, dir.y, dir.z);
light_data[i*LIGHT_SIZE + 1] = make_float4(__int_as_float(shader_id), radius, cosangle, invarea);
light_data[i*LIGHT_SIZE + 2] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
@@ -505,6 +522,7 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce
}
else if(light->type == LIGHT_BACKGROUND) {
shader_id &= ~SHADER_AREA_LIGHT;
+ shader_id |= SHADER_USE_MIS;
light_data[i*LIGHT_SIZE + 0] = make_float4(__int_as_float(light->type), 0.0f, 0.0f, 0.0f);
light_data[i*LIGHT_SIZE + 1] = make_float4(__int_as_float(shader_id), 0.0f, 0.0f, 0.0f);
@@ -515,7 +533,10 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce
float3 axisu = light->axisu*(light->sizeu*light->size);
float3 axisv = light->axisv*(light->sizev*light->size);
float area = len(axisu)*len(axisv);
- float invarea = (area > 0.0f)? 1.0f/area: 0.0f;
+ float invarea = (area > 0.0f)? 1.0f/area: 1.0f;
+
+ if(light->use_mis && area > 0.0f)
+ shader_id |= SHADER_USE_MIS;
light_data[i*LIGHT_SIZE + 0] = make_float4(__int_as_float(light->type), co.x, co.y, co.z);
light_data[i*LIGHT_SIZE + 1] = make_float4(__int_as_float(shader_id), axisu.x, axisu.y, axisu.z);
@@ -530,6 +551,9 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce
float spot_angle = cosf(light->spot_angle*0.5f);
float spot_smooth = (1.0f - spot_angle)*light->spot_smooth;
+ if(light->use_mis && radius > 0.0f)
+ shader_id |= SHADER_USE_MIS;
+
light_data[i*LIGHT_SIZE + 0] = make_float4(__int_as_float(light->type), co.x, co.y, co.z);
light_data[i*LIGHT_SIZE + 1] = make_float4(__int_as_float(shader_id), radius, invarea, spot_angle);
light_data[i*LIGHT_SIZE + 2] = make_float4(spot_smooth, dir.x, dir.y, dir.z);
diff --git a/intern/cycles/render/light.h b/intern/cycles/render/light.h
index 3cedde2596e..acd1692a41f 100644
--- a/intern/cycles/render/light.h
+++ b/intern/cycles/render/light.h
@@ -52,6 +52,7 @@ public:
float spot_smooth;
bool cast_shadow;
+ bool use_mis;
int shader;
int samples;
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 5444299b948..a0a933ef682 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -142,7 +142,7 @@ ImageTextureNode::ImageTextureNode()
slot = -1;
is_float = -1;
filename = "";
- is_builtin = false;
+ builtin_data = NULL;
color_space = ustring("Color");
projection = ustring("Flat");
projection_blend = 0.0f;
@@ -156,7 +156,7 @@ ImageTextureNode::ImageTextureNode()
ImageTextureNode::~ImageTextureNode()
{
if(image_manager)
- image_manager->remove_image(filename, is_builtin);
+ image_manager->remove_image(filename, builtin_data);
}
ShaderNode *ImageTextureNode::clone() const
@@ -177,7 +177,7 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
image_manager = compiler.image_manager;
if(is_float == -1) {
bool is_float_bool;
- slot = image_manager->add_image(filename, is_builtin, animated, is_float_bool);
+ slot = image_manager->add_image(filename, builtin_data, animated, is_float_bool);
is_float = (int)is_float_bool;
}
@@ -238,7 +238,7 @@ void ImageTextureNode::compile(OSLCompiler& compiler)
tex_mapping.compile(compiler);
if(is_float == -1)
- is_float = (int)image_manager->is_float_image(filename, false);
+ is_float = (int)image_manager->is_float_image(filename, NULL);
compiler.parameter("filename", filename.c_str());
if(is_float || color_space != "Color")
@@ -272,7 +272,7 @@ EnvironmentTextureNode::EnvironmentTextureNode()
slot = -1;
is_float = -1;
filename = "";
- is_builtin = false;
+ builtin_data = NULL;
color_space = ustring("Color");
projection = ustring("Equirectangular");
animated = false;
@@ -285,7 +285,7 @@ EnvironmentTextureNode::EnvironmentTextureNode()
EnvironmentTextureNode::~EnvironmentTextureNode()
{
if(image_manager)
- image_manager->remove_image(filename, is_builtin);
+ image_manager->remove_image(filename, builtin_data);
}
ShaderNode *EnvironmentTextureNode::clone() const
@@ -306,7 +306,7 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
image_manager = compiler.image_manager;
if(slot == -1) {
bool is_float_bool;
- slot = image_manager->add_image(filename, is_builtin, animated, is_float_bool);
+ slot = image_manager->add_image(filename, builtin_data, animated, is_float_bool);
is_float = (int)is_float_bool;
}
@@ -356,7 +356,7 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler)
tex_mapping.compile(compiler);
if(is_float == -1)
- is_float = (int)image_manager->is_float_image(filename, false);
+ is_float = (int)image_manager->is_float_image(filename, NULL);
compiler.parameter("filename", filename.c_str());
compiler.parameter("projection", projection);
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 8b2d6a0e5c8..66be919d098 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -70,7 +70,7 @@ public:
int slot;
int is_float;
string filename;
- bool is_builtin;
+ void *builtin_data;
ustring color_space;
ustring projection;
float projection_blend;
@@ -90,7 +90,7 @@ public:
int slot;
int is_float;
string filename;
- bool is_builtin;
+ void *builtin_data;
ustring color_space;
ustring projection;
bool animated;
diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp
index 8d8087266c1..b31650c160a 100644
--- a/intern/cycles/render/object.cpp
+++ b/intern/cycles/render/object.cpp
@@ -84,12 +84,20 @@ void Object::apply_transform()
{
if(!mesh || tfm == transform_identity())
return;
-
+
+ float3 c0 = transform_get_column(&tfm, 0);
+ float3 c1 = transform_get_column(&tfm, 1);
+ float3 c2 = transform_get_column(&tfm, 2);
+ float scalar = pow(fabsf(dot(cross(c0, c1), c2)), 1.0f/3.0f);
+
for(size_t i = 0; i < mesh->verts.size(); i++)
mesh->verts[i] = transform_point(&tfm, mesh->verts[i]);
- for(size_t i = 0; i < mesh->curve_keys.size(); i++)
+ for(size_t i = 0; i < mesh->curve_keys.size(); i++) {
mesh->curve_keys[i].co = transform_point(&tfm, mesh->curve_keys[i].co);
+ /* scale for strand radius - only correct for uniform transforms*/
+ mesh->curve_keys[i].radius *= scalar;
+ }
/* store matrix to transform later. when accessing these as attributes we
* do not want the transform to be applied for consistency between static
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index e49a4a3ed34..94cb69102d2 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -381,7 +381,7 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile)
buffer_params.get_offset_stride(rtile.offset, rtile.stride);
- RenderBuffers *tilebuffers = new RenderBuffers(tile_device);
+ RenderBuffers *tilebuffers;
/* allocate buffers */
if(params.progressive_refine) {
@@ -552,7 +552,7 @@ void Session::run_cpu()
}
else if(need_tonemap) {
/* tonemap only if we do not reset, we don't we don't
- * wan't to show the result of an incomplete sample*/
+ * want to show the result of an incomplete sample*/
tonemap();
}
diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp
index 2d9f0fffae6..4fda090e09e 100644
--- a/intern/cycles/util/util_system.cpp
+++ b/intern/cycles/util/util_system.cpp
@@ -136,7 +136,7 @@ struct CPUCapabilities {
bool fma4;
};
-bool system_cpu_support_optimized()
+static CPUCapabilities& system_cpu_capabilities()
{
static CPUCapabilities caps;
static bool caps_init = false;
@@ -182,7 +182,18 @@ bool system_cpu_support_optimized()
caps_init = true;
}
- /* optimization flags use these */
+ return caps;
+}
+
+bool system_cpu_support_sse2()
+{
+ CPUCapabilities& caps = system_cpu_capabilities();
+ return caps.sse && caps.sse2;
+}
+
+bool system_cpu_support_sse3()
+{
+ CPUCapabilities& caps = system_cpu_capabilities();
return caps.sse && caps.sse2 && caps.sse3;
}
diff --git a/intern/cycles/util/util_system.h b/intern/cycles/util/util_system.h
index f25e009a250..257112883d1 100644
--- a/intern/cycles/util/util_system.h
+++ b/intern/cycles/util/util_system.h
@@ -26,7 +26,8 @@ CCL_NAMESPACE_BEGIN
int system_cpu_thread_count();
string system_cpu_brand_string();
int system_cpu_bits();
-bool system_cpu_support_optimized();
+bool system_cpu_support_sse2();
+bool system_cpu_support_sse3();
CCL_NAMESPACE_END
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index ea09987c564..12dd4c0d3eb 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -271,6 +271,9 @@ elseif(UNIX)
if(WITH_X11_XINPUT)
add_definitions(-DWITH_X11_XINPUT)
+ list(APPEND INC_SYS
+ ${X11_Xinput_INCLUDE_PATH}
+ )
endif()
elseif(WIN32)
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index ffdee6c1550..a92d0d33b65 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -149,6 +149,20 @@ extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
GHOST_TUns32 *height);
/**
+ * Returns the dimensions of all displays combine
+ * (the current workspace).
+ * No need to worrky about overlapping monitors.
+ * \param systemhandle The handle to the system
+ * \param width A pointer the width gets put in
+ * \param height A pointer the height gets put in
+ * \return void.
+ */
+extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
+ GHOST_TUns32 *width,
+ GHOST_TUns32 *height);
+
+
+/**
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 1b3509c1ac3..841293e09e4 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -227,6 +227,12 @@ public:
virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const = 0;
/**
+ * Returns the combine dimensions of all monitors.
+ * \return The dimension of the workspace.
+ */
+ virtual void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const = 0;
+
+ /**
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index be64acf8c94..7622a2a7330 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -123,7 +123,14 @@ void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
system->getMainDisplayDimensions(*width, *height);
}
+void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
+ GHOST_TUns32 *width,
+ GHOST_TUns32 *height)
+{
+ GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
+ system->getAllDisplayDimensions(*width, *height);
+}
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
const char *title,
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp b/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp
index 3f7d2102dac..25e9123dae6 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp
@@ -150,7 +150,7 @@ GHOST_TSuccess GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(GHOST_TUns8
#endif // GHOST_DEBUG
CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues);
-
+
return err == CGDisplayNoErr ? GHOST_kSuccess : GHOST_kFailure;
}
@@ -158,19 +158,18 @@ GHOST_TSuccess GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(GHOST_TUns8
long GHOST_DisplayManagerCarbon::getValue(CFDictionaryRef values, CFStringRef key) const
{
CFNumberRef numberValue = (CFNumberRef) CFDictionaryGetValue(values, key);
-
+
if (!numberValue)
{
return -1;
}
-
+
long intValue;
-
+
if (!CFNumberGetValue(numberValue, kCFNumberLongType, &intValue))
{
return -1;
}
-
+
return intValue;
}
-
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index f5784c7d451..bb6b1bfd4af 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -396,6 +396,11 @@ void GHOST_SystemCarbon::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUn
height = bnds.bottom - bnds.top;
}
+void GHOST_SystemCarbon::getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
+{
+ /* TODO */
+ getMainDisplayDimensions(width, height);
+}
GHOST_IWindow *GHOST_SystemCarbon::createWindow(
const STR_String& title,
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index 61e5a086a0f..b6821bc7419 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -91,6 +91,12 @@ public:
* \return The dimension of the main display.
*/
virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
+
+ /**
+ * Returns the combine dimensions of all monitors.
+ * \return The dimension of the workspace.
+ */
+ virtual void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
/**
* Create a new window.
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index a1b372dac9a..257aeb52a37 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -89,6 +89,11 @@ public:
*/
virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
+ /** Returns the combine dimensions of all monitors.
+ * \return The dimension of the workspace.
+ */
+ virtual void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
+
/**
* Create a new window.
* The new window is added to the list of windows managed.
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 1665180b687..e4245aaf095 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -719,6 +719,11 @@ void GHOST_SystemCocoa::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns
[pool drain];
}
+void GHOST_SystemCocoa::getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
+{
+ /* TODO! */
+ getMainDisplayDimensions(width, height);
+}
GHOST_IWindow* GHOST_SystemCocoa::createWindow(
const STR_String& title,
diff --git a/intern/ghost/intern/GHOST_SystemNULL.h b/intern/ghost/intern/GHOST_SystemNULL.h
index 63e3b5bc828..7021dea36dd 100644
--- a/intern/ghost/intern/GHOST_SystemNULL.h
+++ b/intern/ghost/intern/GHOST_SystemNULL.h
@@ -38,7 +38,7 @@ class GHOST_WindowNULL;
class GHOST_SystemNULL : public GHOST_System {
public:
- GHOST_SystemNULL( ) : GHOST_System() { /* nop */ }
+ GHOST_SystemNULL() : GHOST_System() { /* nop */ }
~GHOST_SystemNULL() { /* nop */ }
bool processEvents(bool waitForEvent) { return false; }
int toggleConsole(int action) { return 0; }
@@ -46,11 +46,12 @@ public:
GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const { return GHOST_kSuccess; }
GHOST_TUns8 *getClipboard(bool selection) const { return NULL; }
void putClipboard(GHOST_TInt8 *buffer, bool selection) const { /* nop */ }
- GHOST_TUns64 getMilliSeconds( ) const { return 0; }
- GHOST_TUns8 getNumDisplays( ) const { return GHOST_TUns8(1); }
- GHOST_TSuccess getCursorPosition( GHOST_TInt32& x, GHOST_TInt32& y ) const { return GHOST_kFailure; }
- GHOST_TSuccess setCursorPosition( GHOST_TInt32 x, GHOST_TInt32 y ) { return GHOST_kFailure; }
- void getMainDisplayDimensions( GHOST_TUns32& width, GHOST_TUns32& height ) const { /* nop */ }
+ GHOST_TUns64 getMilliSeconds() const { return 0; }
+ GHOST_TUns8 getNumDisplays() const { return GHOST_TUns8(1); }
+ GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const { return GHOST_kFailure; }
+ GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) { return GHOST_kFailure; }
+ void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const { /* nop */ }
+ void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const { /* nop */ }
GHOST_TSuccess init() {
GHOST_TSuccess success = GHOST_System::init();
@@ -82,11 +83,4 @@ public:
}
};
-#endif
-
-
-
-
-
-
-
+#endif /* __GHOST_SYSTEMNULL_H__ */
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index fdc4f33b784..da1836d88a0 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -114,6 +114,20 @@ GHOST_SystemSDL::init() {
return GHOST_kFailure;
}
+/**
+ * Returns the dimensions of the main display on this system.
+ * \return The dimension of the main display.
+ */
+void
+GHOST_SystemSDL::getAllDisplayDimensions(GHOST_TUns32& width,
+ GHOST_TUns32& height) const
+{
+ SDL_DisplayMode mode;
+ SDL_GetDesktopDisplayMode(0, &mode); /* note, always 0 display */
+ width = mode.w;
+ height = mode.h;
+}
+
void
GHOST_SystemSDL::getMainDisplayDimensions(GHOST_TUns32& width,
GHOST_TUns32& height) const
diff --git a/intern/ghost/intern/GHOST_SystemSDL.h b/intern/ghost/intern/GHOST_SystemSDL.h
index 43c9129fdd8..776dc2f66a5 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.h
+++ b/intern/ghost/intern/GHOST_SystemSDL.h
@@ -88,6 +88,10 @@ public:
GHOST_TInt32 y);
void
+ getAllDisplayDimensions(GHOST_TUns32& width,
+ GHOST_TUns32& height) const;
+
+ void
getMainDisplayDimensions(GHOST_TUns32& width,
GHOST_TUns32& height) const;
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 50d7b372dd6..138109ce48b 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -215,6 +215,11 @@ void GHOST_SystemWin32::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns
height = ::GetSystemMetrics(SM_CYSCREEN);
}
+void GHOST_SystemWin32::getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
+{
+ width = ::GetSystemMetrics(SM_XVIRTUALSCREEN);
+ height = ::GetSystemMetrics(SM_YVIRTUALSCREEN);
+}
GHOST_IWindow *GHOST_SystemWin32::createWindow(
const STR_String& title,
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 6a756d35872..e47dbda2e92 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -100,7 +100,13 @@ public:
* \return The dimension of the main display.
*/
virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
-
+
+ /**
+ * Returns the dimensions of all displays on this system.
+ * \return The dimension of the main display.
+ */
+ virtual void getAllDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
+
/**
* Create a new window.
* The new window is added to the list of windows managed.
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 28a228b2777..7ba8889fd1e 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -72,6 +72,9 @@
/* for debugging - so we can breakpoint X11 errors */
// #define USE_X11_ERROR_HANDLERS
+/* see [#34039] Fix Alt key glitch on Unity desktop */
+#define USE_UNITY_WORKAROUND
+
static GHOST_TKey convertXKey(KeySym key);
/* these are for copy and select copy */
@@ -234,6 +237,25 @@ getMainDisplayDimensions(
GHOST_TUns32& height) const
{
if (m_display) {
+ /* note, for this to work as documented,
+ * we would need to use Xinerama check r54370 for code that did thia,
+ * we've since removed since its not worth the extra dep - campbell */
+ getAllDisplayDimensions(width, height);
+ }
+}
+
+
+/**
+ * Returns the dimensions of the main display on this system.
+ * \return The dimension of the main display.
+ */
+void
+GHOST_SystemX11::
+getAllDisplayDimensions(
+ GHOST_TUns32& width,
+ GHOST_TUns32& height) const
+{
+ if (m_display) {
width = DisplayWidth(m_display, DefaultScreen(m_display));
height = DisplayHeight(m_display, DefaultScreen(m_display));
}
@@ -496,6 +518,54 @@ processEvents(
processEvent(&xevent);
anyProcessed = true;
+
+
+#ifdef USE_UNITY_WORKAROUND
+ /* note: processEvent() can't include this code because
+ * KeymapNotify event have no valid window information. */
+
+ /* the X server generates KeymapNotify event immediately after
+ * every EnterNotify and FocusIn event. we handle this event
+ * to correct modifier states. */
+ if (xevent.type == FocusIn) {
+ /* use previous event's window, because KeymapNotify event
+ * has no window information. */
+ GHOST_WindowX11 *window = findGhostWindow(xevent.xany.window);
+ if (window && XPending(m_display) >= 2) {
+ XNextEvent(m_display, &xevent);
+
+ if (xevent.type == KeymapNotify) {
+ XEvent xev_next;
+
+ /* check if KeyPress or KeyRelease event was generated
+ * in order to confirm the window is active. */
+ XPeekEvent(m_display, &xev_next);
+
+ if (xev_next.type == KeyPress || xev_next.type == KeyRelease) {
+ /* XK_Hyper_L/R currently unused */
+ const static KeySym modifiers[8] = {XK_Shift_L, XK_Shift_R,
+ XK_Control_L, XK_Control_R,
+ XK_Alt_L, XK_Alt_R,
+ XK_Super_L, XK_Super_R};
+
+ for (int i = 0; i < (sizeof(modifiers) / sizeof(*modifiers)); i++) {
+ KeyCode kc = XKeysymToKeycode(m_display, modifiers[i]);
+ if (((xevent.xkeymap.key_vector[kc >> 3] >> (kc & 7)) & 1) != 0) {
+ pushEvent(new GHOST_EventKey(
+ getMilliSeconds(),
+ GHOST_kEventKeyDown,
+ window,
+ convertXKey(modifiers[i]),
+ '\0',
+ NULL));
+ }
+ }
+ }
+ }
+ }
+ }
+#endif /* USE_UNITY_WORKAROUND */
+
}
if (generateWindowExposeEvents()) {
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index a5d5d9b7a99..5fd494637f9 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -117,6 +117,16 @@ public:
) const;
/**
+ * Returns the dimensions of all displays on this system.
+ * \return The dimension of the main display.
+ */
+ void
+ getAllDisplayDimensions(
+ GHOST_TUns32& width,
+ GHOST_TUns32& height
+ ) const;
+
+ /**
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index ccd6cd93d4c..8d5f8bf89d5 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -58,9 +58,7 @@ extern "C" {
extern void wm_draw_update(bContext *C);
};*/
@interface CocoaWindowDelegate : NSObject
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
<NSWindowDelegate>
-#endif
{
GHOST_SystemCocoa *systemCocoa;
GHOST_WindowCocoa *associatedWindow;
@@ -998,9 +996,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
//Show the new window
[tmpWindow makeKeyAndOrderFront:m_openGLView];
//Close and release old window
- [m_window setDelegate:nil]; // To avoid the notification of "window closed" event
[m_window close];
- [m_window release];
m_window = tmpWindow;
#endif
@@ -1057,9 +1053,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
//Show the new window
[tmpWindow makeKeyAndOrderFront:nil];
//Close and release old window
- [m_window setDelegate:nil]; // To avoid the notification of "window closed" event
[m_window close];
- [m_window release];
m_window = tmpWindow;
#endif
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 2e9ac94b9c7..7ef3a739b7e 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -266,15 +266,14 @@ GHOST_WindowX11(
/* Specify which events we are interested in hearing. */
xattributes.event_mask =
- ExposureMask | StructureNotifyMask |
- KeyPressMask | KeyReleaseMask |
- EnterWindowMask | LeaveWindowMask |
- ButtonPressMask | ButtonReleaseMask |
- PointerMotionMask | FocusChangeMask | PropertyChangeMask;
+ ExposureMask | StructureNotifyMask |
+ KeyPressMask | KeyReleaseMask |
+ EnterWindowMask | LeaveWindowMask |
+ ButtonPressMask | ButtonReleaseMask |
+ PointerMotionMask | FocusChangeMask |
+ PropertyChangeMask | KeymapStateMask;
/* create the window! */
-
- ;
if (parentWindow == 0) {
m_window = XCreateWindow(m_display,
RootWindow(m_display, m_visual->screen),
@@ -329,6 +328,26 @@ GHOST_WindowX11(
GHOST_PRINT("Set drop target\n");
#endif
+ if (state == GHOST_kWindowStateMaximized || state == GHOST_kWindowStateFullScreen) {
+ Atom _NET_WM_STATE = XInternAtom(m_display, "_NET_WM_STATE", False);
+ Atom _NET_WM_STATE_MAXIMIZED_VERT = XInternAtom(m_display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
+ Atom _NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(m_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
+ Atom _NET_WM_STATE_FULLSCREEN = XInternAtom(m_display, "_NET_WM_STATE_FULLSCREEN", False);
+ Atom atoms[2];
+ int count = 0;
+
+ if (state == GHOST_kWindowStateMaximized) {
+ atoms[count++] = _NET_WM_STATE_MAXIMIZED_VERT;
+ atoms[count++] = _NET_WM_STATE_MAXIMIZED_HORZ;
+ }
+ else {
+ atoms[count++] = _NET_WM_STATE_FULLSCREEN;
+ }
+
+ XChangeProperty(m_display, m_window, _NET_WM_STATE, XA_ATOM, 32,
+ PropModeReplace, (unsigned char *)atoms, count);
+ m_post_init = False;
+ }
/*
* One of the problem with WM-spec is that can't set a property
* to a window that isn't mapped. That is why we can't "just
@@ -340,7 +359,7 @@ GHOST_WindowX11(
* So, m_post_init indicate that we need wait for the MapNotify
* event and then set the Window state to the m_post_state.
*/
- if ((state != GHOST_kWindowStateNormal) && (state != GHOST_kWindowStateMinimized)) {
+ else if ((state != GHOST_kWindowStateNormal) && (state != GHOST_kWindowStateMinimized)) {
m_post_init = True;
m_post_state = state;
}
@@ -508,7 +527,7 @@ bool GHOST_WindowX11::createX11_XIC()
EnterWindowMask | LeaveWindowMask |
ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | FocusChangeMask |
- PropertyChangeMask | fevent);
+ PropertyChangeMask | KeymapStateMask | fevent);
return true;
}
#endif
@@ -916,12 +935,12 @@ GHOST_TWindowState GHOST_WindowX11::getState() const
*/
if ((state == IconicState) || (state == WithdrawnState))
state_ret = GHOST_kWindowStateMinimized;
- else if (netwmIsMaximized() == True)
- state_ret = GHOST_kWindowStateMaximized;
else if (netwmIsFullScreen() == True)
state_ret = GHOST_kWindowStateFullScreen;
else if (motifIsFullScreen() == True)
state_ret = GHOST_kWindowStateFullScreen;
+ else if (netwmIsMaximized() == True)
+ state_ret = GHOST_kWindowStateMaximized;
return (state_ret);
}
diff --git a/source/blender/opencl/CMakeLists.txt b/intern/opencl/CMakeLists.txt
index b3c76db1bca..03855cfdf8b 100644
--- a/source/blender/opencl/CMakeLists.txt
+++ b/intern/opencl/CMakeLists.txt
@@ -39,4 +39,4 @@ set(SRC
)
-blender_add_lib(bf_opencl "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_intern_opencl "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/opencl/OCL_opencl.h b/intern/opencl/OCL_opencl.h
index 4ee167b2fb4..4ee167b2fb4 100644
--- a/source/blender/opencl/OCL_opencl.h
+++ b/intern/opencl/OCL_opencl.h
diff --git a/source/blender/opencl/SConscript b/intern/opencl/SConscript
index 388789a5b50..41a6d720098 100644
--- a/source/blender/opencl/SConscript
+++ b/intern/opencl/SConscript
@@ -31,4 +31,4 @@ sources = env.Glob('intern/*.c')
incs = '.'
-env.BlenderLib ( 'bf_opencl', sources, Split(incs), libtype=['core','player'], priority = [192,192] )
+env.BlenderLib ( 'bf_intern_opencl', sources, Split(incs), libtype=['core','player'], priority = [192,192] )
diff --git a/source/blender/opencl/intern/OCL_opencl.c b/intern/opencl/intern/OCL_opencl.c
index e3130e16bde..e3130e16bde 100644
--- a/source/blender/opencl/intern/OCL_opencl.c
+++ b/intern/opencl/intern/OCL_opencl.c
diff --git a/source/blender/opencl/intern/clew.c b/intern/opencl/intern/clew.c
index d68eb17288f..d68eb17288f 100644
--- a/source/blender/opencl/intern/clew.c
+++ b/intern/opencl/intern/clew.c
diff --git a/source/blender/opencl/intern/clew.h b/intern/opencl/intern/clew.h
index bb7e0134dcf..bb7e0134dcf 100644
--- a/source/blender/opencl/intern/clew.h
+++ b/intern/opencl/intern/clew.h
diff --git a/source/blender/rigidbody/CMakeLists.txt b/intern/rigidbody/CMakeLists.txt
index 903fbe66f01..a323e55e570 100644
--- a/source/blender/rigidbody/CMakeLists.txt
+++ b/intern/rigidbody/CMakeLists.txt
@@ -23,7 +23,7 @@
SET(INC
.
- ../../../extern/bullet2/src
+ ../../extern/bullet2/src
)
set(SRC
@@ -32,4 +32,4 @@ set(SRC
RBI_api.h
)
-blender_add_lib(bf_rigidbody "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_intern_rigidbody "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
index ee5006f2838..9dde2cc3049 100644
--- a/source/blender/rigidbody/RBI_api.h
+++ b/intern/rigidbody/RBI_api.h
@@ -284,12 +284,12 @@ extern void RB_constraint_set_enabled(rbConstraint *con, int enabled);
extern void RB_constraint_set_limits_hinge(rbConstraint *con, float lower, float upper);
extern void RB_constraint_set_limits_slider(rbConstraint *con, float lower, float upper);
extern void RB_constraint_set_limits_piston(rbConstraint *con, float lin_lower, float lin_upper, float ang_lower, float ang_upper);
-extern void RB_constraint_set_limits_6dof(rbConstraint *con, float axis, float lower, float upper);
+extern void RB_constraint_set_limits_6dof(rbConstraint *con, int axis, float lower, float upper);
/* 6dof spring specific */
-extern void RB_constraint_set_stiffness_6dof_spring(rbConstraint *con, float axis, float stiffness);
-extern void RB_constraint_set_damping_6dof_spring(rbConstraint *con, float axis, float damping);
-extern void RB_constraint_set_spring_6dof_spring(rbConstraint *con, float axis, int enable);
+extern void RB_constraint_set_stiffness_6dof_spring(rbConstraint *con, int axis, float stiffness);
+extern void RB_constraint_set_damping_6dof_spring(rbConstraint *con, int axis, float damping);
+extern void RB_constraint_set_spring_6dof_spring(rbConstraint *con, int axis, int enable);
extern void RB_constraint_set_equilibrium_6dof_spring(rbConstraint *con);
/* Set number of constraint solver iterations made per step, this overrided world setting
diff --git a/source/blender/rigidbody/SConscript b/intern/rigidbody/SConscript
index 14c80304983..977281f8eef 100644
--- a/source/blender/rigidbody/SConscript
+++ b/intern/rigidbody/SConscript
@@ -34,9 +34,9 @@ sources = env.Glob('*.cpp')
incs = [
'.',
- '../../../extern/bullet2/src',
+ '../../extern/bullet2/src',
]
-env.BlenderLib('bf_rigidbody', sources=sources,
+env.BlenderLib('bf_intern_rigidbody', sources=sources,
includes=incs, defines=[],
libtype=['core', 'player'], priority=[180, 30])
diff --git a/source/blender/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp
index c4a4532bad1..58345d4e08c 100644
--- a/source/blender/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -897,28 +897,29 @@ void RB_constraint_set_limits_piston(rbConstraint *con, float lin_lower, float l
constraint->setUpperAngLimit(ang_upper);
}
-void RB_constraint_set_limits_6dof(rbConstraint *con, float axis, float lower, float upper)
+void RB_constraint_set_limits_6dof(rbConstraint *con, int axis, float lower, float upper)
{
btGeneric6DofConstraint *constraint = reinterpret_cast<btGeneric6DofConstraint*>(con);
constraint->setLimit(axis, lower, upper);
}
-void RB_constraint_set_stiffness_6dof_spring(rbConstraint *con, float axis, float stiffness)
+void RB_constraint_set_stiffness_6dof_spring(rbConstraint *con, int axis, float stiffness)
{
btGeneric6DofSpringConstraint *constraint = reinterpret_cast<btGeneric6DofSpringConstraint*>(con);
constraint->setStiffness(axis, stiffness);
}
-void RB_constraint_set_damping_6dof_spring(rbConstraint *con, float axis, float damping)
+void RB_constraint_set_damping_6dof_spring(rbConstraint *con, int axis, float damping)
{
btGeneric6DofSpringConstraint *constraint = reinterpret_cast<btGeneric6DofSpringConstraint*>(con);
- constraint->setDamping(axis, damping);
+ // invert damping range so that 0 = no damping
+ constraint->setDamping(axis, 1.0f - damping);
}
-void RB_constraint_set_spring_6dof_spring(rbConstraint *con, float axis, int enable)
+void RB_constraint_set_spring_6dof_spring(rbConstraint *con, int axis, int enable)
{
btGeneric6DofSpringConstraint *constraint = reinterpret_cast<btGeneric6DofSpringConstraint*>(con);
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index 4eb11a46f5b..a1d39286a90 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -1055,7 +1055,7 @@ void FLUID_3D::project()
for (x = 1; x < _xRes - 1; x++, index++)
{
float vMask[3] = {1.0f, 1.0f, 1.0f}, vObst[3] = {0, 0, 0};
- float vR = 0.0f, vL = 0.0f, vT = 0.0f, vB = 0.0f, vD = 0.0f, vU = 0.0f;
+ // float vR = 0.0f, vL = 0.0f, vT = 0.0f, vB = 0.0f, vD = 0.0f, vU = 0.0f; // UNUSED
float pC = _pressure[index]; // center
float pR = _pressure[index + 1]; // right
diff --git a/release/datafiles/matcaps/license.txt b/release/datafiles/matcaps/license.txt
index fb9186d7acc..358c8dcd832 100644
--- a/release/datafiles/matcaps/license.txt
+++ b/release/datafiles/matcaps/license.txt
@@ -1,3 +1,3 @@
These matcap images are licensed as GNU GPL 2 or later, like the rest of Blender's code.
-Thanks to Kent Trammell and Aidy Burrows and John Herreno for making the pictures.
+Thanks to Kent Trammell, Aidy Burrows, John Herreno , Terry Wallwork and David Silverman for making the pictures.
diff --git a/release/datafiles/matcaps/mc01.jpg b/release/datafiles/matcaps/mc01.jpg
index 053550f082c..8c7aef287ee 100644
--- a/release/datafiles/matcaps/mc01.jpg
+++ b/release/datafiles/matcaps/mc01.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc02.jpg b/release/datafiles/matcaps/mc02.jpg
index db572856b07..11deddfeaed 100644
--- a/release/datafiles/matcaps/mc02.jpg
+++ b/release/datafiles/matcaps/mc02.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc03.jpg b/release/datafiles/matcaps/mc03.jpg
index 14f15f70460..64d992fb61a 100644
--- a/release/datafiles/matcaps/mc03.jpg
+++ b/release/datafiles/matcaps/mc03.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc04.jpg b/release/datafiles/matcaps/mc04.jpg
index 56d2efb1734..42be580ee93 100644
--- a/release/datafiles/matcaps/mc04.jpg
+++ b/release/datafiles/matcaps/mc04.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc05.jpg b/release/datafiles/matcaps/mc05.jpg
index 8c7aef287ee..586d233ef31 100644
--- a/release/datafiles/matcaps/mc05.jpg
+++ b/release/datafiles/matcaps/mc05.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc06.jpg b/release/datafiles/matcaps/mc06.jpg
index 372caf7e87c..657883d0866 100644
--- a/release/datafiles/matcaps/mc06.jpg
+++ b/release/datafiles/matcaps/mc06.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc07.jpg b/release/datafiles/matcaps/mc07.jpg
index 3793c0fcaa5..372caf7e87c 100644
--- a/release/datafiles/matcaps/mc07.jpg
+++ b/release/datafiles/matcaps/mc07.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc08.jpg b/release/datafiles/matcaps/mc08.jpg
index ba868d2f95a..50eec402812 100644
--- a/release/datafiles/matcaps/mc08.jpg
+++ b/release/datafiles/matcaps/mc08.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc09.jpg b/release/datafiles/matcaps/mc09.jpg
index ed6a6bfeff8..e05d441aaf9 100644
--- a/release/datafiles/matcaps/mc09.jpg
+++ b/release/datafiles/matcaps/mc09.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc10.jpg b/release/datafiles/matcaps/mc10.jpg
index 50eec402812..ab82f17bb93 100644
--- a/release/datafiles/matcaps/mc10.jpg
+++ b/release/datafiles/matcaps/mc10.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc11.jpg b/release/datafiles/matcaps/mc11.jpg
index e05d441aaf9..053550f082c 100644
--- a/release/datafiles/matcaps/mc11.jpg
+++ b/release/datafiles/matcaps/mc11.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc12.jpg b/release/datafiles/matcaps/mc12.jpg
index 002a0910dd9..beb16f3742e 100644
--- a/release/datafiles/matcaps/mc12.jpg
+++ b/release/datafiles/matcaps/mc12.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc13.jpg b/release/datafiles/matcaps/mc13.jpg
index 42be580ee93..7fb8fa58e8f 100644
--- a/release/datafiles/matcaps/mc13.jpg
+++ b/release/datafiles/matcaps/mc13.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc14.jpg b/release/datafiles/matcaps/mc14.jpg
index 586d233ef31..ba868d2f95a 100644
--- a/release/datafiles/matcaps/mc14.jpg
+++ b/release/datafiles/matcaps/mc14.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc15.jpg b/release/datafiles/matcaps/mc15.jpg
index c6ce02d59df..b10ea326a42 100644
--- a/release/datafiles/matcaps/mc15.jpg
+++ b/release/datafiles/matcaps/mc15.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc16.jpg b/release/datafiles/matcaps/mc16.jpg
index b10ea326a42..c6ce02d59df 100644
--- a/release/datafiles/matcaps/mc16.jpg
+++ b/release/datafiles/matcaps/mc16.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc17.jpg b/release/datafiles/matcaps/mc17.jpg
new file mode 100644
index 00000000000..14f15f70460
--- /dev/null
+++ b/release/datafiles/matcaps/mc17.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc18.jpg b/release/datafiles/matcaps/mc18.jpg
new file mode 100644
index 00000000000..db572856b07
--- /dev/null
+++ b/release/datafiles/matcaps/mc18.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc19.jpg b/release/datafiles/matcaps/mc19.jpg
new file mode 100644
index 00000000000..56d2efb1734
--- /dev/null
+++ b/release/datafiles/matcaps/mc19.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc20.jpg b/release/datafiles/matcaps/mc20.jpg
new file mode 100644
index 00000000000..002a0910dd9
--- /dev/null
+++ b/release/datafiles/matcaps/mc20.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc21.jpg b/release/datafiles/matcaps/mc21.jpg
new file mode 100644
index 00000000000..cb2fea573b8
--- /dev/null
+++ b/release/datafiles/matcaps/mc21.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc22.jpg b/release/datafiles/matcaps/mc22.jpg
new file mode 100644
index 00000000000..2fc71b98c5a
--- /dev/null
+++ b/release/datafiles/matcaps/mc22.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc23.jpg b/release/datafiles/matcaps/mc23.jpg
new file mode 100644
index 00000000000..3793c0fcaa5
--- /dev/null
+++ b/release/datafiles/matcaps/mc23.jpg
Binary files differ
diff --git a/release/datafiles/matcaps/mc24.jpg b/release/datafiles/matcaps/mc24.jpg
new file mode 100644
index 00000000000..2a9618d8fe1
--- /dev/null
+++ b/release/datafiles/matcaps/mc24.jpg
Binary files differ
diff --git a/release/datafiles/preview_cycles.blend b/release/datafiles/preview_cycles.blend
index 04055160f7e..11bf8bbb7b8 100644
--- a/release/datafiles/preview_cycles.blend
+++ b/release/datafiles/preview_cycles.blend
Binary files differ
diff --git a/release/datafiles/startup.blend b/release/datafiles/startup.blend
index dc684178f40..0a7e0668a97 100644
--- a/release/datafiles/startup.blend
+++ b/release/datafiles/startup.blend
Binary files differ
diff --git a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
index 5d2f90f0da7..f0adc700a45 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
@@ -358,27 +358,118 @@ def dump_py_messages_from_files(messages, check_ctxt, files):
"""
import ast
+ bpy_struct = bpy.types.ID.__base__
+
+ # Helper function
+ def extract_strings_ex(node, is_split=False):
+ """
+ Recursively get strings, needed in case we have "Blah" + "Blah", passed as an argument in that case it won't
+ evaluate to a string. However, break on some kind of stopper nodes, like e.g. Subscript.
+ """
+
+ if type(node) == ast.Str:
+ eval_str = ast.literal_eval(node)
+ if eval_str:
+ yield (is_split, eval_str, (node,))
+ else:
+ is_split = (type(node) in separate_nodes)
+ for nd in ast.iter_child_nodes(node):
+ if type(nd) not in stopper_nodes:
+ yield from extract_strings_ex(nd, is_split=is_split)
+
+ def _extract_string_merge(estr_ls, nds_ls):
+ return "".join(s for s in estr_ls if s is not None), tuple(n for n in nds_ls if n is not None)
+
+ def extract_strings(node):
+ estr_ls = []
+ nds_ls = []
+ for is_split, estr, nds in extract_strings_ex(node):
+ estr_ls.append(estr)
+ nds_ls.extend(nds)
+ ret = _extract_string_merge(estr_ls, nds_ls)
+ print(ret)
+ return ret
+
+ def extract_strings_split(node):
+ """
+ Returns a list args as returned by 'extract_strings()',
+ But split into groups based on separate_nodes, this way
+ expressions like ("A" if test else "B") wont be merged but
+ "A" + "B" will.
+ """
+ estr_ls = []
+ nds_ls = []
+ bag = []
+ for is_split, estr, nds in extract_strings_ex(node):
+ if is_split:
+ bag.append((estr_ls, nds_ls))
+ estr_ls = []
+ nds_ls = []
+
+ estr_ls.append(estr)
+ nds_ls.extend(nds)
+
+ bag.append((estr_ls, nds_ls))
+
+ return [_extract_string_merge(estr_ls, nds_ls) for estr_ls, nds_ls in bag]
+
+
+ def _ctxt_to_ctxt(node):
+ return extract_strings(node)[0]
+
+ def _op_to_ctxt(node):
+ opname, _ = extract_strings(node)
+ if not opname:
+ return ""
+ op = bpy.ops
+ for n in opname.split('.'):
+ op = getattr(op, n)
+ try:
+ return op.get_rna().bl_rna.translation_context
+ except Exception as e:
+ default_op_context = bpy.app.translations.contexts.operator_default
+ print("ERROR: ", str(e))
+ print(" Assuming default operator context '{}'".format(default_op_context))
+ return default_op_context
+
# -------------------------------------------------------------------------
# Gather function names
+ # so far only 'text' keywords, but we may want others translated later
+ translate_kw = ("text", )
+
# key: func_id
# val: [(arg_kw, arg_pos), (arg_kw, arg_pos), ...]
func_translate_args = {}
- # so far only 'text' keywords, but we may want others translated later
- translate_kw = ("text", )
+ # as we only have one translate keyword, no need for complex context extraction setup for now...
+ # And it's already enough complex like that!
+ # Note: order is important, first one wins!
+ context_kw = ((("text_ctxt",), _ctxt_to_ctxt),
+ (("operator",), _op_to_ctxt),
+ )
+ context_kw_set = set()
+ for c, _ in context_kw:
+ context_kw_set |= set(c)
+
+ # Like func_translate_args.
+ func_context_args = {}
# Break recursive nodes look up on some kind of nodes.
# E.g. we don’t want to get strings inside subscripts (blah["foo"])!
stopper_nodes = {ast.Subscript, }
+ # Consider strings separate: ("a" if test else "b")
+ separate_nodes = {ast.IfExp, }
# For now only consider functions from UILayout...
for func_id, func in bpy.types.UILayout.bl_rna.functions.items():
# check it has one or more arguments as defined in translate_kw
for (arg_pos, (arg_kw, arg)) in enumerate(func.parameters.items()):
- if ((arg_kw in translate_kw) and (arg.is_output is False) and (arg.type == 'STRING')):
+ if ((arg_kw in translate_kw) and (not arg.is_output) and (arg.type == 'STRING')):
func_translate_args.setdefault(func_id, []).append((arg_kw, arg_pos))
- # print(func_translate_args)
+ elif ((arg_kw in context_kw_set) and (not arg.is_output) and (arg.type == 'STRING')):
+ func_context_args.setdefault(func_id, []).append((arg_kw, arg_pos))
+ #print(func_context_args)
check_ctxt_py = None
if check_ctxt:
@@ -387,32 +478,6 @@ def dump_py_messages_from_files(messages, check_ctxt, files):
"not_capitalized": check_ctxt["not_capitalized"],
"end_point": check_ctxt["end_point"]}
- # Helper function
- def extract_strings(fp_rel, node):
- """
- Recursively get strings, needed in case we have "Blah" + "Blah", passed as an argument in that case it won't
- evaluate to a string. However, break on some kind of stopper nodes, like e.g. Subscript.
- """
- if type(node) == ast.Str:
- eval_str = ast.literal_eval(node)
- if eval_str:
- # Parse optional context included in string!
- # XXX Not yet!
- #if bpy.app.i18n.context_sep in eval_str:
- #key = eval_str.split(bpy.app.i18n.context_sep, 1)
- if 0:
- pass
- else:
- key = (CONTEXT_DEFAULT, eval_str)
- msgsrc = "{}:{}".format(fp_rel, node.lineno)
- check(check_ctxt_py, messages, key, msgsrc)
- messages.setdefault(key, []).append(msgsrc)
- return
-
- for nd in ast.iter_child_nodes(node):
- if type(nd) not in stopper_nodes:
- extract_strings(fp_rel, nd)
-
for fp in files:
with open(fp, 'r', encoding="utf8") as filedata:
root_node = ast.parse(filedata.read(), fp, 'exec')
@@ -432,16 +497,51 @@ def dump_py_messages_from_files(messages, check_ctxt, files):
if not hasattr(node.func, "attr"):
continue
- translate_args = func_translate_args.get(node.func.attr, ())
+ # First try to get i18n context.
+ context_args = func_context_args.get(node.func.attr, ())
+ context = ""
+ context_elements = {}
+ for arg_kw, arg_pos in context_args:
+ if arg_pos < len(node.args):
+ context_elements[arg_kw] = node.args[arg_pos]
+ else:
+ for kw in node.keywords:
+ if kw.arg == arg_kw:
+ context_elements[arg_kw] = kw.value
+ break
+ #print(context_elements)
+ for kws, proc in context_kw:
+ if set(kws) <= context_elements.keys():
+ args = tuple(context_elements[k] for k in kws)
+ #print("running ", proc, " with ", args)
+ ctxt = proc(*args)
+ if ctxt:
+ context = ctxt
+ break
+ translate_args = func_translate_args.get(node.func.attr, ())
+ #print(translate_args)
# do nothing if not found
for arg_kw, arg_pos in translate_args:
+ estr_lst = [(None, ())]
if arg_pos < len(node.args):
- extract_strings(fp_rel, node.args[arg_pos])
+ estr_lst = extract_strings_split(node.args[arg_pos])
+ #print(estr, nds)
else:
for kw in node.keywords:
if kw.arg == arg_kw:
- extract_strings(fp_rel, kw.value)
+ estr_lst = extract_strings_split(kw.value)
+ break
+ #print(estr, nds)
+ for estr, nds in estr_lst:
+ if estr:
+ key = (context, estr)
+ if nds:
+ msgsrc = ["{}:{}".format(fp_rel, sorted({nd.lineno for nd in nds})[0])]
+ else:
+ msgsrc = ["{}:???".format(fp_rel)]
+ check(check_ctxt_py, messages, key, msgsrc)
+ messages.setdefault(key, []).extend(msgsrc)
def dump_py_messages(messages, check_ctxt, addons):
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index eb5fd4cd0fa..d9e0de64622 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -306,6 +306,10 @@ PYTHON3_EXEC = "python3"
# The Blender executable!
# This is just an example, you’ll most likely have to edit it in your user_settings.py!
BLENDER_EXEC = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..", "blender"))
+# check for blender.bin
+if not os.path.exists(BLENDER_EXEC):
+ if os.path.exists(BLENDER_EXEC + ".bin"):
+ BLENDER_EXEC = BLENDER_EXEC + ".bin"
# The xgettext tool. You’ll likely have to edit it in your user_settings.py if you’re under Windows.
GETTEXT_XGETTEXT_EXECUTABLE = "xgettext"
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py
index 1c2e62b4c4e..d04e8bead7a 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -236,8 +236,9 @@ class I18nMessages:
import difflib
similar_pool = {}
if use_similar > 0.0:
- for key in self.msgs:
- similar_pool.setdefault(key[1], set()).add(key)
+ for key, msg in self.msgs.items():
+ if msg.msgstr: # No need to waste time with void translations!
+ similar_pool.setdefault(key[1], set()).add(key)
msgs = self._new_messages()
for (key, msg) in ref.msgs.items():
@@ -259,10 +260,11 @@ class I18nMessages:
if skey:
msgs[key].msgstr = self.msgs[skey].msgstr
msgs[key].is_fuzzy = True
- # Add back all "old" and already commented messages as commented ones, if required.
+ # Add back all "old" and already commented messages as commented ones, if required
+ # (and translation was not void!).
if keep_old_commented:
for key, msg in self.msgs.items():
- if key not in msgs:
+ if key not in msgs and msg.msgstr:
msgs[key] = msg
msgs[key].is_commented = True
# And finalize the update!
diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py
index 21bad5ec1e4..dfb6c46ef87 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -436,10 +436,7 @@ def path_reference_copy(copy_set, report=print):
pass
else:
dir_to = os.path.dirname(file_dst)
-
- if not os.path.isdir(dir_to):
- os.makedirs(dir_to)
-
+ os.makedirs(dir_to, exist_ok=True)
shutil.copy(file_src, file_dst)
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 9161cc20d2c..4398b1721f7 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -718,7 +718,9 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
files.sort()
for f, filepath in files:
- props = layout.operator(operator, text=bpy.path.display_name(f))
+ props = layout.operator(operator,
+ text=bpy.path.display_name(f),
+ translate=False)
for attr, value in props_default.items():
setattr(props, attr, value)
@@ -737,3 +739,21 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
self.path_menu(bpy.utils.preset_paths(self.preset_subdir),
self.preset_operator,
filter_ext=lambda ext: ext.lower() in {".py", ".xml"})
+
+class Region(StructRNA):
+ __slots__ = ()
+
+ def callback_add(self, cb, args, draw_mode):
+ """
+ Append a draw function to this region,
+ deprecated, instead use bpy.types.SpaceView3D.draw_handler_add
+ """
+ for area in self.id_data.areas:
+ for region in area.regions:
+ if region == self:
+ spacetype = type(area.spaces[0])
+ return spacetype.draw_handler_add(cb, args, self.type,
+ draw_mode)
+
+ return None
+
diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py
index 60dfa2b6344..55ff84fea96 100644
--- a/release/scripts/modules/console_python.py
+++ b/release/scripts/modules/console_python.py
@@ -334,8 +334,8 @@ def banner(context):
add_scrollback("Cursor: Left/Right Home/End", 'OUTPUT')
add_scrollback("Remove: Backspace/Delete", 'OUTPUT')
add_scrollback("Execute: Enter", 'OUTPUT')
- add_scrollback("Autocomplete: Ctrl+Space", 'OUTPUT')
- add_scrollback("Ctrl +/- Wheel: Zoom", 'OUTPUT')
+ add_scrollback("Autocomplete: Ctrl-Space", 'OUTPUT')
+ add_scrollback("Zoom: Ctrl +/-, Ctrl-Wheel", 'OUTPUT')
add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, "
"bpy.props, bpy.types, bpy.context, bpy.utils, "
"bgl, blf, mathutils",
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index 12438795539..5e8bccb815e 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -135,11 +135,11 @@ def draw(layout, context, context_member, property_type, use_edit=True):
else:
row = box.row()
- row.label(text=key)
+ row.label(text=key, translate=False)
# explicit exception for arrays
if to_dict or to_list:
- row.label(text=val_draw)
+ row.label(text=val_draw, translate=False)
else:
if key in rna_properties:
row.prop(rna_item, key, text="")
diff --git a/release/scripts/presets/interface_theme/back_to_black.xml b/release/scripts/presets/interface_theme/back_to_black.xml
index 18a3e539738..3af07c0cb4e 100644
--- a/release/scripts/presets/interface_theme/back_to_black.xml
+++ b/release/scripts/presets/interface_theme/back_to_black.xml
@@ -1,7 +1,9 @@
<bpy>
<Theme>
<user_interface>
- <ThemeUserInterface icon_file=""
+ <ThemeUserInterface menu_shadow_fac="0.5"
+ menu_shadow_width="12"
+ icon_file=""
icon_alpha="1"
axis_x="#dc0000"
axis_y="#00dc00"
@@ -275,17 +277,16 @@
camera_path="#5a5a5a"
skin_root="#000000">
<space>
- <ThemeSpaceGeneric back="#0f0f0f"
- title="#5d5d5d"
- text="#7d7d7d"
- text_hi="#ffffff"
- header="#000000"
- header_text="#979797"
- header_text_hi="#ffffff"
- button="#00000057"
- button_title="#c5c5c5"
- button_text="#c3c3c3"
- button_text_hi="#ffffff">
+ <ThemeSpaceGradient title="#5d5d5d"
+ text="#7d7d7d"
+ text_hi="#ffffff"
+ header="#000000"
+ header_text="#979797"
+ header_text_hi="#ffffff"
+ button="#00000057"
+ button_title="#c5c5c5"
+ button_text="#c3c3c3"
+ button_text_hi="#ffffff">
<panelcolors>
<ThemePanelColors header="#00000019"
back="#72727280"
@@ -293,7 +294,13 @@
show_back="FALSE">
</ThemePanelColors>
</panelcolors>
- </ThemeSpaceGeneric>
+ <gradients>
+ <ThemeGradientColors show_grad="FALSE"
+ gradient="#000000"
+ high_gradient="#393939">
+ </ThemeGradientColors>
+ </gradients>
+ </ThemeSpaceGradient>
</space>
</ThemeView3D>
</view_3d>
@@ -586,7 +593,10 @@
selected_text="#202020"
cursor="#ff0000"
syntax_builtin="#cf3d99"
+ syntax_symbols="#4c4c4c"
syntax_special="#969629"
+ syntax_preprocessor="#32008c"
+ syntax_reserved="#8c3c00"
syntax_comment="#249d60"
syntax_string="#cc3535"
syntax_numbers="#3c68ff">
@@ -651,6 +661,8 @@
operator_node="#0e3157"
group_node="#091a07"
frame_node="#9a9b9ba0"
+ matte_node="#977474"
+ distor_node="#749797"
noodle_curving="5">
<space>
<ThemeSpaceGeneric back="#000000"
diff --git a/release/scripts/presets/interface_theme/blender_24x.xml b/release/scripts/presets/interface_theme/blender_24x.xml
index 5ad7c502cc7..1c3df142c77 100644
--- a/release/scripts/presets/interface_theme/blender_24x.xml
+++ b/release/scripts/presets/interface_theme/blender_24x.xml
@@ -1,7 +1,9 @@
<bpy>
<Theme>
<user_interface>
- <ThemeUserInterface icon_file=""
+ <ThemeUserInterface menu_shadow_fac="0.5"
+ menu_shadow_width="12"
+ icon_file=""
icon_alpha="1"
axis_x="#dc0000"
axis_y="#00dc00"
@@ -275,17 +277,16 @@
camera_path="#000000"
skin_root="#000000">
<space>
- <ThemeSpaceGeneric back="#757575"
- title="#000000"
- text="#000000"
- text_hi="#ffffff"
- header="#b4b4b4"
- header_text="#000000"
- header_text_hi="#ffffff"
- button="#b4b4b457"
- button_title="#5a5a5a"
- button_text="#5a5a5a"
- button_text_hi="#ffffff">
+ <ThemeSpaceGradient title="#000000"
+ text="#000000"
+ text_hi="#ffffff"
+ header="#b4b4b4"
+ header_text="#000000"
+ header_text_hi="#ffffff"
+ button="#b4b4b457"
+ button_title="#5a5a5a"
+ button_text="#5a5a5a"
+ button_text_hi="#ffffff">
<panelcolors>
<ThemePanelColors header="#00000019"
back="#72727280"
@@ -293,7 +294,13 @@
show_back="FALSE">
</ThemePanelColors>
</panelcolors>
- </ThemeSpaceGeneric>
+ <gradients>
+ <ThemeGradientColors show_grad="FALSE"
+ gradient="#000000"
+ high_gradient="#393939">
+ </ThemeGradientColors>
+ </gradients>
+ </ThemeSpaceGradient>
</space>
</ThemeView3D>
</view_3d>
@@ -586,7 +593,10 @@
selected_text="#c67777"
cursor="#ff0000"
syntax_builtin="#800050"
+ syntax_symbols="#4c4c4c"
syntax_special="#5f5f00"
+ syntax_preprocessor="#32008c"
+ syntax_reserved="#8c3c00"
syntax_comment="#006432"
syntax_string="#640000"
syntax_numbers="#0000c8">
@@ -651,6 +661,8 @@
operator_node="#6c696f"
group_node="#69756e"
frame_node="#9a9b9ba0"
+ matte_node="#977474"
+ distor_node="#749797"
noodle_curving="5">
<space>
<ThemeSpaceGeneric back="#757575"
diff --git a/release/scripts/presets/interface_theme/elsyiun.xml b/release/scripts/presets/interface_theme/elsyiun.xml
index 0daadcd41d3..ef49cb31cbd 100644
--- a/release/scripts/presets/interface_theme/elsyiun.xml
+++ b/release/scripts/presets/interface_theme/elsyiun.xml
@@ -1,7 +1,9 @@
<bpy>
<Theme>
<user_interface>
- <ThemeUserInterface icon_file=""
+ <ThemeUserInterface menu_shadow_fac="0.5"
+ menu_shadow_width="12"
+ icon_file=""
icon_alpha="1"
axis_x="#dc0000"
axis_y="#00dc00"
@@ -275,17 +277,16 @@
camera_path="#000000"
skin_root="#000000">
<space>
- <ThemeSpaceGeneric back="#4b4b4b"
- title="#000000"
- text="#b8b8b8"
- text_hi="#e9e9e9"
- header="#3b3b3b"
- header_text="#b9b9b9"
- header_text_hi="#ffffff"
- button="#3b3b3b57"
- button_title="#979797"
- button_text="#979797"
- button_text_hi="#ffffff">
+ <ThemeSpaceGradient title="#000000"
+ text="#b8b8b8"
+ text_hi="#e9e9e9"
+ header="#3b3b3b"
+ header_text="#b9b9b9"
+ header_text_hi="#ffffff"
+ button="#3b3b3b57"
+ button_title="#979797"
+ button_text="#979797"
+ button_text_hi="#ffffff">
<panelcolors>
<ThemePanelColors header="#00000019"
back="#72727280"
@@ -293,7 +294,13 @@
show_back="FALSE">
</ThemePanelColors>
</panelcolors>
- </ThemeSpaceGeneric>
+ <gradients>
+ <ThemeGradientColors show_grad="FALSE"
+ gradient="#000000"
+ high_gradient="#393939">
+ </ThemeGradientColors>
+ </gradients>
+ </ThemeSpaceGradient>
</space>
</ThemeView3D>
</view_3d>
@@ -586,7 +593,10 @@
selected_text="#4e4e8f"
cursor="#8b8bff"
syntax_builtin="#808bed"
+ syntax_symbols="#4c4c4c"
syntax_special="#c080d0"
+ syntax_preprocessor="#409090"
+ syntax_reserved="#8c3c00"
syntax_comment="#cd8b00"
syntax_string="#ffcd8b"
syntax_numbers="#f0ad6d">
@@ -651,6 +661,8 @@
operator_node="#2c6f6f"
group_node="#1e7524"
frame_node="#9a9b9ba0"
+ matte_node="#977474"
+ distor_node="#749797"
noodle_curving="5">
<space>
<ThemeSpaceGeneric back="#3b3b3b"
diff --git a/release/scripts/presets/interface_theme/hexagon.xml b/release/scripts/presets/interface_theme/hexagon.xml
index 932bd52a4e9..0b6e626268f 100644
--- a/release/scripts/presets/interface_theme/hexagon.xml
+++ b/release/scripts/presets/interface_theme/hexagon.xml
@@ -1,7 +1,9 @@
<bpy>
<Theme>
<user_interface>
- <ThemeUserInterface icon_file=""
+ <ThemeUserInterface menu_shadow_fac="0.5"
+ menu_shadow_width="12"
+ icon_file=""
icon_alpha="1"
axis_x="#dc0000"
axis_y="#00dc00"
@@ -275,17 +277,16 @@
camera_path="#000000"
skin_root="#000000">
<space>
- <ThemeSpaceGeneric back="#7f818d"
- title="#000000"
- text="#000000"
- text_hi="#ffffff"
- header="#646875"
- header_text="#000000"
- header_text_hi="#ffffff"
- button="#6c717f57"
- button_title="#eaeaea"
- button_text="#d7d7d7"
- button_text_hi="#ffffff">
+ <ThemeSpaceGradient title="#000000"
+ text="#000000"
+ text_hi="#ffffff"
+ header="#646875"
+ header_text="#000000"
+ header_text_hi="#ffffff"
+ button="#6c717f57"
+ button_title="#eaeaea"
+ button_text="#d7d7d7"
+ button_text_hi="#ffffff">
<panelcolors>
<ThemePanelColors header="#00000019"
back="#72727280"
@@ -293,7 +294,13 @@
show_back="FALSE">
</ThemePanelColors>
</panelcolors>
- </ThemeSpaceGeneric>
+ <gradients>
+ <ThemeGradientColors show_grad="FALSE"
+ gradient="#000000"
+ high_gradient="#393939">
+ </ThemeGradientColors>
+ </gradients>
+ </ThemeSpaceGradient>
</space>
</ThemeView3D>
</view_3d>
@@ -586,7 +593,10 @@
selected_text="#c67777"
cursor="#ff0000"
syntax_builtin="#800050"
+ syntax_symbols="#4c4c4c"
syntax_special="#5f5f00"
+ syntax_preprocessor="#32008c"
+ syntax_reserved="#8c3c00"
syntax_comment="#006432"
syntax_string="#640000"
syntax_numbers="#0000c8">
@@ -651,6 +661,8 @@
operator_node="#6c697e"
group_node="#69756e"
frame_node="#9a9b9ba0"
+ matte_node="#977474"
+ distor_node="#749797"
noodle_curving="5">
<space>
<ThemeSpaceGeneric back="#7c7e88"
diff --git a/release/scripts/presets/interface_theme/ubuntu_ambiance.xml b/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
index 8be83cbde23..9786d609983 100644
--- a/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
+++ b/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
@@ -1,7 +1,9 @@
<bpy>
<Theme>
<user_interface>
- <ThemeUserInterface icon_file=""
+ <ThemeUserInterface menu_shadow_fac="0.5"
+ menu_shadow_width="12"
+ icon_file=""
icon_alpha="1"
axis_x="#dc0000"
axis_y="#00dc00"
@@ -275,17 +277,16 @@
camera_path="#7dbd00"
skin_root="#000000">
<space>
- <ThemeSpaceGeneric back="#131311"
- title="#9c9c9c"
- text="#9c9c9c"
- text_hi="#ffffff"
- header="#464541"
- header_text="#acacac"
- header_text_hi="#ffffff"
- button="#3c3b3757"
- button_title="#9c9c9c"
- button_text="#9c9c9c"
- button_text_hi="#ffffff">
+ <ThemeSpaceGradient title="#9c9c9c"
+ text="#9c9c9c"
+ text_hi="#ffffff"
+ header="#464541"
+ header_text="#acacac"
+ header_text_hi="#ffffff"
+ button="#3c3b3757"
+ button_title="#9c9c9c"
+ button_text="#9c9c9c"
+ button_text_hi="#ffffff">
<panelcolors>
<ThemePanelColors header="#00000000"
back="#72727280"
@@ -293,7 +294,13 @@
show_back="FALSE">
</ThemePanelColors>
</panelcolors>
- </ThemeSpaceGeneric>
+ <gradients>
+ <ThemeGradientColors show_grad="FALSE"
+ gradient="#000000"
+ high_gradient="#393939">
+ </ThemeGradientColors>
+ </gradients>
+ </ThemeSpaceGradient>
</space>
</ThemeView3D>
</view_3d>
@@ -586,7 +593,10 @@
selected_text="#641f44"
cursor="#f47421"
syntax_builtin="#d6ff01"
+ syntax_symbols="#4c4c4c"
syntax_special="#33a500"
+ syntax_preprocessor="#be00ff"
+ syntax_reserved="#8c3c00"
syntax_comment="#249d60"
syntax_string="#6e00ff"
syntax_numbers="#972144">
@@ -651,6 +661,8 @@
operator_node="#000000"
group_node="#19b6ee"
frame_node="#9a9b9ba0"
+ matte_node="#977474"
+ distor_node="#749797"
noodle_curving="5">
<space>
<ThemeSpaceGeneric back="#29001b"
diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py
index 94465fa6561..161349152d5 100644
--- a/release/scripts/startup/bl_operators/rigidbody.py
+++ b/release/scripts/startup/bl_operators/rigidbody.py
@@ -234,7 +234,9 @@ class ConnectRigidBodies(Operator):
loc = (obj_act.location + obj.location) / 2.0
bpy.ops.object.add(type='EMPTY', view_align=False, enter_editmode=False, location=loc)
bpy.ops.rigidbody.constraint_add()
- con = context.active_object.rigid_body_constraint
+ con_obj = context.active_object
+ con_obj.empty_draw_type = 'ARROWS'
+ con = con_obj.rigid_body_constraint
con.type = self.con_type
con.object1 = obj_act
con.object2 = obj
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 902cfdd418b..6ac61a9f5e7 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1740,8 +1740,7 @@ class WM_OT_addon_install(Operator):
return {'CANCELLED'}
# create dir is if missing.
- if not os.path.exists(path_addons):
- os.makedirs(path_addons)
+ os.makedirs(path_addons, exist_ok=True)
# Check if we are installing from a target path,
# doing so causes 2+ addons of same name or when the same from/to
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index dcef5aaa096..86a48999663 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -60,12 +60,12 @@ class MESH_UL_vgroups(UIList):
# assert(isinstance(item, bpy.types.VertexGroup)
vgroup = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
- layout.label(vgroup.name, icon_value=icon)
+ layout.label(text=vgroup.name, translate=False, icon_value=icon)
icon = 'LOCKED' if vgroup.lock_weight else 'UNLOCKED'
layout.prop(vgroup, "lock_weight", text="", icon=icon, emboss=False)
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
- layout.label("", icon_value=icon)
+ layout.label(text="", icon_value=icon)
class MESH_UL_shape_keys(UIList):
@@ -76,30 +76,30 @@ class MESH_UL_shape_keys(UIList):
key_block = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
split = layout.split(0.66, False)
- split.label(item.name, icon_value=icon)
+ split.label(text=item.name, translate=False, icon_value=icon)
row = split.row(True)
if key_block.mute or (obj.mode == 'EDIT' and not (obj.use_shape_key_edit_mode and obj.type == 'MESH')):
row.active = False
if not item.relative_key or index > 0:
row.prop(key_block, "value", text="", emboss=False)
else:
- row.label("")
+ row.label(text="")
row.prop(key_block, "mute", text="", emboss=False)
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
- layout.label("", icon_value=icon)
+ layout.label(text="", icon_value=icon)
class MESH_UL_uvmaps_vcols(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
# assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, bpy.types.MeshLoopColorLayer))
if self.layout_type in {'DEFAULT', 'COMPACT'}:
- layout.label(item.name, icon_value=icon)
+ layout.label(text=item.name, translate=False, icon_value=icon)
icon = 'RESTRICT_RENDER_OFF' if item.active_render else 'RESTRICT_RENDER_ON'
layout.prop(item, "active_render", text="", icon=icon, emboss=False)
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
- layout.label("", icon_value=icon)
+ layout.label(text="", icon_value=icon)
class MeshButtonsPanel():
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 99f82b1e8a3..679b33292e5 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -265,7 +265,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.prop(md, "angle_limit")
layout.prop(md, "use_dissolve_boundaries")
- layout.label(text="Face Count" + ": %d" % md.face_count)
+ pgettext = bpy.app.translations.pgettext
+ layout.label(text=pgettext("Face Count: %d") % md.face_count, translate=False)
def DISPLACE(self, layout, ob, md):
has_texture = (md.texture is not None)
diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py
index 3bdb6f32076..4ceaffbaf8d 100644
--- a/release/scripts/startup/bl_ui/properties_mask_common.py
+++ b/release/scripts/startup/bl_ui/properties_mask_common.py
@@ -32,7 +32,7 @@ class MASK_UL_layers(UIList):
mask = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
split = layout.split()
- split.label(mask.name, icon_value=icon)
+ split.label(text=mask.name, translate=False, icon_value=icon)
row = split.row(align=True)
row.prop(mask, "alpha", text="", emboss=False)
row.prop(mask, "hide", text="", emboss=False)
@@ -40,7 +40,7 @@ class MASK_UL_layers(UIList):
row.prop(mask, "hide_render", text="", emboss=False)
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
- layout.label("", icon_value=icon)
+ layout.label(text="", icon_value=icon)
class MASK_PT_mask:
diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py
index 7e18cf89080..9b7cfe89a08 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -76,16 +76,19 @@ class MATERIAL_UL_matslots(UIList):
slot = item
ma = slot.material
if self.layout_type in {'DEFAULT', 'COMPACT'}:
- layout.label(ma.name if ma else "", icon_value=icon)
+ layout.label(text=ma.name if ma else "", translate=False, icon_value=icon)
if ma and not context.scene.render.use_shading_nodes:
manode = ma.active_node_material
if manode:
- layout.label("Node %s" % manode.name, icon_value=layout.icon(manode))
+ pgettext = bpy.app.translations.pgettext
+ layout.label(text=pgettext("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode))
elif ma.use_nodes:
- layout.label("Node <none>")
+ layout.label(text="Node <none>")
+ else:
+ layout.label(text="")
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
- layout.label("", icon_value=icon)
+ layout.label(text="", icon_value=icon)
class MaterialButtonsPanel():
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index 90dcf594137..aef860e774b 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -148,7 +148,8 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
#row.label(text="Render")
if part.is_fluid:
- layout.label(text="%d fluid particles for this frame" % part.count)
+ pgettext = bpy.app.translations.pgettext
+ layout.label(text=pgettext("%d fluid particles for this frame") % part.count, translate=False)
return
row = col.row()
diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
index efc675ffe83..7ee63ee7a2f 100644
--- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
+++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
@@ -33,7 +33,7 @@ class PHYSICS_UL_dynapaint_surfaces(UIList):
if self.layout_type in {'DEFAULT', 'COMPACT'}:
row = layout.row(align=True)
row.label(text="", icon_value=icon)
- row.label(text=surf.name, icon_value=sticon)
+ row.label(text=surf.name, translate=False, icon_value=sticon)
row = layout.row(align=True)
if surf.use_color_preview:
row.prop(surf, "show_preview", text="", emboss=False,
diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py
index 08278c02693..c03b5323105 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fluid.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py
@@ -64,7 +64,9 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
if fluid.type == 'DOMAIN':
# odd formatting here so translation script can extract string
- layout.operator("fluid.bake", text="Bake (Req. Memory:" + " %s)" % fluid.memory_estimate, icon='MOD_FLUIDSIM')
+ pgettext = bpy.app.translations.pgettext
+ layout.operator("fluid.bake", text=pgettext("Bake (Req. Memory: %s)") % fluid.memory_estimate,
+ translate=False, icon='MOD_FLUIDSIM')
split = layout.split()
col = split.column()
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index cb5a473dba1..969cb8d4cad 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -43,7 +43,6 @@ class RENDER_MT_framerate_presets(Menu):
draw = Menu.draw_preset
-
class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index e0f4fd1f75b..b9b57923420 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -32,10 +32,10 @@ class SCENE_UL_keying_set_paths(UIList):
kspath = item
icon = layout.enum_item_icon(kspath, "id_type", kspath.id_type)
if self.layout_type in {'DEFAULT', 'COMPACT'}:
- layout.label(kspath.data_path, icon_value=icon)
+ layout.label(text=kspath.data_path, translate=False, icon_value=icon)
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
- layout.label("", icon_value=icon)
+ layout.label(text="", icon_value=icon)
class SceneButtonsPanel():
diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py
index 9e8fd0470cf..dd30627abff 100644
--- a/release/scripts/startup/bl_ui/properties_texture.py
+++ b/release/scripts/startup/bl_ui/properties_texture.py
@@ -63,12 +63,12 @@ class TEXTURE_UL_texslots(UIList):
slot = item
tex = slot.texture if slot else None
if self.layout_type in {'DEFAULT', 'COMPACT'}:
- layout.label(tex.name if tex else "", icon_value=icon)
+ layout.label(text=tex.name if tex else "", translate=False, icon_value=icon)
if tex and isinstance(item, bpy.types.MaterialTextureSlot):
layout.prop(ma, "use_textures", text="", index=index)
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
- layout.label("", icon_value=icon)
+ layout.label(text="", icon_value=icon)
from bl_ui.properties_material import active_node_mat
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index db71bbe2390..84f26acb4cc 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -28,12 +28,10 @@ class CLIP_UL_tracking_objects(UIList):
# assert(isinstance(item, bpy.types.MovieTrackingObject)
tobj = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
- layout.label(tobj.name, icon='CAMERA_DATA'
- if tobj.is_camera else 'OBJECT_DATA')
+ layout.label(text=tobj.name, translate=False, icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA')
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
- layout.label("", icon='CAMERA_DATA'
- if tobj.is_camera else 'OBJECT_DATA')
+ layout.label(text="", icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA')
class CLIP_HT_header(Header):
@@ -909,10 +907,11 @@ class CLIP_MT_view(Menu):
ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
+ text = bpy.app.translations.pgettext("Zoom %d:%d")
for a, b in ratios:
- text = "Zoom %d:%d" % (a, b)
layout.operator("clip.view_zoom_ratio",
- text=text).ratio = a / b
+ text=text % (a, b),
+ translate=False).ratio = a / b
else:
if sc.view == 'GRAPH':
layout.operator_context = 'INVOKE_REGION_PREVIEW'
diff --git a/release/scripts/startup/bl_ui/space_console.py b/release/scripts/startup/bl_ui/space_console.py
index 23d16c14f2d..70e0fb4fcf2 100644
--- a/release/scripts/startup/bl_ui/space_console.py
+++ b/release/scripts/startup/bl_ui/space_console.py
@@ -80,7 +80,9 @@ class CONSOLE_MT_language(Menu):
languages.sort()
for language in languages:
- layout.operator("console.language", text=language[0].upper() + language[1:]).language = language
+ layout.operator("console.language",
+ text=language.title(),
+ translate=False).language = language
def add_scrollback(text, text_type):
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 179c41ace08..6d08663006f 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -70,8 +70,10 @@ class IMAGE_MT_view(Menu):
ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
+ pgettext = bpy.app.translations.pgettext
for a, b in ratios:
- layout.operator("image.view_zoom_ratio", text="Zoom" + " %d:%d" % (a, b)).ratio = a / b
+ layout.operator("image.view_zoom_ratio", text=pgettext("Zoom %d:%d") % (a, b),
+ translate=False).ratio = a / b
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 64ad5656bcd..b8f44a621a9 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -420,15 +420,19 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
sub.prop(strip, "frame_start")
sub.prop(strip, "frame_final_duration")
+ pgettext = bpy.app.translations.pgettext
col = layout.column(align=True)
row = col.row()
- row.label(text="Final Length" + ": %s" % bpy.utils.smpte_from_frame(strip.frame_final_duration))
+ row.label(text=pgettext("Final Length: %s") % bpy.utils.smpte_from_frame(strip.frame_final_duration),
+ translate=False)
row = col.row()
row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
- row.label(text="Playhead" + ": %d" % (frame_current - strip.frame_start))
+ row.label(text=pgettext("Playhead: %d") % (frame_current - strip.frame_start), translate=False)
- col.label(text="Frame Offset" + " %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
- col.label(text="Frame Still" + " %d:%d" % (strip.frame_still_start, strip.frame_still_end))
+ col.label(text=pgettext("Frame Offset %d:%d") % (strip.frame_offset_start, strip.frame_offset_end),
+ translate=False)
+ col.label(text=pgettext("Frame Still %d:%d") % (strip.frame_still_start, strip.frame_still_end),
+ translate=False)
elem = False
@@ -438,7 +442,7 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
elem = strip.elements[0]
if elem and elem.orig_width > 0 and elem.orig_height > 0:
- col.label(text="Original Dimension" + ": %dx%d" % (elem.orig_width, elem.orig_height))
+ col.label(text=pgettext("Original Dimension: %dx%d") % (elem.orig_width, elem.orig_height), translate=False)
else:
col.label(text="Original Dimension: None")
@@ -715,7 +719,8 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
if scene:
sta = scene.frame_start
end = scene.frame_end
- layout.label(text="Original frame range" + ": %d-%d (%d)" % (sta, end, end - sta + 1))
+ pgettext = bpy.app.translations.pgettext
+ layout.label(text=pgettext("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
@@ -744,7 +749,8 @@ class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
if mask:
sta = mask.frame_start
end = mask.frame_end
- layout.label(text="Original frame range" + ": %d-%d (%d)" % (sta, end, end - sta + 1))
+ pgettext = bpy.app.translations.pgettext
+ layout.label(text=pgettext("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py
index 65ec945c7da..b32172e25e0 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -71,12 +71,13 @@ class TEXT_HT_header(Header):
row = layout.row()
if text.filepath:
+ pgettext = bpy.app.translations.pgettext
if text.is_dirty:
- row.label(text="File" + ": *%r " %
- text.filepath + "(unsaved)")
+ row.label(text=pgettext("File: *%r (unsaved)") %
+ text.filepath, translate=False)
else:
- row.label(text="File" + ": %r" %
- text.filepath)
+ row.label(text=pgettext("File: %r") %
+ text.filepath, translate=False)
else:
row.label(text="Text: External"
if text.library
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index dad729077e0..5bb83e7f429 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -19,7 +19,6 @@
# <pep8 compliant>
import bpy
from bpy.types import Header, Menu, Panel
-import os
def ui_style_items(col, context):
@@ -183,6 +182,7 @@ class USERPREF_PT_interface(Panel):
return (userpref.active_section == 'INTERFACE')
def draw(self, context):
+ import sys
layout = self.layout
userpref = context.user_preferences
@@ -268,7 +268,7 @@ class USERPREF_PT_interface(Panel):
col.prop(view, "show_splash")
- if os.name == "nt":
+ if sys.platform[:3] == "win":
col.prop(view, "use_quit_dialog")
@@ -403,6 +403,7 @@ class USERPREF_PT_system(Panel):
return (userpref.active_section == 'SYSTEM')
def draw(self, context):
+ import sys
layout = self.layout
userpref = context.user_preferences
@@ -466,6 +467,9 @@ class USERPREF_PT_system(Panel):
col.label(text="Window Draw Method:")
col.prop(system, "window_draw_method", text="")
col.prop(system, "multi_sample", text="")
+ if sys.platform == "linux" and system.multi_sample != 'NONE':
+ col.label(text="Might fail for Mesh editing selection!")
+ col.separator()
col.prop(system, "use_region_overlap")
col.label(text="Text Draw Options:")
col.prop(system, "use_text_antialiasing")
@@ -774,9 +778,10 @@ class USERPREF_PT_theme(Panel):
layout.separator()
elif theme.theme_area == 'BONE_COLOR_SETS':
col = split.column()
+ pgettext = bpy.app.translations.pgettext
for i, ui in enumerate(theme.bone_color_sets):
- col.label(text="Color Set" + " %d:" % (i + 1)) # i starts from 0
+ col.label(text=pgettext("Color Set %d:") % (i + 1), translate=False) # i starts from 0
row = col.row()
@@ -963,6 +968,8 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel):
return (userpref.active_section == 'INPUT')
def draw_input_prefs(self, inputs, layout):
+ import sys
+
# General settings
row = layout.row()
col = row.column()
@@ -1015,6 +1022,11 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel):
sub.prop(inputs, "invert_zoom_wheel", text="Invert Wheel Zoom Direction")
#sub.prop(view, "wheel_scroll_lines", text="Scroll Lines")
+ if sys.platform == "darwin":
+ sub = col.column()
+ sub.label(text="Trackpad:")
+ sub.prop(inputs, "use_trackpad_natural")
+
col.separator()
sub = col.column()
sub.label(text="NDOF Device:")
@@ -1077,6 +1089,8 @@ class USERPREF_PT_addons(Panel):
@staticmethod
def is_user_addon(mod, user_addon_paths):
+ import os
+
if not user_addon_paths:
for path in (bpy.utils.script_path_user(),
bpy.utils.script_path_pref()):
@@ -1099,6 +1113,7 @@ class USERPREF_PT_addons(Panel):
box.label(l)
def draw(self, context):
+ import os
import addon_utils
layout = self.layout
@@ -1203,15 +1218,15 @@ class USERPREF_PT_addons(Panel):
if mod:
split = colsub.row().split(percentage=0.15)
split.label(text="File:")
- split.label(text=mod.__file__)
+ split.label(text=mod.__file__, translate=False)
if info["author"]:
split = colsub.row().split(percentage=0.15)
split.label(text="Author:")
- split.label(text=info["author"])
+ split.label(text=info["author"], translate=False)
if info["version"]:
split = colsub.row().split(percentage=0.15)
split.label(text="Version:")
- split.label(text='.'.join(str(x) for x in info["version"]))
+ split.label(text='.'.join(str(x) for x in info["version"]), translate=False)
if info["warning"]:
split = colsub.row().split(percentage=0.15)
split.label(text="Warning:")
@@ -1268,7 +1283,7 @@ class USERPREF_PT_addons(Panel):
colsub = box.column()
row = colsub.row()
- row.label(text=module_name, icon='ERROR')
+ row.label(text=module_name, translate=False, icon='ERROR')
if is_enabled:
row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py
index 81d67aa662c..db78adcb576 100644
--- a/release/scripts/startup/bl_ui/space_userpref_keymap.py
+++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py
@@ -97,7 +97,8 @@ class InputKeyMapPanel:
subcol = self.indented_layout(col, level + 1)
subrow = subcol.row()
subrow.prop(km, "show_expanded_items", text="", emboss=False)
- subrow.label(text="%s " % km.name + "(Global)")
+ pgettext = bpy.app.translations.pgettext
+ subrow.label(text=pgettext("%s (Global)") % km.name, translate=False)
else:
km.show_expanded_items = True
@@ -172,17 +173,17 @@ class InputKeyMapPanel:
if kmi.show_expanded:
box = col.box()
- if map_type not in {'TEXTINPUT', 'TIMER'}:
- split = box.split(percentage=0.4)
- sub = split.row()
+ split = box.split(percentage=0.4)
+ sub = split.row()
- if km.is_modal:
- sub.prop(kmi, "propvalue", text="")
- else:
- # One day...
- #~ sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="")
- sub.prop(kmi, "idname", text="")
+ if km.is_modal:
+ sub.prop(kmi, "propvalue", text="")
+ else:
+ # One day...
+ #~ sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="")
+ sub.prop(kmi, "idname", text="")
+ if map_type not in {'TEXTINPUT', 'TIMER'}:
sub = split.column()
subrow = sub.row(align=True)
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 9753a368f54..0e35a154f86 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -1682,7 +1682,6 @@ class VIEW3D_MT_edit_mesh(Menu):
layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
layout.operator("mesh.duplicate_move")
layout.menu("VIEW3D_MT_edit_mesh_delete")
- layout.menu("VIEW3D_MT_edit_mesh_dissolve")
layout.separator()
@@ -1957,21 +1956,12 @@ class VIEW3D_MT_edit_mesh_delete(Menu):
layout.separator()
layout.operator("mesh.dissolve")
- layout.operator("mesh.edge_collapse")
- layout.operator("mesh.delete_edgeloop", text="Edge Loop")
-
-
-class VIEW3D_MT_edit_mesh_dissolve(Menu):
- bl_label = "Dissolve"
-
- def draw(self, context):
- layout = self.layout
-
- layout.operator("mesh.dissolve")
+ layout.operator("mesh.dissolve_limited")
layout.separator()
- layout.operator("mesh.dissolve_limited")
+ layout.operator("mesh.edge_collapse")
+ layout.operator("mesh.delete_edgeloop", text="Edge Loop")
class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 0faac7cce3f..2fb420dabea 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1142,14 +1142,14 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel):
row = split.row()
row.active = (ipaint.use_stencil_layer)
stencil_text = mesh.uv_texture_stencil.name if mesh.uv_texture_stencil else ""
- row.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text)
+ row.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text, translate=False)
row.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
col = layout.column()
col.active = (settings.brush.image_tool == 'CLONE')
col.prop(ipaint, "use_clone_layer", text="Clone from UV map")
clone_text = mesh.uv_texture_clone.name if mesh.uv_texture_clone else ""
- col.menu("VIEW3D_MT_tools_projectpaint_clone", text=clone_text)
+ col.menu("VIEW3D_MT_tools_projectpaint_clone", text=clone_text, translate=False)
layout.prop(ipaint, "seam_bleed")
@@ -1188,7 +1188,7 @@ class VIEW3D_MT_tools_projectpaint_clone(Menu):
layout = self.layout
for i, tex in enumerate(context.active_object.data.uv_textures):
- props = layout.operator("wm.context_set_int", text=tex.name)
+ props = layout.operator("wm.context_set_int", text=tex.name, translate=False)
props.data_path = "active_object.data.uv_texture_clone_index"
props.value = i
@@ -1199,7 +1199,7 @@ class VIEW3D_MT_tools_projectpaint_stencil(Menu):
def draw(self, context):
layout = self.layout
for i, tex in enumerate(context.active_object.data.uv_textures):
- props = layout.operator("wm.context_set_int", text=tex.name)
+ props = layout.operator("wm.context_set_int", text=tex.name, translate=False)
props.data_path = "active_object.data.uv_texture_stencil_index"
props.value = i
diff --git a/release/scripts/templates_py/ui_list.py b/release/scripts/templates_py/ui_list.py
index 18861f7d801..f71b342c854 100644
--- a/release/scripts/templates_py/ui_list.py
+++ b/release/scripts/templates_py/ui_list.py
@@ -20,7 +20,8 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList):
# You should always start your row layout by a label (icon + text), this will also make the row easily
# selectable in the list!
# We use icon_value of label, as our given icon is an integer value, not an enum ID.
- layout.label(ma.name if ma else "", icon_value=icon)
+ # Note "data" names should never be translated!
+ layout.label(text=ma.name if ma else "", translate=False, icon_value=icon)
# And now we can add other UI stuff...
# Here, we add nodes info if this material uses (old!) shading nodes.
if ma and not context.scene.render.use_shading_nodes:
@@ -28,15 +29,15 @@ class MATERIAL_UL_matslots_example(bpy.types.UIList):
if manode:
# The static method UILayout.icon returns the integer value of the icon ID "computed" for the given
# RNA object.
- layout.label("Node %s" % manode.name, icon_value=layout.icon(manode))
+ layout.label(text="Node %s" % manode.name, translate=False, icon_value=layout.icon(manode))
elif ma.use_nodes:
- layout.label("Node <none>")
+ layout.label(text="Node <none>", translate=False)
else:
- layout.label("")
+ layout.label(text="")
# 'GRID' layout type should be as compact as possible (typically a single icon!).
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
- layout.label("", icon_value=icon)
+ layout.label(text="", icon_value=icon)
# And now we can use this list everywhere in Blender. Here is a small example panel.
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index ddfc7c06fb6..14d5a2cca0c 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -107,12 +107,7 @@ add_subdirectory(modifiers)
add_subdirectory(makesdna)
add_subdirectory(makesrna)
-if(WITH_BULLET)
- add_subdirectory(rigidbody)
-endif()
-
if(WITH_COMPOSITOR)
- add_subdirectory(opencl) # later on this may be used more generally
add_subdirectory(compositor)
endif()
diff --git a/source/blender/SConscript b/source/blender/SConscript
index e103aaf8bef..a4041212c89 100644
--- a/source/blender/SConscript
+++ b/source/blender/SConscript
@@ -61,15 +61,10 @@ if env['WITH_BF_OPENEXR']:
if env['WITH_BF_QUICKTIME']:
SConscript (['quicktime/SConscript'])
-if env['WITH_BF_BULLET']:
- SConscript (['rigidbody/SConscript'])
-
if env['WITH_BF_COLLADA']:
SConscript (['collada/SConscript'])
if env['WITH_BF_COMPOSITOR']:
- SConscript (['compositor/SConscript',
- 'opencl/SConscript'])
-
+ SConscript (['compositor/SConscript'])
if env['WITH_BF_FREESTYLE']:
SConscript (['freestyle/SConscript'])
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index 4f54f93a7fc..12c9f6b449f 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -44,6 +44,7 @@ struct FCurve;
struct bPose;
struct bItasc;
struct bPoseChannel;
+struct Main;
struct Object;
struct Scene;
struct ID;
@@ -56,7 +57,7 @@ extern "C" {
/* Action Lib Stuff ----------------- */
/* Allocate a new bAction with the given name */
-struct bAction *add_empty_action(const char name[]);
+struct bAction *add_empty_action(struct Main *bmain, const char name[]);
/* Allocate a copy of the given Action and all its data */
struct bAction *BKE_action_copy(struct bAction *src);
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 765a00b8d4b..fb9e9f4e691 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -73,7 +73,7 @@ typedef struct PoseTree {
extern "C" {
#endif
-struct bArmature *BKE_armature_add(const char *name);
+struct bArmature *BKE_armature_add(struct Main *bmain, const char *name);
struct bArmature *BKE_armature_from_object(struct Object *ob);
void BKE_armature_bonelist_free(struct ListBase *lb);
void BKE_armature_free(struct bArmature *arm);
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 2548d95c383..871e9918f6f 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 265
-#define BLENDER_SUBVERSION 9
+#define BLENDER_SUBVERSION 10
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 262
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index 91f0525d4f3..cfae15961d7 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -37,12 +37,13 @@ struct ID;
struct Brush;
struct ImBuf;
struct ImagePool;
+struct Main;
struct Scene;
struct wmOperator;
// enum CurveMappingPreset;
/* datablock functions */
-struct Brush *BKE_brush_add(const char *name);
+struct Brush *BKE_brush_add(struct Main *bmain, const char *name);
struct Brush *BKE_brush_copy(struct Brush *brush);
void BKE_brush_make_local(struct Brush *brush);
void BKE_brush_free(struct Brush *brush);
diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h
index 2a27934c038..057cd79b9e4 100644
--- a/source/blender/blenkernel/BKE_camera.h
+++ b/source/blender/blenkernel/BKE_camera.h
@@ -39,6 +39,7 @@ extern "C" {
#include "DNA_vec_types.h"
struct Camera;
+struct Main;
struct Object;
struct RegionView3D;
struct RenderData;
@@ -48,7 +49,7 @@ struct View3D;
/* Camera Datablock */
-void *BKE_camera_add(const char *name);
+void *BKE_camera_add(struct Main *bmain, const char *name);
struct Camera *BKE_camera_copy(struct Camera *cam);
void BKE_camera_make_local(struct Camera *cam);
void BKE_camera_free(struct Camera *ca);
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 536bbecb79b..358f884f74e 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -39,6 +39,7 @@ struct Curve;
struct EditNurb;
struct ListBase;
struct ListBase;
+struct Main;
struct Nurb;
struct Object;
struct Scene;
@@ -57,7 +58,7 @@ struct Scene;
void BKE_curve_unlink(struct Curve *cu);
void BKE_curve_free(struct Curve *cu);
void BKE_curve_editfont_free(struct Curve *cu);
-struct Curve *BKE_curve_add(const char *name, int type);
+struct Curve *BKE_curve_add(struct Main *bmain, const char *name, int type);
struct Curve *BKE_curve_copy(struct Curve *cu);
void BKE_curve_make_local(struct Curve *cu);
short BKE_curve_type_get(struct Curve *cu);
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index bf2f1262eee..6ce7b952b97 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -41,6 +41,7 @@ struct FModifier;
struct ChannelDriver;
struct DriverVar;
struct DriverTarget;
+struct FCM_EnvelopeData;
struct bAction;
struct BezTriple;
@@ -181,6 +182,8 @@ void evaluate_value_fmodifiers(ListBase *modifiers, struct FCurve *fcu, float *c
void fcurve_bake_modifiers(struct FCurve *fcu, int start, int end);
+int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array, float frame, int arraylen, short *exists);
+
/* ************** F-Curves API ******************** */
/* -------- Data Managemnt -------- */
diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h
index 3e9803a908b..8c36a73a088 100644
--- a/source/blender/blenkernel/BKE_group.h
+++ b/source/blender/blenkernel/BKE_group.h
@@ -36,13 +36,14 @@
struct Base;
struct Group;
struct GroupObject;
+struct Main;
struct Object;
struct bAction;
struct Scene;
void BKE_group_free(struct Group *group);
void BKE_group_unlink(struct Group *group);
-struct Group *add_group(const char *name);
+struct Group *add_group(struct Main *bmain, const char *name);
struct Group *BKE_group_copy(struct Group *group);
int add_to_group(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
int rem_from_group(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index bfee5e820c3..d12b048bc96 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -153,12 +153,12 @@ struct ImBuf *BKE_image_pool_acquire_ibuf(struct Image *ima, struct ImageUser *i
void BKE_image_pool_release_ibuf(struct Image *ima, struct ImBuf *ibuf, struct ImagePool *pool);
/* returns a new image or NULL if it can't load */
-struct Image *BKE_image_load(const char *filepath);
+struct Image *BKE_image_load(struct Main *bmain, const char *filepath);
/* returns existing Image when filename/type is same (frame optional) */
struct Image *BKE_image_load_exists(const char *filepath);
/* adds image, adds ibuf, generates color or pattern */
-struct Image *BKE_image_add_generated(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4]);
+struct Image *BKE_image_add_generated(struct Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4]);
/* adds image from imbuf, owns imbuf */
struct Image *BKE_image_add_from_imbuf(struct ImBuf *ibuf);
@@ -205,7 +205,7 @@ void BKE_image_memorypack(struct Image *ima);
void BKE_image_print_memlist(void);
/* empty image block, of similar type and filename */
-struct Image *BKE_image_copy(struct Image *ima);
+struct Image *BKE_image_copy(struct Main *bmain, struct Image *ima);
/* merge source into dest, and free source */
void BKE_image_merge(struct Image *dest, struct Image *source);
diff --git a/source/blender/blenkernel/BKE_lamp.h b/source/blender/blenkernel/BKE_lamp.h
index 244decf9d52..205c7c7d1e6 100644
--- a/source/blender/blenkernel/BKE_lamp.h
+++ b/source/blender/blenkernel/BKE_lamp.h
@@ -37,9 +37,10 @@ extern "C" {
#endif
struct Lamp;
+struct Main;
struct Scene;
-struct Lamp *BKE_lamp_add(const char *name) WARN_UNUSED;
+struct Lamp *BKE_lamp_add(struct Main *bmain, const char *name) WARN_UNUSED;
struct Lamp *BKE_lamp_copy(struct Lamp *la) WARN_UNUSED;
struct Lamp *localize_lamp(struct Lamp *la) WARN_UNUSED;
void BKE_lamp_make_local(struct Lamp *la);
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index a0bebd752b5..b195af18a8e 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -35,6 +35,7 @@
*/
struct Lattice;
+struct Main;
struct Object;
struct Scene;
struct DerivedMesh;
@@ -42,7 +43,7 @@ struct BPoint;
struct MDeformVert;
void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
-struct Lattice *BKE_lattice_add(const char *name);
+struct Lattice *BKE_lattice_add(struct Main *bmain, const char *name);
struct Lattice *BKE_lattice_copy(struct Lattice *lt);
void BKE_lattice_free(struct Lattice *lt);
void BKE_lattice_make_local(struct Lattice *lt);
@@ -75,5 +76,10 @@ void BKE_lattice_modifiers_calc(struct Scene *scene, struct Object *ob);
struct MDeformVert *BKE_lattice_deform_verts_get(struct Object *lattice);
+void BKE_lattice_minmax(struct Lattice *lt, float min[3], float max[3]);
+void BKE_lattice_center_median(struct Lattice *lt, float cent[3]);
+void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3]);
+void BKE_lattice_translate(struct Lattice *lt, float offset[3], int do_keys);
+
#endif
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index b9bb67fa509..5aa82be0541 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -51,6 +51,12 @@ __attribute__((warn_unused_result))
__attribute__((nonnull))
#endif
;
+void *BKE_libblock_copy_ex(struct Main *bmain, struct ID *id)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+__attribute__((nonnull))
+#endif
+;
void *BKE_libblock_copy(struct ID *id)
#ifdef __GNUC__
__attribute__((warn_unused_result))
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index cc15ceecbac..b40ad4814f0 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -98,7 +98,7 @@ void BKE_mask_point_select_set(struct MaskSplinePoint *point, const short do_sel
void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, const short do_select);
/* general */
-struct Mask *BKE_mask_new(const char *name);
+struct Mask *BKE_mask_new(struct Main *bmain, const char *name);
struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
struct Mask *BKE_mask_copy(struct Mask *mask);
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index dd1b1a7752b..350eaf23f6f 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -52,7 +52,7 @@ void BKE_material_free_ex(struct Material *ma, int do_id_user);
void test_object_materials(struct ID *id);
void resize_object_material(struct Object *ob, const short totcol);
void init_material(struct Material *ma);
-struct Material *BKE_material_add(const char *name);
+struct Material *BKE_material_add(struct Main *bmain, const char *name);
struct Material *BKE_material_copy(struct Material *ma);
struct Material *localize_material(struct Material *ma);
struct Material *give_node_material(struct Material *ma); /* returns node material or self */
diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h
index 7a0eea1b009..662bfab10a1 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -32,6 +32,7 @@
* \since March 2001
* \author nzc
*/
+struct Main;
struct MetaBall;
struct Object;
struct Scene;
@@ -39,7 +40,7 @@ struct MetaElem;
void BKE_mball_unlink(struct MetaBall *mb);
void BKE_mball_free(struct MetaBall *mb);
-struct MetaBall *BKE_mball_add(const char *name);
+struct MetaBall *BKE_mball_add(struct Main *bmain, const char *name);
struct MetaBall *BKE_mball_copy(struct MetaBall *mb);
void BKE_mball_make_local(struct MetaBall *mb);
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index cfe562e231c..24535eb1fd6 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -39,6 +39,7 @@ struct DispList;
struct ListBase;
struct BMEditMesh;
struct BMesh;
+struct Main;
struct Mesh;
struct MPoly;
struct MLoop;
@@ -146,7 +147,8 @@ void BKE_mesh_flush_select_from_verts(struct Mesh *me);
void BKE_mesh_unlink(struct Mesh *me);
void BKE_mesh_free(struct Mesh *me, int unlink);
-struct Mesh *BKE_mesh_add(const char *name);
+struct Mesh *BKE_mesh_add(struct Main *bmain, const char *name);
+struct Mesh *BKE_mesh_copy_ex(struct Main *bmain, struct Mesh *me);
struct Mesh *BKE_mesh_copy(struct Mesh *me);
void mesh_update_customdata_pointers(struct Mesh *me, const short do_ensure_tess_cd);
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index 25d2678ea47..5777a4094bc 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -43,7 +43,7 @@ struct MovieDistortion;
void BKE_movieclip_free(struct MovieClip *clip);
void BKE_movieclip_unlink(struct Main *bmain, struct MovieClip *clip);
-struct MovieClip *BKE_movieclip_file_add(const char *name);
+struct MovieClip *BKE_movieclip_file_add(struct Main *bmain, const char *name);
void BKE_movieclip_reload(struct MovieClip *clip);
struct ImBuf *BKE_movieclip_get_ibuf(struct MovieClip *clip, struct MovieClipUser *user);
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 718fa2f9ecd..5024b3636c5 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -299,7 +299,7 @@ struct bNodeTreeType *ntreeGetType(int type);
struct bNodeType *ntreeGetNodeType(struct bNodeTree *ntree);
struct bNodeSocketType *ntreeGetSocketType(int type);
-struct bNodeTree *ntreeAddTree(const char *name, int type, int nodetype);
+struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, int type, int nodetype);
void ntreeInitTypes(struct bNodeTree *ntree);
/* copy/free funcs, need to manage ID users */
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index bfae1bd2390..54189e26c92 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -49,6 +49,7 @@ struct bAction;
struct RenderData;
struct rctf;
struct MovieClip;
+struct Main;
void BKE_object_workob_clear(struct Object *workob);
void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
@@ -78,12 +79,12 @@ void BKE_object_unlink(struct Object *ob);
int BKE_object_exists_check(struct Object *obtest);
int BKE_object_is_in_editmode(struct Object *ob);
-struct Object *BKE_object_add_only_object(int type, const char *name);
+struct Object *BKE_object_add_only_object(struct Main *bmain, int type, const char *name);
struct Object *BKE_object_add(struct Scene *scene, int type);
void *BKE_object_obdata_add_from_type(int type);
+struct Object *BKE_object_copy_ex(struct Main *bmain, struct Object *ob, int copy_caches);
struct Object *BKE_object_copy(struct Object *ob);
-struct Object *BKE_object_copy_with_caches(struct Object *ob);
void BKE_object_make_local(struct Object *ob);
int BKE_object_is_libdata(struct Object *ob);
int BKE_object_obdata_is_libdata(struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 3394c4f4ce0..a9a8bc32064 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -96,7 +96,7 @@ typedef struct SPHData {
float *gravity;
float hfac;
/* Average distance to neighbours (other particles in the support domain),
- for calculating the Courant number (adaptive time step). */
+ * for calculating the Courant number (adaptive time step). */
int pass;
float element_size;
float flow[3];
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index 607c3026388..2b19f60b5e4 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -52,6 +52,7 @@ void BKE_rigidbody_free_constraint(struct Object *ob);
struct RigidBodyOb *BKE_rigidbody_copy_object(struct Object *ob);
struct RigidBodyCon *BKE_rigidbody_copy_constraint(struct Object *ob);
+void BKE_rigidbody_relink_constraint(struct RigidBodyCon *rbc);
/* -------------- */
/* Setup */
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 3c6f886b59a..629acab9e34 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -261,6 +261,7 @@ void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar);
void BKE_screen_area_free(struct ScrArea *sa);
struct ARegion *BKE_area_find_region_type(struct ScrArea *sa, int type);
+struct ARegion *BKE_area_find_region_active_win(struct ScrArea *sa);
struct ScrArea *BKE_screen_find_big_area(struct bScreen *sc, const int spacetype, const short min);
void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene);
diff --git a/source/blender/blenkernel/BKE_speaker.h b/source/blender/blenkernel/BKE_speaker.h
index 52c177fce57..e2f0fa50a86 100644
--- a/source/blender/blenkernel/BKE_speaker.h
+++ b/source/blender/blenkernel/BKE_speaker.h
@@ -33,7 +33,9 @@
* \brief General operations for speakers.
*/
-void *BKE_speaker_add(const char *name);
+struct Main;
+
+void *BKE_speaker_add(struct Main *bmain, const char *name);
struct Speaker *BKE_speaker_copy(struct Speaker *spk);
void BKE_speaker_make_local(struct Speaker *spk);
void BKE_speaker_free(struct Speaker *spk);
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index be30eba0559..dc84bc67647 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -45,10 +45,10 @@ struct SpaceText;
void BKE_text_free (struct Text *text);
void txt_set_undostate (int u);
int txt_get_undostate (void);
-struct Text* BKE_text_add (const char *name);
+struct Text* BKE_text_add (struct Main *bmain, const char *name);
int txt_extended_ascii_as_utf8(char **str);
int BKE_text_reload (struct Text *text);
-struct Text* BKE_text_load (const char *file, const char *relpath);
+struct Text* BKE_text_load (struct Main *bmain, const char *file, const char *relpath);
struct Text* BKE_text_copy (struct Text *ta);
void BKE_text_unlink (struct Main *bmain, struct Text *text);
void BKE_text_clear (struct Text *text);
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index 78fdd26c9e0..f1796373367 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -44,6 +44,7 @@ struct EnvMap;
struct HaloRen;
struct Lamp;
struct LampRen;
+struct Main;
struct Material;
struct MTex;
struct OceanTex;
@@ -69,7 +70,7 @@ int colorband_element_remove(struct ColorBand *coba, int index);
void colorband_update_sort(struct ColorBand *coba);
void default_tex(struct Tex *tex);
-struct Tex *add_texture(const char *name);
+struct Tex *add_texture(struct Main *bmain, const char *name);
void tex_set_type(struct Tex *tex, int type);
void default_mtex(struct MTex *mtex);
struct MTex *add_mtex(void);
diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h
index 7a23bff0184..6bb35e46539 100644
--- a/source/blender/blenkernel/BKE_world.h
+++ b/source/blender/blenkernel/BKE_world.h
@@ -33,11 +33,12 @@
* \author nzc
*/
+struct Main;
struct World;
void BKE_world_free(struct World *sc);
void BKE_world_free_ex(struct World *sc, int do_id_user);
-struct World *add_world(const char *name);
+struct World *add_world(struct Main *bmian, const char *name);
struct World *BKE_world_copy(struct World *wrld);
struct World *localize_world(struct World *wrld);
void BKE_world_make_local(struct World *wrld);
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 2eeecefe231..599296f54a5 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -264,7 +264,7 @@ if(WITH_BULLET)
${BULLET_INCLUDE_DIRS}
)
list(APPEND INC
- ../rigidbody
+ ../../../intern/rigidbody
)
add_definitions(-DWITH_BULLET)
endif()
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index bcdf37da104..623df124d96 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -41,7 +41,7 @@ incs += ' ../render/extern/include ../makesrna'
incs += ' ../imbuf ../ikplugin ../avi #/intern/elbeem/extern ../nodes ../modifiers'
incs += ' #/intern/iksolver/extern ../blenloader'
incs += ' #/extern/bullet2/src'
-incs += ' ../rigidbody'
+incs += ' #/intern/rigidbody'
incs += ' #/intern/opennl/extern #/intern/bsp/extern'
incs += ' ../gpu #/extern/glew/include'
incs += ' ../bmesh'
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 2079c783898..e58d484b0c0 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -230,7 +230,7 @@ int ccg_gridsize(int level)
{
BLI_assert(level > 0);
BLI_assert(level <= 31);
-
+
return (1 << (level - 1)) + 1;
}
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8ca6d045712..8e740075bc6 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -562,6 +562,13 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob)
tmp.key = NULL;
}
+ /* Clear selection history */
+ tmp.mselect = NULL;
+ tmp.totselect = 0;
+ if (me->mselect) {
+ MEM_freeN(me->mselect);
+ }
+
*me = tmp;
}
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 5ccf9146440..509442b1d4e 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -78,11 +78,11 @@
/* ***************** Library data level operations on action ************** */
-bAction *add_empty_action(const char name[])
+bAction *add_empty_action(Main *bmain, const char name[])
{
bAction *act;
- act = BKE_libblock_alloc(&G.main->action, ID_AC, name);
+ act = BKE_libblock_alloc(&bmain->action, ID_AC, name);
return act;
}
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index c8fd8aa93e5..bd13c406fa5 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -502,7 +502,7 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths
if (srcAdt->action) {
/* set up an action if necessary, and name it in a similar way so that it can be easily found again */
if (dstAdt->action == NULL) {
- dstAdt->action = add_empty_action(srcAdt->action->id.name + 2);
+ dstAdt->action = add_empty_action(G.main, srcAdt->action->id.name + 2);
}
else if (dstAdt->action == srcAdt->action) {
printf("Argh! Source and Destination share animation! ('%s' and '%s' both use '%s') Making new empty action\n",
@@ -510,7 +510,7 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths
/* TODO: review this... */
id_us_min(&dstAdt->action->id);
- dstAdt->action = add_empty_action(dstAdt->action->id.name + 2);
+ dstAdt->action = add_empty_action(G.main, dstAdt->action->id.name + 2);
}
/* loop over base paths, trying to fix for each one... */
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 3a705a07e22..480814a28c3 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -74,11 +74,11 @@
/* **************** Generic Functions, data level *************** */
-bArmature *BKE_armature_add(const char *name)
+bArmature *BKE_armature_add(Main *bmain, const char *name)
{
bArmature *arm;
- arm = BKE_libblock_alloc(&G.main->armature, ID_AR, name);
+ arm = BKE_libblock_alloc(&bmain->armature, ID_AR, name);
arm->deformflag = ARM_DEF_VGROUP | ARM_DEF_ENVELOPE;
arm->flag = ARM_COL_CUSTOM; /* custom bone-group colors */
arm->layer = 1;
@@ -1655,7 +1655,8 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
else {
/* always copy custom shape */
pchan->custom = pchanp->custom;
- pchan->custom_tx = pchanp->custom_tx;
+ if (pchanp->custom_tx)
+ pchan->custom_tx = BKE_pose_channel_find_name(pose, pchanp->custom_tx->name);
/* ID-Property Syncing */
{
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 70eaa00b82e..2ce5053bdcc 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -109,11 +109,11 @@ static void brush_defaults(Brush *brush)
/* Datablock add/copy/free/make_local */
-Brush *BKE_brush_add(const char *name)
+Brush *BKE_brush_add(Main *bmain, const char *name)
{
Brush *brush;
- brush = BKE_libblock_alloc(&G.main->brush, ID_BR, name);
+ brush = BKE_libblock_alloc(&bmain->brush, ID_BR, name);
/* enable fake user by default */
brush->id.flag |= LIB_FAKEUSER;
@@ -419,7 +419,7 @@ int BKE_brush_texture_set_nr(Brush *brush, int nr)
idtest = (ID *)BLI_findlink(&G.main->tex, nr - 1);
if (idtest == NULL) { /* new tex */
if (id) idtest = (ID *)BKE_texture_copy((Tex *)id);
- else idtest = (ID *)add_texture("Tex");
+ else idtest = (ID *)add_texture(G.main, "Tex");
idtest->us--;
}
if (idtest != id) {
@@ -656,7 +656,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf
* available. my ussual solution to this is to use the
* ratio of change of the size to change the unprojected
* radius. Not completely convinced that is correct.
- * In anycase, a better solution is needed to prevent
+ * In any case, a better solution is needed to prevent
* inconsistency. */
void BKE_brush_size_set(Scene *scene, Brush *brush, int size)
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index d1842b99831..34c2d144f4c 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -50,11 +50,11 @@
/****************************** Camera Datablock *****************************/
-void *BKE_camera_add(const char *name)
+void *BKE_camera_add(Main *bmain, const char *name)
{
Camera *cam;
- cam = BKE_libblock_alloc(&G.main->camera, ID_CA, name);
+ cam = BKE_libblock_alloc(&bmain->camera, ID_CA, name);
cam->lens = 35.0f;
cam->sensor_x = DEFAULT_SENSOR_WIDTH;
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index a6e68b9b2d5..7d6212f8760 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -167,11 +167,11 @@ void BKE_curve_free(Curve *cu)
MEM_freeN(cu->tb);
}
-Curve *BKE_curve_add(const char *name, int type)
+Curve *BKE_curve_add(Main *bmain, const char *name, int type)
{
Curve *cu;
- cu = BKE_libblock_alloc(&G.main->curve, ID_CU, name);
+ cu = BKE_libblock_alloc(&bmain->curve, ID_CU, name);
copy_v3_fl(cu->size, 1.0f);
cu->flag = CU_FRONT | CU_BACK | CU_DEFORM_BOUNDS_OFF | CU_PATH_RADIUS;
cu->pathlen = 100;
@@ -3436,7 +3436,9 @@ int BKE_curve_center_median(Curve *cu, float cent[3])
}
}
- mul_v3_fl(cent, 1.0f / (float)total);
+ if (total) {
+ mul_v3_fl(cent, 1.0f / (float)total);
+ }
return (total != 0);
}
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index f3548f776f5..580a69466c9 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1242,12 +1242,15 @@ void CustomData_update_typemap(CustomData *data)
}
}
+/* currently only used in BLI_assert */
+#ifndef NDEBUG
static int customdata_typemap_is_valid(const CustomData *data)
{
CustomData data_copy = *data;
CustomData_update_typemap(&data_copy);
return (memcmp(data->typemap, data_copy.typemap, sizeof(data->typemap)) == 0);
}
+#endif
void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
CustomDataMask mask, int alloctype, int totelem)
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 78d7bfa5bc5..dab4235559a 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -424,7 +424,7 @@ static void dag_add_lamp_driver_relations(DagForest *dag, DagNode *node, Lamp *l
dag_add_shader_nodetree_driver_relations(dag, node, la->nodetree);
}
-static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Object *ob, DagNode *node, int skip_forcefield)
+static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Object *ob, DagNode *node, int skip_forcefield, bool no_collision)
{
Base *base;
DagNode *node2;
@@ -435,7 +435,7 @@ static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Objec
if ((base->lay & ob->lay) && base->object->pd) {
Object *ob1 = base->object;
if ((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob)) {
- if (skip_forcefield && ob1->pd->forcefield == skip_forcefield)
+ if ((skip_forcefield && ob1->pd->forcefield == skip_forcefield) || (no_collision && ob1->pd->forcefield == 0))
continue;
node2 = dag_get_node(dag, ob1);
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Field Collision");
@@ -599,10 +599,13 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
modifiers_isModifierEnabled(ob, eModifierType_Cloth) ||
modifiers_isModifierEnabled(ob, eModifierType_DynamicPaint))
{
- dag_add_collision_field_relation(dag, scene, ob, node, 0); /* TODO: use effectorweight->group */
+ dag_add_collision_field_relation(dag, scene, ob, node, 0, false); /* TODO: use effectorweight->group */
}
else if (modifiers_isModifierEnabled(ob, eModifierType_Smoke)) {
- dag_add_collision_field_relation(dag, scene, ob, node, PFIELD_SMOKEFLOW);
+ dag_add_collision_field_relation(dag, scene, ob, node, PFIELD_SMOKEFLOW, false);
+ }
+ else if (ob->rigidbody_object) {
+ dag_add_collision_field_relation(dag, scene, ob, node, 0, true);
}
}
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 23b0d3e6e22..6f85d4de60e 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -63,6 +63,7 @@
#include "BLO_sys_types.h" // for intptr_t support
static void boundbox_displist(Object *ob);
+static void boundbox_dispbase(BoundBox *bb, ListBase *dispbase);
void BKE_displist_elem_free(DispList *dl)
{
@@ -506,7 +507,7 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, int flipnormal)
dl = dl->next;
}
- /* XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { */
+ /* XXX (obedit && obedit->actcol) ? (obedit->actcol-1) : 0)) { */
if (totvert && (tot = BLI_scanfill_calc(&sf_ctx, BLI_SCANFILL_CALC_REMOVE_DOUBLES | BLI_SCANFILL_CALC_HOLES))) {
if (tot) {
dlnew = MEM_callocN(sizeof(DispList), "filldisplist");
@@ -758,7 +759,7 @@ static ModifierData *curve_get_tessellate_point(Scene *scene, Object *ob, int fo
/* this modifiers are moving point of tessellation automatically
* (some of them even can't be applied on tessellated curve), set flag
- * for incformation button in modifier's header
+ * for information button in modifier's header
*/
md->mode |= eModifierMode_ApplyOnSpline;
}
@@ -1598,15 +1599,15 @@ void BKE_displist_make_curveTypes(Scene *scene, Object *ob, int forOrco)
if (ob->derivedFinal) {
DM_set_object_boundbox(ob, ob->derivedFinal);
+
+ /* always keep curve's BB in sync with non-deformed displist */
+ if (cu->bb == NULL)
+ cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
+
+ boundbox_dispbase(cu->bb, &cu->disp);
}
else {
boundbox_displist(ob);
-
- /* if there is no derivedMesh, object's boundbox is unneeded */
- if (ob->bb) {
- MEM_freeN(ob->bb);
- ob->bb = NULL;
- }
}
}
@@ -1642,42 +1643,50 @@ float *BKE_displist_make_orco(Scene *scene, Object *ob, DerivedMesh *derivedFina
return orco;
}
-/* this is confusing, there's also min_max_object, appplying the obmat... */
-static void boundbox_displist(Object *ob)
+static void boundbox_dispbase(BoundBox *bb, ListBase *dispbase)
{
- BoundBox *bb = NULL;
float min[3], max[3];
DispList *dl;
float *vert;
int a, tot = 0;
+ int doit = 0;
INIT_MINMAX(min, max);
+ for (dl = dispbase->first; dl; dl = dl->next) {
+ tot = (dl->type == DL_INDEX3) ? dl->nr : dl->nr * dl->parts;
+ vert = dl->verts;
+ for (a = 0; a < tot; a++, vert += 3) {
+ minmax_v3v3_v3(min, max, vert);
+ }
+ doit |= (tot != 0);
+ }
+
+ if (!doit) {
+ /* there's no geometry in displist, use zero-sized boundbox */
+ zero_v3(min);
+ zero_v3(max);
+ }
+
+ BKE_boundbox_init_from_minmax(bb, min, max);
+}
+
+/* this is confusing, there's also min_max_object, appplying the obmat... */
+static void boundbox_displist(Object *ob)
+{
if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
Curve *cu = ob->data;
- int doit = 0;
- if (cu->bb == NULL) cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
- bb = cu->bb;
+ /* calculate curve's BB based on non-deformed displist */
+ if (cu->bb == NULL)
+ cu->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
- for (dl = ob->disp.first; dl; dl = dl->next) {
- tot = (dl->type == DL_INDEX3) ? dl->nr : dl->nr * dl->parts;
- vert = dl->verts;
- for (a = 0; a < tot; a++, vert += 3) {
- minmax_v3v3_v3(min, max, vert);
- }
- doit = (tot != 0);
- }
+ boundbox_dispbase(cu->bb, &cu->disp);
- if (!doit) {
- /* there's no geometry in displist, use zero-sized boundbox */
- zero_v3(min);
- zero_v3(max);
- }
-
- }
+ /* object's BB is calculated from final displist */
+ if (ob->bb == NULL)
+ ob->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
- if (bb) {
- BKE_boundbox_init_from_minmax(bb, min, max);
+ boundbox_dispbase(ob->bb, &ob->disp);
}
}
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index d41893b4335..d652b97e2fa 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -248,6 +248,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *em)
totfilltri = BLI_scanfill_calc_ex(&sf_ctx, 0, efa->no);
BLI_assert(totfilltri <= efa->len - 2);
+ (void)totfilltri;
for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
BMLoop **l_ptr = looptris[i++];
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 7b007af86d6..c3fc659137d 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -480,6 +480,92 @@ static FModifierTypeInfo FMI_ENVELOPE = {
fcm_envelope_evaluate /* evaluate */
};
+/* exported function for finding points */
+
+/* Binary search algorithm for finding where to insert Envelope Data Point.
+ * Returns the index to insert at (data already at that index will be offset if replace is 0)
+ */
+#define BINARYSEARCH_FRAMEEQ_THRESH 0.0001f
+
+int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int arraylen, short *exists)
+{
+ int start = 0, end = arraylen;
+ int loopbreaker = 0, maxloop = arraylen * 2;
+
+ /* initialize exists-flag first */
+ *exists = 0;
+
+ /* sneaky optimizations (don't go through searching process if...):
+ * - keyframe to be added is to be added out of current bounds
+ * - keyframe to be added would replace one of the existing ones on bounds
+ */
+ if ((arraylen <= 0) || (array == NULL)) {
+ printf("Warning: binarysearch_fcm_envelopedata_index() encountered invalid array\n");
+ return 0;
+ }
+ else {
+ /* check whether to add before/after/on */
+ float framenum;
+
+ /* 'First' Point (when only one point, this case is used) */
+ framenum = array[0].time;
+ if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
+ *exists = 1;
+ return 0;
+ }
+ else if (frame < framenum) {
+ return 0;
+ }
+
+ /* 'Last' Point */
+ framenum = array[(arraylen - 1)].time;
+ if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
+ *exists = 1;
+ return (arraylen - 1);
+ }
+ else if (frame > framenum) {
+ return arraylen;
+ }
+ }
+
+
+ /* most of the time, this loop is just to find where to put it
+ * - 'loopbreaker' is just here to prevent infinite loops
+ */
+ for (loopbreaker = 0; (start <= end) && (loopbreaker < maxloop); loopbreaker++) {
+ /* compute and get midpoint */
+ int mid = start + ((end - start) / 2); /* we calculate the midpoint this way to avoid int overflows... */
+ float midfra = array[mid].time;
+
+ /* check if exactly equal to midpoint */
+ if (IS_EQT(frame, midfra, BINARYSEARCH_FRAMEEQ_THRESH)) {
+ *exists = 1;
+ return mid;
+ }
+
+ /* repeat in upper/lower half */
+ if (frame > midfra) {
+ start = mid + 1;
+ }
+ else if (frame < midfra) {
+ end = mid - 1;
+ }
+ }
+
+ /* print error if loop-limit exceeded */
+ if (loopbreaker == (maxloop - 1)) {
+ printf("Error: binarysearch_fcm_envelopedata_index() was taking too long\n");
+
+ // include debug info
+ printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
+ }
+
+ /* not found, so return where to place it */
+ return start;
+}
+#undef BINARYSEARCH_FRAMEEQ_THRESH
+
+
/* Cycles F-Curve Modifier --------------------------- */
/* This modifier changes evaltime to something that exists within the curve's frame-range,
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index fda7dfb046e..61f468373f4 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -137,11 +137,11 @@ void BKE_group_unlink(Group *group)
group->id.us = 0;
}
-Group *add_group(const char *name)
+Group *add_group(Main *bmain, const char *name)
{
Group *group;
- group = BKE_libblock_alloc(&G.main->group, ID_GR, name);
+ group = BKE_libblock_alloc(&bmain->group, ID_GR, name);
group->layer = (1 << 20) - 1;
return group;
}
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 9086ef49e4d..9fdf51ceba9 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -27,7 +27,6 @@
* \ingroup bke
*/
-
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 82b0d231869..018cd25187a 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -242,11 +242,11 @@ void BKE_image_free(Image *ima)
}
/* only image block itself */
-static Image *image_alloc(const char *name, short source, short type)
+static Image *image_alloc(Main *bmain, const char *name, short source, short type)
{
Image *ima;
- ima = BKE_libblock_alloc(&G.main->image, ID_IM, name);
+ ima = BKE_libblock_alloc(&bmain->image, ID_IM, name);
if (ima) {
ima->ok = IMA_OK;
@@ -323,9 +323,9 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame)
}
/* empty image block, of similar type and filename */
-Image *BKE_image_copy(Image *ima)
+Image *BKE_image_copy(Main *bmain, Image *ima)
{
- Image *nima = image_alloc(ima->id.name + 2, ima->source, ima->type);
+ Image *nima = image_alloc(bmain, ima->id.name + 2, ima->source, ima->type);
BLI_strncpy(nima->name, ima->name, sizeof(ima->name));
@@ -343,6 +343,9 @@ Image *BKE_image_copy(Image *ima)
BKE_color_managed_colorspace_settings_copy(&nima->colorspace_settings, &ima->colorspace_settings);
+ if (ima->packedfile)
+ nima->packedfile = dupPackedFile(ima->packedfile);
+
return nima;
}
@@ -433,7 +436,7 @@ void BKE_image_make_local(struct Image *ima)
extern_local_image(ima);
}
else if (is_local && is_lib) {
- Image *ima_new = BKE_image_copy(ima);
+ Image *ima_new = BKE_image_copy(bmain, ima);
ima_new->id.us = 0;
@@ -568,7 +571,7 @@ static void image_init_color_management(Image *ima)
}
}
-Image *BKE_image_load(const char *filepath)
+Image *BKE_image_load(Main *bmain, const char *filepath)
{
Image *ima;
int file, len;
@@ -576,7 +579,7 @@ Image *BKE_image_load(const char *filepath)
char str[FILE_MAX];
BLI_strncpy(str, filepath, sizeof(str));
- BLI_path_abs(str, G.main->name);
+ BLI_path_abs(str, bmain->name);
/* exists? */
file = BLI_open(str, O_BINARY | O_RDONLY, 0);
@@ -589,7 +592,7 @@ Image *BKE_image_load(const char *filepath)
while (len > 0 && filepath[len - 1] != '/' && filepath[len - 1] != '\\') len--;
libname = filepath + len;
- ima = image_alloc(libname, IMA_SRC_FILE, IMA_TYPE_IMAGE);
+ ima = image_alloc(bmain, libname, IMA_SRC_FILE, IMA_TYPE_IMAGE);
BLI_strncpy(ima->name, filepath, sizeof(ima->name));
if (BLI_testextensie_array(filepath, imb_ext_movie))
@@ -631,7 +634,7 @@ Image *BKE_image_load_exists(const char *filepath)
}
}
- return BKE_image_load(filepath);
+ return BKE_image_load(G.main, filepath);
}
static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type,
@@ -691,10 +694,10 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
}
/* adds new image block, creates ImBuf and initializes color */
-Image *BKE_image_add_generated(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4])
+Image *BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4])
{
/* on save, type is changed to FILE in editsima.c */
- Image *ima = image_alloc(name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);
+ Image *ima = image_alloc(bmain, name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST);
if (ima) {
ImBuf *ibuf;
@@ -720,7 +723,7 @@ Image *BKE_image_add_from_imbuf(ImBuf *ibuf)
/* on save, type is changed to FILE in editsima.c */
Image *ima;
- ima = image_alloc(BLI_path_basename(ibuf->name), IMA_SRC_FILE, IMA_TYPE_IMAGE);
+ ima = image_alloc(G.main, BLI_path_basename(ibuf->name), IMA_SRC_FILE, IMA_TYPE_IMAGE);
if (ima) {
BLI_strncpy(ima->name, ibuf->name, FILE_MAX);
@@ -2104,7 +2107,7 @@ Image *BKE_image_verify_viewer(int type, const char *name)
break;
if (ima == NULL)
- ima = image_alloc(name, IMA_SRC_VIEWER, type);
+ ima = image_alloc(G.main, name, IMA_SRC_VIEWER, type);
/* happens on reload, imagewindow cannot be image user when hidden*/
if (ima->id.us == 0)
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 59dd02849dd..c5364744b2d 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1548,7 +1548,7 @@ static void ipo_to_animdata(ID *id, Ipo *ipo, char actname[], char constname[],
BLI_snprintf(nameBuf, sizeof(nameBuf), "CDA:%s", ipo->id.name + 2);
- adt->action = add_empty_action(nameBuf);
+ adt->action = add_empty_action(G.main, nameBuf);
if (G.debug & G_DEBUG) printf("\t\tadded new action - '%s'\n", nameBuf);
}
@@ -2093,7 +2093,7 @@ void do_versions_ipos_to_animato(Main *main)
bAction *new_act;
/* add a new action for this, and convert all data into that action */
- new_act = add_empty_action(id->name + 2);
+ new_act = add_empty_action(main, id->name + 2);
ipo_to_animato(NULL, ipo, NULL, NULL, NULL, NULL, &new_act->curves, &drivers);
new_act->idroot = ipo->blocktype;
}
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 2f37db846f3..32cc5c6c22e 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -54,11 +54,11 @@
#include "BKE_main.h"
#include "BKE_node.h"
-Lamp *BKE_lamp_add(const char *name)
+Lamp *BKE_lamp_add(Main *bmain, const char *name)
{
Lamp *la;
- la = BKE_libblock_alloc(&G.main->lamp, ID_LA, name);
+ la = BKE_libblock_alloc(&bmain->lamp, ID_LA, name);
la->r = la->g = la->b = la->k = 1.0f;
la->haint = la->energy = 1.0f;
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index fa01e9fd933..fd57a88e279 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -180,11 +180,11 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
MEM_freeN(vertexCos);
}
-Lattice *BKE_lattice_add(const char *name)
+Lattice *BKE_lattice_add(Main *bmain, const char *name)
{
Lattice *lt;
- lt = BKE_libblock_alloc(&G.main->latt, ID_LT, name);
+ lt = BKE_libblock_alloc(&bmain->latt, ID_LT, name);
lt->flag = LT_GRID;
@@ -1003,3 +1003,66 @@ struct MDeformVert *BKE_lattice_deform_verts_get(struct Object *oblatt)
if (lt->editlatt) lt = lt->editlatt->latt;
return lt->dvert;
}
+
+void BKE_lattice_center_median(struct Lattice *lt, float cent[3])
+{
+ int i, numVerts;
+
+ if (lt->editlatt) lt = lt->editlatt->latt;
+ numVerts = lt->pntsu * lt->pntsv * lt->pntsw;
+
+ zero_v3(cent);
+
+ for (i = 0; i < numVerts; i++)
+ add_v3_v3(cent, lt->def[i].vec);
+
+ mul_v3_fl(cent, 1.0f / (float)numVerts);
+}
+
+void BKE_lattice_minmax(struct Lattice *lt, float min[3], float max[3])
+{
+ int i, numVerts;
+
+ if (lt->editlatt) lt = lt->editlatt->latt;
+ numVerts = lt->pntsu * lt->pntsv * lt->pntsw;
+
+ for (i = 0; i < numVerts; i++)
+ minmax_v3v3_v3(min, max, lt->def[i].vec);
+}
+
+void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3])
+{
+ float min[3], max[3];
+
+ INIT_MINMAX(min, max);
+
+ BKE_lattice_minmax(lt, min, max);
+ mid_v3_v3v3(cent, min, max);
+}
+
+void BKE_lattice_translate(Lattice *lt, float offset[3], int do_keys)
+{
+ int i, numVerts;
+
+ numVerts = lt->pntsu * lt->pntsv * lt->pntsw;
+
+ if (lt->def)
+ for (i = 0; i < numVerts; i++)
+ add_v3_v3(lt->def[i].vec, offset);
+
+ if (lt->editlatt)
+ for (i = 0; i < numVerts; i++)
+ add_v3_v3(lt->editlatt->latt->def[i].vec, offset);
+
+ if (do_keys && lt->key) {
+ KeyBlock *kb;
+
+ for (kb = lt->key->block.first; kb; kb = kb->next) {
+ float *fp = kb->data;
+ for (i = kb->totelem; i--; fp += 3) {
+ add_v3_v3(fp, offset);
+ }
+ }
+ }
+}
+
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 610237abcdd..b4c1d681ddc 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -319,7 +319,7 @@ int id_copy(ID *id, ID **newid, int test)
if (!test) *newid = (ID *)BKE_texture_copy((Tex *)id);
return 1;
case ID_IM:
- if (!test) *newid = (ID *)BKE_image_copy((Image *)id);
+ if (!test) *newid = (ID *)BKE_image_copy(G.main, (Image *)id);
return 1;
case ID_LT:
if (!test) *newid = (ID *)BKE_lattice_copy((Lattice *)id);
@@ -766,13 +766,13 @@ void BKE_libblock_copy_data(ID *id, const ID *id_from, const short do_action)
}
/* used everywhere in blenkernel */
-void *BKE_libblock_copy(ID *id)
+void *BKE_libblock_copy_ex(Main *bmain, ID *id)
{
ID *idn;
ListBase *lb;
size_t idn_len;
- lb = which_libbase(G.main, GS(id->name));
+ lb = which_libbase(bmain, GS(id->name));
idn = BKE_libblock_alloc(lb, GS(id->name), id->name + 2);
assert(idn != NULL);
@@ -793,6 +793,11 @@ void *BKE_libblock_copy(ID *id)
return idn;
}
+void *BKE_libblock_copy(ID *id)
+{
+ return BKE_libblock_copy_ex(G.main, id);
+}
+
static void BKE_library_free(Library *lib)
{
if (lib->packedfile)
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index bda924060d5..960432d6b3d 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -698,18 +698,18 @@ void BKE_mask_point_select_set_handle(MaskSplinePoint *point, const short do_sel
}
/* only mask block itself */
-static Mask *mask_alloc(const char *name)
+static Mask *mask_alloc(Main *bmain, const char *name)
{
Mask *mask;
- mask = BKE_libblock_alloc(&G.main->mask, ID_MSK, name);
+ mask = BKE_libblock_alloc(&bmain->mask, ID_MSK, name);
mask->id.flag |= LIB_FAKEUSER;
return mask;
}
-Mask *BKE_mask_new(const char *name)
+Mask *BKE_mask_new(Main *bmain, const char *name)
{
Mask *mask;
char mask_name[MAX_ID_NAME - 2];
@@ -719,7 +719,7 @@ Mask *BKE_mask_new(const char *name)
else
strcpy(mask_name, "Mask");
- mask = mask_alloc(mask_name);
+ mask = mask_alloc(bmain, mask_name);
/* arbitrary defaults */
mask->sfra = 1;
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 73452b216ff..e3423c93f3c 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -213,7 +213,7 @@ MaskRasterHandle *BKE_maskrasterize_handle_new(void)
{
MaskRasterHandle *mr_handle;
- mr_handle = MEM_callocN(sizeof(MaskRasterHandle), STRINGIFY(MaskRasterHandle));
+ mr_handle = MEM_callocN(sizeof(MaskRasterHandle), "MaskRasterHandle");
return mr_handle;
}
@@ -569,7 +569,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
unsigned int masklay_index;
mr_handle->layers_tot = BLI_countlist(&mask->masklayers);
- mr_handle->layers = MEM_mallocN(sizeof(MaskRasterLayer) * mr_handle->layers_tot, STRINGIFY(MaskRasterLayer));
+ mr_handle->layers = MEM_mallocN(sizeof(MaskRasterLayer) * mr_handle->layers_tot, "MaskRasterLayer");
BLI_rctf_init_minmax(&mr_handle->bounds);
for (masklay = mask->masklayers.first, masklay_index = 0; masklay; masklay = masklay->next, masklay_index++) {
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index ad0a149a42c..50e00161db3 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -209,11 +209,11 @@ void init_material(Material *ma)
ma->preview = NULL;
}
-Material *BKE_material_add(const char *name)
+Material *BKE_material_add(Main *bmain, const char *name)
{
Material *ma;
- ma = BKE_libblock_alloc(&G.main->mat, ID_MA, name);
+ ma = BKE_libblock_alloc(&bmain->mat, ID_MA, name);
init_material(ma);
@@ -1781,7 +1781,7 @@ static short convert_tfacenomaterial(Main *main, Mesh *me, MTFace *tf, int flag)
}
/* create a new material */
else {
- ma = BKE_material_add(idname + 2);
+ ma = BKE_material_add(main, idname + 2);
if (ma) {
printf("TexFace Convert: Material \"%s\" created.\n", idname + 2);
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index b3f71e58e9f..d939b9cc3c0 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -196,11 +196,11 @@ void BKE_mball_free(MetaBall *mb)
if (mb->disp.first) BKE_displist_free(&mb->disp);
}
-MetaBall *BKE_mball_add(const char *name)
+MetaBall *BKE_mball_add(Main *bmain, const char *name)
{
MetaBall *mb;
- mb = BKE_libblock_alloc(&G.main->mball, ID_MB, name);
+ mb = BKE_libblock_alloc(&bmain->mball, ID_MB, name);
mb->size[0] = mb->size[1] = mb->size[2] = 1.0;
mb->texflag = MB_AUTOSPACE;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 03df0c28944..21641e77b0b 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -445,11 +445,11 @@ static void mesh_tessface_clear_intern(Mesh *mesh, int free_customdata)
mesh->totface = 0;
}
-Mesh *BKE_mesh_add(const char *name)
+Mesh *BKE_mesh_add(Main *bmain, const char *name)
{
Mesh *me;
- me = BKE_libblock_alloc(&G.main->mesh, ID_ME, name);
+ me = BKE_libblock_alloc(&bmain->mesh, ID_ME, name);
me->size[0] = me->size[1] = me->size[2] = 1.0;
me->smoothresh = 30;
@@ -466,7 +466,7 @@ Mesh *BKE_mesh_add(const char *name)
return me;
}
-Mesh *BKE_mesh_copy(Mesh *me)
+Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me)
{
Mesh *men;
MTFace *tface;
@@ -474,7 +474,7 @@ Mesh *BKE_mesh_copy(Mesh *me)
int a, i;
const int do_tessface = ((me->totface != 0) && (me->totpoly == 0)); /* only do tessface if we have no polys */
- men = BKE_libblock_copy(&me->id);
+ men = BKE_libblock_copy_ex(bmain, &me->id);
men->mat = MEM_dupallocN(me->mat);
for (a = 0; a < men->totcol; a++) {
@@ -527,6 +527,11 @@ Mesh *BKE_mesh_copy(Mesh *me)
return men;
}
+Mesh *BKE_mesh_copy(Mesh *me)
+{
+ return BKE_mesh_copy_ex(G.main, me);
+}
+
BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob)
{
BMesh *bm;
@@ -1489,7 +1494,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, int use_orco_u
if (dm == NULL) {
if (BKE_mesh_nurbs_displist_to_mdata(ob, dispbase, &allvert, &totvert,
&alledge, &totedge, &allloop,
- &allpoly, (use_orco_uv)? &alluv: NULL,
+ &allpoly, (use_orco_uv) ? &alluv : NULL,
&totloop, &totpoly) != 0)
{
/* Error initializing */
@@ -1497,7 +1502,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, int use_orco_u
}
/* make mesh */
- me = BKE_mesh_add("Mesh");
+ me = BKE_mesh_add(G.main, "Mesh");
me->totvert = totvert;
me->totedge = totedge;
me->totloop = totloop;
@@ -1519,7 +1524,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, int use_orco_u
BKE_mesh_calc_edges(me, TRUE);
}
else {
- me = BKE_mesh_add("Mesh");
+ me = BKE_mesh_add(G.main, "Mesh");
DM_to_mesh(dm, me, ob);
}
@@ -1635,7 +1640,7 @@ void BKE_mesh_from_curve(Scene *scene, Object *ob)
BLI_edgehash_free(eh, NULL);
if (edges.first) {
- Curve *cu = BKE_curve_add(ob->id.name + 2, OB_CURVE);
+ Curve *cu = BKE_curve_add(G.main, ob->id.name + 2, OB_CURVE);
cu->flag |= CU_3D;
while (edges.first) {
@@ -2574,6 +2579,7 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
totfilltri = BLI_scanfill_calc(&sf_ctx, 0);
BLI_assert(totfilltri <= mp->totloop - 2);
+ (void)totfilltri;
for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next, mf++) {
mface_to_poly_map[mface_index] = poly_index;
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 69e368f0d08..943d9e9452a 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -479,11 +479,11 @@ static void put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, i
/*********************** common functions *************************/
/* only image block itself */
-static MovieClip *movieclip_alloc(const char *name)
+static MovieClip *movieclip_alloc(Main *bmain, const char *name)
{
MovieClip *clip;
- clip = BKE_libblock_alloc(&G.main->movieclip, ID_MC, name);
+ clip = BKE_libblock_alloc(&bmain->movieclip, ID_MC, name);
clip->aspx = clip->aspy = 1.0f;
@@ -542,7 +542,7 @@ static void detect_clip_source(MovieClip *clip)
* otherwise creates new.
* does not load ibuf itself
* pass on optional frame for #name images */
-MovieClip *BKE_movieclip_file_add(const char *name)
+MovieClip *BKE_movieclip_file_add(Main *bmain, const char *name)
{
MovieClip *clip;
int file, len;
@@ -550,7 +550,7 @@ MovieClip *BKE_movieclip_file_add(const char *name)
char str[FILE_MAX], strtest[FILE_MAX];
BLI_strncpy(str, name, sizeof(str));
- BLI_path_abs(str, G.main->name);
+ BLI_path_abs(str, bmain->name);
/* exists? */
file = BLI_open(str, O_BINARY | O_RDONLY, 0);
@@ -559,7 +559,7 @@ MovieClip *BKE_movieclip_file_add(const char *name)
close(file);
/* ** first search an identical clip ** */
- for (clip = G.main->movieclip.first; clip; clip = clip->id.next) {
+ for (clip = bmain->movieclip.first; clip; clip = clip->id.next) {
BLI_strncpy(strtest, clip->name, sizeof(clip->name));
BLI_path_abs(strtest, G.main->name);
@@ -580,7 +580,7 @@ MovieClip *BKE_movieclip_file_add(const char *name)
len--;
libname = name + len;
- clip = movieclip_alloc(libname);
+ clip = movieclip_alloc(bmain, libname);
BLI_strncpy(clip->name, name, sizeof(clip->name));
detect_clip_source(clip);
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 6f585198524..143f2186020 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1447,9 +1447,9 @@ void BKE_nla_validate_state(AnimData *adt)
if (strip->extendmode != NLASTRIP_EXTEND_NOTHING) {
/* 1) First strip must be set to extend hold, otherwise, stuff before acts dodgy
* 2) Only overwrite extend mode if *not* changing it will most probably result in
- * occlusion problems, which will occur iff
- * - blendmode = REPLACE
- * - all channels the same (this is fiddly to test, so is currently assumed)
+ * occlusion problems, which will occur if...
+ * - blendmode = REPLACE
+ * - all channels the same (this is fiddly to test, so is currently assumed)
*
* Should fix problems such as [#29869]
*/
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index c73bd5ef8fd..97bee320ecb 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -656,7 +656,7 @@ void nodeDetachNode(struct bNode *node)
}
}
-bNodeTree *ntreeAddTree(const char *name, int type, int nodetype)
+bNodeTree *ntreeAddTree(Main *bmain, const char *name, int type, int nodetype)
{
bNodeTree *ntree;
bNodeType *ntype;
@@ -670,7 +670,7 @@ bNodeTree *ntreeAddTree(const char *name, int type, int nodetype)
BLI_strncpy(ntree->id.name + 2, name, sizeof(ntree->id.name));
}
else
- ntree = BKE_libblock_alloc(&G.main->nodetree, ID_NT, name);
+ ntree = BKE_libblock_alloc(&bmain->nodetree, ID_NT, name);
ntree->type = type;
ntree->nodetype = nodetype;
@@ -1634,7 +1634,7 @@ void BKE_node_clipboard_add_node(bNode *node)
{
#ifdef USE_NODE_CB_VALIDATE
/* add extra info */
- bNodeClipboardExtraInfo *node_info = MEM_mallocN(sizeof(bNodeClipboardExtraInfo), STRINGIFY(bNodeClipboardExtraInfo));
+ bNodeClipboardExtraInfo *node_info = MEM_mallocN(sizeof(bNodeClipboardExtraInfo), "bNodeClipboardExtraInfo");
node_info->id = node->id;
if (node->id) {
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index a46196f38d8..498b3b226f6 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -843,16 +843,16 @@ int BKE_object_exists_check(Object *obtest)
void *BKE_object_obdata_add_from_type(int type)
{
switch (type) {
- case OB_MESH: return BKE_mesh_add("Mesh");
- case OB_CURVE: return BKE_curve_add("Curve", OB_CURVE);
- case OB_SURF: return BKE_curve_add("Surf", OB_SURF);
- case OB_FONT: return BKE_curve_add("Text", OB_FONT);
- case OB_MBALL: return BKE_mball_add("Meta");
- case OB_CAMERA: return BKE_camera_add("Camera");
- case OB_LAMP: return BKE_lamp_add("Lamp");
- case OB_LATTICE: return BKE_lattice_add("Lattice");
- case OB_ARMATURE: return BKE_armature_add("Armature");
- case OB_SPEAKER: return BKE_speaker_add("Speaker");
+ case OB_MESH: return BKE_mesh_add(G.main, "Mesh");
+ case OB_CURVE: return BKE_curve_add(G.main, "Curve", OB_CURVE);
+ case OB_SURF: return BKE_curve_add(G.main, "Surf", OB_SURF);
+ case OB_FONT: return BKE_curve_add(G.main, "Text", OB_FONT);
+ case OB_MBALL: return BKE_mball_add(G.main, "Meta");
+ case OB_CAMERA: return BKE_camera_add(G.main, "Camera");
+ case OB_LAMP: return BKE_lamp_add(G.main, "Lamp");
+ case OB_LATTICE: return BKE_lattice_add(G.main, "Lattice");
+ case OB_ARMATURE: return BKE_armature_add(G.main, "Armature");
+ case OB_SPEAKER: return BKE_speaker_add(G.main, "Speaker");
case OB_EMPTY: return NULL;
default:
printf("BKE_object_obdata_add_from_type: Internal error, bad type: %d\n", type);
@@ -881,14 +881,14 @@ static const char *get_obdata_defname(int type)
}
/* more general add: creates minimum required data, but without vertices etc. */
-Object *BKE_object_add_only_object(int type, const char *name)
+Object *BKE_object_add_only_object(Main *bmain, int type, const char *name)
{
Object *ob;
if (!name)
name = get_obdata_defname(type);
- ob = BKE_libblock_alloc(&G.main->object, ID_OB, name);
+ ob = BKE_libblock_alloc(&bmain->object, ID_OB, name);
/* default object vars */
ob->type = type;
@@ -974,7 +974,7 @@ Object *BKE_object_add(struct Scene *scene, int type)
char name[MAX_ID_NAME];
BLI_strncpy(name, get_obdata_defname(type), sizeof(name));
- ob = BKE_object_add_only_object(type, name);
+ ob = BKE_object_add_only_object(G.main, type, name);
ob->data = BKE_object_obdata_add_from_type(type);
@@ -1240,13 +1240,13 @@ void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src)
copy_v3_v3(ob_tar->size, ob_src->size);
}
-static Object *object_copy_do(Object *ob, int copy_caches)
+Object *BKE_object_copy_ex(Main *bmain, Object *ob, int copy_caches)
{
Object *obn;
ModifierData *md;
int a;
- obn = BKE_libblock_copy(&ob->id);
+ obn = BKE_libblock_copy_ex(bmain, &ob->id);
if (ob->totcol) {
obn->mat = MEM_dupallocN(ob->mat);
@@ -1322,13 +1322,7 @@ static Object *object_copy_do(Object *ob, int copy_caches)
/* copy objects, will re-initialize cached simulation data */
Object *BKE_object_copy(Object *ob)
{
- return object_copy_do(ob, FALSE);
-}
-
-/* copy objects, will duplicate cached simulation data */
-Object *BKE_object_copy_with_caches(Object *ob)
-{
- return object_copy_do(ob, TRUE);
+ return BKE_object_copy_ex(G.main, ob, FALSE);
}
static void extern_local_object(Object *ob)
@@ -3205,6 +3199,9 @@ void BKE_object_relink(Object *ob)
if (ob->adt)
BKE_relink_animdata(ob->adt);
+
+ if (ob->rigidbody_constraint)
+ BKE_rigidbody_relink_constraint(ob->rigidbody_constraint);
ID_NEW(ob->parent);
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index dc8aed91c00..d34d5eaa250 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -43,6 +43,7 @@
#include "BKE_brush.h"
#include "BKE_context.h"
+#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_paint.h"
#include "BKE_subsurf.h"
@@ -179,7 +180,7 @@ void BKE_paint_init(Paint *p, const char col[3])
/* If there's no brush, create one */
brush = paint_brush(p);
if (brush == NULL)
- brush = BKE_brush_add("Brush");
+ brush = BKE_brush_add(G.main, "Brush");
paint_brush_set(p, brush);
memcpy(p->paint_cursor_col, col, 3);
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 71854a93f4d..c01ea4e518d 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -684,8 +684,6 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[4][4], floa
ParticleRenderData *data;
ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
- if (G.is_rendering == FALSE)
- return;
if (psys->renderdata)
return;
@@ -2384,7 +2382,7 @@ void psys_find_parents(ParticleSimulationData *sim)
int from = PART_FROM_FACE;
totparent = (int)(totchild * part->parents * 0.3f);
- if (G.is_rendering && part->child_nbr && part->ren_child_nbr)
+ if ((sim->psys->renderdata || G.is_rendering) && part->child_nbr && part->ren_child_nbr)
totparent *= (float)part->child_nbr / (float)part->ren_child_nbr;
tree = BLI_kdtree_new(totparent);
@@ -2461,7 +2459,7 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
if (totchild && part->childtype == PART_CHILD_FACES) {
totparent = (int)(totchild * part->parents * 0.3f);
- if (G.is_rendering && part->child_nbr && part->ren_child_nbr)
+ if ((psys->renderdata || G.is_rendering) && part->child_nbr && part->ren_child_nbr)
totparent *= (float)part->child_nbr / (float)part->ren_child_nbr;
/* part->parents could still be 0 so we can't test with totparent */
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 9a0b1a76988..666c85d2f6b 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -770,7 +770,7 @@ static void pbvh_bmesh_collapse_edge(PBVH *bvh, BMEdge *e, BMVert *v1,
BM_edge_kill(bvh->bm, e);
/* For all remaining faces of v2, create a new face that is the
- same except it uses v1 instead of v2 */
+ * same except it uses v1 instead of v2 */
/* Note: this could be done with BM_vert_splice(), but that
* requires handling other issues like duplicate edges, so doesn't
* really buy anything. */
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index ef096adc7a7..4302032ade1 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1275,7 +1275,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
if (scene && (duplis-- > 0) && (ob->transflag & OB_DUPLI)) {
ListBase *lb_dupli_ob;
- /* don't update the dupli groups, we only wan't their pid's */
+ /* don't update the dupli groups, we only want their pid's */
if ((lb_dupli_ob = object_duplilist_ex(scene, ob, FALSE, FALSE))) {
DupliObject *dob;
for (dob= lb_dupli_ob->first; dob; dob= dob->next) {
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 7cab0d7471f..24355149926 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -203,8 +203,6 @@ RigidBodyCon *BKE_rigidbody_copy_constraint(Object *ob)
/* just duplicate the whole struct first (to catch all the settings) */
rbcN = MEM_dupallocN(ob->rigidbody_constraint);
- // RB_TODO be more clever about copying constrained objects
-
/* tag object as needing to be verified */
rbcN->flag |= RBC_FLAG_NEEDS_VALIDATE;
@@ -216,6 +214,13 @@ RigidBodyCon *BKE_rigidbody_copy_constraint(Object *ob)
return rbcN;
}
+/* preserve relationships between constraints and rigid bodies after duplication */
+void BKE_rigidbody_relink_constraint(RigidBodyCon *rbc)
+{
+ ID_NEW(rbc->ob1);
+ ID_NEW(rbc->ob2);
+}
+
/* ************************************** */
/* Setup Utilities - Validate Sim Instances */
@@ -354,7 +359,7 @@ void BKE_rigidbody_validate_sim_shape(Object *ob, short rebuild)
/* if automatically determining dimensions, use the Object's boundbox
* - assume that all quadrics are standing upright on local z-axis
* - assume even distribution of mass around the Object's pivot
- * (i.e. Object pivot is centralised in boundbox)
+ * (i.e. Object pivot is centralized in boundbox)
*/
// XXX: all dimensions are auto-determined now... later can add stored settings for this
/* get object dimensions without scaling */
@@ -416,6 +421,10 @@ void BKE_rigidbody_validate_sim_shape(Object *ob, short rebuild)
rbo->physics_shape = new_shape;
RB_shape_set_margin(rbo->physics_shape, RBO_GET_MARGIN(rbo));
}
+ else { /* otherwise fall back to box shape */
+ rbo->shape = RB_SHAPE_BOX;
+ BKE_rigidbody_validate_sim_shape(ob, true);
+ }
}
/* --------------------- */
@@ -853,7 +862,7 @@ void BKE_rigidbody_remove_object(Scene *scene, Object *ob)
if (rbw->constraints) {
for (go = rbw->constraints->gobject.first; go; go = go->next) {
Object *obt = go->ob;
- if (obt) {
+ if (obt && obt->rigidbody_constraint) {
rbc = obt->rigidbody_constraint;
if (rbc->ob1 == ob) {
rbc->ob1 = NULL;
@@ -954,7 +963,7 @@ static void rigidbody_update_sim_ob(Scene *scene, RigidBodyWorld *rbw, Object *o
RB_shape_set_margin(rbo->physics_shape, RBO_GET_MARGIN(rbo) * MIN3(scale[0], scale[1], scale[2]));
/* make transformed objects temporarily kinmatic so that they can be moved by the user during simulation */
- if ((ob->flag & SELECT && G.moving & G_TRANSFORM_OBJ) || rbo->type == RBO_TYPE_PASSIVE) {
+ if (ob->flag & SELECT && G.moving & G_TRANSFORM_OBJ) {
RB_body_set_kinematic_state(rbo->physics_object, TRUE);
RB_body_set_mass(rbo->physics_object, 0.0f);
}
@@ -1114,6 +1123,9 @@ static void rigidbody_update_simulation_post_step(RigidBodyWorld *rbw)
if (ob->flag & SELECT && G.moving & G_TRANSFORM_OBJ) {
RB_body_set_kinematic_state(rbo->physics_object, rbo->flag & RBO_FLAG_KINEMATIC || rbo->flag & RBO_FLAG_DISABLED);
RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
+ /* deactivate passive objects so they don't interfere with deactivation of active objects */
+ if (rbo->type == RBO_TYPE_PASSIVE)
+ RB_body_deactivate(rbo->physics_object);
}
}
}
@@ -1174,8 +1186,12 @@ void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], flo
copy_qt_qt(rbo->orn, ob->quat);
copy_qt_qt(ob->quat, quat);
}
- if (rbo->physics_object)
+ if (rbo->physics_object) {
+ /* allow passive objects to return to original transform */
+ if (rbo->type == RBO_TYPE_PASSIVE)
+ RB_body_set_kinematic_state(rbo->physics_object, TRUE);
RB_body_set_loc_rot(rbo->physics_object, rbo->pos, rbo->orn);
+ }
// RB_TODO update rigid body physics object's loc/rot for dynamic objects here as well (needs to be done outside bullet's update loop)
}
@@ -1280,6 +1296,7 @@ void BKE_rigidbody_free_object(Object *ob) {}
void BKE_rigidbody_free_constraint(Object *ob) {}
struct RigidBodyOb *BKE_rigidbody_copy_object(Object *ob) { return NULL; }
struct RigidBodyCon *BKE_rigidbody_copy_constraint(Object *ob) { return NULL; }
+void BKE_rigidbody_relink_constraint(RigidBodyCon *rbc) {}
void BKE_rigidbody_validate_sim_shape(Object *ob, short rebuild) {}
void BKE_rigidbody_validate_sim_object(RigidBodyWorld *rbw, Object *ob, short rebuild) {}
void BKE_rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, short rebuild) {}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index f5d529f0f07..81084661368 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -742,7 +742,7 @@ void BKE_scene_unlink(Main *bmain, Scene *sce, Scene *newsce)
}
/* used by metaballs
- * doesnt return the original duplicated object, only dupli's
+ * doesn't return the original duplicated object, only dupli's
*/
int BKE_scene_base_iter_next(Scene **scene, int val, Base **base, Object **ob)
{
@@ -1091,7 +1091,7 @@ static void scene_depsgraph_hack(Scene *scene, Scene *scene_parent)
if (ob->depsflag) {
int recalc = 0;
- // printf("depshack %s\n", ob->id.name+2);
+ // printf("depshack %s\n", ob->id.name + 2);
if (ob->depsflag & OB_DEPS_EXTRA_OB_RECALC)
recalc |= OB_RECALC_OB;
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 95b72d0185c..01f57b95378 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -355,6 +355,20 @@ ARegion *BKE_area_find_region_type(ScrArea *sa, int type)
return NULL;
}
+ARegion *BKE_area_find_region_active_win(ScrArea *sa)
+{
+ if (sa) {
+ ARegion *ar = BLI_findlink(&sa->regionbase, sa->region_active_win);
+ if (ar && (ar->regiontype == RGN_TYPE_WINDOW)) {
+ return ar;
+ }
+
+ /* fallback to any */
+ return BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ }
+ return NULL;
+}
+
/* note, using this function is generally a last resort, you really want to be
* using the context when you can - campbell
* -1 for any type */
diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
index 3d8a2f7cddf..9ea405ef636 100644
--- a/source/blender/blenkernel/intern/seqmodifier.c
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -135,7 +135,7 @@ static void modifier_apply_threaded(ImBuf *ibuf, ImBuf *mask, modifier_apply_thr
init_data.apply_callback = apply_callback;
IMB_processor_apply_threaded(ibuf->y, sizeof(ModifierThread), &init_data,
- modifier_init_handle, modifier_do_thread);
+ modifier_init_handle, modifier_do_thread);
}
/* **** Color Balance Modifier **** */
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 2c1fd092fbb..f1724bdfc6b 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1434,7 +1434,7 @@ void BKE_sequencer_proxy_rebuild(SeqIndexBuildContext *context, short *stop, sho
seq_proxy_build_frame(render_context, seq, cfra, 100);
}
- *progress = (float) cfra / (seq->enddisp - seq->endstill - seq->startdisp + seq->startstill);
+ *progress = (float) (cfra - seq->startdisp - seq->startstill) / (seq->enddisp - seq->endstill - seq->startdisp - seq->startstill);
*do_update = TRUE;
if (*stop || G.is_break)
@@ -1746,7 +1746,7 @@ void BKE_sequencer_color_balance_apply(StripColorBalance *cb, ImBuf *ibuf, float
init_data.mask = mask_input;
IMB_processor_apply_threaded(ibuf->y, sizeof(ColorBalanceThread), &init_data,
- color_balance_init_handle, color_balance_do_thread);
+ color_balance_init_handle, color_balance_do_thread);
/* color balance either happens on float buffer or byte buffer, but never on both,
* free byte buffer if there's float buffer since float buffer would be used for
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index be36e30808d..f56d03bfb57 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -213,8 +213,8 @@ static void smoke_pos_to_cell(SmokeDomainSettings *sds, float pos[3])
pos[2] *= 1.0f / sds->cell_size[2];
}
-/* set domain resolution and dimensions from object derivedmesh */
-static void smoke_set_domain_from_derivedmesh(SmokeDomainSettings *sds, Object *ob, DerivedMesh *dm)
+/* set domain transformations and base resolution from object derivedmesh */
+static void smoke_set_domain_from_derivedmesh(SmokeDomainSettings *sds, Object *ob, DerivedMesh *dm, int init_resolution)
{
size_t i;
float min[3] = {FLT_MAX, FLT_MAX, FLT_MAX}, max[3] = {-FLT_MAX, -FLT_MAX, -FLT_MAX};
@@ -246,7 +246,10 @@ static void smoke_set_domain_from_derivedmesh(SmokeDomainSettings *sds, Object *
/* calculate domain dimensions */
sub_v3_v3v3(size, max, min);
- copy_v3_v3(sds->cell_size, size);
+ if (init_resolution) {
+ zero_v3_int(sds->base_res);
+ copy_v3_v3(sds->cell_size, size);
+ }
mul_v3_v3(size, ob->size);
copy_v3_v3(sds->global_size, size);
copy_v3_v3(sds->dp0, min);
@@ -254,18 +257,18 @@ static void smoke_set_domain_from_derivedmesh(SmokeDomainSettings *sds, Object *
invert_m4_m4(sds->imat, ob->obmat);
// prevent crash when initializing a plane as domain
- if ((size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || (size[2] < FLT_EPSILON))
+ if (!init_resolution || (size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || (size[2] < FLT_EPSILON))
return;
/* define grid resolutions from longest domain side */
- if (size[0] > MAX2(size[1], size[2])) {
+ if (size[0] >= MAX2(size[1], size[2])) {
scale = res / size[0];
sds->scale = size[0] / ob->size[0];
sds->base_res[0] = res;
sds->base_res[1] = (int)(size[1] * scale + 0.5f);
sds->base_res[2] = (int)(size[2] * scale + 0.5f);
}
- else if (size[1] > MAX2(size[0], size[2])) {
+ else if (size[1] >= MAX2(size[0], size[2])) {
scale = res / size[1];
sds->scale = size[1] / ob->size[1];
sds->base_res[0] = (int)(size[0] * scale + 0.5f);
@@ -293,7 +296,7 @@ static int smokeModifier_init(SmokeModifierData *smd, Object *ob, Scene *scene,
SmokeDomainSettings *sds = smd->domain;
int res[3];
/* set domain dimensions from derivedmesh */
- smoke_set_domain_from_derivedmesh(sds, ob, dm);
+ smoke_set_domain_from_derivedmesh(sds, ob, dm, TRUE);
/* reset domain values */
zero_v3_int(sds->shift);
zero_v3(sds->shift_f);
@@ -1984,7 +1987,7 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *
/* update object state */
invert_m4_m4(sds->imat, ob->obmat);
copy_m4_m4(sds->obmat, ob->obmat);
- smoke_set_domain_from_derivedmesh(sds, ob, domain_dm);
+ smoke_set_domain_from_derivedmesh(sds, ob, domain_dm, (sds->flags & MOD_SMOKE_ADAPTIVE_DOMAIN));
/* use global gravity if enabled */
if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index f6599cc9648..f3391803294 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -42,11 +42,11 @@
#include "BKE_main.h"
#include "BKE_speaker.h"
-void *BKE_speaker_add(const char *name)
+void *BKE_speaker_add(Main *bmain, const char *name)
{
Speaker *spk;
- spk = BKE_libblock_alloc(&G.main->speaker, ID_SPK, name);
+ spk = BKE_libblock_alloc(&bmain->speaker, ID_SPK, name);
spk->attenuation = 1.0f;
spk->cone_angle_inner = 360.0f;
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index a0f611a5a7b..3be9097ce82 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -171,9 +171,8 @@ void BKE_text_free(Text *text)
#endif
}
-Text *BKE_text_add(const char *name)
+Text *BKE_text_add(Main *bmain, const char *name)
{
- Main *bmain = G.main;
Text *ta;
TextLine *tmp;
@@ -363,9 +362,8 @@ int BKE_text_reload(Text *text)
return 1;
}
-Text *BKE_text_load(const char *file, const char *relpath)
+Text *BKE_text_load(Main *bmain, const char *file, const char *relpath)
{
- Main *bmain = G.main;
FILE *fp;
int i, llen, len;
unsigned char *buffer;
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 2e909f11eaa..55a0f3752a1 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -540,9 +540,8 @@ void tex_set_type(Tex *tex, int type)
/* ------------------------------------------------------------------------- */
-Tex *add_texture(const char *name)
+Tex *add_texture(Main *bmain, const char *name)
{
- Main *bmain = G.main;
Tex *tex;
tex = BKE_libblock_alloc(&bmain->tex, ID_TE, name);
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 3c5d94a21e4..8b81e474e76 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -169,8 +169,9 @@ void BKE_tracking_settings_init(MovieTracking *tracking)
tracking->settings.default_motion_model = TRACK_MOTION_MODEL_TRANSLATION;
tracking->settings.default_minimum_correlation = 0.75;
- tracking->settings.default_pattern_size = 11;
+ tracking->settings.default_pattern_size = 15;
tracking->settings.default_search_size = 61;
+ tracking->settings.default_algorithm_flag |= TRACK_ALGORITHM_FLAG_USE_BRUTE;
tracking->settings.dist = 1;
tracking->settings.object_distance = 1;
tracking->settings.reconstruction_success_threshold = 1e-3;
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index ad101c41dc5..206f829eaa8 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -79,9 +79,8 @@ void BKE_world_free(World *wrld)
BKE_world_free_ex(wrld, TRUE);
}
-World *add_world(const char *name)
+World *add_world(Main *bmain, const char *name)
{
- Main *bmain = G.main;
World *wrld;
wrld = BKE_libblock_alloc(&bmain->world, ID_WO, name);
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 448396811d3..a822bdb9414 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -68,6 +68,7 @@ void closest_to_line_segment_v2(float closest[2], const float p[2], const float
float dist_to_plane_normalized_v3(const float p[3], const float plane_co[3], const float plane_no_unit[3]);
float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3]);
float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]);
+float dist_to_line_v3(const float p[3], const float l1[3], const float l2[3]);
float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]);
float closest_to_line_v2(float r[2], const float p[2], const float l1[2], const float l2[2]);
void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3], const float l2[3]);
@@ -130,7 +131,7 @@ int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
/* point in polygon */
int isect_point_quad_v2(const float p[2], const float a[2], const float b[2], const float c[2], const float d[2]);
-int isect_point_tri_v2(const float v1[2], const float v2[2], const float v3[2], const float pt[2]);
+int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2]);
int isect_point_tri_v2_cw(const float pt[2], const float v1[2], const float v2[2], const float v3[2]);
int isect_point_tri_v2_int(const int x1, const int y1, const int x2, const int y2, const int a, const int b);
int isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3]);
@@ -261,6 +262,7 @@ MINLINE void madd_sh_shfl(float r[9], const float sh[3], const float f);
float form_factor_hemi_poly(float p[3], float n[3],
float v1[3], float v2[3], float v3[3], float v4[3]);
+bool axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3]);
void axis_dominant_v3(int *r_axis_a, int *r_axis_b, const float axis[3]);
float axis_dominant_v3_max(int *r_axis_a, int *r_axis_b, const float axis[3])
#ifdef __GNUC__
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 415c503146c..a5ab2373b89 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -90,11 +90,12 @@ void mul_m4_v3(float M[4][4], float r[3]);
void mul_v3_m4v3(float r[3], float M[4][4], const float v[3]);
void mul_mat3_m4_v3(float M[4][4], float r[3]);
void mul_m4_v4(float M[4][4], float r[4]);
-void mul_v4_m4v4(float r[4], float M[4][4], float v[4]);
+void mul_v4_m4v4(float r[4], float M[4][4], const float v[4]);
void mul_project_m4_v3(float M[4][4], float vec[3]);
void mul_m3_v3(float M[3][3], float r[3]);
-void mul_v3_m3v3(float r[3], float M[3][3], float a[3]);
+void mul_v3_m3v3(float r[3], float M[3][3], const float a[3]);
+void mul_v2_m3v3(float r[2], float M[3][3], const float a[3]);
void mul_transposed_m3_v3(float M[3][3], float r[3]);
void mul_m3_v3_double(float M[3][3], double r[3]);
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h
index 20ea89f3abf..a1cbad73239 100644
--- a/source/blender/blenlib/BLI_mempool.h
+++ b/source/blender/blenlib/BLI_mempool.h
@@ -92,6 +92,13 @@ __attribute__((nonnull(1)))
#endif
;
+void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+__attribute__((nonnull(1, 2)))
+#endif
+;
+
/** iteration stuff. note: this may easy to produce bugs with **/
/* private structure */
typedef struct BLI_mempool_iter {
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 43b1e7871cd..95ad786c7c2 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -45,7 +45,11 @@
# ifdef __cplusplus
typedef bool _BLI_Bool;
# else
-# define _BLI_Bool signed char
+/* using char here may cause nasty tricky bugs, e.g.
+ * bool is_bit_flag = RNA_property_flag(prop) & PROP_ENUM_FLAG;
+ * as PROP_ENUM_FLAG is farther than 8th bit, do_translate would be always false!
+ */
+# define _BLI_Bool unsigned int
# endif
# else
# define _BLI_Bool _Bool
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 7d2fc38272d..7ebe4430e20 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -78,9 +78,9 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val)
unsigned int hash = gh->hashfp(key) % gh->nbuckets;
Entry *e = (Entry *)BLI_mempool_alloc(gh->entrypool);
+ e->next = gh->buckets[hash];
e->key = key;
e->val = val;
- e->next = gh->buckets[hash];
gh->buckets[hash] = e;
if (++gh->nentries > (float)gh->nbuckets / 2) {
@@ -109,13 +109,13 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val)
void *BLI_ghash_lookup(GHash *gh, const void *key)
{
- if (gh) {
- unsigned int hash = gh->hashfp(key) % gh->nbuckets;
- Entry *e;
+ const unsigned int hash = gh->hashfp(key) % gh->nbuckets;
+ Entry *e;
- for (e = gh->buckets[hash]; e; e = e->next)
- if (gh->cmpfp(key, e->key) == 0)
- return e->val;
+ for (e = gh->buckets[hash]; e; e = e->next) {
+ if (gh->cmpfp(key, e->key) == 0) {
+ return e->val;
+ }
}
return NULL;
}
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index 0d6b8a44a1e..bf228f7456a 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -235,7 +235,11 @@ void *BLI_mempool_calloc(BLI_mempool *pool)
return retval;
}
-/* doesnt protect against double frees, don't be stupid! */
+/**
+ * Free an element from the mempool.
+ *
+ * \note doesnt protect against double frees, don't be stupid!
+ */
void BLI_mempool_free(BLI_mempool *pool, void *addr)
{
BLI_freenode *newhead = addr;
@@ -325,6 +329,16 @@ void BLI_mempool_as_array(BLI_mempool *pool, void **data)
BLI_assert((p - data) == pool->totused);
}
+/**
+ * Allocate an array from the mempool.
+ */
+void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr)
+{
+ void *data = MEM_mallocN(BLI_mempool_count(pool) * pool->esize, allocstr);
+ BLI_mempool_as_array(pool, data);
+ return data;
+}
+
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
{
BLI_assert(pool->flag & BLI_MEMPOOL_ALLOW_ITER);
@@ -397,6 +411,9 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
#endif
+/**
+ * Free the mempool its self (and all elements).
+ */
void BLI_mempool_destroy(BLI_mempool *pool)
{
BLI_mempool_chunk *mpchunk = NULL;
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index fc1d0e99a30..ac9534dac25 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -304,6 +304,15 @@ float dist_to_line_segment_v3(const float v1[3], const float v2[3], const float
return len_v3v3(closest, v1);
}
+float dist_to_line_v3(const float v1[3], const float v2[3], const float v3[3])
+{
+ float closest[3];
+
+ closest_to_line_v3(closest, v1, v2, v3);
+
+ return len_v3v3(closest, v1);
+}
+
/* Adapted from "Real-Time Collision Detection" by Christer Ericson,
* published by Morgan Kaufmann Publishers, copyright 2005 Elsevier Inc.
*
@@ -1957,7 +1966,48 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
}
}
-/****************************** Interpolation ********************************/
+/****************************** Axis Utils ********************************/
+
+/**
+ * \brief Normal to x,y matrix
+ *
+ * Creates a 3x3 matrix from a normal.
+ * This matrix can be applied to vectors so their 'z' axis runs along \a normal.
+ * In practice it means you can use x,y as 2d coords. \see
+ *
+ * \param r_mat The matrix to return.
+ * \param normal A unit length vector.
+ */
+bool axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
+{
+ float up[3] = {0.0f, 0.0f, 1.0f};
+ float axis[3];
+ float angle;
+
+ /* double check they are normalized */
+#ifdef DEBUG
+ float test;
+ BLI_assert(fabsf((test = len_squared_v3(normal)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
+#endif
+
+ cross_v3_v3v3(axis, normal, up);
+ angle = saacos(dot_v3v3(normal, up));
+
+ if (angle >= FLT_EPSILON) {
+ if (len_squared_v3(axis) < FLT_EPSILON) {
+ axis[0] = 0.0f;
+ axis[1] = 1.0f;
+ axis[2] = 0.0f;
+ }
+
+ axis_angle_to_mat3(r_mat, axis, angle);
+ return true;
+ }
+ else {
+ unit_m3(r_mat);
+ return false;
+ }
+}
/* get the 2 dominant axis values, 0==X, 1==Y, 2==Z */
void axis_dominant_v3(int *r_axis_a, int *r_axis_b, const float axis[3])
@@ -1983,6 +2033,9 @@ float axis_dominant_v3_max(int *r_axis_a, int *r_axis_b, const float axis[3])
else { *r_axis_a = 1; *r_axis_b = 2; return xn; }
}
+
+/****************************** Interpolation ********************************/
+
static float tri_signed_area(const float v1[3], const float v2[3], const float v3[3], const int i, const int j)
{
return 0.5f * ((v1[i] - v2[i]) * (v2[j] - v3[j]) + (v1[j] - v2[j]) * (v3[i] - v2[i]));
@@ -2378,7 +2431,7 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
t2 = mean_value_half_tan_v3(co, vmid, vnext);
len = len_v3v3(co, vmid);
- w[i] = (len != 0.0f)? (t1 + t2) / len: 0.0f;
+ w[i] = (len != 0.0f) ? (t1 + t2) / len: 0.0f;
totweight += w[i];
}
@@ -2430,7 +2483,7 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
t2 = mean_value_half_tan_v2(co, vmid, vnext);
len = len_v2v2(co, vmid);
- w[i] = (len != 0.0f)? (t1 + t2) / len: 0.0f;
+ w[i] = (len != 0.0f) ? (t1 + t2) / len: 0.0f;
totweight += w[i];
}
@@ -3526,7 +3579,7 @@ float form_factor_hemi_poly(float p[3], float n[3], float v1[3], float v2[3], fl
int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
{
float nor[3], nor1[3], nor2[3], vec[4][2];
- int axis_a, axis_b;
+ float mat[3][3];
/* define projection, do both trias apart, quad is undefined! */
@@ -3543,18 +3596,14 @@ int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], c
}
add_v3_v3v3(nor, nor1, nor2);
+ normalize_v3(nor);
- axis_dominant_v3(&axis_a, &axis_b, nor);
-
- vec[0][0] = v1[axis_a];
- vec[0][1] = v1[axis_b];
- vec[1][0] = v2[axis_a];
- vec[1][1] = v2[axis_b];
+ axis_dominant_v3_to_m3(mat, nor);
- vec[2][0] = v3[axis_a];
- vec[2][1] = v3[axis_b];
- vec[3][0] = v4[axis_a];
- vec[3][1] = v4[axis_b];
+ mul_v2_m3v3(vec[0], mat, v1);
+ mul_v2_m3v3(vec[1], mat, v2);
+ mul_v2_m3v3(vec[2], mat, v3);
+ mul_v2_m3v3(vec[3], mat, v4);
/* linetests, the 2 diagonals have to instersect to be convex */
return (isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0) ? TRUE : FALSE;
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 8f9ea917b8c..5c443b9b1f3 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -366,7 +366,7 @@ void mul_project_m4_v3(float mat[4][4], float vec[3])
vec[2] /= w;
}
-void mul_v4_m4v4(float r[4], float mat[4][4], float v[4])
+void mul_v4_m4v4(float r[4], float mat[4][4], const float v[4])
{
float x, y, z;
@@ -404,13 +404,19 @@ void mul_m4_v4d(float mat[4][4], double r[4])
mul_v4d_m4v4d(r, mat, r);
}
-void mul_v3_m3v3(float r[3], float M[3][3], float a[3])
+void mul_v3_m3v3(float r[3], float M[3][3], const float a[3])
{
r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2];
r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2];
r[2] = M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2];
}
+void mul_v2_m3v3(float r[2], float M[3][3], const float a[3])
+{
+ r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2];
+ r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2];
+}
+
void mul_m3_v3(float M[3][3], float r[3])
{
float tmp[3];
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index b38b5a2de10..e6399ed356e 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -84,6 +84,8 @@ void mul_qt_qtqt(float q[4], const float q1[4], const float q2[4])
* \note:
* Assumes a unit quaternion?
*
+ * \note: multiplying by 3x3 matrix is ~25% faster.
+ *
* in fact not, but you may want to use a unit quat, read on...
*
* Shortcut for 'q v q*' when \a v is actually a quaternion.
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 8c62fdf81a7..c4def539c10 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -528,6 +528,7 @@ MINLINE float cross_v2v2(const float a[2], const float b[2])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
{
+ BLI_assert(r != a && r != b);
r[0] = a[1] * b[2] - a[2] * b[1];
r[1] = a[2] * b[0] - a[0] * b[2];
r[2] = a[0] * b[1] - a[1] * b[0];
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 06b1f1f09b1..5265d862ab8 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -848,7 +848,7 @@ const char *BLI_getDefaultDocumentFolder(void)
/* ************************************************************* */
/* ************************************************************* */
-// #define PATH_DEBUG2
+// #define PATH_DEBUG
static char *blender_version_decimal(const int ver)
{
@@ -871,14 +871,14 @@ static int test_path(char *targetpath, const char *path_base, const char *path_s
BLI_strncpy(targetpath, tmppath, sizeof(tmppath));
if (BLI_is_dir(targetpath)) {
-#ifdef PATH_DEBUG2
- printf("\tpath found: %s\n", targetpath);
+#ifdef PATH_DEBUG
+ printf("\t%s found: %s\n", __func__, targetpath);
#endif
return 1;
}
else {
-#ifdef PATH_DEBUG2
- printf("\tpath missing: %s\n", targetpath);
+#ifdef PATH_DEBUG
+ printf("\t%s missing: %s\n", __func__, targetpath);
#endif
//targetpath[0] = '\0';
return 0;
@@ -892,10 +892,16 @@ static int test_env_path(char *path, const char *envvar)
if (BLI_is_dir(env)) {
BLI_strncpy(path, env, FILE_MAX);
+#ifdef PATH_DEBUG
+ printf("\t%s env %s found: %s\n", __func__, envvar, env);
+#endif
return 1;
}
else {
path[0] = '\0';
+#ifdef PATH_DEBUG
+ printf("\t%s env %s missing: %s\n", __func__, envvar, env);
+#endif
return 0;
}
}
@@ -904,8 +910,8 @@ static int get_path_local(char *targetpath, const char *folder_name, const char
{
char relfolder[FILE_MAX];
-#ifdef PATH_DEBUG2
- printf("get_path_local...\n");
+#ifdef PATH_DEBUG
+ printf("%s...\n", __func__);
#endif
if (folder_name) {
@@ -964,8 +970,8 @@ static int get_path_user(char *targetpath, const char *folder_name, const char *
if (!user_path[0])
return 0;
-#ifdef PATH_DEBUG2
- printf("get_path_user: %s\n", user_path);
+#ifdef PATH_DEBUG
+ printf("%s: %s\n", __func__, user_path);
#endif
if (subfolder_name) {
@@ -1034,8 +1040,8 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
if (!system_path[0])
return 0;
-#ifdef PATH_DEBUG2
- printf("get_path_system: %s\n", system_path);
+#ifdef PATH_DEBUG
+ printf("%s: %s\n", __func__, system_path);
#endif
if (subfolder_name) {
@@ -1174,7 +1180,7 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check)
#ifdef PATH_DEBUG
-#undef PATH_DEBUG
+# undef PATH_DEBUG
#endif
void BLI_setenv(const char *env, const char *val)
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index fdf23458c76..abede57b3ce 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2682,15 +2682,15 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
data->prop = newdataadr(fd, data->prop);
if (data->prop)
IDP_DirectLinkProperty(data->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
- }
break;
+ }
case CONSTRAINT_TYPE_SPLINEIK:
{
bSplineIKConstraint *data= con->data;
-
+
data->points= newdataadr(fd, data->points);
- }
break;
+ }
case CONSTRAINT_TYPE_KINEMATIC:
{
bKinematicConstraint *data = con->data;
@@ -2700,14 +2700,15 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
/* version patch for runtime flag, was not cleared in some case */
data->flag &= ~CONSTRAINT_IK_AUTO;
+ break;
}
case CONSTRAINT_TYPE_CHILDOF:
{
/* XXX version patch, in older code this flag wasn't always set, and is inherent to type */
if (con->ownspace == CONSTRAINT_SPACE_POSE)
con->flag |= CONSTRAINT_SPACEONCE;
- }
break;
+ }
}
}
}
@@ -6031,6 +6032,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
sa->handlers.first = sa->handlers.last = NULL;
sa->type = NULL; /* spacetype callbacks */
+ sa->region_active_win = -1;
for (ar = sa->regionbase.first; ar; ar = ar->next)
direct_link_region(fd, ar, sa->spacetype);
@@ -7549,6 +7551,17 @@ static void do_version_node_cleanup_dynamic_sockets_264(void *UNUSED(data), ID *
}
}
+static void do_version_node_fix_translate_wrapping(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
+{
+ bNode *node;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == CMP_NODE_TRANSLATE && node->storage == NULL) {
+ node->storage = MEM_callocN(sizeof(NodeTranslateData), "node translate data");
+ }
+ }
+}
+
static void do_version_node_fix_internal_links_264(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
{
bNode *node;
@@ -8840,11 +8853,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (main->versionfile < 265 || (main->versionfile == 265 && main->subversionfile < 5)) {
Scene *scene;
- Image *image;
- Tex *tex;
+ Image *image, *nimage;
+ Tex *tex, *otex;
for (scene = main->scene.first; scene; scene = scene->id.next) {
Sequence *seq;
+ bool set_premul = false;
SEQ_BEGIN (scene->ed, seq)
{
@@ -8855,21 +8869,85 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (scene->r.bake_samples == 0)
scene->r.bake_samples = 256;
+
+ if (scene->world) {
+ World *world = blo_do_versions_newlibadr(fd, scene->id.lib, scene->world);
+
+ if (is_zero_v3(&world->horr)) {
+ if ((world->skytype & WO_SKYBLEND) == 0 || is_zero_v3(&world->zenr)) {
+ set_premul = true;
+ }
+ }
+ }
+ else
+ set_premul = true;
+
+ if (set_premul) {
+ printf("2.66 versioning fix: replacing black sky with premultiplied alpha for scene %s\n", scene->id.name + 2);
+ scene->r.alphamode = R_ALPHAPREMUL;
+ }
}
for (image = main->image.first; image; image = image->id.next) {
if (image->flag & IMA_DO_PREMUL)
image->alpha_mode = IMA_ALPHA_STRAIGHT;
- }
+ image->flag &= ~IMA_DONE_TAG;
+ }
+
+ /* use alpha flag moved from texture to image datablock */
for (tex = main->tex.first; tex; tex = tex->id.next) {
if (tex->type == TEX_IMAGE && (tex->imaflag & TEX_USEALPHA) == 0) {
image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima);
- if (image)
+ /* skip if no image or already tested */
+ if (!image || (image->flag & (IMA_DONE_TAG|IMA_IGNORE_ALPHA)))
+ continue;
+
+ image->flag |= IMA_DONE_TAG;
+
+ /* we might have some textures using alpha and others not, so we check if
+ * they exist and duplicate the image datablock if necessary */
+ for (otex = main->tex.first; otex; otex = otex->id.next)
+ if (otex->type == TEX_IMAGE && (otex->imaflag & TEX_USEALPHA))
+ if (image == blo_do_versions_newlibadr(fd, otex->id.lib, otex->ima))
+ break;
+
+ if (otex) {
+ /* copy image datablock */
+ nimage = BKE_image_copy(main, image);
+ nimage->flag |= IMA_IGNORE_ALPHA|IMA_DONE_TAG;
+ nimage->id.us--;
+
+ /* we need to do some trickery to make file loading think
+ * this new datablock is part of file we're loading */
+ blo_do_versions_oldnewmap_insert(fd->libmap, nimage, nimage, 0);
+ nimage->id.lib = image->id.lib;
+ nimage->id.flag |= (image->id.flag & LIB_NEED_LINK);
+
+ /* assign new image, and update the users counts accordingly */
+ for (otex = main->tex.first; otex; otex = otex->id.next) {
+ if (otex->type == TEX_IMAGE && (otex->imaflag & TEX_USEALPHA) == 0) {
+ if (image == blo_do_versions_newlibadr(fd, otex->id.lib, otex->ima)) {
+ if (!(otex->id.flag & LIB_NEED_LINK)) {
+ image->id.us--;
+ nimage->id.us++;
+ }
+ otex->ima = nimage;
+ break;
+ }
+ }
+ }
+ }
+ else {
+ /* no other textures using alpha, just set the flag */
image->flag |= IMA_IGNORE_ALPHA;
+ }
}
}
+
+ for (image = main->image.first; image; image = image->id.next)
+ image->flag &= ~IMA_DONE_TAG;
}
if (main->versionfile < 265 || (main->versionfile == 265 && main->subversionfile < 7)) {
@@ -8923,6 +9001,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ // add storage for compositor translate nodes when not existing
+ if (!MAIN_VERSION_ATLEAST(main, 265, 10)) {
+ bNodeTreeType *ntreetype;
+
+ ntreetype = ntreeGetType(NTREE_COMPOSIT);
+ if (ntreetype && ntreetype->foreach_nodetree)
+ ntreetype->foreach_nodetree(main, NULL, do_version_node_fix_translate_wrapping);
+ }
+
+
+
// if (main->versionfile < 265 || (main->versionfile == 265 && main->subversionfile < 7)) {
#ifdef WITH_FREESTYLE
@@ -9208,7 +9297,7 @@ static void sort_bhead_old_map(FileData *fd)
fd->tot_bheadmap = tot;
if (tot == 0) return;
- bhs = fd->bheadmap = MEM_mallocN(tot*sizeof(struct BHeadSort), STRINGIFY(BHeadSort));
+ bhs = fd->bheadmap = MEM_mallocN(tot * sizeof(struct BHeadSort), "BHeadSort");
for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead), bhs++) {
bhs->bhead = bhead;
@@ -10295,7 +10384,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
Base *base;
/* BKE_object_add(...) messes with the selection */
- Object *ob = BKE_object_add_only_object(OB_EMPTY, group->id.name+2);
+ Object *ob = BKE_object_add_only_object(mainvar, OB_EMPTY, group->id.name+2);
ob->type = OB_EMPTY;
ob->lay = scene->lay;
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index d49686f204a..bf719a5c790 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -114,6 +114,8 @@ set(SRC
tools/bmesh_decimate.h
tools/bmesh_edgesplit.c
tools/bmesh_edgesplit.h
+ tools/bmesh_triangulate.c
+ tools/bmesh_triangulate.h
bmesh.h
bmesh_class.h
diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h
index f593f78bab7..3b33513b575 100644
--- a/source/blender/bmesh/bmesh.h
+++ b/source/blender/bmesh/bmesh.h
@@ -268,8 +268,9 @@ extern "C" {
#include "intern/bmesh_inline.h"
-#include "tools/bmesh_decimate.h"
#include "tools/bmesh_bevel.h"
+#include "tools/bmesh_decimate.h"
+#include "tools/bmesh_triangulate.h"
#ifdef __cplusplus
}
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index 1337cb7c8eb..36a5412e401 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -252,8 +252,22 @@ static void bm_log_faces_unmake(BMesh *bm, BMLog *log, GHash *faces)
void *key = BLI_ghashIterator_getKey(&gh_iter);
unsigned int id = GET_INT_FROM_POINTER(key);
BMFace *f = bm_log_face_from_id(log, id);
+ BMEdge *e_tri[3];
+ BMLoop *l_iter;
+ int i;
+ l_iter = BM_FACE_FIRST_LOOP(f);
+ for (i = 0; i < 3; i++, l_iter = l_iter->next) {
+ e_tri[i] = l_iter->e;
+ }
+
+ /* Remove any unused edges */
BM_face_kill(bm, f);
+ for (i = 0; i < 3; i++) {
+ if (BM_edge_is_wire(e_tri[i])) {
+ BM_edge_kill(bm, e_tri[i]);
+ }
+ }
}
}
@@ -722,7 +736,7 @@ void BM_log_redo(BMesh *bm, BMLog *log)
* vertex in the map of added vertices.
*
* If the vertex already existed prior to the current log entry, a
- * seperate key/value map of modified vertices is used (using the
+ * separate key/value map of modified vertices is used (using the
* vertex's ID as the key). The values stored in that case are
* the vertex's original state so that an undo can restore the
* previous state.
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index e72ad5dae3c..3c4fa490477 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -245,7 +245,7 @@ void BM_mesh_free(BMesh *bm)
BM_mesh_data_free(bm);
if (bm->py_handle) {
- /* keep this out of 'BM_mesh_data_free' because we wan't python
+ /* keep this out of 'BM_mesh_data_free' because we want python
* to be able to clear the mesh and maintain access. */
extern void bpy_bm_generic_invalidate(void *self);
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index a63b715fd14..6697430a88d 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -162,7 +162,11 @@ char BM_mesh_cd_flag_from_bmesh(BMesh *bm)
return cd_flag;
}
-/* Mesh -> BMesh */
+/**
+ * \brief Mesh -> BMesh
+ *
+ * \warning This function doesn't calculate face normals.
+ */
void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, bool set_key, int act_key_nr)
{
MVert *mvert;
@@ -465,7 +469,9 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, bool set_key, int act_key_nr)
}
-/* BMesh -> Mesh */
+/**
+ * \brief BMesh -> Mesh
+ */
static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert)
{
BMVert **vertMap = NULL;
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index 4147da82363..c5eeceb43a3 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1436,7 +1436,7 @@ static BMOpDefine bmo_beautify_fill_def = {
"beautify_fill",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
- {"constrain_edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* edges that can't be flipped */
+ {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* edges that can be flipped */
{{'\0'}},
},
/* slots_out */
@@ -1455,7 +1455,8 @@ static BMOpDefine bmo_beautify_fill_def = {
static BMOpDefine bmo_triangle_fill_def = {
"triangle_fill",
/* slots_in */
- {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
+ {{"use_beauty", BMO_OP_SLOT_BOOL},
+ {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
{{'\0'}},
},
/* slots_out */
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 3308a014d25..98958596324 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -562,7 +562,7 @@ static int bmo_mesh_flag_count(BMesh *bm, const char htype, const short oflag,
BMElemF *ele_f;
int i;
- BLI_assert(ELEM(true, false, test_for_enabled));
+ BLI_assert((unsigned int)test_for_enabled <= 1);
for (i = 0; i < 3; i++) {
if (htype & flag_types[i]) {
@@ -938,7 +938,7 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op,
int totelement, i = 0;
BLI_assert(op->slots_in == slot_args || op->slots_out == slot_args);
- BLI_assert(ELEM(true, false, test_for_enabled));
+ BLI_assert((unsigned int)test_for_enabled <= 1);
if (test_for_enabled)
totelement = BMO_mesh_enabled_flag_count(bm, htype, oflag);
@@ -1586,7 +1586,7 @@ static int bmo_opname_to_opcode(const char *opname)
* **Utility**
*
* Pass an existing slot which is copied to either an input or output slot.
- * Taking the operator and slot-name pair of args.
+ * Taking the operator and slot-name pair of args (BMOperator *, const char *).
* - `s` - slot_in (lower case)
* - `S` - slot_out (upper case)
*
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 5c3d164c768..1aa4d7c5e00 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -297,7 +297,6 @@ static void scale_edge_v3f(float v1[3], float v2[3], const float fac)
add_v3_v3v3(v2, v2, mid);
}
-
/**
* \brief POLY ROTATE PLANE
*
@@ -306,30 +305,14 @@ static void scale_edge_v3f(float v1[3], float v2[3], const float fac)
*/
void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nverts)
{
-
- float up[3] = {0.0f, 0.0f, 1.0f}, axis[3], q[4];
float mat[3][3];
- float angle;
- int i;
-
- cross_v3_v3v3(axis, normal, up);
-
- angle = saacos(dot_v3v3(normal, up));
-
- if (angle < FLT_EPSILON)
- return;
- if (len_squared_v3(axis) < FLT_EPSILON) {
- axis[0] = 0.0f;
- axis[1] = 1.0f;
- axis[2] = 0.0f;
+ if (axis_dominant_v3_to_m3(mat, normal)) {
+ int i;
+ for (i = 0; i < nverts; i++) {
+ mul_m3_v3(mat, verts[i]);
+ }
}
-
- axis_angle_to_quat(q, axis, angle);
- quat_to_mat3(mat, q);
-
- for (i = 0; i < nverts; i++)
- mul_m3_v3(mat, verts[i]);
}
/**
@@ -614,16 +597,16 @@ bool BM_face_point_inside_test(BMFace *f, const float co[3])
return crosses % 2 != 0;
}
-static bool bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i, int v2i, int v3i)
+static bool bm_face_goodline(float const (*projectverts)[2], BMFace *f, int v1i, int v2i, int v3i)
{
BMLoop *l_iter;
BMLoop *l_first;
- float v1[3], v2[3], v3[3], pv1[3];
- int i;
- copy_v3_v3(v1, projectverts[v1i]);
- copy_v3_v3(v2, projectverts[v2i]);
- copy_v3_v3(v3, projectverts[v3i]);
+ float pv1[2];
+ const float *v1 = projectverts[v1i];
+ const float *v2 = projectverts[v2i];
+ const float *v3 = projectverts[v3i];
+ int i;
/* v3 must be on the left side of [v1, v2] line, else we know [v1, v3] is outside of f! */
if (testedgesidef(v1, v2, v3)) {
@@ -633,7 +616,7 @@ static bool bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i,
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
i = BM_elem_index_get(l_iter->v);
- copy_v3_v3(pv1, projectverts[i]);
+ copy_v2_v2(pv1, projectverts[i]);
if (ELEM3(i, v1i, v2i, v3i)) {
#if 0
@@ -659,13 +642,14 @@ static bool bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i,
* \brief Find Ear
*
* Used by tessellator to find the next triangle to 'clip off' of a polygon while tessellating.
+ *
* \param f The face to search.
- * \param verts an array of face vert coords.
+ * \param projectverts an array of face vert coords.
* \param use_beauty Currently only applies to quads, can be extended later on.
* \param abscoss Must be allocated by caller, and at least f->len length
* (allow to avoid allocating a new one for each tri!).
*/
-static BMLoop *find_ear(BMFace *f, float (*verts)[3], const bool use_beauty, float *abscoss)
+static BMLoop *poly_find_ear(BMFace *f, float (*projectverts)[2], const bool use_beauty, float *abscoss)
{
BMLoop *bestear = NULL;
@@ -711,7 +695,7 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const bool use_beauty, flo
/* Last check we do not get overlapping triangles
* (as much as possible, there are some cases with no good solution!) */
i4 = (i + 3) % 4;
- if (!bm_face_goodline((float const (*)[3])verts, f, BM_elem_index_get(larr[i4]->v),
+ if (!bm_face_goodline((float const (*)[2])projectverts, f, BM_elem_index_get(larr[i4]->v),
BM_elem_index_get(larr[i]->v), BM_elem_index_get(larr[i + 1]->v)))
{
i = !i;
@@ -721,73 +705,38 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const bool use_beauty, flo
}
else {
- BMVert *v1, *v2, *v3;
-
/* float angle, bestangle = 180.0f; */
- float cos, tcos, bestcos = 1.0f;
- float *tcoss;
- bool is_ear;
- int i = 0, j, len;
+ float cos, bestcos = 1.0f;
+ int i, j, len;
/* Compute cos of all corners! */
+ i = 0;
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
len = l_iter->f->len;
- tcoss = abscoss;
do {
- v1 = l_iter->prev->v;
- v2 = l_iter->v;
- v3 = l_iter->next->v;
+ const BMVert *v1 = l_iter->prev->v;
+ const BMVert *v2 = l_iter->v;
+ const BMVert *v3 = l_iter->next->v;
- *tcoss = fabsf(cos_v3v3v3(v1->co, v2->co, v3->co));
+ abscoss[i] = fabsf(cos_v3v3v3(v1->co, v2->co, v3->co));
/* printf("tcoss: %f\n", *tcoss);*/
- tcoss++;
+ i++;
} while ((l_iter = l_iter->next) != l_first);
+ i = 0;
l_iter = l_first;
- tcoss = abscoss;
do {
- is_ear = true;
-
- v1 = l_iter->prev->v;
- v2 = l_iter->v;
- v3 = l_iter->next->v;
+ const BMVert *v1 = l_iter->prev->v;
+ const BMVert *v2 = l_iter->v;
+ const BMVert *v3 = l_iter->next->v;
- /* We may have already internal edges... */
- if (BM_edge_exists(v1, v3)) {
- is_ear = false;
- }
- else if (!bm_face_goodline((float const (*)[3])verts, f, BM_elem_index_get(v1),
- BM_elem_index_get(v2), BM_elem_index_get(v3)))
+ if (bm_face_goodline((float const (*)[2])projectverts, f,
+ BM_elem_index_get(v1), BM_elem_index_get(v2), BM_elem_index_get(v3)))
{
-#if 0
- printf("(%d, %d, %d) would not be a valid tri!\n",
- BM_elem_index_get(v1), BM_elem_index_get(v2), BM_elem_index_get(v3));
-#endif
- is_ear = false;
- }
-
- if (is_ear) {
-#if 0 /* Old, already commented code */
- /* if this code comes back, it needs to be converted to radians */
- angle = angle_v3v3v3(verts[v1->head.eflag2], verts[v2->head.eflag2], verts[v3->head.eflag2]);
- if (!bestear || ABS(angle - 45.0f) < bestangle) {
- bestear = l;
- bestangle = ABS(45.0f - angle);
- }
-
- if (angle > 20 && angle < 90) break;
- if (angle < 100 && i > 5) break;
- i += 1;
-#endif
-
/* Compute highest cos (i.e. narrowest angle) of this tri. */
- cos = *tcoss;
- tcos = fabsf(cos_v3v3v3(v2->co, v3->co, v1->co));
- if (tcos > cos)
- cos = tcos;
- tcos = fabsf(cos_v3v3v3(v3->co, v1->co, v2->co));
- if (tcos > cos)
- cos = tcos;
+ cos = max_fff(abscoss[i],
+ fabsf(cos_v3v3v3(v2->co, v3->co, v1->co)),
+ fabsf(cos_v3v3v3(v3->co, v1->co, v2->co)));
/* Compare to prev best (i.e. lowest) cos. */
if (cos < bestcos) {
@@ -816,7 +765,6 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const bool use_beauty, flo
#endif
}
}
- tcoss++;
i++;
} while ((l_iter = l_iter->next) != l_first);
}
@@ -827,129 +775,71 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const bool use_beauty, flo
/**
* \brief BMESH TRIANGULATE FACE
*
- * --- Prev description (wasn’t correct, ear clipping was currently simply picking the first tri in the loop!)
- * Triangulates a face using a simple 'ear clipping' algorithm that tries to
- * favor non-skinny triangles (angles less than 90 degrees).
- *
- * If the triangulator has bits left over (or cannot triangulate at all)
- * it uses a simple fan triangulation,
- * --- End of prev description
- *
- * Currently tries to repeatedly find the best triangle (i.e. the most "open" one), provided it does not
+ * Currently repeatedly find the best triangle (i.e. the most "open" one), provided it does not
* produces a "remaining" face with too much wide/narrow angles
* (using cos (i.e. dot product of normalized vectors) of angles).
*
- * newfaces, if non-null, must be an array of BMFace pointers,
- * with a length equal to f->len. It will be filled with the new
- * triangles, and will be NULL-terminated.
+ * \param r_faces_new if non-null, must be an array of BMFace pointers,
+ * with a length equal to (f->len - 2). It will be filled with the new
+ * triangles.
*
- * \note newedgeflag sets a flag layer flag, obviously not the header flag.
+ * \note use_tag tags new flags and edges.
*/
-void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], const short newedge_oflag,
- const short newface_oflag, BMFace **newfaces, const bool use_beauty)
+void BM_face_triangulate(BMesh *bm, BMFace *f,
+ BMFace **r_faces_new,
+ const bool use_beauty, const bool use_tag)
{
- int i, nvert, nf_i = 0;
- bool done;
- BMLoop *newl;
+ const float f_len_orig = f->len;
+ int i, nf_i = 0;
+ BMLoop *l_new;
BMLoop *l_iter;
BMLoop *l_first;
/* BM_face_triangulate: temp absolute cosines of face corners */
- float *abscoss = BLI_array_alloca(abscoss, f->len);
+ float (*projectverts)[2] = BLI_array_alloca(projectverts, f_len_orig);
+ float *abscoss = BLI_array_alloca(abscoss, f_len_orig);
+ float mat[3][3];
+
+ axis_dominant_v3_to_m3(mat, f->no);
/* copy vertex coordinates to vertspace area */
i = 0;
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
- copy_v3_v3(projectverts[i], l_iter->v->co);
- BM_elem_index_set(l_iter->v, i); /* set dirty! */
- i++;
+ mul_v2_m3v3(projectverts[i], mat, l_iter->v->co);
+ BM_elem_index_set(l_iter->v, i++); /* set dirty! */
} while ((l_iter = l_iter->next) != l_first);
bm->elem_index_dirty |= BM_VERT; /* see above */
- /* bmesh_face_normal_update(bm, f, f->no, projectverts); */
-
- calc_poly_normal(f->no, projectverts, f->len);
- poly_rotate_plane(f->no, projectverts, i);
-
- nvert = f->len;
-
- /* calc_poly_plane(projectverts, i); */
- for (i = 0; i < nvert; i++) {
- projectverts[i][2] = 0.0f;
- }
-
- done = false;
- while (!done && f->len > 3) {
- done = true;
- l_iter = find_ear(f, projectverts, use_beauty, abscoss);
+ while (f->len > 3) {
+ l_iter = poly_find_ear(f, projectverts, use_beauty, abscoss);
/* force triangulation - if we can't find an ear the face is degenerate */
if (l_iter == NULL) {
l_iter = BM_FACE_FIRST_LOOP(f);
}
- {
- done = false;
-/* printf("Subdividing face...\n");*/
- f = BM_face_split(bm, l_iter->f, l_iter->prev->v, l_iter->next->v, &newl, NULL, true);
-
- if (UNLIKELY(!f)) {
- fprintf(stderr, "%s: triangulator failed to split face! (bmesh internal error)\n", __func__);
- break;
- }
-
- copy_v3_v3(f->no, l_iter->f->no);
- BMO_elem_flag_enable(bm, newl->e, newedge_oflag);
- BMO_elem_flag_enable(bm, f, newface_oflag);
-
- if (newfaces)
- newfaces[nf_i++] = f;
-
-#if 0
- l = f->loopbase;
- do {
- if (l->v == v) {
- f->loopbase = l;
- break;
- }
- l = l->next;
- } while (l != f->loopbase);
-#endif
+/* printf("Subdividing face...\n");*/
+ f = BM_face_split(bm, l_iter->f, l_iter->prev->v, l_iter->next->v, &l_new, NULL, true);
+ if (UNLIKELY(!f)) {
+ fprintf(stderr, "%s: triangulator failed to split face! (bmesh internal error)\n", __func__);
+ break;
}
- }
- BLI_assert(f->len == 3);
+ copy_v3_v3(f->no, l_iter->f->no);
-#if 0 /* XXX find_ear should now always return a corner, so no more need for this piece of code... */
- if (f->len > 3) {
- l_iter = BM_FACE_FIRST_LOOP(f);
- while (l_iter->f->len > 3) {
- nextloop = l_iter->next->next;
- f = BM_face_split(bm, l_iter->f, l_iter->v, nextloop->v,
- &newl, NULL, true);
- if (!f) {
- printf("triangle fan step of triangulator failed.\n");
-
- /* NULL-terminate */
- if (newfaces) newfaces[nf_i] = NULL;
- return;
- }
+ if (use_tag) {
+ BM_elem_flag_enable(l_new->e, BM_ELEM_TAG);
+ BM_elem_flag_enable(f, BM_ELEM_TAG);
+ }
- if (newfaces) newfaces[nf_i++] = f;
-
- BMO_elem_flag_enable(bm, newl->e, newedge_oflag);
- BMO_elem_flag_enable(bm, f, newface_oflag);
- l_iter = nextloop;
+ if (r_faces_new) {
+ r_faces_new[nf_i++] = f;
}
}
-#endif
- /* NULL-terminate */
- if (newfaces) {
- newfaces[nf_i] = NULL;
- }
+ BLI_assert(f->len == 3);
}
/**
diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h
index a0c6ac5eeaa..601caae2337 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.h
+++ b/source/blender/bmesh/intern/bmesh_polygon.h
@@ -44,9 +44,8 @@ void BM_vert_normal_update_all(BMVert *v);
void BM_face_normal_flip(BMesh *bm, BMFace *f);
bool BM_face_point_inside_test(BMFace *f, const float co[3]);
-void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
- const short newedge_oflag, const short newface_oflag, BMFace **newfaces,
- const bool use_beauty);
+void BM_face_triangulate(BMesh *bm, BMFace *f, BMFace **newfaces,
+ const bool use_beauty, const bool use_tag);
void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len);
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index 7ed23aaf1f8..2284e183d97 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -763,6 +763,19 @@ int BM_edge_is_manifold(BMEdge *e)
#endif
/**
+ * Tests that the edge is manifold and
+ * that both its faces point the same way.
+ */
+bool BM_edge_is_contiguous(BMEdge *e)
+{
+ const BMLoop *l = e->l;
+ const BMLoop *l_other = l->radial_next;
+ return (l && (l_other != l) && /* not 0 or 1 face users */
+ (l_other->radial_next == l) && /* 2 face users */
+ (l_other->v != l->v));
+}
+
+/**
* Tests whether or not an edge is on the boundary
* of a shell (has one face associated with it)
*/
@@ -1007,6 +1020,22 @@ void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
}
/**
+ * Check if the loop is convex or concave
+ * (depends on face normal)
+ */
+bool BM_loop_is_convex(BMLoop *l)
+{
+ float e_dir_prev[3];
+ float e_dir_next[3];
+ float l_no[3];
+
+ sub_v3_v3v3(e_dir_prev, l->prev->v->co, l->v->co);
+ sub_v3_v3v3(e_dir_next, l->next->v->co, l->v->co);
+ cross_v3_v3v3(l_no, e_dir_next, e_dir_prev);
+ return dot_v3v3(l_no, l->f->no) > 0.0f;
+}
+
+/**
* Calculates the angle between the previous and next loops
* (angle at this loops face corner).
*
@@ -1034,7 +1063,7 @@ void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3])
l->v->co,
l->next->v->co) != 0.0f)
{
- return;
+ /* pass */
}
else {
copy_v3_v3(r_normal, l->f->no);
@@ -1042,6 +1071,29 @@ void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3])
}
/**
+ * \brief BM_loop_calc_face_direction
+ *
+ * Calculate the direction a loop is pointing.
+ *
+ * \param l The loop to calculate the direction at
+ * \param r_dir Resulting direction
+ */
+void BM_loop_calc_face_direction(BMLoop *l, float r_dir[3])
+{
+ float v_prev[3];
+ float v_next[3];
+
+ sub_v3_v3v3(v_prev, l->v->co, l->prev->v->co);
+ sub_v3_v3v3(v_next, l->next->v->co, l->v->co);
+
+ normalize_v3(v_prev);
+ normalize_v3(v_next);
+
+ add_v3_v3v3(r_dir, v_prev, v_next);
+ normalize_v3(r_dir);
+}
+
+/**
* \brief BM_loop_calc_face_tangent
*
* Calculate the tangent at this loop corner or fallback to the face normal on straight lines.
@@ -1054,23 +1106,27 @@ void BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3])
{
float v_prev[3];
float v_next[3];
+ float dir[3];
sub_v3_v3v3(v_prev, l->prev->v->co, l->v->co);
sub_v3_v3v3(v_next, l->v->co, l->next->v->co);
normalize_v3(v_prev);
normalize_v3(v_next);
+ add_v3_v3v3(dir, v_prev, v_next);
- if (compare_v3v3(v_prev, v_next, FLT_EPSILON) == false) {
- float dir[3];
+ if (compare_v3v3(v_prev, v_next, FLT_EPSILON * 10.0f) == false) {
float nor[3]; /* for this purpose doesn't need to be normalized */
- add_v3_v3v3(dir, v_prev, v_next);
cross_v3_v3v3(nor, v_prev, v_next);
+ /* concave face check */
+ if (UNLIKELY(dot_v3v3(nor, l->f->no) < 0.0f)) {
+ negate_v3(nor);
+ }
cross_v3_v3v3(r_tangent, dir, nor);
}
else {
/* prev/next are the same - compare with face normal since we don't have one */
- cross_v3_v3v3(r_tangent, v_next, l->f->no);
+ cross_v3_v3v3(r_tangent, dir, l->f->no);
}
normalize_v3(r_tangent);
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h
index 9892700162e..7cb5749a4bf 100644
--- a/source/blender/bmesh/intern/bmesh_queries.h
+++ b/source/blender/bmesh/intern/bmesh_queries.h
@@ -61,9 +61,13 @@ bool BM_edge_is_wire(BMEdge *e);
bool BM_vert_is_manifold(BMVert *v);
bool BM_edge_is_manifold(BMEdge *e);
bool BM_edge_is_boundary(BMEdge *e);
+bool BM_edge_is_contiguous(BMEdge *e);
+
+bool BM_loop_is_convex(BMLoop *l);
float BM_loop_calc_face_angle(BMLoop *l);
void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3]);
+void BM_loop_calc_face_direction(BMLoop *l, float r_normal[3]);
void BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3]);
float BM_edge_calc_face_angle(BMEdge *e);
diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index bbe02a49967..ac6d4089372 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -858,7 +858,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
if (!EDGE_CHECK(e)) {
/* walker won't traverse to a non-manifold edge, but may
* be started on one, and should not traverse *away* from
- * a non-manfold edge (non-manifold edges are never in an
+ * a non-manifold edge (non-manifold edges are never in an
* edge ring with manifold edges */
return e;
}
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index 3a0e18b9ee5..9a17ebea38d 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -359,6 +359,17 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
/* Last point of loop 2 */
v4 = get_outer_vert(bm, ee2[clamp_index(-1, BLI_array_count(ee2))]);
+ /* ugh, happens when bridging single edges, user could just make a face
+ * but better support it for sake of completeness */
+ if (v1 == v2) {
+ BLI_assert(BLI_array_count(ee1) == 1);
+ v2 = (vv1[0] == v2) ? vv1[1] : vv1[0];
+ }
+ if (v3 == v4) {
+ BLI_assert(BLI_array_count(ee2) == 1);
+ v4 = (vv2[0] == v4) ? vv2[1] : vv2[0];
+ }
+
/* If v1 is a better match for v4 than v3, AND v2 is a better match
* for v3 than v4, the loops are in opposite directions, so reverse
* the order of reads from vv1. We can avoid sqrt for comparison */
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 744f706681d..3d78ff64876 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -37,45 +37,22 @@
#include "intern/bmesh_operators_private.h" /* own include */
-#define EDGE_NEW 1
-#define FACE_NEW 1
-
#define ELE_NEW 1
#define FACE_MARK 2
#define EDGE_MARK 4
void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
{
- BMOIter siter;
- BMFace *face, **newfaces = NULL;
- BLI_array_declare(newfaces);
- float (*projectverts)[3] = NULL;
- BLI_array_declare(projectverts);
- int i;
const bool use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty");
BMOpSlot *slot_facemap_out = BMO_slot_get(op->slots_out, "face_map.out");
- 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);
-
- BLI_array_grow_items(projectverts, face->len * 3);
- BLI_array_grow_items(newfaces, face->len);
+ BM_mesh_elem_hflag_disable_all(bm, BM_FACE | BM_EDGE, BM_ELEM_TAG, false);
+ BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false);
- BM_face_triangulate(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces, use_beauty);
+ BM_mesh_triangulate(bm, use_beauty, true, op, slot_facemap_out);
- BMO_slot_map_elem_insert(op, slot_facemap_out, face, face);
- for (i = 0; newfaces[i]; i++) {
- BMO_slot_map_elem_insert(op, slot_facemap_out, newfaces[i], face);
- }
- }
-
- 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);
+ BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_TAG);
+ BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
}
void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
@@ -86,7 +63,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
BMEdge *e;
int stop = 0;
- BMO_slot_buffer_flag_enable(bm, op->slots_in, "constrain_edges", BM_EDGE, EDGE_MARK);
+ BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK);
BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
if (f->len == 3) {
@@ -98,9 +75,11 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
stop = 1;
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
- BMVert *v1, *v2, *v3, *v4;
+ float v1_xy[2], v2_xy[2], v3_xy[2], v4_xy[2];
+ float no[3];
+ float axis_mat[3][3];
- if (!BM_edge_is_manifold(e) || BMO_elem_flag_test(bm, e, EDGE_MARK)) {
+ if (!BM_edge_is_manifold(e) || !BMO_elem_flag_test(bm, e, EDGE_MARK)) {
continue;
}
@@ -110,37 +89,51 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
continue;
}
- v1 = e->l->prev->v;
- v2 = e->l->v;
- v3 = e->l->radial_next->prev->v;
- v4 = e->l->next->v;
-
- if (is_quad_convex_v3(v1->co, v2->co, v3->co, v4->co)) {
+ {
+ float *v1, *v2, *v3, *v4;
+ float no_a[3], no_b[3];
+ v1 = e->l->prev->v->co;
+ v2 = e->l->v->co;
+ v3 = e->l->radial_next->prev->v->co;
+ v4 = e->l->next->v->co;
+
+ normal_tri_v3(no_a, v1, v2, v3);
+ normal_tri_v3(no_b, v1, v3, v4);
+ add_v3_v3v3(no, no_a, no_b);
+ normalize_v3(no);
+ axis_dominant_v3_to_m3(axis_mat, no);
+ mul_v2_m3v3(v1_xy, axis_mat, v1);
+ mul_v2_m3v3(v2_xy, axis_mat, v2);
+ mul_v2_m3v3(v3_xy, axis_mat, v3);
+ mul_v2_m3v3(v4_xy, axis_mat, v4);
+ }
+
+ if (is_quad_convex_v2(v1_xy, v2_xy, v3_xy, v4_xy)) {
float len1, len2, len3, len4, len5, len6, opp1, opp2, fac1, fac2;
/* testing rule:
* the area divided by the total edge lengths
*/
- len1 = len_v3v3(v1->co, v2->co);
- len2 = len_v3v3(v2->co, v3->co);
- len3 = len_v3v3(v3->co, v4->co);
- len4 = len_v3v3(v4->co, v1->co);
- len5 = len_v3v3(v1->co, v3->co);
- len6 = len_v3v3(v2->co, v4->co);
+ len1 = len_v2v2(v1_xy, v2_xy);
+ len2 = len_v2v2(v2_xy, v3_xy);
+ len3 = len_v2v2(v3_xy, v4_xy);
+ len4 = len_v2v2(v4_xy, v1_xy);
+ len5 = len_v2v2(v1_xy, v3_xy);
+ len6 = len_v2v2(v2_xy, v4_xy);
- opp1 = area_tri_v3(v1->co, v2->co, v3->co);
- opp2 = area_tri_v3(v1->co, v3->co, v4->co);
+ opp1 = area_tri_v2(v1_xy, v2_xy, v3_xy);
+ opp2 = area_tri_v2(v1_xy, v3_xy, v4_xy);
fac1 = opp1 / (len1 + len2 + len5) + opp2 / (len3 + len4 + len5);
- opp1 = area_tri_v3(v2->co, v3->co, v4->co);
- opp2 = area_tri_v3(v2->co, v4->co, v1->co);
+ opp1 = area_tri_v2(v2_xy, v3_xy, v4_xy);
+ opp2 = area_tri_v2(v2_xy, v4_xy, v1_xy);
fac2 = opp1 / (len2 + len3 + len6) + opp2 / (len4 + len1 + len6);
if (fac1 > fac2) {
e = BM_edge_rotate(bm, e, false, BM_EDGEROT_CHECK_EXISTS);
if (e) {
- BMO_elem_flag_enable(bm, e, ELE_NEW);
+ BMO_elem_flag_enable(bm, e, ELE_NEW | EDGE_MARK);
BMO_elem_flag_enable(bm, e->l->f, FACE_MARK | ELE_NEW);
BMO_elem_flag_enable(bm, e->l->radial_next->f, FACE_MARK | ELE_NEW);
@@ -156,9 +149,9 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
{
+ const bool use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty");
BMOIter siter;
BMEdge *e;
- BMOperator bmop;
ScanFillContext sf_ctx;
/* ScanFillEdge *sf_edge; */ /* UNUSED */
ScanFillVert *sf_vert, *sf_vert_1, *sf_vert_2;
@@ -210,11 +203,14 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
BLI_scanfill_end(&sf_ctx);
BLI_smallhash_release(&hash);
- /* 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.slots_out, "geom.out", BM_FACE | BM_EDGE, ELE_NEW);
- BMO_op_finish(bm, &bmop);
+ if (use_beauty) {
+ BMOperator bmop;
+
+ BMO_op_initf(bm, &bmop, op->flag, "beautify_fill faces=%ff edges=%Fe", ELE_NEW, EDGE_MARK);
+ BMO_op_exec(bm, &bmop);
+ 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, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW);
}
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 5461e5fe788..1e74354603b 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -384,6 +384,7 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid,
int iret;
BLI_assert(f1 != NULL && f2 != NULL);
+ (void)f1, (void)f2; /* UNUSED */
/* get direction vectors for two offset lines */
sub_v3_v3v3(dir1, v->co, BM_edge_other_vert(e1->e, v)->co);
@@ -518,7 +519,7 @@ static int bev_ccw_test(BMEdge *a, BMEdge *b, BMFace *f)
* We want M to make M*A=B where A has the left side above, as columns
* and B has the right side as columns - both extended into homogeneous coords.
* So M = B*(Ainverse). Doing Ainverse by hand gives the code below.
-*/
+ */
static int make_unit_square_map(const float va[3], const float vmid[3], const float vb[3],
float r_mat[4][4])
{
@@ -1304,7 +1305,7 @@ static void fix_vmesh_tangents(VMesh *vm, BevVert *bv)
/* Also want (i, 1, k) snapped to plane of adjacent face for
* 1 < k < ns - 1, but current initial cage and subdiv rules
- * ensure this, so nothing to do */
+ * ensure this, so nothing to do */
} while ((bndv = bndv->next) != vm->boundstart);
}
@@ -1654,7 +1655,13 @@ static void build_vmesh(BevelParams *bp, BMesh *bm, BevVert *bv)
if (v->ebev) {
va = mesh_vert(vm, i, 0, 0)->co;
vb = mesh_vert(vm, i, 0, ns)->co;
- project_to_edge(v->ebev->e, va, vb, midco);
+ if (bv->edgecount == 3 && bv->selcount == 1) {
+ /* special case: profile cuts the third face, so line it up with that */
+ copy_v3_v3(midco, bv->v->co);
+ }
+ else {
+ project_to_edge(v->ebev->e, va, vb, midco);
+ }
for (k = 1; k < ns; k++) {
get_point_on_round_edge(v->ebev, k, va, midco, vb, co);
copy_v3_v3(mesh_vert(vm, i, 0, k)->co, co);
diff --git a/source/blender/bmesh/tools/bmesh_triangulate.c b/source/blender/bmesh/tools/bmesh_triangulate.c
new file mode 100644
index 00000000000..79f6c76afc7
--- /dev/null
+++ b/source/blender/bmesh/tools/bmesh_triangulate.c
@@ -0,0 +1,87 @@
+/*
+ * ***** 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): Joseph Eagar
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/tools/bmesh_triangulate.c
+ * \ingroup bmesh
+ *
+ * Triangulate.
+ *
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_array.h"
+
+#include "bmesh.h"
+
+#include "bmesh_triangulate.h" /* own include */
+
+/**
+ * a version of #BM_face_triangulate that maps to #BMOpSlot
+ */
+static void bm_face_triangulate_mapping(BMesh *bm, BMFace *face, const bool use_beauty, const bool use_tag,
+ BMOperator *op, BMOpSlot *slot_facemap_out)
+{
+ const int faces_array_tot = face->len - 3;
+ BMFace **faces_array = BLI_array_alloca(faces_array, faces_array_tot);
+ BLI_assert(face->len > 3);
+
+ BM_face_triangulate(bm, face, faces_array, use_beauty, use_tag);
+
+ if (faces_array) {
+ int i;
+ BMO_slot_map_elem_insert(op, slot_facemap_out, face, face);
+ for (i = 0; i < faces_array_tot; i++) {
+ BMO_slot_map_elem_insert(op, slot_facemap_out, faces_array[i], face);
+ }
+ }
+}
+
+
+void BM_mesh_triangulate(BMesh *bm, const bool use_beauty, const bool tag_only,
+ BMOperator *op, BMOpSlot *slot_facemap_out)
+{
+ BMIter iter;
+ BMFace *face;
+
+ if (slot_facemap_out) {
+ /* same as below but call: bm_face_triangulate_mapping() */
+ BM_ITER_MESH (face, &iter, bm, BM_FACES_OF_MESH) {
+ if (face->len > 3) {
+ if (tag_only == false || BM_elem_flag_test(face, BM_ELEM_TAG)) {
+ bm_face_triangulate_mapping(bm, face, use_beauty, tag_only,
+ op, slot_facemap_out);
+ }
+ }
+ }
+ }
+ else {
+ BM_ITER_MESH (face, &iter, bm, BM_FACES_OF_MESH) {
+ if (face->len > 3) {
+ if (tag_only == false || BM_elem_flag_test(face, BM_ELEM_TAG)) {
+ BM_face_triangulate(bm, face, NULL, use_beauty, tag_only);
+ }
+ }
+ }
+ }
+}
diff --git a/source/blender/bmesh/tools/bmesh_triangulate.h b/source/blender/bmesh/tools/bmesh_triangulate.h
new file mode 100644
index 00000000000..936a90d3a16
--- /dev/null
+++ b/source/blender/bmesh/tools/bmesh_triangulate.h
@@ -0,0 +1,36 @@
+/*
+ * ***** 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): Joseph Eagar
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/tools/bmesh_triangulate.h
+ * \ingroup bmesh
+ *
+ * Triangulate.
+ *
+ */
+
+#ifndef __BMESH_TRIAMGULATE_H__
+#define __BMESH_TRIAMGULATE_H__
+
+void BM_mesh_triangulate(BMesh *bm, const bool use_beauty, const bool tag_only,
+ BMOperator *op, BMOpSlot *slot_facemap_out);
+
+#endif /* __BMESH_TRIAMGULATE_H__ */
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 493d15135a7..4a0696dc857 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -84,9 +84,9 @@ void AnimationExporter::operator()(Object *ob)
}
}
-
- export_object_constraint_animation(ob);
-
+
+ export_object_constraint_animation(ob);
+
//This needs to be handled by extra profiles, so postponed for now
//export_morph_animation(ob);
@@ -149,11 +149,11 @@ void AnimationExporter::operator()(Object *ob)
void AnimationExporter::export_object_constraint_animation(Object *ob)
{
std::vector<float> fra;
- //Takes frames of target animations
+ //Takes frames of target animations
make_anim_frames_from_targets(ob, fra);
-
+
if (fra.size())
- dae_baked_object_animation(fra, ob);
+ dae_baked_object_animation(fra, ob);
}
void AnimationExporter::export_morph_animation(Object *ob)
@@ -274,8 +274,8 @@ void AnimationExporter::dae_animation(Object *ob, FCurve *fcu, char *transformNa
//axis names for colors
else if (!strcmp(transformName, "color") ||
- !strcmp(transformName, "specular_color") ||
- !strcmp(transformName, "diffuse_color") ||
+ !strcmp(transformName, "specular_color") ||
+ !strcmp(transformName, "diffuse_color") ||
!strcmp(transformName, "alpha"))
{
const char *axis_names[] = {"R", "G", "B"};
@@ -285,9 +285,9 @@ void AnimationExporter::dae_animation(Object *ob, FCurve *fcu, char *transformNa
//axis names for transforms
else if (!strcmp(transformName, "location") ||
- !strcmp(transformName, "scale") ||
+ !strcmp(transformName, "scale") ||
!strcmp(transformName, "rotation_euler") ||
- !strcmp(transformName, "rotation_quaternion"))
+ !strcmp(transformName, "rotation_quaternion"))
{
const char *axis_names[] = {"X", "Y", "Z"};
if (fcu->array_index < 3)
@@ -439,11 +439,11 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
std::vector<float> fra;
//char prefix[256];
- FCurve *fcu = (FCurve *)ob_arm->adt->action->curves.first;
-
//Check if there is a fcurve in the armature for the bone in param
//when baking this check is not needed, solve every bone for every frame.
- /*while (fcu) {
+ /*FCurve *fcu = (FCurve *)ob_arm->adt->action->curves.first;
+
+ while (fcu) {
std::string bone_name = getObjectBoneName(ob_arm, fcu);
int val = BLI_strcasecmp((char *)bone_name.c_str(), bone->name);
if (val == 0) break;
@@ -526,7 +526,7 @@ void AnimationExporter::dae_baked_object_animation(std::vector<float> &fra, Obje
return;
BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s", (char*)translate_id(ob_name).c_str(),
- "object_matrix");
+ "object_matrix");
openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
@@ -730,7 +730,6 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
values[1] = bezt->vec[2][1];
}
break;
- break;
default:
*length = 0;
break;
@@ -898,11 +897,10 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
add_source_parameters(param, semantic, false, NULL, true);
source.prepareToAppendValues();
-
+
bPoseChannel *parchan = NULL;
bPoseChannel *pchan = NULL;
- bPoseChannel *rootchan = NULL;
-
+
if (ob->type == OB_ARMATURE ){
bPose *pose = ob->pose;
pchan = BKE_pose_channel_find_name(pose, bone->name);
@@ -918,7 +916,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
int j = 0;
for (it = frames.begin(); it != frames.end(); it++) {
float mat[4][4], ipar[4][4];
-
+
float ctime = BKE_scene_frame_get_from_ctime(scene, *it);
CFRA = BKE_scene_frame_get_from_ctime(scene, *it);
//BKE_scene_update_for_newframe(G.main,scene,scene->lay);
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 36993eae7b6..0929bfda6e7 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -104,19 +104,19 @@ bool ArmatureExporter::add_instance_controller(Object *ob)
for (bone = (Bone *)arm->bonebase.first; bone; bone = bone->next) {
write_bone_URLs(ins, ob_arm, bone);
}
-
+
InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob, this->export_settings->active_uv_only);
ins.add();
return true;
}
+#if 0
void ArmatureExporter::operator()(Object *ob)
{
Object *ob_arm = bc_get_assigned_armature(ob);
}
-#if 0
bool ArmatureExporter::already_written(Object *ob_arm)
{
@@ -248,7 +248,7 @@ void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, COLLADA
void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node)
{
- bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name);
+ //bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name);
float mat[4][4];
diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h
index e2496a4e578..6222496a9f7 100644
--- a/source/blender/collada/ArmatureExporter.h
+++ b/source/blender/collada/ArmatureExporter.h
@@ -67,7 +67,7 @@ public:
//void export_controllers(Scene *sce);*/
- void operator()(Object *ob);
+ //void operator()(Object *ob);
private:
Scene *scene;
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 58c3f34e093..86d9de64085 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -200,7 +200,6 @@ void ArmatureImporter::add_leaf_bone(float mat[4][4], EditBone *bone, COLLADAFW
void ArmatureImporter::fix_leaf_bones( )
{
// just setting tail for leaf bones here
- float correctionMin = 1.0f;
std::vector<LeafBone>::iterator it;
for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) {
LeafBone& leaf = *it;
@@ -212,7 +211,7 @@ void ArmatureImporter::fix_leaf_bones( )
mul_v3_fl(vec, leaf_bone_length);
add_v3_v3v3(leaf.bone->tail, leaf.bone->head , vec);
- }
+ }
}
#if 0
@@ -320,7 +319,7 @@ void ArmatureImporter::create_armature_bones( )
if (!ob_arm)
continue;
-
+
ED_armature_to_edit(ob_arm);
/*
@@ -328,8 +327,8 @@ void ArmatureImporter::create_armature_bones( )
* check if bones have already been created for a given joint
*/
- create_bone(NULL, *ri , NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature *)ob_arm->data);
-
+ create_bone(NULL, *ri , NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature *)ob_arm->data);
+
//leaf bone tails are derived from the matrix, so no need of this.
fix_leaf_bones();
@@ -337,15 +336,13 @@ void ArmatureImporter::create_armature_bones( )
unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
ED_armature_from_edit(ob_arm);
-
+
//This serves no purpose, as pose is automatically reset later, in BKE_where_is_bone()
//set_pose(ob_arm, *ri, NULL, NULL);
ED_armature_edit_free(ob_arm);
DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB | OB_RECALC_DATA);
}
-
-
}
void ArmatureImporter::create_armature_bones(SkinInfo& skin)
@@ -466,8 +463,6 @@ void ArmatureImporter::set_pose(Object *ob_arm, COLLADAFW::Node *root_node, con
float mat[4][4];
float obmat[4][4];
- float angle = 0.0f;
-
// object-space
get_node_mat(obmat, root_node, NULL, NULL);
@@ -492,6 +487,7 @@ void ArmatureImporter::set_pose(Object *ob_arm, COLLADAFW::Node *root_node, con
}
+ //float angle = 0.0f;
///*mat4_to_axis_angle(ax, &angle, mat);
//pchan->bone->roll = angle;*/
@@ -652,12 +648,12 @@ bool ArmatureImporter::write_controller(const COLLADAFW::Controller *controller)
void ArmatureImporter::make_shape_keys(){
std::vector<COLLADAFW::MorphController *>::iterator mc;
float weight;
-
+
for (mc = morph_controllers.begin(); mc != morph_controllers.end(); mc++) {
//Controller data
COLLADAFW::UniqueIdArray& morphTargetIds = (*mc)->getMorphTargets();
COLLADAFW::FloatOrDoubleArray& morphWeights = (*mc)->getMorphWeights();
-
+
//Prereq: all the geometries must be imported and mesh objects must be made
Object *source_ob = this->mesh_importer->get_object_by_geom_uid((*mc)->getSource());
diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt
index 7f389346a81..326ca2b9937 100644
--- a/source/blender/collada/CMakeLists.txt
+++ b/source/blender/collada/CMakeLists.txt
@@ -57,6 +57,7 @@ set(SRC
EffectExporter.cpp
ErrorHandler.cpp
ExportSettings.cpp
+ ImportSettings.cpp
ExtraHandler.cpp
ExtraTags.cpp
GeometryExporter.cpp
@@ -84,6 +85,7 @@ set(SRC
EffectExporter.h
ErrorHandler.h
ExportSettings.h
+ ImportSettings.h
ExtraHandler.h
ExtraTags.h
GeometryExporter.h
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index d41c907ee98..57047346617 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -96,7 +96,7 @@ bool ControllerExporter::add_instance_controller(Object *ob)
for (bone = (Bone *)arm->bonebase.first; bone; bone = bone->next) {
write_bone_URLs(ins, ob_arm, bone);
}
-
+
InstanceWriter::add_material_bindings(ins.getBindMaterial(), ob, this->export_settings->active_uv_only);
ins.add();
@@ -246,10 +246,13 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
float sumw = 0.0f;
for (j = 0; j < vert->totweight; j++) {
- int joint_index = joint_index_by_def_index[vert->dw[j].def_nr];
- if (joint_index != -1 && vert->dw[j].weight > 0.0f) {
- jw[joint_index] += vert->dw[j].weight;
- sumw += vert->dw[j].weight;
+ int idx = vert->dw[j].def_nr;
+ if (idx >= 0) {
+ int joint_index = joint_index_by_def_index[idx];
+ if (joint_index != -1 && vert->dw[j].weight > 0.0f) {
+ jw[joint_index] += vert->dw[j].weight;
+ sumw += vert->dw[j].weight;
+ }
}
}
@@ -302,7 +305,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key)
openMorph(controller_id, controller_name,
COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob, use_instantiation)));
-
+
std::string targets_id = add_morph_targets(key, ob);
std::string morph_weights_id = add_morph_weights(key, ob);
@@ -320,7 +323,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key)
{
BKE_libblock_free_us(&(G.main->mesh), me);
}
-
+
//support for animations
//can also try the base element and param alternative
add_weight_extras(key);
@@ -337,7 +340,7 @@ std::string ControllerExporter::add_morph_targets(Key *key, Object *ob)
source.setArrayId(source_id + ARRAY_ID_SUFFIX);
source.setAccessorCount(key->totkey - 1);
source.setAccessorStride(1);
-
+
COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
param.push_back("IDREF");
@@ -366,7 +369,7 @@ std::string ControllerExporter::add_morph_weights(Key *key, Object *ob)
source.setArrayId(source_id + ARRAY_ID_SUFFIX);
source.setAccessorCount(key->totkey - 1);
source.setAccessorStride(1);
-
+
COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
param.push_back("MORPH_WEIGHT");
@@ -393,6 +396,7 @@ void ControllerExporter::add_weight_extras(Key *key){
//skip the basis
kb = kb->next;
for (; kb; kb = kb->next) {
+ // XXX why is the weight not used here and set to 0.0?
float weight = kb->curval;
extra.addExtraTechniqueParameter ("KHR", "morph_weights" , 0.000, "MORPH_WEIGHT_TO_TARGET");
}
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 1d8be5910c6..7437401ed09 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -76,6 +76,9 @@ extern "C" {
#include "MEM_guardedalloc.h"
+#include "WM_api.h"
+#include "WM_types.h"
+
}
#include "ExtraHandler.h"
@@ -96,9 +99,9 @@ extern "C" {
// creates empties for each imported bone on layer 2, for debugging
// #define ARMATURE_TEST
-DocumentImporter::DocumentImporter(bContext *C, const char *filename) :
+DocumentImporter::DocumentImporter(bContext *C, const ImportSettings *import_settings) :
+ import_settings(import_settings),
mImportStage(General),
- mFilename(filename),
mContext(C),
armature_importer(&unit_converter, &mesh_importer, &anim_importer, CTX_data_scene(C)),
mesh_importer(&unit_converter, &armature_importer, CTX_data_scene(C)),
@@ -128,7 +131,9 @@ bool DocumentImporter::import()
// deselect all to select new objects
BKE_scene_base_deselect_all(CTX_data_scene(mContext));
- if (!root.loadDocument(mFilename)) {
+ std::string mFilename = std::string(this->import_settings->filepath);
+ const std::string encodedFilename = bc_url_encode(mFilename);
+ if (!root.loadDocument(encodedFilename)) {
fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 1st pass\n");
return false;
}
@@ -143,7 +148,7 @@ bool DocumentImporter::import()
COLLADASaxFWL::Loader loader2;
COLLADAFW::Root root2(&loader2, this);
- if (!root2.loadDocument(mFilename)) {
+ if (!root2.loadDocument(encodedFilename)) {
fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 2nd pass\n");
return false;
}
@@ -184,29 +189,47 @@ void DocumentImporter::finish()
Scene *sce = CTX_data_scene(mContext);
// for scene unit settings: system, scale_length
+
RNA_id_pointer_create(&sce->id, &sceneptr);
unit_settings = RNA_pointer_get(&sceneptr, "unit_settings");
system = RNA_struct_find_property(&unit_settings, "system");
scale = RNA_struct_find_property(&unit_settings, "scale_length");
-
- switch (unit_converter.isMetricSystem()) {
- case UnitConverter::Metric:
- RNA_property_enum_set(&unit_settings, system, USER_UNIT_METRIC);
- break;
- case UnitConverter::Imperial:
- RNA_property_enum_set(&unit_settings, system, USER_UNIT_IMPERIAL);
- break;
- default:
- RNA_property_enum_set(&unit_settings, system, USER_UNIT_NONE);
- break;
+
+ if (this->import_settings->import_units) {
+
+ switch (unit_converter.isMetricSystem()) {
+ case UnitConverter::Metric:
+ RNA_property_enum_set(&unit_settings, system, USER_UNIT_METRIC);
+ break;
+ case UnitConverter::Imperial:
+ RNA_property_enum_set(&unit_settings, system, USER_UNIT_IMPERIAL);
+ break;
+ default:
+ RNA_property_enum_set(&unit_settings, system, USER_UNIT_NONE);
+ break;
+ }
+ float unit_factor = unit_converter.getLinearMeter();
+ RNA_property_float_set(&unit_settings, scale, unit_factor);
+ fprintf(stdout, "Collada: Adjusting Blender units to Importset units: %f.\n", unit_factor);
+
+ }
+ else {
+ // TODO: add automatic scaling for the case when Blender units
+ // and import units are set to different values.
}
- RNA_property_float_set(&unit_settings, scale, unit_converter.getLinearMeter());
-
- const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
+ // Write nodes to scene
+ const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
for (unsigned int i = 0; i < roots.getCount(); i++) {
write_node(roots[i], NULL, sce, NULL, false);
}
+
+ // update scene
+ Main *bmain = CTX_data_main(mContext);
+ DAG_scene_sort(bmain, sce);
+ DAG_ids_flush_update(bmain, 0);
+ WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL);
+
}
@@ -414,7 +437,7 @@ void DocumentImporter::create_constraints(ExtraTags *et, Object *ob){
std::string name;
short* type = 0;
et->setData("type", type);
- bConstraint * con = BKE_add_ob_constraint(ob, "Test_con", *type);
+ BKE_add_ob_constraint(ob, "Test_con", *type);
}
}
@@ -424,11 +447,16 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
Object *ob = NULL;
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
bool read_transform = true;
-
- ExtraTags *et = getExtraTags(node->getUniqueId());
+ std::string id = node->getOriginalId();
+ std::string name = node->getName();
std::vector<Object *> *objects_done = new std::vector<Object *>();
-
+
+ fprintf(stderr,
+ "Writing node id='%s', name='%s'\n",
+ id.c_str(),
+ name.c_str());
+
if (is_joint) {
armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par, sce);
}
@@ -450,13 +478,21 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
while (geom_done < geom.getCount()) {
ob = mesh_importer.create_mesh_object(node, geom[geom_done], false, uid_material_map,
material_texture_mapping_map);
- objects_done->push_back(ob);
+ if (ob == NULL) {
+ fprintf(stderr,
+ "<node id=\"%s\", name=\"%s\" >...contains a reference to an unknown instance_mesh.\n",
+ id.c_str(),
+ name.c_str());
+ }
+ else {
+ objects_done->push_back(ob);
+ }
++geom_done;
}
while (camera_done < camera.getCount()) {
ob = create_camera_object(camera[camera_done], sce);
if (ob == NULL) {
- std::string id = node->getOriginalId();
+ std::string id = node->getOriginalId();
std::string name = node->getName();
fprintf(stderr, "<node id=\"%s\", name=\"%s\" >...contains a reference to an unknown instance_camera.\n", id.c_str(), name.c_str());
}
@@ -539,8 +575,11 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
}
// if node has child nodes write them
COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
- for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
- write_node(child_nodes[i], node, sce, ob, is_library_node);
+ if (objects_done->size() > 0) {
+ ob = *objects_done->begin();
+ for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
+ write_node(child_nodes[i], node, sce, ob, is_library_node);
+ }
}
}
@@ -603,7 +642,7 @@ bool DocumentImporter::writeMaterial(const COLLADAFW::Material *cmat)
return true;
const std::string& str_mat_id = cmat->getName().size() ? cmat->getName() : cmat->getOriginalId();
- Material *ma = BKE_material_add((char *)str_mat_id.c_str());
+ Material *ma = BKE_material_add(G.main, (char *)str_mat_id.c_str());
this->uid_effect_map[cmat->getInstantiatedEffect()] = ma;
this->uid_material_map[cmat->getUniqueId()] = ma;
@@ -627,7 +666,7 @@ MTex *DocumentImporter::create_texture(COLLADAFW::EffectCommon *ef, COLLADAFW::T
ma->mtex[i] = add_mtex();
ma->mtex[i]->texco = TEXCO_UV;
- ma->mtex[i]->tex = add_texture("Texture");
+ ma->mtex[i]->tex = add_texture(G.main, "Texture");
ma->mtex[i]->tex->type = TEX_IMAGE;
ma->mtex[i]->tex->ima = uid_image_map[ima_uid];
@@ -833,8 +872,8 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera)
cam_id = camera->getOriginalId();
cam_name = camera->getName();
- if (cam_name.size()) cam = (Camera *)BKE_camera_add((char *)cam_name.c_str());
- else cam = (Camera *)BKE_camera_add((char *)cam_id.c_str());
+ if (cam_name.size()) cam = (Camera *)BKE_camera_add(G.main, (char *)cam_name.c_str());
+ else cam = (Camera *)BKE_camera_add(G.main, (char *)cam_id.c_str());
if (!cam) {
fprintf(stderr, "Cannot create camera.\n");
@@ -948,7 +987,7 @@ bool DocumentImporter::writeImage(const COLLADAFW::Image *image)
// XXX maybe it is necessary to check if the path is absolute or relative
const std::string& filepath = image->getImageURI().toNativePath();
- const char *filename = (const char *)mFilename.c_str();
+ const char *filename = (const char *)filepath.c_str();
char dir[FILE_MAX];
char full_path[FILE_MAX];
@@ -983,8 +1022,8 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
la_id = light->getOriginalId();
la_name = light->getName();
- if (la_name.size()) lamp = (Lamp *)BKE_lamp_add((char *)la_name.c_str());
- else lamp = (Lamp *)BKE_lamp_add((char *)la_id.c_str());
+ if (la_name.size()) lamp = (Lamp *)BKE_lamp_add(G.main, (char *)la_name.c_str());
+ else lamp = (Lamp *)BKE_lamp_add(G.main, (char *)la_id.c_str());
if (!lamp) {
fprintf(stderr, "Cannot create lamp.\n");
@@ -1205,8 +1244,9 @@ bool DocumentImporter::is_armature(COLLADAFW::Node *node){
if(child_nodes[i]->getType() == COLLADAFW::Node::JOINT) return true;
else continue;
}
-
+
//no child is JOINT
return false;
}
+
diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h
index 7e3476fb7e0..76d16f38a0c 100644
--- a/source/blender/collada/DocumentImporter.h
+++ b/source/blender/collada/DocumentImporter.h
@@ -47,6 +47,7 @@
#include "ArmatureImporter.h"
#include "ControllerExporter.h"
#include "MeshImporter.h"
+#include "ImportSettings.h"
@@ -63,7 +64,7 @@ public:
Controller, //!< Second pass to collect controller data
};
/** Constructor */
- DocumentImporter(bContext *C, const char *filename);
+ DocumentImporter(bContext *C, const ImportSettings *import_settings);
/** Destructor */
~DocumentImporter();
@@ -137,10 +138,10 @@ public:
private:
+ const ImportSettings *import_settings;
/** Current import stage we're in. */
ImportStage mImportStage;
- std::string mFilename;
bContext *mContext;
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 6673e1de815..0720c1f9b81 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -157,7 +157,7 @@ void GeometryExporter::operator()(Object *ob)
if (this->export_settings->apply_modifiers) {
BKE_libblock_free_us(&(G.main->mesh), me);
}
-
+
if (this->export_settings->include_shapekeys) {
Key * key = BKE_key_from_object(ob);
if(key) {
diff --git a/source/blender/collada/ImportSettings.cpp b/source/blender/collada/ImportSettings.cpp
new file mode 100644
index 00000000000..74607787f25
--- /dev/null
+++ b/source/blender/collada/ImportSettings.cpp
@@ -0,0 +1,27 @@
+/*
+ * ***** 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): Gaia Clary.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/collada/ExportSettings.cpp
+ * \ingroup collada
+ */
+
+#include "ImportSettings.h"
diff --git a/source/blender/collada/ImportSettings.h b/source/blender/collada/ImportSettings.h
new file mode 100644
index 00000000000..3f3a9fb354e
--- /dev/null
+++ b/source/blender/collada/ImportSettings.h
@@ -0,0 +1,39 @@
+/*
+ * ***** 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): Gaia Clary
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file ExportSettings.h
+ * \ingroup collada
+ */
+
+#ifndef __IMPORTSETTINGS_H__
+#define __IMPORTSETTINGS_H__
+
+#include "collada.h"
+
+struct ImportSettings {
+public:
+ bool import_units;
+
+ char *filepath;
+};
+
+#endif
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index febfb772430..bf5a39cfae8 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -63,10 +63,9 @@ extern "C" {
// get node name, or fall back to original id if not present (name is optional)
template<class T>
-static const char *bc_get_dae_name(T *node)
+static const std::string bc_get_dae_name(T *node)
{
- const std::string& name = node->getName();
- return name.size() ? name.c_str() : node->getOriginalId().c_str();
+ return node->getName().size() ? node->getName(): node->getOriginalId();
}
static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type)
@@ -268,7 +267,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has su
{
COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
- const char *name = bc_get_dae_name(mesh);
+ const std::string &name = bc_get_dae_name(mesh);
for (unsigned i = 0; i < prim_arr.getCount(); i++) {
@@ -287,7 +286,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has su
int count = vca[j];
if (count < 3) {
fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n",
- type_str, name);
+ type_str, name.c_str());
return false;
}
}
@@ -305,7 +304,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has su
}
if (mesh->getPositions().empty()) {
- fprintf(stderr, "Mesh %s has no vertices.\n", name);
+ fprintf(stderr, "Mesh %s has no vertices.\n", name.c_str());
return false;
}
@@ -1291,12 +1290,12 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom)
COLLADAFW::Mesh *mesh = (COLLADAFW::Mesh *)geom;
if (!is_nice_mesh(mesh)) {
- fprintf(stderr, "Ignoring mesh %s\n", bc_get_dae_name(mesh));
+ fprintf(stderr, "Ignoring mesh %s\n", bc_get_dae_name(mesh).c_str());
return true;
}
const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId();
- Mesh *me = BKE_mesh_add((char *)str_geom_id.c_str());
+ Mesh *me = BKE_mesh_add(G.main, (char *)str_geom_id.c_str());
me->id.us--; // is already 1 here, but will be set later in set_mesh
// store the Mesh pointer to link it later with an Object
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index bb33e4084e0..3a06ca3bc0e 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -184,7 +184,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
if (ob->constraints.first != NULL ){
bConstraint *con = (bConstraint*) ob->constraints.first;
- while(con){
+ while (con) {
std::string con_name(id_name(con));
std::string con_tag = con_name + "_constraint";
colladaNode.addExtraTechniqueChildParameter("blender",con_tag,"type",con->type);
@@ -209,7 +209,6 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
cti->get_constraint_targets(con, &targets);
if(cti){
- int i = 1;
for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next){
obtar = ct->tar;
std::string tar_id(id_name(obtar));
@@ -217,7 +216,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
}
}
}
-
+
con = con->next;
}
}
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index 24124c7b58d..913c0710cc6 100644
--- a/source/blender/collada/TransformReader.cpp
+++ b/source/blender/collada/TransformReader.cpp
@@ -45,12 +45,13 @@ void TransformReader::get_node_mat(float mat[4][4], COLLADAFW::Node *node, std::
COLLADAFW::Transformation *tm = node->getTransformations()[i];
COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
-
- if(type == COLLADAFW::Transformation::MATRIX){
+
+ if (type == COLLADAFW::Transformation::MATRIX){
+ // XXX why does this return and discard all following transformations?
dae_matrix_to_mat4(tm, mat);
return;
}
- else{
+ else {
switch (type) {
case COLLADAFW::Transformation::TRANSLATE:
dae_translate_to_mat4(tm, cur);
diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp
index f06c8cb9e00..fb8ba567192 100644
--- a/source/blender/collada/TransformWriter.cpp
+++ b/source/blender/collada/TransformWriter.cpp
@@ -111,7 +111,7 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
node.addMatrix("parentinverse", dmat);
}
}
-
+
double d_obmat[4][4];
converter.mat4_to_dae_double(d_obmat, ob->obmat);
node.addMatrix("transform",d_obmat);
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index ef34c55bbe6..1aff0f166ba 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -31,6 +31,7 @@
#include "DocumentExporter.h"
#include "DocumentImporter.h"
#include "ExportSettings.h"
+#include "ImportSettings.h"
extern "C"
{
@@ -42,9 +43,17 @@ extern "C"
#include "BLI_path_util.h"
#include "BLI_linklist.h"
-int collada_import(bContext *C, const char *filepath)
+int collada_import(bContext *C,
+ const char *filepath,
+ int import_units)
{
- DocumentImporter imp(C, filepath);
+
+ ImportSettings import_settings;
+ import_settings.filepath = (char *)filepath;
+
+ import_settings.import_units = import_units != 0;
+
+ DocumentImporter imp(C, &import_settings);
if (imp.import()) return 1;
return 0;
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index a02e3e007ae..587dc37b7db 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -46,7 +46,10 @@ struct Scene;
/*
* both return 1 on success, 0 on error
*/
-int collada_import(bContext *C, const char *filepath);
+int collada_import(bContext *C,
+ const char *filepath,
+ int import_units);
+
int collada_export(Scene *sce,
const char *filepath,
int apply_modifiers,
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 7bdda387d5e..27af5c0aba2 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -49,6 +49,7 @@ extern "C" {
#include "BKE_customdata.h"
#include "BKE_depsgraph.h"
#include "BKE_object.h"
+#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_scene.h"
#include "BKE_DerivedMesh.h"
@@ -115,16 +116,19 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
par->recalc |= OB_RECALC_OB;
+ /** done once after import
DAG_scene_sort(bmain, sce);
DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
+ */
+
return true;
}
Object *bc_add_object(Scene *scene, int type, const char *name)
{
- Object *ob = BKE_object_add_only_object(type, name);
+ Object *ob = BKE_object_add_only_object(G.main, type, name);
ob->data = BKE_object_obdata_add_from_type(type);
ob->lay = scene->lay;
@@ -151,7 +155,7 @@ Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob, BC_export_mesh_type e
}
}
- tmpmesh = BKE_mesh_add("ColladaMesh"); // name is not important here
+ tmpmesh = BKE_mesh_add(G.main, "ColladaMesh"); // name is not important here
DM_to_mesh(dm, tmpmesh, ob);
dm->release(dm);
return tmpmesh;
@@ -282,3 +286,20 @@ int bc_get_active_UVLayer(Object *ob)
Mesh *me = (Mesh *)ob->data;
return CustomData_get_active_layer_index(&me->fdata, CD_MTFACE);
}
+
+std::string bc_url_encode(std::string data) {
+ /* XXX We probably do not need to do a full encoding.
+ But in case that is necessary,then it can be added here.
+ */
+ return bc_replace_string(data,"#", "%23");
+}
+
+std::string bc_replace_string(std::string data, const std::string& pattern,
+ const std::string& replacement) {
+ size_t pos = 0;
+ while((pos = data.find(pattern, pos)) != std::string::npos) {
+ data.replace(pos, pattern.length(), replacement);
+ pos += replacement.length();
+ }
+ return data;
+} \ No newline at end of file
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index b8990c3fcdd..90282d9d28f 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -77,4 +77,7 @@ extern void bc_bubble_sort_by_Object_name(LinkNode *export_set);
extern bool bc_is_root_bone(Bone *aBone, bool deform_bones_only);
extern int bc_get_active_UVLayer(Object *ob);
+extern std::string bc_replace_string(std::string data, const std::string& pattern, const std::string& replacement);
+extern std::string bc_url_encode(std::string data);
+
#endif
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index 0e8ddf4068c..ba897a87f97 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -35,13 +35,13 @@ set(INC
../imbuf
../makesdna
../makesrna
- ../opencl
../windowmanager
../nodes
../nodes/composite
../nodes/intern
../render/extern/include
../render/intern/include
+ ../../../intern/opencl
../../../intern/guardedalloc
)
@@ -580,6 +580,8 @@ set(SRC
# Distort operation
operations/COM_TranslateOperation.h
operations/COM_TranslateOperation.cpp
+ operations/COM_WrapOperation.h
+ operations/COM_WrapOperation.cpp
operations/COM_RotateOperation.h
operations/COM_RotateOperation.cpp
operations/COM_ScaleOperation.h
diff --git a/source/blender/compositor/SConscript b/source/blender/compositor/SConscript
index 1872bf2afac..64169ac7403 100644
--- a/source/blender/compositor/SConscript
+++ b/source/blender/compositor/SConscript
@@ -32,7 +32,7 @@ sources = env.Glob('intern/*.cpp') + env.Glob('nodes/*.cpp') + env.Glob('operati
incs = '. nodes intern operations ../blenlib ../blenkernel ../makesdna ../render/extern/include ../render/intern/include'
incs += ' ../makesrna ../blenloader ../../../intern/guardedalloc ../imbuf ../windowmanager '
-incs += '../opencl ../nodes ../nodes/intern ../nodes/composite '
+incs += '#intern/opencl ../nodes ../nodes/intern ../nodes/composite '
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp
index e10d7dbad2e..4cef337d994 100644
--- a/source/blender/compositor/nodes/COM_GroupNode.cpp
+++ b/source/blender/compositor/nodes/COM_GroupNode.cpp
@@ -58,7 +58,7 @@ void GroupNode::ungroup(ExecutionSystem &system)
InputSocket *inputSocket = inputsockets[index];
bNodeSocket *editorInput = inputSocket->getbNodeSocket();
if (editorInput->groupsock) {
- SocketProxyNode *proxy = new SocketProxyNode(bnode, editorInput, editorInput->groupsock);
+ SocketProxyNode *proxy = new SocketProxyNode(bnode, editorInput, editorInput->groupsock, false);
inputSocket->relinkConnections(proxy->getInputSocket(0), index, &system);
ExecutionSystemHelper::addNode(system.getNodes(), proxy);
}
@@ -68,7 +68,7 @@ void GroupNode::ungroup(ExecutionSystem &system)
OutputSocket *outputSocket = outputsockets[index];
bNodeSocket *editorOutput = outputSocket->getbNodeSocket();
if (editorOutput->groupsock) {
- SocketProxyNode *proxy = new SocketProxyNode(bnode, editorOutput->groupsock, editorOutput);
+ SocketProxyNode *proxy = new SocketProxyNode(bnode, editorOutput->groupsock, editorOutput, true);
outputSocket->relinkConnections(proxy->getOutputSocket(0));
ExecutionSystemHelper::addNode(system.getNodes(), proxy);
}
diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
index 709dc75b502..dd3ff5fbaa7 100644
--- a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
+++ b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp
@@ -27,7 +27,11 @@
void SetAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
SetAlphaOperation *operation = new SetAlphaOperation();
-
+
+ if (!this->getInputSocket(0)->isConnected() && this->getInputSocket(1)->isConnected()) {
+ operation->setResolutionInputSocketIndex(1);
+ }
+
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
index bfb32a96156..ded6186ad77 100644
--- a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
+++ b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp
@@ -27,11 +27,14 @@
#include "COM_SetValueOperation.h"
#include "COM_SetVectorOperation.h"
#include "COM_SetColorOperation.h"
+#include "COM_WriteBufferOperation.h"
+#include "COM_ReadBufferOperation.h"
-SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput) : Node(editorNode, false)
+SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool buffer) : Node(editorNode, false)
{
DataType dt;
-
+ this->m_buffer = buffer;
+
dt = COM_DT_VALUE;
if (editorInput->type == SOCK_RGBA) dt = COM_DT_COLOR;
if (editorInput->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
@@ -53,6 +56,17 @@ void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorCont
inputsocket->relinkConnections(operation->getInputSocket(0));
outputsocket->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
+ if (m_buffer) {
+ WriteBufferOperation *writeOperation = new WriteBufferOperation();
+ ReadBufferOperation *readOperation = new ReadBufferOperation();
+ readOperation->setMemoryProxy(writeOperation->getMemoryProxy());
+
+ operation->getOutputSocket()->relinkConnections(readOperation->getOutputSocket());
+ addLink(graph, operation->getOutputSocket(), writeOperation->getInputSocket(0));
+
+ graph->addOperation(writeOperation);
+ graph->addOperation(readOperation);
+ }
}
else {
/* If input is not connected, add a constant value operation instead */
diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.h b/source/blender/compositor/nodes/COM_SocketProxyNode.h
index ea50be418e2..a83ac094b2b 100644
--- a/source/blender/compositor/nodes/COM_SocketProxyNode.h
+++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h
@@ -30,8 +30,10 @@
* @ingroup Node
*/
class SocketProxyNode : public Node {
+private:
+ bool m_buffer;
public:
- SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput);
+ SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool buffer);
void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
virtual bool isProxyNode() const { return true; }
diff --git a/source/blender/compositor/nodes/COM_TranslateNode.cpp b/source/blender/compositor/nodes/COM_TranslateNode.cpp
index c805f8f8baa..44d796c2911 100644
--- a/source/blender/compositor/nodes/COM_TranslateNode.cpp
+++ b/source/blender/compositor/nodes/COM_TranslateNode.cpp
@@ -23,6 +23,7 @@
#include "COM_TranslateNode.h"
#include "COM_TranslateOperation.h"
+#include "COM_WrapOperation.h"
#include "COM_ExecutionSystem.h"
TranslateNode::TranslateNode(bNode *editorNode) : Node(editorNode)
@@ -37,10 +38,32 @@ void TranslateNode::convertToOperations(ExecutionSystem *graph, CompositorContex
InputSocket *inputYSocket = this->getInputSocket(2);
OutputSocket *outputSocket = this->getOutputSocket(0);
TranslateOperation *operation = new TranslateOperation();
-
- inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
+
+ bNode *bnode = this->getbNode();
+ NodeTranslateData *data = (NodeTranslateData *)bnode->storage;
+
+ if (data->wrap_axis) {
+ WrapOperation *wrapOperation = new WrapOperation();
+ wrapOperation->setWrapping(data->wrap_axis);
+ inputSocket->relinkConnections(wrapOperation->getInputSocket(0), 0, graph);
+ addLink(graph, wrapOperation->getOutputSocket(), operation->getInputSocket(0));
+ graph->addOperation(wrapOperation);
+ }
+ else {
+ inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
+ }
+
+ if (data->relative) {
+ const RenderData *rd = context->getRenderData();
+ float fx = rd->xsch * rd->size / 100.0f;
+ float fy = rd->ysch * rd->size / 100.0f;
+
+ operation->setFactorXY(fx, fy);
+ }
+
inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
outputSocket->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
}
+
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
index ecc618a5346..b54e47c136d 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
@@ -323,124 +323,147 @@ DilateStepOperation::DilateStepOperation() : NodeOperation()
void DilateStepOperation::initExecution()
{
this->m_inputProgram = this->getInputSocketReader(0);
- this->m_cached_buffer = NULL;
- this->initMutex();
+}
+
+
+// small helper to pass data from initializeTileData to executePixel
+typedef struct tile_info {
+ rcti rect;
+ int width;
+ float *buffer;
+} tile_info;
+
+static tile_info *create_cache(int xmin, int xmax, int ymin, int ymax)
+{
+ tile_info *result = (tile_info *)MEM_mallocN(sizeof(tile_info), "dilate erode tile");
+ result->rect.xmin = xmin;
+ result->rect.xmax = xmax;
+ result->rect.ymin = ymin;
+ result->rect.ymax = ymax;
+ result->width = xmax - xmin;
+ result->buffer = (float *)MEM_callocN(sizeof(float) * (ymax - ymin) * result->width, "dilate erode cache");
+ return result;
}
void *DilateStepOperation::initializeTileData(rcti *rect)
{
- if (this->m_cached_buffer != NULL) {
- return this->m_cached_buffer;
- }
- lockMutex();
- if (this->m_cached_buffer == NULL) {
- MemoryBuffer *buffer = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL);
- float *rectf = buffer->convertToValueBuffer();
- int x, y, i;
- int bwidth = buffer->getWidth();
- int bheight = buffer->getHeight();
-
- /*
- The following is based on the van Herk/Gil-Werman algorithm for morphology operations.
- */
- int half_window = this->m_iterations;
- int window = half_window * 2 + 1;
- float *temp = (float *)MEM_mallocN((2 * window - 1) * sizeof(float), "dilate erode temp");
- float *buf = (float *)MEM_mallocN((max(bwidth, bheight) + 5 * half_window) * sizeof(float), "dilate erode buf");
-
- for (y = 0; y < bheight; y++) {
- for (x = 0; x < window - 1; x++) {
- buf[x] = -MAXFLOAT;
- }
- for (x = 0; x < bwidth; x++) {
- buf[x + window - 1] = rectf[bwidth * y + x];
- }
- for (x = bwidth + window - 1; x < bwidth + 5 * half_window; x++) {
- buf[x] = -MAXFLOAT;
- }
+ MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL);
+ int x, y, i;
+ int width = tile->getWidth();
+ int height = tile->getHeight();
+ float *buffer = tile->getBuffer();
+
+ int half_window = this->m_iterations;
+ int window = half_window * 2 + 1;
+
+ int xmin = max(0, rect->xmin - half_window);
+ int ymin = max(0, rect->ymin - half_window);
+ int xmax = min(width, rect->xmax + half_window);
+ int ymax = min(height, rect->ymax + half_window);
+
+ int bwidth = rect->xmax - rect->xmin;
+ int bheight = rect->ymax - rect->ymin;
+
+ // Note: Cache buffer has original tilesize width, but new height.
+ // We have to calculate the additional rows in the first pass,
+ // to have valid data available for the second pass.
+ tile_info *result = create_cache(rect->xmin, rect->xmax, ymin, ymax);
+ float *rectf = result->buffer;
+
+ // temp holds maxima for every step in the algorithm, buf holds a
+ // single row or column of input values, padded with MAXFLOATs to
+ // simplify the logic.
+ float *temp = (float *)MEM_mallocN(sizeof(float) * (2 * window - 1), "dilate erode temp");
+ float *buf = (float *)MEM_mallocN(sizeof(float) * (max(bwidth, bheight) + 5 * half_window), "dilate erode buf");
+
+ // The following is based on the van Herk/Gil-Werman algorithm for morphology operations.
+ // first pass, horizontal dilate/erode
+ for (y = ymin; y < ymax; y++) {
+ for (x = 0; x < bwidth + 5 * half_window; x++) {
+ buf[x] = -MAXFLOAT;
+ }
+ for (x = xmin; x < xmax; ++x) {
+ buf[x - rect->xmin + window - 1] = buffer[4 * (y * width + x)];
+ }
- for (i = 0; i < (bwidth + 3 * half_window) / window; i++) {
- int start = (i + 1) * window - 1;
+ for (i = 0; i < (bwidth + 3 * half_window) / window; i++) {
+ int start = (i + 1) * window - 1;
- temp[window - 1] = buf[start];
- for (x = 1; x < window; x++) {
- temp[window - 1 - x] = max(temp[window - x], buf[start - x]);
- temp[window - 1 + x] = max(temp[window + x - 2], buf[start + x]);
- }
+ temp[window - 1] = buf[start];
+ for (x = 1; x < window; x++) {
+ temp[window - 1 - x] = max(temp[window - x], buf[start - x]);
+ temp[window - 1 + x] = max(temp[window + x - 2], buf[start + x]);
+ }
- start = half_window + (i - 1) * window + 1;
- for (x = -min(0, start); x < window - max(0, start + window - bwidth); x++) {
- rectf[bwidth * y + (start + x)] = max(temp[x], temp[x + window - 1]);
- }
+ start = half_window + (i - 1) * window + 1;
+ for (x = -min(0, start); x < window - max(0, start + window - bwidth); x++) {
+ rectf[bwidth * (y - ymin) + (start + x)] = max(temp[x], temp[x + window - 1]);
}
}
+ }
- for (x = 0; x < bwidth; x++) {
- for (y = 0; y < window - 1; y++) {
- buf[y] = -MAXFLOAT;
- }
- for (y = 0; y < bheight; y++) {
- buf[y + window - 1] = rectf[bwidth * y + x];
- }
- for (y = bheight + window - 1; y < bheight + 5 * half_window; y++) {
- buf[y] = -MAXFLOAT;
- }
+ // second pass, vertical dilate/erode
+ for (x = 0; x < bwidth; x++) {
+ for (y = 0; y < bheight + 5 * half_window; y++) {
+ buf[y] = -MAXFLOAT;
+ }
+ for (y = ymin; y < ymax; y++) {
+ buf[y - rect->ymin + window - 1] = rectf[(y - ymin) * bwidth + x];
+ }
- for (i = 0; i < (bheight + 3 * half_window) / window; i++) {
- int start = (i + 1) * window - 1;
+ for (i = 0; i < (bheight + 3 * half_window) / window; i++) {
+ int start = (i + 1) * window - 1;
- temp[window - 1] = buf[start];
- for (y = 1; y < window; y++) {
- temp[window - 1 - y] = max(temp[window - y], buf[start - y]);
- temp[window - 1 + y] = max(temp[window + y - 2], buf[start + y]);
- }
+ temp[window - 1] = buf[start];
+ for (y = 1; y < window; y++) {
+ temp[window - 1 - y] = max(temp[window - y], buf[start - y]);
+ temp[window - 1 + y] = max(temp[window + y - 2], buf[start + y]);
+ }
- start = half_window + (i - 1) * window + 1;
- for (y = -min(0, start); y < window - max(0, start + window - bheight); y++) {
- rectf[bwidth * (y + start) + x] = max(temp[y], temp[y + window - 1]);
- }
+ start = half_window + (i - 1) * window + 1;
+ for (y = -min(0, start); y < window - max(0, start + window - bheight); y++) {
+ rectf[bwidth * (y + start + (rect->ymin - ymin)) + x] = max(temp[y], temp[y + window - 1]);
}
}
-
- MEM_freeN(temp);
- MEM_freeN(buf);
- this->m_cached_buffer = rectf;
}
- unlockMutex();
- return this->m_cached_buffer;
+
+ MEM_freeN(temp);
+ MEM_freeN(buf);
+
+ return result;
}
void DilateStepOperation::executePixel(float output[4], int x, int y, void *data)
{
- output[0] = this->m_cached_buffer[y * this->getWidth() + x];
+ tile_info *tile = (tile_info *)data;
+ int nx = x - tile->rect.xmin;
+ int ny = y - tile->rect.ymin;
+ output[0] = tile->buffer[tile->width * ny + nx];
}
void DilateStepOperation::deinitExecution()
{
this->m_inputProgram = NULL;
- this->deinitMutex();
- if (this->m_cached_buffer) {
- MEM_freeN(this->m_cached_buffer);
- this->m_cached_buffer = NULL;
- }
+}
+
+void DilateStepOperation::deinitializeTileData(rcti *rect, void *data)
+{
+ tile_info *tile = (tile_info *)data;
+ MEM_freeN(tile->buffer);
+ MEM_freeN(tile);
}
bool DilateStepOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
- if (this->m_cached_buffer) {
- return false;
- }
- else {
- rcti newInput;
-
- newInput.xmax = getWidth();
- newInput.xmin = 0;
- newInput.ymax = getHeight();
- newInput.ymin = 0;
-
- return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
- }
+ rcti newInput;
+ int it = this->m_iterations;
+ newInput.xmax = input->xmax + it;
+ newInput.xmin = input->xmin - it;
+ newInput.ymax = input->ymax + it;
+ newInput.ymin = input->ymin - it;
+
+ return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
// Erode step
@@ -451,80 +474,88 @@ ErodeStepOperation::ErodeStepOperation() : DilateStepOperation()
void *ErodeStepOperation::initializeTileData(rcti *rect)
{
- if (this->m_cached_buffer != NULL) {
- return this->m_cached_buffer;
- }
- lockMutex();
- if (this->m_cached_buffer == NULL) {
- MemoryBuffer *buffer = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL);
- float *rectf = buffer->convertToValueBuffer();
- int x, y, i;
- int bwidth = buffer->getWidth();
- int bheight = buffer->getHeight();
-
- int half_window = this->m_iterations;
- int window = half_window * 2 + 1;
- float *temp = (float *)MEM_mallocN((2 * window - 1) * sizeof(float), "dilate erode temp");
- float *buf = (float *)MEM_mallocN((max(bwidth, bheight) + 5 * half_window) * sizeof(float), "dilate erode buf");
-
- for (y = 0; y < bheight; y++) {
- for (x = 0; x < window - 1; x++) {
- buf[x] = MAXFLOAT;
- }
- for (x = 0; x < bwidth; x++) {
- buf[x + window - 1] = rectf[bwidth * y + x];
- }
- for (x = bwidth + window - 1; x < bwidth + 5 * half_window; x++) {
- buf[x] = MAXFLOAT;
- }
+ MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL);
+ int x, y, i;
+ int width = tile->getWidth();
+ int height = tile->getHeight();
+ float *buffer = tile->getBuffer();
+
+ int half_window = this->m_iterations;
+ int window = half_window * 2 + 1;
+
+ int xmin = max(0, rect->xmin - half_window);
+ int ymin = max(0, rect->ymin - half_window);
+ int xmax = min(width, rect->xmax + half_window);
+ int ymax = min(height, rect->ymax + half_window);
+
+ int bwidth = rect->xmax - rect->xmin;
+ int bheight = rect->ymax - rect->ymin;
+
+ // Note: Cache buffer has original tilesize width, but new height.
+ // We have to calculate the additional rows in the first pass,
+ // to have valid data available for the second pass.
+ tile_info *result = create_cache(rect->xmin, rect->xmax, ymin, ymax);
+ float *rectf = result->buffer;
+
+ // temp holds maxima for every step in the algorithm, buf holds a
+ // single row or column of input values, padded with MAXFLOATs to
+ // simplify the logic.
+ float *temp = (float *)MEM_mallocN(sizeof(float) * (2 * window - 1), "dilate erode temp");
+ float *buf = (float *)MEM_mallocN(sizeof(float) * (max(bwidth, bheight) + 5 * half_window), "dilate erode buf");
+
+ // The following is based on the van Herk/Gil-Werman algorithm for morphology operations.
+ // first pass, horizontal dilate/erode
+ for (y = ymin; y < ymax; y++) {
+ for (x = 0; x < bwidth + 5 * half_window; x++) {
+ buf[x] = MAXFLOAT;
+ }
+ for (x = xmin; x < xmax; ++x) {
+ buf[x - rect->xmin + window - 1] = buffer[4 * (y * width + x)];
+ }
- for (i = 0; i < (bwidth + 3 * half_window) / window; i++) {
- int start = (i + 1) * window - 1;
+ for (i = 0; i < (bwidth + 3 * half_window) / window; i++) {
+ int start = (i + 1) * window - 1;
- temp[window - 1] = buf[start];
- for (x = 1; x < window; x++) {
- temp[window - 1 - x] = min(temp[window - x], buf[start - x]);
- temp[window - 1 + x] = min(temp[window + x - 2], buf[start + x]);
- }
+ temp[window - 1] = buf[start];
+ for (x = 1; x < window; x++) {
+ temp[window - 1 - x] = min(temp[window - x], buf[start - x]);
+ temp[window - 1 + x] = min(temp[window + x - 2], buf[start + x]);
+ }
- start = half_window + (i - 1) * window + 1;
- for (x = -min(0, start); x < window - max(0, start + window - bwidth); x++) {
- rectf[bwidth * y + (start + x)] = min(temp[x], temp[x + window - 1]);
- }
+ start = half_window + (i - 1) * window + 1;
+ for (x = -min(0, start); x < window - max(0, start + window - bwidth); x++) {
+ rectf[bwidth * (y - ymin) + (start + x)] = min(temp[x], temp[x + window - 1]);
}
}
+ }
- for (x = 0; x < bwidth; x++) {
- for (y = 0; y < window - 1; y++) {
- buf[y] = MAXFLOAT;
- }
- for (y = 0; y < bheight; y++) {
- buf[y + window - 1] = rectf[bwidth * y + x];
- }
- for (y = bheight + window - 1; y < bheight + 5 * half_window; y++) {
- buf[y] = MAXFLOAT;
- }
+ // second pass, vertical dilate/erode
+ for (x = 0; x < bwidth; x++) {
+ for (y = 0; y < bheight + 5 * half_window; y++) {
+ buf[y] = MAXFLOAT;
+ }
+ for (y = ymin; y < ymax; y++) {
+ buf[y - rect->ymin + window - 1] = rectf[(y - ymin) * bwidth + x];
+ }
- for (i = 0; i < (bheight + 3 * half_window) / window; i++) {
- int start = (i + 1) * window - 1;
+ for (i = 0; i < (bheight + 3 * half_window) / window; i++) {
+ int start = (i + 1) * window - 1;
- temp[window - 1] = buf[start];
- for (y = 1; y < window; y++) {
- temp[window - 1 - y] = min(temp[window - y], buf[start - y]);
- temp[window - 1 + y] = min(temp[window + y - 2], buf[start + y]);
- }
+ temp[window - 1] = buf[start];
+ for (y = 1; y < window; y++) {
+ temp[window - 1 - y] = min(temp[window - y], buf[start - y]);
+ temp[window - 1 + y] = min(temp[window + y - 2], buf[start + y]);
+ }
- start = half_window + (i - 1) * window + 1;
- for (y = -min(0, start); y < window - max(0, start + window - bheight); y++) {
- rectf[bwidth * (y + start) + x] = min(temp[y], temp[y + window - 1]);
- }
+ start = half_window + (i - 1) * window + 1;
+ for (y = -min(0, start); y < window - max(0, start + window - bheight); y++) {
+ rectf[bwidth * (y + start + (rect->ymin - ymin)) + x] = min(temp[y], temp[y + window - 1]);
}
}
-
- MEM_freeN(temp);
- MEM_freeN(buf);
- this->m_cached_buffer = rectf;
}
- unlockMutex();
- return this->m_cached_buffer;
+
+ MEM_freeN(temp);
+ MEM_freeN(buf);
+
+ return result;
}
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h
index 47480d47c3b..51bad81d0ca 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.h
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h
@@ -128,7 +128,6 @@ protected:
int m_iterations;
- float *m_cached_buffer;
public:
DilateStepOperation();
@@ -147,6 +146,7 @@ public:
* Deinitialize the execution
*/
void deinitExecution();
+ void deinitializeTileData(rcti *rect, void *data);
void setIterations(int iterations) { this->m_iterations = iterations; }
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
index 0efead77cd4..aaf5f92505b 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
@@ -182,8 +182,8 @@ bool GaussianAlphaXBlurOperation::determineDependingAreaOfInterest(rcti *input,
#endif
{
if (this->m_sizeavailable && this->m_gausstab != NULL) {
- newInput.xmax = input->xmax + this->m_rad;
- newInput.xmin = input->xmin - this->m_rad;
+ newInput.xmax = input->xmax + this->m_rad + 1;
+ newInput.xmin = input->xmin - this->m_rad - 1;
newInput.ymax = input->ymax;
newInput.ymin = input->ymin;
}
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
index 1f9cc8e461a..650805f91d5 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
@@ -184,8 +184,8 @@ bool GaussianAlphaYBlurOperation::determineDependingAreaOfInterest(rcti *input,
if (this->m_sizeavailable && this->m_gausstab != NULL) {
newInput.xmax = input->xmax;
newInput.xmin = input->xmin;
- newInput.ymax = input->ymax + this->m_rad;
- newInput.ymin = input->ymin - this->m_rad;
+ newInput.ymax = input->ymax + this->m_rad + 1;
+ newInput.ymin = input->ymin - this->m_rad - 1;
}
else {
newInput.xmax = this->getWidth();
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index 573a19466e8..af231d118a6 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -133,8 +133,8 @@ bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadB
}
{
if (this->m_sizeavailable && this->m_gausstab != NULL) {
- newInput.xmax = input->xmax + this->m_rad;
- newInput.xmin = input->xmin - this->m_rad;
+ newInput.xmax = input->xmax + this->m_rad + 1;
+ newInput.xmin = input->xmin - this->m_rad - 1;
newInput.ymax = input->ymax;
newInput.ymin = input->ymin;
}
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index 0c0a4d8aa4f..7bf85a953f4 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -136,8 +136,8 @@ bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadB
if (this->m_sizeavailable && this->m_gausstab != NULL) {
newInput.xmax = input->xmax;
newInput.xmin = input->xmin;
- newInput.ymax = input->ymax + this->m_rad;
- newInput.ymin = input->ymin - this->m_rad;
+ newInput.ymax = input->ymax + this->m_rad + 1;
+ newInput.ymin = input->ymin - this->m_rad - 1;
}
else {
newInput.xmax = this->getWidth();
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cpp b/source/blender/compositor/operations/COM_TranslateOperation.cpp
index 761f55a1455..9f6924eb428 100644
--- a/source/blender/compositor/operations/COM_TranslateOperation.cpp
+++ b/source/blender/compositor/operations/COM_TranslateOperation.cpp
@@ -15,9 +15,10 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor:
- * Jeroen Bakker
+ * Contributor:
+ * Jeroen Bakker
* Monique Dewanchand
+ * Thomas Beck (plasmasolutions.de)
*/
#include "COM_TranslateOperation.h"
@@ -33,6 +34,8 @@ TranslateOperation::TranslateOperation() : NodeOperation()
this->m_inputXOperation = NULL;
this->m_inputYOperation = NULL;
this->m_isDeltaSet = false;
+ this->m_factorX = 1.0f;
+ this->m_factorY = 1.0f;
}
void TranslateOperation::initExecution()
{
@@ -40,6 +43,7 @@ void TranslateOperation::initExecution()
this->m_inputXOperation = this->getInputSocketReader(1);
this->m_inputYOperation = this->getInputSocketReader(2);
+ ensureDelta();
}
void TranslateOperation::deinitExecution()
@@ -53,18 +57,30 @@ void TranslateOperation::deinitExecution()
void TranslateOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
ensureDelta();
- this->m_inputOperation->read(output, x - this->getDeltaX(), y - this->getDeltaY(), sampler);
+
+ float originalXPos = x - this->getDeltaX();
+ float originalYPos = y - this->getDeltaY();
+
+ this->m_inputOperation->read(output, originalXPos, originalYPos, sampler);
}
bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
- ensureDelta();
rcti newInput;
-
- newInput.xmax = input->xmax - this->getDeltaX();
+
+ ensureDelta();
+
newInput.xmin = input->xmin - this->getDeltaX();
- newInput.ymax = input->ymax - this->getDeltaY();
+ newInput.xmax = input->xmax - this->getDeltaX();
newInput.ymin = input->ymin - this->getDeltaY();
-
+ newInput.ymax = input->ymax - this->getDeltaY();
+
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
+
+void TranslateOperation::setFactorXY(float factorX, float factorY)
+{
+ m_factorX = factorX;
+ m_factorY = factorY;
+}
+
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.h b/source/blender/compositor/operations/COM_TranslateOperation.h
index faaadb1ced2..d53c3e464fc 100644
--- a/source/blender/compositor/operations/COM_TranslateOperation.h
+++ b/source/blender/compositor/operations/COM_TranslateOperation.h
@@ -33,6 +33,10 @@ private:
float m_deltaX;
float m_deltaY;
bool m_isDeltaSet;
+ float m_relativeOffsetX;
+ float m_relativeOffsetY;
+ float m_factorX;
+ float m_factorY;
public:
TranslateOperation();
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
@@ -41,8 +45,8 @@ public:
void initExecution();
void deinitExecution();
- float getDeltaX() { return this->m_deltaX; }
- float getDeltaY() { return this->m_deltaY; }
+ float getDeltaX() { return this->m_deltaX * this->m_factorX; }
+ float getDeltaY() { return this->m_deltaY * this->m_factorY; }
inline void ensureDelta() {
if (!this->m_isDeltaSet) {
@@ -54,6 +58,8 @@ public:
this->m_isDeltaSet = true;
}
}
+
+ void setFactorXY(float factorX, float factorY);
};
#endif
diff --git a/source/blender/compositor/operations/COM_WrapOperation.cpp b/source/blender/compositor/operations/COM_WrapOperation.cpp
new file mode 100644
index 00000000000..37a93520c7c
--- /dev/null
+++ b/source/blender/compositor/operations/COM_WrapOperation.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * 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:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Thomas Beck (plasmasolutions.de)
+ */
+
+#include "COM_WrapOperation.h"
+
+WrapOperation::WrapOperation() : NodeOperation()
+{
+ this->addInputSocket(COM_DT_COLOR);
+ this->addOutputSocket(COM_DT_COLOR);
+ this->setResolutionInputSocketIndex(0);
+ this->m_inputOperation = NULL;
+}
+void WrapOperation::initExecution()
+{
+ this->m_inputOperation = this->getInputSocketReader(0);
+}
+
+void WrapOperation::deinitExecution()
+{
+ this->m_inputOperation = NULL;
+}
+
+inline float WrapOperation::getWrappedOriginalXPos(float x)
+{
+ while (x < 0) x += this->m_width;
+ return fmodf(x, this->getWidth());
+}
+
+inline float WrapOperation::getWrappedOriginalYPos(float y)
+{
+ while (y < 0) y += this->m_height;
+ return fmodf(y, this->getHeight());
+}
+
+void WrapOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
+{
+ float nx, ny;
+ nx = x;
+ ny = y;
+ switch (m_wrappingType) {
+ case CMP_NODE_WRAP_NONE:
+ //Intentionally empty, originalXPos and originalYPos have been set before
+ break;
+ case CMP_NODE_WRAP_X:
+ // wrap only on the x-axis
+ nx = this->getWrappedOriginalXPos(x);
+ break;
+ case CMP_NODE_WRAP_Y:
+ // wrap only on the y-axis
+ ny = this->getWrappedOriginalYPos(y);
+ break;
+ case CMP_NODE_WRAP_XY:
+ // wrap on both
+ nx = this->getWrappedOriginalXPos(x);
+ ny = this->getWrappedOriginalYPos(y);
+ break;
+ }
+
+ this->m_inputOperation->read(output, nx, ny, sampler);
+
+}
+
+bool WrapOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
+{
+ rcti newInput;
+
+ newInput.xmin = input->xmin;
+ newInput.xmax = input->xmax;
+ newInput.ymin = input->ymin;
+ newInput.ymax = input->ymax;
+
+ if (m_wrappingType == 1 || m_wrappingType == 3) {
+ // wrap only on the x-axis if tile is wrapping
+ newInput.xmin = getWrappedOriginalXPos(input->xmin);
+ newInput.xmax = getWrappedOriginalXPos(input->xmax);
+ if (newInput.xmin > newInput.xmax) {
+ newInput.xmin = 0;
+ newInput.xmax = this->getWidth();
+ }
+ }
+ if (m_wrappingType == 2 || m_wrappingType == 3) {
+ // wrap only on the y-axis if tile is wrapping
+ newInput.ymin = getWrappedOriginalYPos(input->ymin);
+ newInput.ymax = getWrappedOriginalYPos(input->ymax);
+ if (newInput.ymin > newInput.ymax) {
+ newInput.ymin = 0;
+ newInput.ymax = this->getHeight();
+ }
+ }
+
+ return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+}
+
+void WrapOperation::setWrapping(int wrapping_type)
+{
+ m_wrappingType = wrapping_type;
+}
diff --git a/source/blender/compositor/operations/COM_WrapOperation.h b/source/blender/compositor/operations/COM_WrapOperation.h
new file mode 100644
index 00000000000..b84d85e7b5d
--- /dev/null
+++ b/source/blender/compositor/operations/COM_WrapOperation.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * 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:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ */
+
+#ifndef _COM_WrapOperation_h_
+#define _COM_WrapOperation_h_
+
+#include "COM_NodeOperation.h"
+
+class WrapOperation : public NodeOperation {
+private:
+ SocketReader *m_inputOperation;
+ int m_wrappingType;
+public:
+ WrapOperation();
+ bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
+ void executePixel(float output[4], float x, float y, PixelSampler sampler);
+
+ void initExecution();
+ void deinitExecution();
+
+ void setWrapping(int wrapping_type);
+ float getWrappedOriginalXPos(float x);
+ float getWrappedOriginalYPos(float y);
+
+ void setFactorXY(float factorX, float factorY);
+};
+
+#endif
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index ef1b73fc58f..62725cb6c70 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -41,6 +41,7 @@
#include "RNA_enum_types.h"
#include "BLI_blenlib.h"
+#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -146,16 +147,15 @@ int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, f
marker->frame += (int)floorf(value + 0.5f);
changed++;
}
+ break;
}
- break;
-
case TFM_TIME_SCALE:
{
/* rescale the distance between the marker and the current frame */
marker->frame = cfra + (int)floorf(((float)(marker->frame - cfra) * value) + 0.5f);
changed++;
+ break;
}
- break;
}
}
}
@@ -402,17 +402,22 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
/* and the marker name too, shifted slightly to the top-right */
if (marker->name && marker->name[0]) {
float x, y;
+
+ /* minimal y coordinate which wouldn't be occluded by scroll */
+ int min_y = 17.0f * UI_DPI_FAC;
if (marker->flag & SELECT) {
UI_ThemeColor(TH_TEXT_HI);
x = xpos * xscale + 4.0f * UI_DPI_FAC;
y = (ypixels <= 39.0f * UI_DPI_FAC) ? (ypixels - 10.0f * UI_DPI_FAC) : 29.0f * UI_DPI_FAC;
+ y = max_ii(y, min_y);
}
else {
UI_ThemeColor(TH_TEXT);
if ((marker->frame <= cfra) && (marker->frame + 5 > cfra)) {
x = xpos * xscale + 8.0f * UI_DPI_FAC;
y = (ypixels <= 39.0f * UI_DPI_FAC) ? (ypixels - 10.0f * UI_DPI_FAC) : 29.0f * UI_DPI_FAC;
+ y = max_ii(y, min_y);
}
else {
x = xpos * xscale + 8.0f * UI_DPI_FAC;
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 6bd774e084a..cc2366affe6 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -327,88 +327,7 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short
uiItemR(col, &ptr, "depth", 0, NULL, ICON_NONE);
}
-/* --------------- */
-
-#define BINARYSEARCH_FRAMEEQ_THRESH 0.0001f
-
-/* Binary search algorithm for finding where to insert Envelope Data Point.
- * Returns the index to insert at (data already at that index will be offset if replace is 0)
- */
-static int binarysearch_fcm_envelopedata_index(FCM_EnvelopeData array[], float frame, int arraylen, short *exists)
-{
- int start = 0, end = arraylen;
- int loopbreaker = 0, maxloop = arraylen * 2;
-
- /* initialize exists-flag first */
- *exists = 0;
-
- /* sneaky optimizations (don't go through searching process if...):
- * - keyframe to be added is to be added out of current bounds
- * - keyframe to be added would replace one of the existing ones on bounds
- */
- if ((arraylen <= 0) || (array == NULL)) {
- printf("Warning: binarysearch_fcm_envelopedata_index() encountered invalid array\n");
- return 0;
- }
- else {
- /* check whether to add before/after/on */
- float framenum;
-
- /* 'First' Point (when only one point, this case is used) */
- framenum = array[0].time;
- if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
- *exists = 1;
- return 0;
- }
- else if (frame < framenum)
- return 0;
-
- /* 'Last' Point */
- framenum = array[(arraylen - 1)].time;
- if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
- *exists = 1;
- return (arraylen - 1);
- }
- else if (frame > framenum)
- return arraylen;
- }
-
-
- /* most of the time, this loop is just to find where to put it
- * - 'loopbreaker' is just here to prevent infinite loops
- */
- for (loopbreaker = 0; (start <= end) && (loopbreaker < maxloop); loopbreaker++) {
- /* compute and get midpoint */
- int mid = start + ((end - start) / 2); /* we calculate the midpoint this way to avoid int overflows... */
- float midfra = array[mid].time;
-
- /* check if exactly equal to midpoint */
- if (IS_EQT(frame, midfra, BINARYSEARCH_FRAMEEQ_THRESH)) {
- *exists = 1;
- return mid;
- }
-
- /* repeat in upper/lower half */
- if (frame > midfra)
- start = mid + 1;
- else if (frame < midfra)
- end = mid - 1;
- }
-
- /* print error if loop-limit exceeded */
- if (loopbreaker == (maxloop - 1)) {
- printf("Error: binarysearch_fcm_envelopedata_index() was taking too long\n");
-
- // include debug info
- printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
- }
-
- /* not found, so return where to place it */
- return start;
-}
-
/* callback to add new envelope data point */
-// TODO: should we have a separate file for things like this?
static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(arg))
{
Scene *scene = CTX_data_scene(C);
@@ -425,7 +344,7 @@ static void fmod_envelope_addpoint_cb(bContext *C, void *fcm_dv, void *UNUSED(ar
/* check that no data exists for the current frame... */
if (env->data) {
short exists = -1;
- int i = binarysearch_fcm_envelopedata_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
+ int i = BKE_fcm_envelope_find_index(env->data, (float)(scene->r.cfra), env->totvert, &exists);
/* binarysearch_...() will set exists by default to 0, so if it is non-zero, that means that the point exists already */
if (exists)
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 015c2667a93..decbc351cad 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -300,7 +300,14 @@ static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, Key
/* loop through each F-Curve, working on the keyframes until the first curve aborts */
for (ale = anim_data.first; ale; ale = ale->next) {
- ret_code = ANIM_fcurve_keyframes_loop(ked, ale->data, key_ok, key_cb, fcu_cb);
+ switch (ale->datatype) {
+ case ALE_MASKLAY:
+ case ALE_GPFRAME:
+ break;
+ default:
+ ret_code = ANIM_fcurve_keyframes_loop(ked, ale->data, key_ok, key_cb, fcu_cb);
+ break;
+ }
if (ret_code)
break;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 64832a1311f..c99f939300e 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -143,7 +143,7 @@ bAction *verify_adt_action(ID *id, short add)
if ((adt->action == NULL) && (add)) {
char actname[sizeof(id->name) - 2];
BLI_snprintf(actname, sizeof(actname), "%sAction", id->name + 2);
- adt->action = add_empty_action(actname);
+ adt->action = add_empty_action(G.main, actname);
}
/* return the action */
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index ca2fe48543a..3bcb4002ece 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -563,7 +563,9 @@ void docenter_armature(Scene *scene, Object *ob, float cursor[3], int centermode
add_v3_v3(cent, ebone->head);
add_v3_v3(cent, ebone->tail);
}
- mul_v3_fl(cent, 1.0f / (float)total);
+ if (total) {
+ mul_v3_fl(cent, 1.0f / (float)total);
+ }
}
else {
float min[3], max[3];
@@ -3658,6 +3660,16 @@ void ARMATURE_OT_subdivide(wmOperatorType *ot)
* easy to retrieve any hierarchical/chain relationships which are necessary for
* this to be done easily.
*/
+
+/* helper to clear BONE_TRANSFORM flags */
+static void armature_clear_swap_done_flags(bArmature *arm)
+{
+ EditBone *ebone;
+
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ ebone->flag &= ~BONE_TRANSFORM;
+ }
+}
static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -3669,9 +3681,16 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
/* get chains of bones (ends on chains) */
chains_find_tips(arm->edbo, &chains);
if (chains.first == NULL) return OPERATOR_CANCELLED;
-
+
+ /* ensure that mirror bones will also be operated on */
armature_tag_select_mirrored(arm);
-
+
+ /* clear BONE_TRANSFORM flags
+ * - used to prevent duplicate/cancelling operations from occurring [#34123]
+ * - BONE_DONE cannot be used here as that's already used for mirroring
+ */
+ armature_clear_swap_done_flags(arm);
+
/* loop over chains, only considering selected and visible bones */
for (chain = chains.first; chain; chain = chain->next) {
EditBone *ebo, *child = NULL, *parent = NULL;
@@ -3684,51 +3703,59 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
*/
parent = ebo->parent;
- /* only if selected and editable */
- if (EBONE_VISIBLE(arm, ebo) && EBONE_EDITABLE(ebo)) {
- /* swap head and tail coordinates */
- SWAP(float, ebo->head[0], ebo->tail[0]);
- SWAP(float, ebo->head[1], ebo->tail[1]);
- SWAP(float, ebo->head[2], ebo->tail[2]);
-
- /* do parent swapping:
- * - use 'child' as new parent
- * - connected flag is only set if points are coincidental
- */
- ebo->parent = child;
- if ((child) && equals_v3v3(ebo->head, child->tail))
- ebo->flag |= BONE_CONNECTED;
- else
- ebo->flag &= ~BONE_CONNECTED;
-
- /* get next bones
- * - child will become the new parent of next bone
- */
- child = ebo;
- }
- else {
- /* not swapping this bone, however, if its 'parent' got swapped, unparent us from it
- * as it will be facing in opposite direction
- */
- if ((parent) && (EBONE_VISIBLE(arm, parent) && EBONE_EDITABLE(parent))) {
- ebo->parent = NULL;
- ebo->flag &= ~BONE_CONNECTED;
+ /* skip bone if already handled... [#34123] */
+ if ((ebo->flag & BONE_TRANSFORM) == 0) {
+ /* only if selected and editable */
+ if (EBONE_VISIBLE(arm, ebo) && EBONE_EDITABLE(ebo)) {
+ /* swap head and tail coordinates */
+ SWAP(float, ebo->head[0], ebo->tail[0]);
+ SWAP(float, ebo->head[1], ebo->tail[1]);
+ SWAP(float, ebo->head[2], ebo->tail[2]);
+
+ /* do parent swapping:
+ * - use 'child' as new parent
+ * - connected flag is only set if points are coincidental
+ */
+ ebo->parent = child;
+ if ((child) && equals_v3v3(ebo->head, child->tail))
+ ebo->flag |= BONE_CONNECTED;
+ else
+ ebo->flag &= ~BONE_CONNECTED;
+
+ /* get next bones
+ * - child will become the new parent of next bone
+ */
+ child = ebo;
+ }
+ else {
+ /* not swapping this bone, however, if its 'parent' got swapped, unparent us from it
+ * as it will be facing in opposite direction
+ */
+ if ((parent) && (EBONE_VISIBLE(arm, parent) && EBONE_EDITABLE(parent))) {
+ ebo->parent = NULL;
+ ebo->flag &= ~BONE_CONNECTED;
+ }
+
+ /* get next bones
+ * - child will become new parent of next bone (not swapping occurred,
+ * so set to NULL to prevent infinite-loop)
+ */
+ child = NULL;
}
- /* get next bones
- * - child will become new parent of next bone (not swapping occurred,
- * so set to NULL to prevent infinite-loop)
- */
- child = NULL;
+ /* tag as done (to prevent double-swaps) */
+ ebo->flag |= BONE_TRANSFORM;
}
}
}
/* free chains */
BLI_freelistN(&chains);
-
+
+ /* clear temp flags */
+ armature_clear_swap_done_flags(arm);
armature_tag_unselect(arm);
-
+
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 04815b9c33c..b2c1b7fdcd0 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -54,6 +54,7 @@
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_depsgraph.h"
+#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_object.h"
@@ -196,7 +197,7 @@ static bAction *poselib_init_new(Object *ob)
/* init object's poselib action (unlink old one if there) */
if (ob->poselib)
id_us_min(&ob->poselib->id);
- ob->poselib = add_empty_action("PoseLib");
+ ob->poselib = add_empty_action(G.main, "PoseLib");
return ob->poselib;
}
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index ed3088696b1..8d108644470 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -100,6 +100,14 @@ if(WITH_BLENDER)
data_to_c_simple(../../../../release/datafiles/matcaps/mc14.jpg SRC)
data_to_c_simple(../../../../release/datafiles/matcaps/mc15.jpg SRC)
data_to_c_simple(../../../../release/datafiles/matcaps/mc16.jpg SRC)
+ data_to_c_simple(../../../../release/datafiles/matcaps/mc17.jpg SRC)
+ data_to_c_simple(../../../../release/datafiles/matcaps/mc18.jpg SRC)
+ data_to_c_simple(../../../../release/datafiles/matcaps/mc19.jpg SRC)
+ data_to_c_simple(../../../../release/datafiles/matcaps/mc20.jpg SRC)
+ data_to_c_simple(../../../../release/datafiles/matcaps/mc21.jpg SRC)
+ data_to_c_simple(../../../../release/datafiles/matcaps/mc22.jpg SRC)
+ data_to_c_simple(../../../../release/datafiles/matcaps/mc23.jpg SRC)
+ data_to_c_simple(../../../../release/datafiles/matcaps/mc24.jpg SRC)
endif()
diff --git a/source/blender/editors/datafiles/SConscript b/source/blender/editors/datafiles/SConscript
index fb1f9f37975..c17ab386fe6 100644
--- a/source/blender/editors/datafiles/SConscript
+++ b/source/blender/editors/datafiles/SConscript
@@ -95,6 +95,14 @@ sources.extend((
os.path.join(env['DATA_SOURCES'], "mc14.jpg.c"),
os.path.join(env['DATA_SOURCES'], "mc15.jpg.c"),
os.path.join(env['DATA_SOURCES'], "mc16.jpg.c"),
+ os.path.join(env['DATA_SOURCES'], "mc17.jpg.c"),
+ os.path.join(env['DATA_SOURCES'], "mc18.jpg.c"),
+ os.path.join(env['DATA_SOURCES'], "mc19.jpg.c"),
+ os.path.join(env['DATA_SOURCES'], "mc20.jpg.c"),
+ os.path.join(env['DATA_SOURCES'], "mc21.jpg.c"),
+ os.path.join(env['DATA_SOURCES'], "mc22.jpg.c"),
+ os.path.join(env['DATA_SOURCES'], "mc23.jpg.c"),
+ os.path.join(env['DATA_SOURCES'], "mc24.jpg.c"),
))
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 3e092ed8c5b..09a7890a539 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -27,7 +27,6 @@
* \ingroup edgpencil
*/
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index 19552d60387..81dbb8e9aa5 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -206,6 +206,30 @@ extern char datatoc_mc15_jpg[];
extern int datatoc_mc16_jpg_size;
extern char datatoc_mc16_jpg[];
+extern int datatoc_mc17_jpg_size;
+extern char datatoc_mc17_jpg[];
+
+extern int datatoc_mc18_jpg_size;
+extern char datatoc_mc18_jpg[];
+
+extern int datatoc_mc19_jpg_size;
+extern char datatoc_mc19_jpg[];
+
+extern int datatoc_mc20_jpg_size;
+extern char datatoc_mc20_jpg[];
+
+extern int datatoc_mc21_jpg_size;
+extern char datatoc_mc21_jpg[];
+
+extern int datatoc_mc22_jpg_size;
+extern char datatoc_mc22_jpg[];
+
+extern int datatoc_mc23_jpg_size;
+extern char datatoc_mc23_jpg[];
+
+extern int datatoc_mc24_jpg_size;
+extern char datatoc_mc24_jpg[];
+
#endif /* __ED_DATAFILES_H__ */
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index f5ac3f19b5b..0560cbd69cc 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -1007,6 +1007,14 @@ DEF_ICON(MATCAP_13)
DEF_ICON(MATCAP_14)
DEF_ICON(MATCAP_15)
DEF_ICON(MATCAP_16)
+DEF_ICON(MATCAP_17)
+DEF_ICON(MATCAP_18)
+DEF_ICON(MATCAP_19)
+DEF_ICON(MATCAP_20)
+DEF_ICON(MATCAP_21)
+DEF_ICON(MATCAP_22)
+DEF_ICON(MATCAP_23)
+DEF_ICON(MATCAP_24)
/* vector icons, VICO_ prefix added */
DEF_VICO(VIEW3D_VEC)
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index e9cb2eff7e3..434fb58184f 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -85,6 +85,9 @@ typedef struct uiLayout uiLayout;
#define UI_MAX_DRAW_STR 400
#define UI_MAX_NAME_STR 128
+/* use for clamping popups within the screen */
+#define UI_SCREEN_MARGIN 10
+
/* uiBlock->dt */
#define UI_EMBOSS 0 /* use widget style for drawing */
#define UI_EMBOSSN 1 /* Nothing, only icon and/or text */
@@ -219,7 +222,7 @@ typedef enum {
NUMSLI = (14 << 9),
COLOR = (15 << 9),
IDPOIN = (16 << 9),
- HSVSLI = (17 << 9),
+ HSVSLI = (17 << 9), /* UNUSED, but code still references */
SCROLL = (18 << 9),
BLOCK = (19 << 9),
BUTM = (20 << 9),
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 1dee497ff11..4a5f3acad4f 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -319,6 +319,7 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, eBlockBound
wmWindow *window = CTX_wm_window(C);
int startx, starty, endx, endy, width, height, oldwidth, oldheight;
int oldbounds, xmax, ymax;
+ const int margin = UI_SCREEN_MARGIN;
oldbounds = block->bounds;
@@ -356,20 +357,20 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, eBlockBound
startx = window->eventstate->x + block->rect.xmin + (block->mx * width) / oldwidth;
starty = window->eventstate->y + block->rect.ymin + (block->my * height) / oldheight;
- if (startx < 10)
- startx = 10;
- if (starty < 10)
- starty = 10;
+ if (startx < margin)
+ startx = margin;
+ if (starty < margin)
+ starty = margin;
endx = startx + width;
endy = starty + height;
if (endx > xmax) {
- endx = xmax - 10;
+ endx = xmax - margin;
startx = endx - width;
}
- if (endy > ymax - 20) {
- endy = ymax - 20;
+ if (endy > ymax - margin) {
+ endy = ymax - margin;
starty = endy - height;
}
@@ -927,6 +928,8 @@ void uiEndBlock(const bContext *C, uiBlock *block)
block->auto_open = block->oldblock->auto_open;
block->auto_open_last = block->oldblock->auto_open_last;
block->tooltipdisabled = block->oldblock->tooltipdisabled;
+ copy_v3_v3(ui_block_hsv_get(block),
+ ui_block_hsv_get(block->oldblock));
block->oldblock = NULL;
}
@@ -997,7 +1000,7 @@ void ui_fontscale(short *points, float aspect)
/* project button or block (but==NULL) to pixels in regionspace */
static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, uiBut *but)
{
- rctf rectf = (but)? but->rect: block->rect;
+ rctf rectf = (but) ? but->rect : block->rect;
ui_block_to_window_fl(ar, block, &rectf.xmin, &rectf.ymin);
ui_block_to_window_fl(ar, block, &rectf.xmax, &rectf.ymax);
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 5d62ef768d2..e4c163e9162 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -57,7 +57,11 @@
static FCurve *ui_but_get_fcurve(uiBut *but, bAction **action, int *driven)
{
- return rna_get_fcurve(&but->rnapoin, but->rnaprop, but->rnaindex, action, driven);
+ /* for entire array buttons we check the first component, it's not perfect
+ * but works well enough in typical cases */
+ int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex;
+
+ return rna_get_fcurve(&but->rnapoin, but->rnaprop, rnaindex, action, driven);
}
void ui_but_anim_flag(uiBut *but, float cfra)
@@ -131,7 +135,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
ID *id;
FCurve *fcu;
char *path;
- short ok = 0;
+ bool ok = false;
/* button must have RNA-pointer to a numeric-capable property */
if (ELEM(NULL, but->rnapoin.data, but->rnaprop)) {
@@ -140,6 +144,14 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
return 0;
}
+ if (RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0) {
+ if (but->rnaindex == -1) {
+ if (G.debug & G_DEBUG)
+ printf("ERROR: create expression failed - can't create expression for entire array\n");
+ return 0;
+ }
+ }
+
/* make sure we have animdata for this */
/* FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them */
id = (ID *)but->rnapoin.id.data;
@@ -168,6 +180,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
/* updates */
driver->flag |= DRIVER_FLAG_RECOMPILE;
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME, NULL);
+ ok = true;
}
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 792553f842c..e19e89af5da 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -373,7 +373,7 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad)
glEnable(GL_BLEND);
uiDrawBox(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
-
+
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 0d65cd19034..edd5b901ca1 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -214,18 +214,22 @@ typedef struct uiAfterFunc {
static int ui_but_contains_pt(uiBut *but, int mx, int my);
static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y);
static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state);
-static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata);
+static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *userdata);
static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type);
static void button_timers_tooltip_remove(bContext *C, uiBut *but);
/* ******************** menu navigation helpers ************** */
/* assumes event type is MOUSEPAN */
-void ui_pan_to_scroll(wmEvent *event, int *type, int *val)
+void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
{
static int lastdy = 0;
int dy = event->prevy - event->y;
-
+
+ /* This event should be originally from event->type,
+ * converting wrong event into wheel is bad, see [#33803] */
+ BLI_assert(*type == MOUSEPAN);
+
/* sign differs, reset */
if ((dy > 0 && lastdy < 0) || (dy < 0 && lastdy > 0))
lastdy = dy;
@@ -233,8 +237,14 @@ void ui_pan_to_scroll(wmEvent *event, int *type, int *val)
lastdy += dy;
if (ABS(lastdy) > (int)UI_UNIT_Y) {
+ int dy = event->prevy - event->y;
+
+ if (U.uiflag2 & USER_TRACKPAD_NATURAL)
+ dy = -dy;
+
*val = KM_PRESS;
- if (event->prevy - event->y > 0)
+
+ if (dy > 0)
*type = WHEELUPMOUSE;
else
*type = WHEELDOWNMOUSE;
@@ -291,15 +301,15 @@ static uiBut *ui_but_last(uiBlock *block)
return NULL;
}
-static int ui_is_a_warp_but(uiBut *but)
+static bool ui_is_a_warp_but(uiBut *but)
{
if (U.uiflag & USER_CONTINUOUS_MOUSE) {
- if (ELEM6(but->type, NUM, NUMABS, HSVCIRCLE, TRACKPREVIEW, HSVCUBE, BUT_CURVE)) {
- return TRUE;
+ if (ELEM7(but->type, NUM, NUMSLI, NUMABS, HSVCIRCLE, TRACKPREVIEW, HSVCUBE, BUT_CURVE)) {
+ return true;
}
}
- return FALSE;
+ return false;
}
static float ui_mouse_scale_warp_factor(const short shift)
@@ -721,7 +731,7 @@ static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *da
/* ****************** drag drop code *********************** */
-static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event)
+static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, const wmEvent *event)
{
rcti rect;
int x = event->x, y = event->y;
@@ -745,7 +755,7 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event)
return BLI_rcti_isect_pt(&rect, x, y);
}
-static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
/* prevent other WM gestures to start while we try to drag */
WM_gestures_remove(C);
@@ -1162,7 +1172,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
/* ******************* drop event ******************** */
/* only call if event type is EVT_DROP */
-static void ui_but_drop(bContext *C, wmEvent *event, uiBut *but, uiHandleButtonData *data)
+static void ui_but_drop(bContext *C, const wmEvent *event, uiBut *but, uiHandleButtonData *data)
{
wmDrag *wmd;
ListBase *drags = event->customdata; /* drop event type has listbase customdata by default */
@@ -1911,7 +1921,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
}
-static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my, changed = 0, inbox = 0, update = 0, retval = WM_UI_HANDLER_CONTINUE;
@@ -2103,7 +2113,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
ED_region_tag_redraw(data->region);
}
-static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my, retval = WM_UI_HANDLER_CONTINUE;
@@ -2292,7 +2302,7 @@ int ui_button_open_menu_direction(uiBut *but)
/* ***************** events for different button types *************** */
-static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
if (data->state == BUTTON_STATE_HIGHLIGHT) {
if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
@@ -2320,7 +2330,7 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
if (data->state == BUTTON_STATE_HIGHLIGHT) {
if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
@@ -2381,7 +2391,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
if (data->state == BUTTON_STATE_HIGHLIGHT) {
if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
@@ -2406,7 +2416,7 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
if (data->state == BUTTON_STATE_HIGHLIGHT) {
if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val == KM_PRESS) {
@@ -2431,7 +2441,7 @@ static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_do_but_SEARCH_UNLINK(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_SEARCH_UNLINK(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
/* unlink icon is on right */
if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val == KM_PRESS) {
@@ -2459,7 +2469,7 @@ static int ui_do_but_SEARCH_UNLINK(bContext *C, uiBlock *block, uiBut *but, uiHa
return ui_do_but_TEX(C, block, but, data, event);
}
-static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
if (data->state == BUTTON_STATE_HIGHLIGHT) {
if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
@@ -2472,7 +2482,7 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
if (data->state == BUTTON_STATE_HIGHLIGHT) {
@@ -2730,7 +2740,7 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
return changed;
}
-static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my; /* mouse location scaled to fit the UI */
int screen_mx, screen_my; /* mouse location kept at screen pixel coords */
@@ -2745,7 +2755,9 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
if (data->state == BUTTON_STATE_HIGHLIGHT) {
int type = event->type, val = event->val;
- ui_pan_to_scroll(event, &type, &val);
+ if (type == MOUSEPAN) {
+ ui_pan_to_scroll(event, &type, &val);
+ }
/* XXX hardcoded keymap check.... */
if (type == MOUSEPAN && event->alt)
@@ -2882,36 +2894,66 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
return retval;
}
-static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, const short shift, const short ctrl, int mx)
+static bool ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data,
+ const bool is_horizontal, const bool shift, const bool ctrl, int mx)
{
float deler, f, tempf, softmin, softmax, softrange;
- int temp, lvalue, changed = 0;
+ int temp, lvalue;
+ bool changed = false;
+ float mx_fl, my_fl;
+ /* note, 'offs' is really from the widget drawing rounded corners see 'widget_numslider' */
+ float offs;
softmin = but->softmin;
softmax = but->softmax;
softrange = softmax - softmin;
+ /* yes, 'mx' as both x/y is intentional */
+ ui_mouse_scale_warp(data, mx, mx, &mx_fl, &my_fl, shift);
+
if (but->type == NUMSLI) {
- deler = (BLI_rctf_size_x(&but->rect) - 5.0f * but->aspect);
+ offs = (BLI_rctf_size_y(&but->rect) / 2.0f) * but->aspect;
+ deler = BLI_rctf_size_x(&but->rect) - offs;
}
else if (but->type == HSVSLI) {
- deler = (BLI_rctf_size_x(&but->rect) / 2.0f - 5.0f * but->aspect);
+ offs = (BLI_rctf_size_y(&but->rect) / 2.0f) * but->aspect;
+ deler = (BLI_rctf_size_x(&but->rect) / 2.0f) - offs;
}
else if (but->type == SCROLL) {
- int horizontal = (BLI_rctf_size_x(&but->rect) > BLI_rctf_size_y(&but->rect));
- float size = (horizontal) ? BLI_rctf_size_x(&but->rect) : -BLI_rctf_size_y(&but->rect);
+ const float size = (is_horizontal) ? BLI_rctf_size_x(&but->rect) : -BLI_rctf_size_y(&but->rect);
deler = size * (but->softmax - but->softmin) / (but->softmax - but->softmin + but->a1);
+ offs = 0.0;
}
else {
- deler = (BLI_rctf_size_x(&but->rect) - 5.0f * but->aspect);
+ offs = (BLI_rctf_size_y(&but->rect) / 2.0f) * but->aspect;
+ deler = (BLI_rctf_size_x(&but->rect) - offs);
}
- f = (float)(mx - data->dragstartx) / deler + data->dragfstart;
-
- if (shift)
- f = (f - data->dragfstart) / 10.0f + data->dragfstart;
-
+ f = (mx_fl - data->dragstartx) / deler + data->dragfstart;
CLAMP(f, 0.0f, 1.0f);
+
+
+ /* deal with mouse correction */
+#ifdef USE_CONT_MOUSE_CORRECT
+ if (ui_is_a_warp_but(but)) {
+ /* OK but can go outside bounds */
+ if (is_horizontal) {
+ data->ungrab_mval[0] = (but->rect.xmin + offs / but->aspect) + (f * deler);
+ data->ungrab_mval[1] = BLI_rctf_cent_y(&but->rect);
+ }
+ else {
+ data->ungrab_mval[1] = (but->rect.ymin + offs / but->aspect) + (f * deler);
+ data->ungrab_mval[0] = BLI_rctf_cent_x(&but->rect);
+ }
+ BLI_rctf_clamp_pt_v(&but->rect, data->ungrab_mval);
+ }
+#endif
+ if (is_horizontal == false) {
+ mx_fl = my_fl;
+ }
+ /* done correcting mouse */
+
+
tempf = softmin + f * softrange;
temp = floorf(tempf + 0.5f);
@@ -2947,7 +2989,7 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, const short
if (temp != lvalue) {
data->value = temp;
data->dragchange = 1;
- changed = 1;
+ changed = true;
}
}
else {
@@ -2956,14 +2998,14 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, const short
if (tempf != (float)data->value) {
data->value = tempf;
data->dragchange = 1;
- changed = 1;
+ changed = true;
}
}
return changed;
}
-static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my, click = 0;
int retval = WM_UI_HANDLER_CONTINUE;
@@ -2974,8 +3016,10 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
if (data->state == BUTTON_STATE_HIGHLIGHT) {
int type = event->type, val = event->val;
-
- ui_pan_to_scroll(event, &type, &val);
+
+ if (type == MOUSEPAN) {
+ ui_pan_to_scroll(event, &type, &val);
+ }
/* XXX hardcoded keymap check.... */
if (type == MOUSEPAN && event->alt)
@@ -3032,7 +3076,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
click = 1;
}
else if (event->type == MOUSEMOVE) {
- if (ui_numedit_but_SLI(but, data, event->shift, event->ctrl, mx))
+ if (ui_numedit_but_SLI(but, data, true, event->shift, event->ctrl, mx))
ui_numedit_apply(C, block, but, data);
}
retval = WM_UI_HANDLER_BREAK;
@@ -3105,11 +3149,11 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
return retval;
}
-static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my /*, click = 0 */;
int retval = WM_UI_HANDLER_CONTINUE;
- int horizontal = (BLI_rctf_size_x(&but->rect) > BLI_rctf_size_y(&but->rect));
+ bool horizontal = (BLI_rctf_size_x(&but->rect) > BLI_rctf_size_y(&but->rect));
mx = event->x;
my = event->y;
@@ -3146,7 +3190,7 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
else if (event->type == MOUSEMOVE) {
- if (ui_numedit_but_SLI(but, data, 0, 0, (horizontal) ? mx : my))
+ if (ui_numedit_but_SLI(but, data, horizontal, false, false, (horizontal) ? mx : my))
ui_numedit_apply(C, block, but, data);
}
@@ -3157,7 +3201,7 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
}
-static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
if (data->state == BUTTON_STATE_HIGHLIGHT) {
@@ -3320,7 +3364,7 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
return changed;
}
-static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my;
@@ -3506,7 +3550,7 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF
ui_set_but_vectorf(but, data->vec);
}
-static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my;
@@ -3706,7 +3750,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND
}
-static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my;
mx = event->x;
@@ -3825,7 +3869,7 @@ static int ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int mx
return changed;
}
-static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
ColorBand *coba;
CBData *cbd;
@@ -3989,7 +4033,7 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
return changed;
}
-static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my, a, changed = 0;
@@ -4171,7 +4215,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
return changed;
}
-static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my;
@@ -4254,7 +4298,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
return changed;
}
-static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my;
@@ -4329,7 +4373,7 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int
return changed;
}
-static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my;
@@ -4374,7 +4418,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
}
#ifdef WITH_INTERNATIONAL
-static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event))
+static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), const wmEvent *UNUSED(event))
{
/* XXX 2.50 bad global and state access */
#if 0
@@ -4479,7 +4523,7 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
#endif
-static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
VECCOPY2D(but->linkto, event->mval);
@@ -4546,7 +4590,7 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
return changed;
}
-static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
+static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event)
{
int mx, my;
@@ -4722,7 +4766,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
{
uiPopupMenu *pup;
uiLayout *layout;
- int length;
+ bool is_array, is_array_component;
const char *name;
uiStringInfo label = {BUT_GET_LABEL, NULL};
@@ -4749,12 +4793,14 @@ static int ui_but_menu(bContext *C, uiBut *but)
if (is_anim)
is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
- length = RNA_property_array_length(&but->rnapoin, but->rnaprop);
+ /* determine if we can key a single component of an array */
+ is_array = RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0;
+ is_array_component = (is_array && but->rnaindex != -1);
/* Keyframes */
if (but->flag & UI_BUT_ANIMATED_KEY) {
/* replace/delete keyfraemes */
- if (length) {
+ if (is_array_component) {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Replace Keyframes"),
ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Replace Single Keyframe"),
@@ -4766,9 +4812,9 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
else {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Replace Keyframe"),
- ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
+ ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Keyframe"),
- ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 0);
+ ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 1);
}
/* keyframe settings */
@@ -4780,7 +4826,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
/* pass */
}
else if (is_anim) {
- if (length) {
+ if (is_array_component) {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Keyframes"),
ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Single Keyframe"),
@@ -4788,12 +4834,12 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
else {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Keyframe"),
- ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
+ ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
}
}
if (but->flag & UI_BUT_ANIMATED) {
- if (length) {
+ if (is_array_component) {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Keyframes"),
ICON_NONE, "ANIM_OT_keyframe_clear_button", "all", 1);
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Single Keyframes"),
@@ -4801,7 +4847,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
else {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Keyframes"),
- ICON_NONE, "ANIM_OT_keyframe_clear_button", "all", 0);
+ ICON_NONE, "ANIM_OT_keyframe_clear_button", "all", 1);
}
}
@@ -4809,7 +4855,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
if (but->flag & UI_BUT_DRIVEN) {
uiItemS(layout);
- if (length) {
+ if (is_array_component) {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Drivers"),
ICON_NONE, "ANIM_OT_driver_button_remove", "all", 1);
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Single Driver"),
@@ -4817,7 +4863,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
else {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Driver"),
- ICON_NONE, "ANIM_OT_driver_button_remove", "all", 0);
+ ICON_NONE, "ANIM_OT_driver_button_remove", "all", 1);
}
uiItemO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Driver"),
@@ -4833,7 +4879,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
else if (is_anim) {
uiItemS(layout);
- if (length) {
+ if (is_array_component) {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Add Drivers"),
ICON_NONE, "ANIM_OT_driver_button_add", "all", 1);
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Add Single Driver"),
@@ -4841,7 +4887,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
else {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Add Driver"),
- ICON_NONE, "ANIM_OT_driver_button_add", "all", 0);
+ ICON_NONE, "ANIM_OT_driver_button_add", "all", 1);
}
if (ANIM_driver_can_paste()) {
@@ -4855,7 +4901,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
if (is_anim) {
uiItemS(layout);
- if (length) {
+ if (is_array_component) {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Add All to Keying Set"),
ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 1);
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Add Single to Keying Set"),
@@ -4865,7 +4911,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
else {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Keying Set"),
- ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 0);
+ ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 1);
uiItemO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"),
ICON_NONE, "ANIM_OT_keyingset_button_remove");
}
@@ -4878,15 +4924,15 @@ static int ui_but_menu(bContext *C, uiBut *but)
/* Copy Property Value
* Paste Property Value */
- if (length) {
+ if (is_array_component) {
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Reset All to Default Values"),
ICON_NONE, "UI_OT_reset_default_button", "all", 1);
uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Reset Single to Default Value"),
ICON_NONE, "UI_OT_reset_default_button", "all", 0);
}
else {
- uiItemO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Reset to Default Value"),
- ICON_NONE, "UI_OT_reset_default_button");
+ uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Reset to Default Value"),
+ ICON_NONE, "UI_OT_reset_default_button", "all", 1);
}
uiItemO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Data Path"),
@@ -5006,7 +5052,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
return 1;
}
-static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
+static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *event)
{
uiHandleButtonData *data;
int retval;
@@ -5919,7 +5965,7 @@ void uiContextAnimUpdate(const bContext *C)
/************** handle activating a button *************/
-static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event)
+static uiBut *uit_but_find_open_event(ARegion *ar, const wmEvent *event)
{
uiBlock *block;
uiBut *but;
@@ -5932,7 +5978,7 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event)
return NULL;
}
-static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
+static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar)
{
uiBut *but;
@@ -5987,7 +6033,7 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu
/************ handle events for an activated button ***********/
-static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
+static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
{
uiHandleButtonData *data;
uiBlock *block;
@@ -6161,7 +6207,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
return retval;
}
-static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
+static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar)
{
uiBut *but = ui_list_find_mouse_over(ar, event->x, event->y);
int retval = WM_UI_HANDLER_CONTINUE;
@@ -6248,7 +6294,7 @@ static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
return retval;
}
-static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *but)
+static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, uiBut *but)
{
uiHandleButtonData *data;
uiPopupBlockHandle *menu;
@@ -6451,7 +6497,7 @@ static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my, uiBut *to_bt)
return 0;
}
-static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int level)
+static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu, int level)
{
ARegion *ar;
uiBlock *block;
@@ -6862,7 +6908,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
return retval;
}
-static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlockHandle *menu)
+static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
{
ARegion *ar;
uiBut *but;
@@ -6911,7 +6957,7 @@ static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlo
return WM_UI_HANDLER_BREAK;
}
-static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int level)
+static int ui_handle_menus_recursive(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu, int level)
{
uiBut *but;
uiHandleButtonData *data;
@@ -6933,7 +6979,7 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa
retval = ui_handle_menu_return_submenu(C, event, menu);
submenu = NULL; /* hint not to use this, it may be freed by call above */
(void)submenu;
- /* we may wan't to quit the submenu and handle the even in this menu,
+ /* we may want to quit the submenu and handle the even in this menu,
* if its important to use it, check 'data->menu' first */
if ((retval == WM_UI_HANDLER_BREAK) && do_ret_out_parent) {
retval = ui_handle_menu_event(C, event, menu, level);
@@ -6949,7 +6995,7 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa
/* *************** UI event handlers **************** */
-static int ui_handler_region(bContext *C, wmEvent *event, void *UNUSED(userdata))
+static int ui_handler_region(bContext *C, const wmEvent *event, void *UNUSED(userdata))
{
ARegion *ar;
uiBut *but;
@@ -7007,7 +7053,7 @@ static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata))
ui_apply_but_funcs_after(C);
}
-static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(userdata))
+static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSED(userdata))
{
ARegion *ar;
uiBut *but;
@@ -7062,7 +7108,7 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(user
}
/* two types of popups, one with operator + enum, other with regular callbacks */
-static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata)
+static int ui_handler_popup(bContext *C, const wmEvent *event, void *userdata)
{
uiPopupBlockHandle *menu = userdata;
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 619fb18cd7a..086e9dad895 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -130,6 +130,7 @@ static IconTexture icongltex = {0, 0, 0, 0.0f, 0.0f};
/* **************************************************** */
+#ifndef WITH_HEADLESS
static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int size, int type)
{
@@ -469,6 +470,7 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)
}
#ifndef WITH_HEADLESS
+
static void init_brush_icons(void)
{
@@ -531,7 +533,7 @@ static void icon_verify_datatoc(IconImage *iimg)
iimg->datatoc_size, IB_rect, NULL, "<matcap icon>");
/* w and h were set on initialize */
if (bbuf->x != iimg->h && bbuf->y != iimg->w)
- IMB_scalefastImBuf(bbuf, iimg->w, iimg->h);
+ IMB_scaleImBuf(bbuf, iimg->w, iimg->h);
iimg->rect = bbuf->rect;
bbuf->rect = NULL;
@@ -548,7 +550,7 @@ static void init_matcap_icons(void)
int size = datatoc_ ##name## _jpg_size; \
DrawInfo *di; \
\
- di = def_internal_icon(NULL, icon_id, 0, 0, 128, ICON_TYPE_BUFFER); \
+ di = def_internal_icon(NULL, icon_id, 0, 0, 96, ICON_TYPE_BUFFER); \
di->data.buffer.image->datatoc_rect = rect; \
di->data.buffer.image->datatoc_size = size; \
} (void)0
@@ -569,6 +571,14 @@ static void init_matcap_icons(void)
INIT_MATCAP_ICON(ICON_MATCAP_14, mc14);
INIT_MATCAP_ICON(ICON_MATCAP_15, mc15);
INIT_MATCAP_ICON(ICON_MATCAP_16, mc16);
+ INIT_MATCAP_ICON(ICON_MATCAP_17, mc17);
+ INIT_MATCAP_ICON(ICON_MATCAP_18, mc18);
+ INIT_MATCAP_ICON(ICON_MATCAP_19, mc19);
+ INIT_MATCAP_ICON(ICON_MATCAP_20, mc20);
+ INIT_MATCAP_ICON(ICON_MATCAP_21, mc21);
+ INIT_MATCAP_ICON(ICON_MATCAP_22, mc22);
+ INIT_MATCAP_ICON(ICON_MATCAP_23, mc23);
+ INIT_MATCAP_ICON(ICON_MATCAP_24, mc24);
#undef INIT_MATCAP_ICON
@@ -781,6 +791,8 @@ static void free_iconfile_list(struct ListBase *list)
}
}
+#endif /* WITH_HEADLESS */
+
int UI_iconfile_get_index(const char *filename)
{
IconFile *ifile;
@@ -1134,9 +1146,9 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
else if (di->type == ICON_TYPE_BUFFER) {
/* it is a builtin icon */
iimg = di->data.buffer.image;
-
+#ifndef WITH_HEADLESS
icon_verify_datatoc(iimg);
-
+#endif
if (!iimg->rect) return; /* something has gone wrong! */
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 0b94a0dabdc..eb7f09c7b34 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -319,7 +319,7 @@ struct uiBlock {
void *handle_func_arg;
/* custom extra handling */
- int (*block_event_func)(const struct bContext *C, struct uiBlock *, struct wmEvent *);
+ int (*block_event_func)(const struct bContext *C, struct uiBlock *, const struct wmEvent *);
/* extra draw function for custom blocks */
void (*drawextra)(const struct bContext *C, void *idv, void *arg1, void *arg2, rcti *rect);
@@ -468,7 +468,7 @@ ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBu
int ui_searchbox_inside(struct ARegion *ar, int x, int y);
void ui_searchbox_update(struct bContext *C, struct ARegion *ar, uiBut *but, int reset);
void ui_searchbox_autocomplete(struct bContext *C, struct ARegion *ar, uiBut *but, char *str);
-void ui_searchbox_event(struct bContext *C, struct ARegion *ar, uiBut *but, struct wmEvent *event);
+void ui_searchbox_event(struct bContext *C, struct ARegion *ar, uiBut *but, const struct wmEvent *event);
void ui_searchbox_apply(uiBut *but, struct ARegion *ar);
void ui_searchbox_free(struct bContext *C, struct ARegion *ar);
void ui_but_search_test(uiBut *but);
@@ -489,7 +489,7 @@ int ui_step_name_menu(uiBut *but, int step);
struct AutoComplete;
/* interface_panel.c */
-extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event);
+extern int ui_handler_panel_region(struct bContext *C, const struct wmEvent *event);
extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect);
/* interface_draw.c */
@@ -507,7 +507,7 @@ void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rct
void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
/* interface_handlers.c */
-extern void ui_pan_to_scroll(struct wmEvent *event, int *type, int *val);
+extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val);
extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but);
extern void ui_button_active_free(const struct bContext *C, uiBut *but);
extern int ui_button_is_active(struct ARegion *ar);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 10375824518..c69f53a53d2 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -624,6 +624,18 @@ void uiFileBrowseContextProperty(const bContext *C, PointerRNA *ptr, PropertyRNA
/********************* Button Items *************************/
+/**
+ * Update a buttons tip with an enum's description if possible.
+ */
+static void ui_but_tip_from_enum_item(uiBut *but, EnumPropertyItem *item)
+{
+ if (but->tip == NULL || but->tip[0] == '\0') {
+ if (item->description && item->description[0]) {
+ but->tip = item->description;
+ }
+ }
+}
+
/* disabled item */
static void ui_item_disabled(uiLayout *layout, const char *name)
{
@@ -837,6 +849,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
else {
uiItemEnumO_ptr__internal(column, ot, item[i].name, item[i].icon, prop, item[i].value);
}
+ ui_but_tip_from_enum_item(block->buttons.last, &item[i]);
}
else {
if (item[i].name) {
@@ -849,6 +862,8 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
uiItemL(column, item[i].name, ICON_NONE);
bt = block->buttons.last;
bt->flag = UI_TEXT_LEFT;
+
+ ui_but_tip_from_enum_item(bt, &item[i]);
}
else { /* XXX bug here, colums draw bottom item badly */
uiItemS(column);
@@ -1239,6 +1254,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
for (i = 0; i < totitem; i++) {
if (item[i].identifier[0]) {
uiItemEnumR(column, item[i].name, ICON_NONE, ptr, propname, item[i].value);
+ ui_but_tip_from_enum_item(block->buttons.last, &item[i]);
}
else {
if (item[i].name) {
@@ -1251,6 +1267,8 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
uiItemL(column, item[i].name, ICON_NONE);
bt = block->buttons.last;
bt->flag = UI_TEXT_LEFT;
+
+ ui_but_tip_from_enum_item(bt, &item[i]);
}
else
uiItemS(column);
@@ -1393,7 +1411,11 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
/* turn button into search button */
if (searchprop) {
- but->type = SEARCH_MENU_UNLINK;
+ if (RNA_property_flag(prop) & PROP_NEVER_UNLINK)
+ but->type = SEARCH_MENU;
+ else
+ but->type = SEARCH_MENU_UNLINK;
+
but->hardmax = MAX2(but->hardmax, 256.0f);
but->rnasearchpoin = *searchptr;
but->rnasearchprop = searchprop;
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index e57e52d74b6..e03a171da18 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -661,11 +661,12 @@ static int reports_to_text_poll(bContext *C)
static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
{
ReportList *reports = CTX_wm_reports(C);
+ Main *bmain = CTX_data_main(C);
Text *txt;
char *str;
/* create new text-block to write to */
- txt = BKE_text_add("Recent Reports");
+ txt = BKE_text_add(bmain, "Recent Reports");
/* convert entire list to a display string, and add this to the text-block
* - if commandline debug option enabled, show debug reports too
@@ -803,7 +804,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
}
if (text == NULL) {
- text = BKE_text_load(filepath, bmain->name);
+ text = BKE_text_load(bmain, filepath, bmain->name);
}
if (text == NULL) {
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index c2c1de9cbd7..1b2034d6e40 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -875,7 +875,7 @@ static void ui_do_animate(const bContext *C, Panel *panel)
void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar)
{
Panel *pa;
-
+
/* set all panels as inactive, so that at the end we know
* which ones were used */
for (pa = ar->panels.first; pa; pa = pa->next) {
@@ -1016,7 +1016,7 @@ static void check_panel_overlap(ARegion *ar, Panel *panel)
/************************ panel dragging ****************************/
-static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
+static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel)
{
uiHandlePanelData *data = panel->activedata;
ScrArea *sa = CTX_wm_area(C);
@@ -1134,7 +1134,7 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
/* XXX should become modal keymap */
/* AKey is opening/closing panels, independent of button state now */
-int ui_handler_panel_region(bContext *C, wmEvent *event)
+int ui_handler_panel_region(bContext *C, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
uiBlock *block;
@@ -1277,7 +1277,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
/**************** window level modal panel interaction **************/
/* note, this is modal handler and should not swallow events for animation */
-static int ui_handler_panel(bContext *C, wmEvent *event, void *userdata)
+static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata)
{
Panel *panel = userdata;
uiHandlePanelData *data = panel->activedata;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index e846fc3f078..9b2ed9f0984 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -893,7 +893,7 @@ void ui_searchbox_apply(uiBut *but, ARegion *ar)
}
}
-void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, wmEvent *event)
+void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, const wmEvent *event)
{
uiSearchboxData *data = ar->regiondata;
int type = event->type, val = event->val;
@@ -1532,7 +1532,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
{
uiBut *bt;
- int width = UI_ThemeMenuShadowWidth();
+ int width = UI_SCREEN_MARGIN;
int winx, winy;
if (block->flag & UI_BLOCK_NO_WIN_CLIP) {
@@ -2195,7 +2195,7 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
}
-static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, wmEvent *event)
+static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, const wmEvent *event)
{
float add = 0.0f;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 58d59391939..0876e8f362c 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -1595,11 +1595,12 @@ static uiBlock *icon_view_menu(bContext *C, ARegion *ar, void *arg_litem)
for (a = 0; item[a].identifier; a++) {
int x, y;
- x = (a % 8) * UI_UNIT_X * 6;
- y = (a / 8) * UI_UNIT_X * 6;
+ /* XXX hardcoded size to 5 x unit */
+ x = (a % 8) * UI_UNIT_X * 5;
+ y = (a / 8) * UI_UNIT_X * 5;
icon = item[a].icon;
- but = uiDefIconButR_prop(block, ROW, 0, icon, x, y, UI_UNIT_X * 6, UI_UNIT_Y * 6, &cb.ptr, cb.prop, -1, 0, icon, -1, -1, NULL);
+ but = uiDefIconButR_prop(block, ROW, 0, icon, x, y, UI_UNIT_X * 5, UI_UNIT_Y * 5, &cb.ptr, cb.prop, -1, 0, icon, -1, -1, NULL);
uiButSetFlag(but, UI_HAS_ICON | UI_ICON_PREVIEW);
}
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 41bbed8eb19..ae89b25d5ea 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1029,16 +1029,16 @@ void UI_view2d_view_ortho(View2D *v2d)
/* XXX ton: this flag set by outliner, for icons */
if (v2d->flag & V2D_PIXELOFS_X) {
- curmasked.xmin = floorf(curmasked.xmin) - 0.001f;
- curmasked.xmax = floorf(curmasked.xmax) - 0.001f;
+ curmasked.xmin = floorf(curmasked.xmin) - (0.001f + xofs);
+ curmasked.xmax = floorf(curmasked.xmax) - (0.001f + xofs);
}
if (v2d->flag & V2D_PIXELOFS_Y) {
- curmasked.ymin = floorf(curmasked.ymin) - 0.001f;
- curmasked.ymax = floorf(curmasked.ymax) - 0.001f;
+ curmasked.ymin = floorf(curmasked.ymin) - (0.001f + yofs);
+ curmasked.ymax = floorf(curmasked.ymax) - (0.001f + yofs);
}
/* set matrix on all appropriate axes */
- wmOrtho2(curmasked.xmin - xofs, curmasked.xmax - xofs, curmasked.ymin - yofs, curmasked.ymax - yofs);
+ wmOrtho2(curmasked.xmin, curmasked.xmax, curmasked.ymin, curmasked.ymax);
/* XXX is this necessary? */
glLoadIdentity();
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index f53672b7092..2004b18adf6 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -308,18 +308,47 @@ void WM_OT_collada_export(wmOperatorType *ot)
static int wm_collada_import_exec(bContext *C, wmOperator *op)
{
char filename[FILE_MAX];
+ int import_units;
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
BKE_report(op->reports, RPT_ERROR, "No filename given");
return OPERATOR_CANCELLED;
}
- RNA_string_get(op->ptr, "filepath", filename);
- if (collada_import(C, filename)) return OPERATOR_FINISHED;
+ /* Options panel */
+ import_units = RNA_boolean_get(op->ptr, "import_units");
+ RNA_string_get(op->ptr, "filepath", filename);
+ if (collada_import( C,
+ filename,
+ import_units)) {
+ return OPERATOR_FINISHED;
+ }
+ else {
BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document (see console for details)");
+ return OPERATOR_CANCELLED;
+ }
+}
+
+static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
+{
+ uiLayout *box, *row;
+
+ /* Import Options: */
+ box = uiLayoutBox(layout);
+ row = uiLayoutRow(box, FALSE);
+ uiItemL(row, IFACE_("Import Data Options:"), ICON_MESH_DATA);
- return OPERATOR_FINISHED;
+ row = uiLayoutRow(box, FALSE);
+ uiItemR(row, imfptr, "import_units", 0, NULL, ICON_NONE);
+}
+
+static void wm_collada_import_draw(bContext *UNUSED(C), wmOperator *op)
+{
+ PointerRNA ptr;
+
+ RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
+ uiCollada_importSettings(op->layout, &ptr);
}
void WM_OT_collada_import(wmOperatorType *ot)
@@ -332,7 +361,15 @@ void WM_OT_collada_import(wmOperatorType *ot)
ot->exec = wm_collada_import_exec;
ot->poll = WM_operator_winactive;
+ //ot->flag |= OPTYPE_PRESET;
+
+ ot->ui = wm_collada_import_draw;
+
WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_OPENFILE,
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+
+ RNA_def_boolean(ot->srna, "import_units", 0, "Import Units",
+ "If enabled use Units as defined in Collada Import, else keep Blender's current Units settings");
+
}
#endif
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index 35f85f3faee..0a996c11f14 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -36,6 +36,7 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
+#include "BKE_main.h"
#include "BKE_mask.h"
#include "DNA_scene_types.h"
@@ -261,9 +262,10 @@ int ED_mask_feather_find_nearest(const bContext *C, Mask *mask, float normal_co[
Mask *ED_mask_new(bContext *C, const char *name)
{
ScrArea *sa = CTX_wm_area(C);
+ Main *bmain = CTX_data_main(C);
Mask *mask;
- mask = BKE_mask_new(name);
+ mask = BKE_mask_new(bmain, name);
if (sa && sa->spacedata.first) {
switch (sa->spacetype) {
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index e49dc3c28f9..bc7fe783e78 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -645,6 +645,7 @@ static void knife_get_vert_faces(KnifeTool_OpData *kcd, KnifeVert *kfv, BMFace *
{
BMIter bmiter;
BMFace *f;
+ Ref *r;
if (kfv->isface && facef) {
knife_append_list(kcd, lst, facef);
@@ -654,6 +655,11 @@ static void knife_get_vert_faces(KnifeTool_OpData *kcd, KnifeVert *kfv, BMFace *
knife_append_list(kcd, lst, f);
}
}
+ else {
+ for (r = kfv->faces.first; r; r = r->next) {
+ knife_append_list(kcd, lst, r->ref);
+ }
+ }
}
static void knife_get_edge_faces(KnifeTool_OpData *kcd, KnifeEdge *kfe, ListBase *lst)
@@ -780,6 +786,7 @@ static void knife_cut_through(KnifeTool_OpData *kcd)
kcd->totlinehit = 0;
/* set up for next cut */
+ kcd->curr.vert = lastv;
kcd->prev = kcd->curr;
}
@@ -1853,7 +1860,7 @@ static void remerge_faces(KnifeTool_OpData *kcd)
BMOperator bmop;
int idx;
- BMO_op_initf(bm, &bmop, "beautify_fill faces=%ff constrain_edges=%fe", FACE_NEW, BOUNDARY);
+ BMO_op_initf(bm, &bmop, "beautify_fill faces=%ff edges=%Fe", FACE_NEW, BOUNDARY);
BMO_op_exec(bm, &bmop);
BMO_slot_buffer_flag_enable(bm, &bmop, "geom.out", BM_FACE, FACE_NEW);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index b411cd2bd27..647bb6c1d77 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3314,9 +3314,12 @@ static int edbm_fill_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
+ int use_beauty = RNA_boolean_get(op->ptr, "use_beauty");
BMOperator bmop;
- if (!EDBM_op_init(em, &bmop, op, "triangle_fill edges=%he", BM_ELEM_SELECT)) {
+ if (!EDBM_op_init(em, &bmop, op,
+ "triangle_fill edges=%he use_beauty=%b",
+ BM_ELEM_SELECT, use_beauty)) {
return OPERATOR_CANCELLED;
}
@@ -3348,6 +3351,8 @@ void MESH_OT_fill(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "use_beauty", true, "Beauty", "Use best triangulation division");
}
static int edbm_beautify_fill_exec(bContext *C, wmOperator *op)
@@ -3355,7 +3360,7 @@ static int edbm_beautify_fill_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- if (!EDBM_op_callf(em, op, "beautify_fill faces=%hf", BM_ELEM_SELECT))
+ if (!EDBM_op_callf(em, op, "beautify_fill faces=%hf edges=ae", BM_ELEM_SELECT))
return OPERATOR_CANCELLED;
EDBM_update_generic(em, TRUE, TRUE);
@@ -3384,10 +3389,22 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
+ BMOperator bmop;
int use_beauty = RNA_boolean_get(op->ptr, "use_beauty");
- if (!EDBM_op_callf(em, op, "triangulate faces=%hf use_beauty=%b", BM_ELEM_SELECT, use_beauty))
+ EDBM_op_init(em, &bmop, op, "triangulate faces=%hf use_beauty=%b", BM_ELEM_SELECT, use_beauty);
+ BMO_op_exec(em->bm, &bmop);
+
+ /* now call beauty fill */
+ if (use_beauty) {
+ EDBM_op_callf(em, op,
+ "beautify_fill faces=%S edges=%S",
+ &bmop, "faces.out", &bmop, "edges.out");
+ }
+
+ if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
+ }
EDBM_update_generic(em, TRUE, TRUE);
@@ -3408,7 +3425,7 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_boolean(ot->srna, "use_beauty", 1, "Beauty", "Use best triangulation division (currently quads only)");
+ RNA_def_boolean(ot->srna, "use_beauty", 1, "Beauty", "Use best triangulation division");
}
static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op)
@@ -3955,9 +3972,11 @@ static int edbm_select_mirror_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
int extend = RNA_boolean_get(op->ptr, "extend");
- EDBM_select_mirrored(obedit, em, extend);
- EDBM_selectmode_flush(em);
- WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+ if (em->bm->totvert && em->bm->totvertsel) {
+ EDBM_select_mirrored(obedit, em, extend);
+ EDBM_selectmode_flush(em);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+ }
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 1d13aa36a6b..0c9a5aab537 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -575,13 +575,19 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
- Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
+ Base *base;
Image *ima = NULL;
Mesh *me;
Object *obedit;
int exitmode = 0;
- char name[MAX_ID_NAME - 2];
+ if (v3d == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "No 3D View Available");
+ return OPERATOR_CANCELLED;
+ }
+
+ base = ED_view3d_give_base_under_cursor(C, event->mval);
+
/* Check context */
if (base == NULL || base->object->type != OB_MESH) {
BKE_report(op->reports, RPT_ERROR, "Not an object or mesh");
@@ -596,6 +602,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
ima = BKE_image_load_exists(path);
}
else {
+ char name[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "name", name);
ima = (Image *)BKE_libblock_find_name(ID_IM, name);
}
@@ -641,7 +648,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
void MESH_OT_drop_named_image(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Assign Image to UV Map";
+ ot->name = "Drop Image to Mesh UV Map";
ot->description = "Assign Image to active UV Map, or create an UV Map";
ot->idname = "MESH_OT_drop_named_image";
@@ -650,7 +657,7 @@ void MESH_OT_drop_named_image(wmOperatorType *ot)
ot->invoke = drop_named_image_invoke;
/* flags */
- ot->flag = OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
/* properties */
RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Image name to assign");
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 9403299b0cd..140681304b2 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -203,7 +203,7 @@ void ED_operatormacros_mesh(void)
OPTYPE_UNDO | OPTYPE_REGISTER);
WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
- RNA_struct_idprops_unset(otmacro->ptr, "release_confirm");
+ RNA_boolean_set(otmacro->ptr, "release_confirm", false);
ot = WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", "Duplicate mesh and move",
OPTYPE_UNDO | OPTYPE_REGISTER);
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 8457b278c6c..ffaa6f61cae 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1558,7 +1558,7 @@ static int convert_exec(bContext *C, wmOperator *op)
mb = newob->data;
mb->id.us--;
- newob->data = BKE_mesh_add("Mesh");
+ newob->data = BKE_mesh_add(bmain, "Mesh");
newob->type = OB_MESH;
me = newob->data;
@@ -2005,7 +2005,8 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
static int add_named_exec(bContext *C, wmOperator *op)
{
- wmEvent *event = CTX_wm_window(C)->eventstate;
+ wmWindow *win = CTX_wm_window(C);
+ wmEvent *event = win ? win->eventstate : NULL;
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Base *basen, *base;
@@ -2037,8 +2038,10 @@ static int add_named_exec(bContext *C, wmOperator *op)
basen->lay = basen->object->lay = scene->lay;
- ED_object_location_from_view(C, basen->object->loc);
- ED_view3d_cursor3d_position(C, basen->object->loc, event->x, event->y);
+ if (event) {
+ ED_object_location_from_view(C, basen->object->loc);
+ ED_view3d_cursor3d_position(C, basen->object->loc, event->x, event->y);
+ }
ED_base_object_activate(C, basen);
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 7bf1a5db3b1..9b683a1ba98 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -311,7 +311,7 @@ static int group_create_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "name", name);
- group = add_group(name);
+ group = add_group(bmain, name);
CTX_DATA_BEGIN (C, Base *, base, selected_bases)
{
@@ -348,12 +348,13 @@ static int group_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_context(C);
+ Main *bmain = CTX_data_main(C);
Group *group;
if (ob == NULL)
return OPERATOR_CANCELLED;
- group = add_group("Group");
+ group = add_group(bmain, "Group");
add_to_group(group, ob, scene, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index da12db50cc5..33b159f3cf2 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -2168,7 +2168,7 @@ void OBJECT_OT_drop_named_material(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_UNDO;
+ ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
/* properties */
RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME - 2, "Name", "Material name to assign");
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 7a2eb5667a2..68075e7b6f9 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -57,6 +57,7 @@
#include "BKE_tessmesh.h"
#include "BKE_multires.h"
#include "BKE_armature.h"
+#include "BKE_lattice.h"
#include "RNA_define.h"
#include "RNA_access.h"
@@ -699,9 +700,11 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
else {
if (around == V3D_CENTROID) {
- const float total_div = 1.0f / (float)em->bm->totvert;
- BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- madd_v3_v3fl(cent, eve->co, total_div);
+ if (em->bm->totvert) {
+ const float total_div = 1.0f / (float)em->bm->totvert;
+ BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+ madd_v3_v3fl(cent, eve->co, total_div);
+ }
}
}
else {
@@ -899,6 +902,20 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
break;
}
}
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt = ob->data;
+
+ if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
+ else if (around == V3D_CENTROID) { BKE_lattice_center_median(lt, cent); }
+ else { BKE_lattice_center_bounds(lt, cent); }
+
+ negate_v3_v3(cent_neg, cent);
+ BKE_lattice_translate(lt, cent_neg, 1);
+
+ tot_change++;
+ lt->id.flag |= LIB_DOIT;
+ do_inverse_offset = TRUE;
+ }
/* offset other selected objects */
if (do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {
diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt
index 435327319aa..29d8aec4224 100644
--- a/source/blender/editors/physics/CMakeLists.txt
+++ b/source/blender/editors/physics/CMakeLists.txt
@@ -64,7 +64,7 @@ endif()
if(WITH_BULLET)
list(APPEND INC
- ../../rigidbody
+ ../../../../intern/rigidbody
)
add_definitions(-DWITH_BULLET)
endif()
diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript
index b68cc944925..7916ea24bde 100644
--- a/source/blender/editors/physics/SConscript
+++ b/source/blender/editors/physics/SConscript
@@ -33,7 +33,7 @@ incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../gpu ../../blenloader ../../bmesh'
incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern'
-incs += ' ../../rigidbody'
+incs += ' #/intern/rigidbody'
defs = []
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index deddc649956..78377834b9f 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3397,7 +3397,7 @@ static int brush_add(PEData *data, short number)
weight[w] = 0.0f;
}
- if(totw > 0.0f) {
+ if (totw > 0.0f) {
for (w=0; w<maxw; w++)
weight[w] /= totw;
}
@@ -4151,7 +4151,7 @@ int PE_minmax(Scene *scene, float min[3], float max[3])
BKE_object_minmax(ob, min, max, TRUE);
ok= 1;
}
-
+
return ok;
}
diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c
index fac835a414a..b2f53379090 100644
--- a/source/blender/editors/physics/rigidbody_constraint.c
+++ b/source/blender/editors/physics/rigidbody_constraint.c
@@ -45,6 +45,7 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
+#include "BKE_global.h"
#include "BKE_group.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -87,7 +88,7 @@ void ED_rigidbody_con_add(wmOperator *op, Scene *scene, Object *ob, int type)
}
/* create constraint group if it doesn't already exits */
if (rbw->constraints == NULL) {
- rbw->constraints = add_group("RigidBodyConstraints");
+ rbw->constraints = add_group(G.main, "RigidBodyConstraints");
}
/* make rigidbody constraint settings */
ob->rigidbody_constraint = BKE_rigidbody_create_constraint(scene, ob, type);
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index 38ed903a161..9ce4656d4cd 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -46,6 +46,7 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
+#include "BKE_global.h"
#include "BKE_group.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -113,7 +114,7 @@ void ED_rigidbody_ob_add(wmOperator *op, Scene *scene, Object *ob, int type)
scene->rigidbody_world = rbw;
}
if (rbw->group == NULL) {
- rbw->group = add_group("RigidBodyWorld");
+ rbw->group = add_group(G.main, "RigidBodyWorld");
}
/* make rigidbody object settings */
@@ -337,12 +338,14 @@ static int rigidbody_obs_shape_change_exec(bContext *C, wmOperator *op)
/* use RNA-system to change the property and perform all necessary changes */
RNA_pointer_create(&ob->id, &RNA_RigidBodyObject, ob->rigidbody_object, &ptr);
RNA_enum_set(&ptr, "collision_shape", shape);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
}
CTX_DATA_END;
/* send updates */
- WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); // XXX: wrong notifiers for now, but these also do the job...
+ WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -583,12 +586,14 @@ static int rigidbody_obs_calc_mass_exec(bContext *C, wmOperator *op)
/* use RNA-system to change the property and perform all necessary changes */
RNA_pointer_create(&ob->id, &RNA_RigidBodyObject, ob->rigidbody_object, &ptr);
RNA_float_set(&ptr, "mass", mass);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
}
CTX_DATA_END;
/* send updates */
- WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); // XXX: wrong notifiers for now, but these also do the job...
+ WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
/* done */
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 16ebaf58a59..994c7275ecd 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -1100,6 +1100,10 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
ShaderPreview *sp;
Scene *scene = CTX_data_scene(C);
+ /* node previews not supported for cycles */
+ if (BKE_scene_use_new_shading_nodes(scene) && method == PR_NODE_RENDER)
+ return;
+
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview",
WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW);
sp = MEM_callocN(sizeof(ShaderPreview), "shader preview");
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index dfc53d0b195..aa1edb1c1b1 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -373,6 +373,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
+ Main *bmain = CTX_data_main(C);
PointerRNA ptr, idptr;
PropertyRNA *prop;
@@ -381,7 +382,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
ma = BKE_material_copy(ma);
}
else {
- ma = BKE_material_add("Material");
+ ma = BKE_material_add(bmain, "Material");
if (BKE_scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &ma->id);
@@ -426,6 +427,7 @@ void MATERIAL_OT_new(wmOperatorType *ot)
static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
{
Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+ Main *bmain = CTX_data_main(C);
PointerRNA ptr, idptr;
PropertyRNA *prop;
@@ -433,7 +435,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
if (tex)
tex = BKE_texture_copy(tex);
else
- tex = add_texture("Texture");
+ tex = add_texture(bmain, "Texture");
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
@@ -473,6 +475,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data;
+ Main *bmain = CTX_data_main(C);
PointerRNA ptr, idptr;
PropertyRNA *prop;
@@ -481,7 +484,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
wo = BKE_world_copy(wo);
}
else {
- wo = add_world("World");
+ wo = add_world(bmain, "World");
if (BKE_scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &wo->id);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index cca713ec14a..7c22dff1b01 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1337,13 +1337,14 @@ int ED_screen_area_active(const bContext *C)
/* Do NOT call in area/region queues! */
void ED_screen_set(bContext *C, bScreen *sc)
{
+ Main *bmain = CTX_data_main(C);
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
bScreen *oldscreen = CTX_wm_screen(C);
ID *id;
/* validate screen, it's called with notifier reference */
- for (id = CTX_data_main(C)->screen.first; id; id = id->next)
+ for (id = bmain->screen.first; id; id = id->next)
if (sc == (bScreen *)id)
break;
if (id == NULL)
@@ -1355,7 +1356,7 @@ void ED_screen_set(bContext *C, bScreen *sc)
if (sc->full) { /* find associated full */
bScreen *sc1;
- for (sc1 = CTX_data_main(C)->screen.first; sc1; sc1 = sc1->id.next) {
+ for (sc1 = bmain->screen.first; sc1; sc1 = sc1->id.next) {
ScrArea *sa = sc1->areabase.first;
if (sa->full == sc) {
sc = sc1;
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index e7f5e57552c..da2facc244a 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -360,7 +360,7 @@ int ED_operator_editarmature(bContext *C)
/**
* \brief check for pose mode (no mixed modes)
*
- * We wan't to enable most pose operations in weight paint mode,
+ * We want to enable most pose operations in weight paint mode,
* when it comes to transforming bones, but managing bomes layers/groups
* can be left for pose mode only. (not weight paint mode)
*/
@@ -3598,8 +3598,8 @@ static void SCENE_OT_delete(wmOperatorType *ot)
/* ***************** region alpha blending ***************** */
/* implementation note: a disapplearing region needs at least 1 last draw with 100% backbuffer
- texture over it- then triple buffer will clear it entirely.
- This because flag RGN_HIDDEN is set in end - region doesnt draw at all then */
+ * texture over it- then triple buffer will clear it entirely.
+ * This because flag RGN_HIDDEN is set in end - region doesnt draw at all then */
typedef struct RegionAlphaInfo {
ScrArea *sa;
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index efd0db3b442..1f7fee313b3 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -272,7 +272,8 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE, FILE_SPECIAL, FILE_SAVE,
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
- RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Capture the whole window. Otherwise only capture the active area");
+ RNA_def_boolean(ot->srna, "full", 1, "Full Screen",
+ "Capture the whole window (otherwise only capture the active area)");
}
/* *************** screenshot movie job ************************* */
@@ -500,5 +501,6 @@ void SCREEN_OT_screencast(wmOperatorType *ot)
ot->flag = 0;
RNA_def_property(ot->srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Capture the whole window. Otherwise only capture the active area");
+ RNA_def_boolean(ot->srna, "full", 1, "Full Screen",
+ "Capture the whole window (otherwise only capture the active area)");
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index c60097e20eb..74399857a97 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -4347,7 +4347,7 @@ static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, c
pos[1] = (float)(mval_i[1]);
// we may want to use this later
- // BKE_brush_painter_require_imbuf(painter, ((ibuf->rect_float)? 1: 0), 0, 0);
+ // BKE_brush_painter_require_imbuf(painter, ((ibuf->rect_float) ? 1 : 0), 0, 0);
if (BKE_brush_painter_paint(painter, project_paint_op, pos, time, pressure, ps, 0)) {
return 1;
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 618d545b084..408572c7979 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -62,11 +62,12 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
/*int type = RNA_enum_get(op->ptr, "type");*/
Paint *paint = paint_get_active_from_context(C);
struct Brush *br = paint_brush(paint);
+ Main *bmain = CTX_data_main(C);
if (br)
br = BKE_brush_copy(br);
else
- br = BKE_brush_add("Brush");
+ br = BKE_brush_add(bmain, "Brush");
paint_brush_set(paint, br);
@@ -272,7 +273,7 @@ static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool,
brush = brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode);
if (!brush && brush_tool(brush_orig, tool_offset) != tool && create_missing) {
- brush = BKE_brush_add(tool_name);
+ brush = BKE_brush_add(bmain, tool_name);
brush_tool_set(brush, tool_offset, tool);
brush->ob_mode = ob_mode;
brush->toggle_brush = brush_orig;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 5b04bdb8ee7..956f8d2c136 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1029,6 +1029,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
unsigned int index;
view3d_operator_needs_opengl(C);
+ ED_view3d_init_mats_rv3d(vc.obact, vc.rv3d);
if (use_vert_sel) {
if (ED_mesh_pick_vert(C, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_VERT_SIZE, TRUE)) {
@@ -1118,6 +1119,7 @@ static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA
win->eventstate->y - vc.ar->winrct.ymin};
view3d_operator_needs_opengl(C);
+ ED_view3d_init_mats_rv3d(vc.obact, vc.rv3d);
if (use_vert_sel) {
if (ED_mesh_pick_vert(C, vc.obact, mval, &index, ED_MESH_PICK_DEFAULT_VERT_SIZE, TRUE)) {
@@ -2230,7 +2232,8 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
indexar = wpd->indexar;
view3d_operator_needs_opengl(C);
-
+ ED_view3d_init_mats_rv3d(ob, vc->rv3d);
+
/* load projection matrix */
mult_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat);
@@ -2863,7 +2866,8 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
RNA_float_get_array(itemptr, "mouse", mval);
view3d_operator_needs_opengl(C);
-
+ ED_view3d_init_mats_rv3d(ob, vc->rv3d);
+
/* load projection matrix */
mult_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index ce7d72f9787..10f4dc2aebc 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -654,7 +654,6 @@ static int sculpt_brush_test_cyl(SculptBrushTest *test, float co[3], float locat
/* ===== Sculpting =====
*
*/
-
static float overlapped_curve(Brush *br, float x)
{
@@ -4527,7 +4526,7 @@ static void SCULPT_OT_set_persistent_base(wmOperatorType *ot)
static void sculpt_dynamic_topology_triangulate(BMesh *bm)
{
- BMO_op_callf(bm, BMO_FLAG_DEFAULTS, "triangulate faces=%af");
+ BM_mesh_triangulate(bm, false, false, NULL, NULL);
}
void sculpt_pbvh_clear(Object *ob)
@@ -4571,6 +4570,7 @@ void sculpt_dynamic_topology_enable(bContext *C)
ss->bm = BM_mesh_create(&bm_mesh_allocsize_default);
BM_mesh_bm_from_me(ss->bm, me, TRUE, ob->shapenr);
+ BM_mesh_normals_update(ss->bm, false);
sculpt_dynamic_topology_triangulate(ss->bm);
BM_data_layer_add(ss->bm, &ss->bm->vdata, CD_PAINT_MASK);
BM_mesh_normals_update(ss->bm, TRUE);
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index a80d425b90a..7e99e6c065d 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -53,6 +53,7 @@
#include "BKE_action.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_nla.h"
#include "BKE_context.h"
#include "BKE_report.h"
@@ -104,8 +105,10 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op))
action = BKE_action_copy(oldact);
}
else {
+ Main *bmain = CTX_data_main(C);
+
/* just make a new (empty) action */
- action = add_empty_action("Action");
+ action = add_empty_action(bmain, "Action");
}
/* when creating new ID blocks, use is already 1 (fake user),
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index d0f76c21019..964a6a20c37 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -259,12 +259,35 @@ static void borderselect_action(bAnimContext *ac, rcti rect, short mode, short s
!((ymax < rectf.ymin) || (ymin > rectf.ymax)))
{
/* loop over data selecting */
- if (ale->type == ANIMTYPE_GPLAYER)
- ED_gplayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode);
- else if (ale->type == ANIMTYPE_MASKLAYER)
- ED_masklayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode);
- else
- ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL);
+ switch (ale->type) {
+ case ANIMTYPE_GPDATABLOCK:
+ {
+ bGPdata *gpd = ale->data;
+ bGPDlayer *gpl;
+ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ ED_gplayer_frames_select_border(gpl, rectf.xmin, rectf.xmax, selectmode);
+ }
+ break;
+ }
+ case ANIMTYPE_GPLAYER:
+ ED_gplayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode);
+ break;
+ case ANIMTYPE_MASKDATABLOCK:
+ {
+ Mask *mask = ale->data;
+ MaskLayer *masklay;
+ for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+ ED_masklayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode);
+ }
+ break;
+ }
+ case ANIMTYPE_MASKLAYER:
+ ED_masklayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode);
+ break;
+ default:
+ ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL);
+ break;
+ }
}
/* set minimum extent to be the maximum of the next channel */
@@ -944,6 +967,7 @@ static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short s
else if (ale->type == ANIMTYPE_MASKLAYER)
ED_mask_select_frame(ale->data, selx, select_mode);
}
+ BLI_freelistN(&anim_data);
}
else {
ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index cf4e76a8427..dfb69be6f18 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -160,6 +160,7 @@ static int open_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
bScreen *screen = CTX_wm_screen(C);
+ Main *bmain = CTX_data_main(C);
PropertyPointerRNA *pprop;
PointerRNA idptr;
MovieClip *clip = NULL;
@@ -191,7 +192,7 @@ static int open_exec(bContext *C, wmOperator *op)
errno = 0;
- clip = BKE_movieclip_file_add(str);
+ clip = BKE_movieclip_file_add(bmain, str);
if (!clip) {
if (op->customdata)
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index 1bdf5214192..ad70abf5732 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -219,23 +219,32 @@ static void clip_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOp
static void clip_panel_operator_redo(const bContext *C, Panel *pa)
{
wmOperator *op = WM_operator_last_redo(C);
- uiBlock *block;
+ ARegion *ar;
+ ARegion *ar1;
if (op == NULL)
return;
- if (WM_operator_poll((bContext *)C, op->type) == 0)
- return;
+ /* keep in sync with logic in ED_undo_operator_repeat() */
+ ar = CTX_wm_region(C);
+ ar1 = BKE_area_find_region_type(CTX_wm_area(C), RGN_TYPE_WINDOW);
+ if (ar1)
+ CTX_wm_region_set((bContext *)C, ar1);
+
+ if (WM_operator_poll((bContext *)C, op->type)) {
+ uiBlock *block = uiLayoutGetBlock(pa->layout);
- block = uiLayoutGetBlock(pa->layout);
+ if (!WM_operator_check_ui_enabled(C, op->type->name))
+ uiLayoutSetEnabled(pa->layout, FALSE);
- if (!WM_operator_check_ui_enabled(C, op->type->name))
- uiLayoutSetEnabled(pa->layout, FALSE);
+ /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
+ uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
- /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
- uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
+ clip_panel_operator_redo_operator(C, pa, op);
+ }
- clip_panel_operator_redo_operator(C, pa, op);
+ /* set region back */
+ CTX_wm_region_set((bContext *)C, ar);
}
void ED_clip_tool_props_register(ARegionType *art)
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 778a3f4df3e..8c45b161d26 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -95,7 +95,7 @@ FileSelectParams *ED_fileselect_get_params(struct SpaceFile *sfile)
}
/**
- * \note RNA_struct_property_is_set_ex is used here because we wan't
+ * \note RNA_struct_property_is_set_ex is used here because we want
* the previously used settings to be used here rather then overriding them */
short ED_fileselect_set_params(SpaceFile *sfile)
{
@@ -244,9 +244,11 @@ short ED_fileselect_set_params(SpaceFile *sfile)
params->display = FILE_SHORTDISPLAY;
params->filter = 0;
params->filter_glob[0] = '\0';
- params->sort = FILE_SORT_ALPHA;
}
+ /* operator has no setting for this */
+ params->sort = FILE_SORT_ALPHA;
+
/* initialize the list with previous folders */
if (!sfile->folders_prev)
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index ba4f8287cd7..00bc3d1d26b 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -425,11 +425,11 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl
MEM_freeN(trectf);
/* ogl trick below is slower... (on ATI 9600) */
// glColorMask(1, 0, 0, 0);
-// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf+3);
+// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf + 3);
// glColorMask(0, 1, 0, 0);
-// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf+2);
+// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf + 2);
// glColorMask(0, 0, 1, 0);
-// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf+1);
+// glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_RGBA, GL_FLOAT, rectf + 1);
// glColorMask(1, 1, 1, 1);
}
@@ -514,16 +514,12 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
unsigned char *display_buffer;
void *cache_handle;
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
if (sima->flag & SI_USE_ALPHA) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
fdrawcheckerboard(x, y, x + ibuf->x * zoomx, y + ibuf->y * zoomy);
}
- else {
- glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
- glRecti(x, y, x + ibuf->x * zoomx, y + ibuf->y * zoomy);
- }
display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
@@ -536,7 +532,8 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
IMB_display_buffer_release(cache_handle);
- glDisable(GL_BLEND);
+ if (sima->flag & SI_USE_ALPHA)
+ glDisable(GL_BLEND);
}
/* reset zoom */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 23adf7eb575..2d2d29d9eaa 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1716,6 +1716,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
Scene *scene;
Object *obedit;
Image *ima;
+ Main *bmain;
PointerRNA ptr, idptr;
PropertyRNA *prop;
char name[MAX_ID_NAME - 2];
@@ -1726,6 +1727,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
sima = CTX_wm_space_image(C);
scene = CTX_data_scene(C);
obedit = CTX_data_edit_object(C);
+ bmain = CTX_data_main(C);
RNA_string_get(op->ptr, "name", name);
width = RNA_int_get(op->ptr, "width");
@@ -1735,15 +1737,10 @@ static int image_new_exec(bContext *C, wmOperator *op)
RNA_float_get_array(op->ptr, "color", color);
alpha = RNA_boolean_get(op->ptr, "alpha");
- if (!floatbuf) {
- /* OCIO_TODO: perhaps we need to convert to display space, not just to sRGB */
- linearrgb_to_srgb_v3_v3(color, color);
- }
-
if (!alpha)
color[3] = 1.0f;
- ima = BKE_image_add_generated(width, height, name, alpha ? 32 : 24, floatbuf, gen_type, color);
+ ima = BKE_image_add_generated(bmain, width, height, name, alpha ? 32 : 24, floatbuf, gen_type, color);
if (!ima)
return OPERATOR_CANCELLED;
@@ -1806,6 +1803,7 @@ void IMAGE_OT_new(wmOperatorType *ot)
RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width", 1, 16384);
RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height", 1, 16384);
prop = RNA_def_float_color(ot->srna, "color", 4, NULL, 0.0f, FLT_MAX, "Color", "Default fill color", 0.0f, 1.0f);
+ RNA_def_property_subtype(prop, PROP_COLOR_GAMMA);
RNA_def_property_float_array_default(prop, default_color);
RNA_def_boolean(ot->srna, "alpha", 1, "Alpha", "Create an image with an alpha channel");
RNA_def_enum(ot->srna, "generated_type", image_generated_type_items, IMA_GENTYPE_BLANK,
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 1c384ef38d7..35ba83a8bc6 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -152,7 +152,7 @@ static SpaceLink *image_new(const bContext *UNUSED(C))
simage->spacetype = SPACE_IMAGE;
simage->zoom = 1.0f;
simage->lock = TRUE;
- simage->flag = SI_SHOW_GPENCIL;
+ simage->flag = SI_SHOW_GPENCIL | SI_USE_ALPHA;
simage->iuser.ok = TRUE;
simage->iuser.fie_ima = 2;
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 663d136fdf2..22668a3de3a 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -266,10 +266,10 @@ static int unpack_item_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
ID *id;
- char idname[BKE_ST_MAXNAME];
+ char idname[MAX_ID_NAME - 2];
int type = RNA_int_get(op->ptr, "id_type");
int method = RNA_enum_get(op->ptr, "method");
-
+
RNA_string_get(op->ptr, "id_name", idname);
id = BKE_libblock_find_name(type, idname);
@@ -319,7 +319,7 @@ void FILE_OT_unpack_item(wmOperatorType *ot)
/* properties */
RNA_def_enum(ot->srna, "method", unpack_item_method_items, PF_USE_LOCAL, "Method", "How to unpack");
RNA_def_string(ot->srna, "id_name", "", BKE_ST_MAXNAME, "ID name", "Name of ID block to unpack");
- RNA_def_int(ot->srna, "id_type", 0, 0, INT_MAX, "ID Type", "Identifier type of ID block", 0, INT_MAX);
+ RNA_def_int(ot->srna, "id_type", ID_IM, 0, INT_MAX, "ID Type", "Identifier type of ID block", 0, INT_MAX);
}
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index f46151fd33a..fa7e888f8d7 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -1860,6 +1860,25 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
uiItemR(col, ptr, "integral_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "derivate_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
break;
+ case ACT_OBJECT_CHARACTER:
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
+ uiItemR(row, ptr, "offset_location", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(split, TRUE);
+ uiItemR(row, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
+ uiItemR(row, ptr, "use_add_character_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
+
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
+ uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE);
+ uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
+
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
+ split = uiLayoutSplit(row, 0.7, FALSE);
+ uiItemL(split, "", ICON_NONE); /*Just use this for some spacing */
+ uiItemR(split, ptr, "use_character_jump", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
+ break;
}
}
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index cca1858f112..9b342ed8f44 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1983,7 +1983,7 @@ static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED
uiLayout *col, *row;
col = uiLayoutColumn(layout, TRUE);
-
+
uiItemL(layout, IFACE_("Color Space:"), ICON_NONE);
row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -2379,6 +2379,12 @@ static void node_composit_buts_stabilize2d(uiLayout *layout, bContext *C, Pointe
uiItemR(layout, ptr, "filter_type", 0, "", ICON_NONE);
}
+static void node_composit_buts_translate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "use_relative", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "wrap_axis", 0, NULL, ICON_NONE);
+}
+
static void node_composit_buts_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "filter_type", 0, "", ICON_NONE);
@@ -2931,6 +2937,9 @@ static void node_composit_set_butfunc(bNodeType *ntype)
case CMP_NODE_TRANSFORM:
ntype->uifunc = node_composit_buts_transform;
break;
+ case CMP_NODE_TRANSLATE:
+ ntype->uifunc = node_composit_buts_translate;
+ break;
case CMP_NODE_MOVIEDISTORTION:
ntype->uifunc = node_composit_buts_moviedistortion;
break;
@@ -3283,17 +3292,9 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode)
else {
glPixelZoom(snode->zoom, snode->zoom);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
- glRecti(x, y, x + ibuf->x * snode->zoom, y + ibuf->y * snode->zoom);
-
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer);
glPixelZoom(1.0f, 1.0f);
-
- glDisable(GL_BLEND);
}
}
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index b47be150417..22631568d03 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -441,6 +441,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode;
bNodeTree *ntree;
+ Main *bmain;
PointerRNA ptr, idptr;
PropertyRNA *prop;
int treetype;
@@ -448,6 +449,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
/* retrieve state */
snode = CTX_wm_space_node(C);
+ bmain = CTX_data_main(C);
if (RNA_struct_property_is_set(op->ptr, "type"))
treetype = RNA_enum_get(op->ptr, "type");
@@ -457,7 +459,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
if (RNA_struct_property_is_set(op->ptr, "name"))
RNA_string_get(op->ptr, "name", treename);
- ntree = ntreeAddTree(treename, treetype, 0);
+ ntree = ntreeAddTree(bmain, treename, treetype, 0);
if (!ntree)
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 321eaa32e80..fb4e4f62e52 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -328,7 +328,7 @@ void ED_node_shader_default(Scene *scene, ID *id)
int output_type, shader_type;
float color[3], strength = 1.0f;
- ntree = ntreeAddTree("Shader Nodetree", NTREE_SHADER, 0);
+ ntree = ntreeAddTree(G.main, "Shader Nodetree", NTREE_SHADER, 0);
switch (GS(id->name)) {
case ID_MA:
@@ -424,7 +424,7 @@ void ED_node_composit_default(Scene *sce)
return;
}
- sce->nodetree = ntreeAddTree("Compositing Nodetree", NTREE_COMPOSIT, 0);
+ sce->nodetree = ntreeAddTree(G.main, "Compositing Nodetree", NTREE_COMPOSIT, 0);
sce->nodetree->chunksize = 256;
sce->nodetree->edit_quality = NTREE_QUALITY_HIGH;
@@ -468,7 +468,7 @@ void ED_node_texture_default(Tex *tx)
return;
}
- tx->nodetree = ntreeAddTree("Texture Nodetree", NTREE_TEXTURE, 0);
+ tx->nodetree = ntreeAddTree(G.main, "Texture Nodetree", NTREE_TEXTURE, 0);
ntemp.type = TEX_NODE_OUTPUT;
out = nodeAddNode(tx->nodetree, &ntemp);
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index 4dd9c89375d..943f12c4c54 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -457,8 +457,10 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
/* ensure unique node name in the nodee tree */
nodeUniqueName(ntree, node);
- node->locx += gnode->locx;
- node->locy += gnode->locy;
+ if (!node->parent) {
+ node->locx += gnode->locx;
+ node->locy += gnode->locy;
+ }
node->flag |= NODE_SELECT;
}
@@ -673,8 +675,10 @@ static int node_group_separate_selected(bNodeTree *ntree, bNode *gnode, int make
/* ensure unique node name in the node tree */
nodeUniqueName(ntree, newnode);
- newnode->locx += gnode->locx;
- newnode->locy += gnode->locy;
+ if (!newnode->parent) {
+ newnode->locx += gnode->locx;
+ newnode->locy += gnode->locy;
+ }
}
else {
/* ensure valid parent pointers, detach if child stays inside the group */
@@ -865,12 +869,14 @@ static int node_group_make_test(bNodeTree *ntree, bNode *gnode)
static void node_get_selected_minmax(bNodeTree *ntree, bNode *gnode, float *min, float *max)
{
bNode *node;
+ float loc[2];
INIT_MINMAX2(min, max);
for (node = ntree->nodes.first; node; node = node->next) {
if (node == gnode)
continue;
if (node->flag & NODE_SELECT) {
- minmax_v2v2_v2(min, max, &node->locx);
+ nodeToView(node, 0.0f, 0.0f, &loc[0], &loc[1]);
+ minmax_v2v2_v2(min, max, loc);
}
}
}
@@ -921,8 +927,10 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
/* ensure unique node name in the ngroup */
nodeUniqueName(ngroup, node);
- node->locx -= 0.5f * (min[0] + max[0]);
- node->locy -= 0.5f * (min[1] + max[1]);
+ if (!node->parent) {
+ node->locx -= 0.5f * (min[0] + max[0]);
+ node->locy -= 0.5f * (min[1] + max[1]);
+ }
}
else {
/* if the parent is to be inserted but not the child, detach properly */
@@ -1039,7 +1047,7 @@ static bNode *node_group_make_from_selected(bNodeTree *ntree)
node_get_selected_minmax(ntree, NULL, min, max);
/* new nodetree */
- ngroup = ntreeAddTree("NodeGroup", ntree->type, NODE_GROUP);
+ ngroup = ntreeAddTree(G.main, "NodeGroup", ntree->type, NODE_GROUP);
/* make group node */
ntemp.type = NODE_GROUP;
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index e82917feb21..e92d93485a1 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -136,7 +136,7 @@ static void do_node_add_group(bContext *C, void *UNUSED(arg), int event)
ntemp.type = -event;
switch (ntemp.type) {
case NODE_GROUP:
- ntemp.ngroup = ntreeAddTree("Group", snode->treetype, ntemp.type);
+ ntemp.ngroup = ntreeAddTree(bmain, "Group", snode->treetype, ntemp.type);
break;
default:
ntemp.ngroup = NULL;
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 513f6b43e9a..a5f6ca9ded0 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -119,7 +119,7 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
snode = MEM_callocN(sizeof(SpaceNode), "initnode");
snode->spacetype = SPACE_NODE;
- snode->flag = SNODE_SHOW_GPENCIL;
+ snode->flag = SNODE_SHOW_GPENCIL | SNODE_USE_ALPHA;
/* backdrop */
snode->zoom = 1.0f;
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index a087ff65f63..ab660b9cd4a 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -1309,8 +1309,8 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
* for now, we don't supply one, and just let this use the KeyingSet name */
BKE_keyingset_add_path(ks, id, NULL, path, array_index, flag, groupmode);
ks->active_path = BLI_countlist(&ks->paths);
+ break;
}
- break;
case KEYINGSET_EDITMODE_REMOVE:
{
/* find the relevant path, then remove it from the KeyingSet */
@@ -1322,8 +1322,8 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
ks->active_path = 0;
}
+ break;
}
- break;
}
/* free path, since it had to be generated */
@@ -1637,7 +1637,7 @@ void OUTLINER_OT_parent_drop(wmOperatorType *ot)
ot->poll = ED_operator_outliner_active;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
/* properties */
RNA_def_string(ot->srna, "child", "Object", MAX_ID_NAME, "Child", "Child Object");
@@ -1726,7 +1726,7 @@ void OUTLINER_OT_parent_clear(wmOperatorType *ot)
ot->poll = ED_operator_outliner_active;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
/* properties */
RNA_def_string(ot->srna, "dragged_obj", "Object", MAX_ID_NAME, "Child", "Child Object");
@@ -1819,7 +1819,7 @@ void OUTLINER_OT_scene_drop(wmOperatorType *ot)
ot->poll = ED_operator_outliner_active;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
/* properties */
RNA_def_string(ot->srna, "object", "Object", MAX_ID_NAME, "Object", "Target Object");
@@ -1883,7 +1883,7 @@ void OUTLINER_OT_material_drop(wmOperatorType *ot)
ot->poll = ED_operator_outliner_active;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
/* properties */
RNA_def_string(ot->srna, "object", "Object", MAX_ID_NAME, "Object", "Target Object");
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 15528093869..97943f7e6ac 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2463,9 +2463,15 @@ void SEQUENCER_OT_strip_jump(wmOperatorType *ot)
static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
{
int gap = seqb->startdisp - seqa->enddisp;
- seqb->start = (seqb->start - seqb->startdisp) + seqa->startdisp;
+ int seq_a_start;
+ int seq_b_start;
+
+ seq_b_start = (seqb->start - seqb->startdisp) + seqa->startdisp;
+ BKE_sequence_translate(scene, seqb, seq_b_start - seqb->start);
BKE_sequence_calc(scene, seqb);
- seqa->start = (seqa->start - seqa->startdisp) + seqb->enddisp + gap;
+
+ seq_a_start = (seqa->start - seqa->startdisp) + seqb->enddisp + gap;
+ BKE_sequence_translate(scene, seqa, seq_a_start - seqa->start);
BKE_sequence_calc(scene, seqa);
}
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 21966ef614c..1f209f90007 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -161,11 +161,12 @@ void text_update_edited(Text *text)
static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st = CTX_wm_space_text(C);
+ Main *bmain = CTX_data_main(C);
Text *text;
PointerRNA ptr, idptr;
PropertyRNA *prop;
- text = BKE_text_add("Text");
+ text = BKE_text_add(bmain, "Text");
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
@@ -226,6 +227,7 @@ static int text_open_cancel(bContext *UNUSED(C), wmOperator *op)
static int text_open_exec(bContext *C, wmOperator *op)
{
SpaceText *st = CTX_wm_space_text(C);
+ Main *bmain = CTX_data_main(C);
Text *text;
PropertyPointerRNA *pprop;
PointerRNA idptr;
@@ -234,7 +236,7 @@ static int text_open_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", str);
- text = BKE_text_load(str, G.main->name);
+ text = BKE_text_load(bmain, str, G.main->name);
if (!text) {
if (op->customdata) MEM_freeN(op->customdata);
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 29daee3e11b..70d3857601f 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -74,61 +74,18 @@
#include "ED_mesh.h"
-
#include "BLF_api.h"
-
#include "view3d_intern.h" // own include
+struct GPUTexture;
-#ifdef _WIN32
-#include <time.h>
-#include <stdio.h>
-#include <conio.h>
-#include <windows.h>
-
-static LARGE_INTEGER liFrequency;
-static LARGE_INTEGER liStartTime;
-static LARGE_INTEGER liCurrentTime;
+// #define DEBUG_DRAW_TIME
-static void tstart(void)
-{
- QueryPerformanceFrequency(&liFrequency);
- QueryPerformanceCounter(&liStartTime);
-}
-static void tend(void)
-{
- QueryPerformanceCounter(&liCurrentTime);
-}
-static double tval(void)
-{
- return ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart) * (double)1000.0 / (double)liFrequency.QuadPart));
-}
-#else
-#include <sys/time.h>
-static struct timeval _tstart, _tend;
-static struct timezone tz;
-static void tstart(void)
-{
- gettimeofday(&_tstart, &tz);
-}
-static void tend(void)
-{
- gettimeofday(&_tend, &tz);
-}
- #if 0
-static double tval()
-{
- double t1, t2;
- t1 = ( double ) _tstart.tv_sec * 1000 + ( double ) _tstart.tv_usec / (1000);
- t2 = ( double ) _tend.tv_sec * 1000 + ( double ) _tend.tv_usec / (1000);
- return t2 - t1;
-}
- #endif
+#ifdef DEBUG_DRAW_TIME
+# include "PIL_time.h"
#endif
-struct GPUTexture;
-
static int intersect_edges(float *points, float a, float b, float c, float d, float edges[12][2][3])
{
int i;
@@ -275,7 +232,10 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
return;
}
- tstart();
+#ifdef DEBUG_DRAW_TIME
+ TIMEIT_START(draw);
+#endif
+
/* generate flame spectrum texture */
#define SPEC_WIDTH 256
#define FIRE_THRESH 7
@@ -522,8 +482,10 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
n++;
}
- tend();
- // printf ( "Draw Time: %f\n",(float) tval() );
+#ifdef DEBUG_DRAW_TIME
+ printf("Draw Time: %f\n", (float)TIMEIT_VALUE(draw));
+ TIMEIT_END(draw);
+#endif
if (tex_shadow)
GPU_texture_unbind(tex_shadow);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index b2d58cf41de..658196a1bd4 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -146,7 +146,7 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
if (rv3d == NULL) {
ScrArea *sa = CTX_wm_area(C);
if (sa && sa->spacetype == SPACE_VIEW3D) {
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ ARegion *ar = BKE_area_find_region_active_win(sa);
if (ar) {
rv3d = ar->regiondata;
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 562d1ec4b64..5c2e75776e4 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -921,8 +921,12 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
if (event->type == MOUSEPAN) {
- /* invert it, trackpad scroll then follows how you mapped it globally */
- viewrotate_apply(vod, 2 * event->x - event->prevx, 2 * event->y - event->prevy);
+ /* Rotate direction we keep always same */
+ if (U.uiflag2 & USER_TRACKPAD_NATURAL)
+ viewrotate_apply(vod, 2 * event->x - event->prevx, 2 * event->y - event->prevy);
+ else
+ viewrotate_apply(vod, event->prevx, event->prevy);
+
ED_view3d_depth_tag_update(rv3d);
viewops_data_free(C, op);
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index bfeb56036e6..bb5b7aa6911 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -101,22 +101,33 @@ static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wm
static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
{
wmOperator *op = WM_operator_last_redo(C);
- uiBlock *block;
-
- if (op == NULL)
- return;
- if (WM_operator_poll((bContext *)C, op->type) == 0)
+ ARegion *ar;
+ ARegion *ar1;
+
+ if (op == NULL) {
return;
-
- block = uiLayoutGetBlock(pa->layout);
-
- if (!WM_operator_check_ui_enabled(C, op->type->name))
- uiLayoutSetEnabled(pa->layout, FALSE);
+ }
- /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
- uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
-
- view3d_panel_operator_redo_operator(C, pa, op);
+ /* keep in sync with logic in ED_undo_operator_repeat() */
+ ar = CTX_wm_region(C);
+ ar1 = BKE_area_find_region_active_win(CTX_wm_area(C));
+ if (ar1)
+ CTX_wm_region_set((bContext *)C, ar1);
+
+ if (WM_operator_poll((bContext *)C, op->type)) {
+ uiBlock *block = uiLayoutGetBlock(pa->layout);
+
+ if (!WM_operator_check_ui_enabled(C, op->type->name))
+ uiLayoutSetEnabled(pa->layout, FALSE);
+
+ /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
+ uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
+
+ view3d_panel_operator_redo_operator(C, pa, op);
+ }
+
+ /* set region back */
+ CTX_wm_region_set((bContext *)C, ar);
}
/* ******************* */
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index c4960de1e19..98d4c5e7b81 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -4890,6 +4890,45 @@ static void len_v3_ensure(float v[3], const float length)
}
/**
+ * Find the closest point on the ngon on the opposite side.
+ * used to set the edge slide distance for ngons.
+ */
+static bool bm_loop_calc_opposite_co(BMLoop *l_tmp,
+ const float plane_no[3],
+ float r_co[3])
+{
+ /* skip adjacent edges */
+ BMLoop *l_first = l_tmp->next;
+ BMLoop *l_last = l_tmp->prev;
+ BMLoop *l_iter;
+ float dist = FLT_MAX;
+
+ l_iter = l_first;
+ do {
+ float tvec[3];
+ if (isect_line_plane_v3(tvec,
+ l_iter->v->co, l_iter->next->v->co,
+ l_tmp->v->co, plane_no, false))
+ {
+ const float fac = line_point_factor_v3(tvec, l_iter->v->co, l_iter->next->v->co);
+ /* allow some overlap to avoid missing the intersection because of float precision */
+ if ((fac > -FLT_EPSILON) && (fac < 1.0f + FLT_EPSILON)) {
+ /* likelyhood of multiple intersections per ngon is quite low,
+ * it would have to loop back on its self, but better support it
+ * so check for the closest opposite edge */
+ const float tdist = len_v3v3(l_tmp->v->co, tvec);
+ if (tdist < dist) {
+ copy_v3_v3(r_co, tvec);
+ dist = tdist;
+ }
+ }
+ }
+ } while ((l_iter = l_iter->next) != l_last);
+
+ return (dist != FLT_MAX);
+}
+
+/**
* Given 2 edges and a loop, step over the loops
* and calculate a direction to slide along.
*
@@ -4919,21 +4958,39 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
else {
/* When there is no edge to slide along,
* we must slide along the vector defined by the face we're attach to */
- float e_dir_prev[3], e_dir_next[3], tvec[3];
+ BMLoop *l_tmp = BM_face_vert_share_loop(l_first->f, v);
- sub_v3_v3v3(e_dir_prev, BM_edge_other_vert(e_prev, v)->co, v->co);
- sub_v3_v3v3(e_dir_next, BM_edge_other_vert(e_next, v)->co, v->co);
+ BLI_assert(ELEM(l_tmp->e, e_prev, e_next) && ELEM(l_tmp->prev->e, e_prev, e_next));
- cross_v3_v3v3(tvec, l->f->no, e_dir_prev);
- cross_v3_v3v3(vec_accum, e_dir_next, l->f->no);
+ if (l_tmp->f->len == 4) {
+ /* we could use code below, but in this case
+ * sliding diagonally across the quad works well */
+ sub_v3_v3v3(vec_accum, l_tmp->next->next->v->co, v->co);
+ }
+ else {
+ float tdir[3];
+ BM_loop_calc_face_direction(l_tmp, tdir);
+ cross_v3_v3v3(vec_accum, l_tmp->f->no, tdir);
+#if 0
+ /* rough guess, we can do better! */
+ len_v3_ensure(vec_accum, (BM_edge_calc_length(e_prev) + BM_edge_calc_length(e_next)) / 2.0f);
+#else
+ /* be clever, check the opposite ngon edge to slide into.
+ * this gives best results */
+ {
+ float tvec[3];
+ float dist;
- mid_v3_v3v3(vec_accum, vec_accum, tvec);
+ if (bm_loop_calc_opposite_co(l_tmp, tdir, tvec)) {
+ dist = len_v3v3(l_tmp->v->co, tvec);
+ }
+ else {
+ dist = (BM_edge_calc_length(e_prev) + BM_edge_calc_length(e_next)) / 2.0f;
+ }
- /* check if we need to flip
- * (compare the normal defines by the edges with the face normal) */
- cross_v3_v3v3(tvec, e_dir_prev, e_dir_next);
- if (dot_v3v3(tvec, l->f->no) > 0.0f) {
- negate_v3(vec_accum);
+ len_v3_ensure(vec_accum, dist);
+ }
+#endif
}
}
@@ -5025,6 +5082,7 @@ static int createEdgeSlideVerts(TransInfo *t)
BMEdge *e, *e1;
BMVert *v, *v2;
TransDataEdgeSlideVert *sv_array;
+ int sv_tot;
BMBVHTree *btree;
SmallHash table;
EdgeSlideData *sld = MEM_callocN(sizeof(*sld), "sld");
@@ -5124,10 +5182,10 @@ static int createEdgeSlideVerts(TransInfo *t)
return 0;
}
- sv_array = MEM_callocN(sizeof(TransDataEdgeSlideVert) * j, "sv_array");
+ sv_tot = j;
+ sv_array = MEM_callocN(sizeof(TransDataEdgeSlideVert) * sv_tot, "sv_array");
loop_nr = 0;
- j = 0;
while (1) {
BMLoop *l, *l1, *l2;
BMVert *v_first;
@@ -5187,10 +5245,10 @@ static int createEdgeSlideVerts(TransInfo *t)
/*iterate over the loop*/
v_first = v;
do {
- TransDataEdgeSlideVert *sv = sv_array + j;
-
- BLI_assert(j < MEM_allocN_len(sv_array) / sizeof(*sv));
+ TransDataEdgeSlideVert *sv;
+ /* XXX, 'sv' will initialize multiple times, this is suspicious. see [#34024] */
+ sv = sv_array + GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
sv->v = v;
sv->origvert = *v;
sv->loop_nr = loop_nr;
@@ -5212,11 +5270,7 @@ static int createEdgeSlideVerts(TransInfo *t)
e1 = e;
e = get_other_edge(v, e);
if (!e) {
- //v2=v, v = BM_edge_other_vert(l1->e, v);
-
- BLI_assert(j + 1 < MEM_allocN_len(sv_array) / sizeof(*sv));
-
- sv = sv_array + j + 1;
+ sv = sv_array + GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
sv->v = v;
sv->origvert = *v;
sv->loop_nr = loop_nr;
@@ -5233,16 +5287,13 @@ static int createEdgeSlideVerts(TransInfo *t)
BM_elem_flag_disable(v, BM_ELEM_TAG);
BM_elem_flag_disable(v2, BM_ELEM_TAG);
-
- j += 2;
+
break;
}
l1 = get_next_loop(v, l1, e1, e, vec);
l2 = l2 ? get_next_loop(v, l2, e1, e, vec2) : NULL;
- j += 1;
-
BM_elem_flag_disable(v, BM_ELEM_TAG);
BM_elem_flag_disable(v2, BM_ELEM_TAG);
} while (e != v_first->e && l1);
@@ -5253,7 +5304,7 @@ static int createEdgeSlideVerts(TransInfo *t)
/* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */
sld->sv = sv_array;
- sld->totsv = j;
+ sld->totsv = sv_tot;
/* find mouse vectors, the global one, and one per loop in case we have
* multiple loops selected, in case they are oriented different */
@@ -5628,7 +5679,7 @@ void initEdgeSlide(TransInfo *t)
/* set custom point first if you want value to be initialized by init */
setCustomPoints(t, &t->mouse, sld->end, sld->start);
- initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO);
+ initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO_FLIP);
t->idx_max = 0;
t->num.idx_max = 0;
@@ -5879,19 +5930,14 @@ static void calcVertSlideCustomPoints(struct TransInfo *t)
TransDataVertSlideVert *sv = &sld->sv[sld->curr_sv_index];
float *co_orig = sv->co_orig_2d;
float *co_curr = sv->co_link_orig_2d[sv->co_link_curr];
- float co_curr_flip[2];
-
- flip_v2_v2v2(co_curr_flip, co_orig, co_curr);
+ const int start[2] = {co_orig[0], co_orig[1]};
+ const int end[2] = {co_curr[0], co_curr[1]};
- {
- const int start[2] = {co_orig[0], co_orig[1]};
- const int end[2] = {co_curr_flip[0], co_curr_flip[1]};
- if (!sld->flipped_vtx) {
- setCustomPoints(t, &t->mouse, end, start);
- }
- else {
- setCustomPoints(t, &t->mouse, start, end);
- }
+ if (sld->flipped_vtx && sld->is_proportional == false) {
+ setCustomPoints(t, &t->mouse, start, end);
+ }
+ else {
+ setCustomPoints(t, &t->mouse, end, start);
}
}
@@ -5977,7 +6023,7 @@ static int createVertSlideVerts(TransInfo *t)
if (t->spacetype == SPACE_VIEW3D) {
/* background mode support */
// v3d = t->sa ? t->sa->spacedata.first : NULL;
- rv3d = t->ar ? t->ar->regiondata : NULL;
+ rv3d = ar ? ar->regiondata : NULL;
}
sld->is_proportional = true;
@@ -6043,18 +6089,30 @@ static int createVertSlideVerts(TransInfo *t)
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
BMVert *v_other = BM_edge_other_vert(e, v);
copy_v3_v3(sv_array[j].co_link_orig_3d[k], v_other->co);
- ED_view3d_project_float_v2_m4(ar,
- sv_array[j].co_link_orig_3d[k],
- sv_array[j].co_link_orig_2d[k],
- projectMat);
+ if (ar) {
+ ED_view3d_project_float_v2_m4(ar,
+ sv_array[j].co_link_orig_3d[k],
+ sv_array[j].co_link_orig_2d[k],
+ projectMat);
+ }
+ else {
+ copy_v2_v2(sv_array[j].co_link_orig_2d[k],
+ sv_array[j].co_link_orig_3d[k]);
+ }
k++;
}
}
- ED_view3d_project_float_v2_m4(ar,
- sv_array[j].co_orig_3d,
- sv_array[j].co_orig_2d,
- projectMat);
+ if (ar) {
+ ED_view3d_project_float_v2_m4(ar,
+ sv_array[j].co_orig_3d,
+ sv_array[j].co_orig_2d,
+ projectMat);
+ }
+ else {
+ copy_v2_v2(sv_array[j].co_orig_2d,
+ sv_array[j].co_orig_3d);
+ }
j++;
}
@@ -6147,16 +6205,17 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event)
case EKEY:
if (event->val == KM_PRESS) {
sld->is_proportional = !sld->is_proportional;
+ if (sld->flipped_vtx) {
+ calcVertSlideCustomPoints(t);
+ }
return 1;
}
break;
case FKEY:
{
if (event->val == KM_PRESS) {
- if (sld->is_proportional == FALSE) {
- sld->flipped_vtx = !sld->flipped_vtx;
- calcVertSlideCustomPoints(t);
- }
+ sld->flipped_vtx = !sld->flipped_vtx;
+ calcVertSlideCustomPoints(t);
return 1;
}
break;
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index c72c6a83d82..a27fe91c3c3 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -677,7 +677,8 @@ typedef enum {
INPUT_HORIZONTAL_ABSOLUTE,
INPUT_VERTICAL_RATIO,
INPUT_VERTICAL_ABSOLUTE,
- INPUT_CUSTOM_RATIO
+ INPUT_CUSTOM_RATIO,
+ INPUT_CUSTOM_RATIO_FLIP
} MouseInputMode;
void initMouseInput(TransInfo *t, MouseInput *mi, const int center[2], const int mval[2]);
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 39c51ff456e..7d62775ae58 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2642,6 +2642,14 @@ static void createTransNlaData(bContext *C, TransInfo *t)
/* stop if trying to build list if nothing selected */
if (count == 0) {
+ /* clear temp metas that may have been created but aren't needed now
+ * because they fell on the wrong side of CFRA
+ */
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ NlaTrack *nlt = (NlaTrack *)ale->data;
+ BKE_nlastrips_clear_metas(&nlt->strips, 0, 1);
+ }
+
/* cleanup temp list */
BLI_freelistN(&anim_data);
return;
@@ -2686,14 +2694,14 @@ static void createTransNlaData(bContext *C, TransInfo *t)
tdn->oldTrack = tdn->nlt = nlt;
tdn->strip = strip;
tdn->trackIndex = BLI_findindex(&adt->nla_tracks, nlt);
-
+
yval = (float)(tdn->trackIndex * NLACHANNEL_STEP(snla));
-
+
tdn->h1[0] = strip->start;
tdn->h1[1] = yval;
tdn->h2[0] = strip->end;
tdn->h2[1] = yval;
-
+
center[0] = (float)CFRA;
center[1] = yval;
center[2] = 0.0f;
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index c805dfe1b41..dd1510498b0 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -180,7 +180,7 @@ void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, const int start[2], c
data[3] = end[1];
}
-static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3])
+static void InputCustomRatioFlip(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3])
{
double length;
double distance;
@@ -213,6 +213,12 @@ static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const int mva
}
}
+static void InputCustomRatio(TransInfo *t, MouseInput *mi, const int mval[2], float output[3])
+{
+ InputCustomRatioFlip(t, mi, mval, output);
+ output[0] = -output[0];
+}
+
static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3])
{
double dx2 = mval[0] - mi->center[0];
@@ -232,7 +238,7 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
double deler = (((dx1 * dx1 + dy1 * dy1) +
(dx2 * dx2 + dy2 * dy2) -
(dx3 * dx3 + dy3 * dy3)) / (2.0 * ((A * B) ? (A * B) : 1.0)));
- /* ((A*B)?(A*B):1.0) this takes care of potential divide by zero errors */
+ /* ((A * B) ? (A * B) : 1.0) this takes care of potential divide by zero errors */
float dphi;
@@ -358,6 +364,10 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
mi->apply = InputCustomRatio;
t->helpline = HLP_NONE;
break;
+ case INPUT_CUSTOM_RATIO_FLIP:
+ mi->apply = InputCustomRatioFlip;
+ t->helpline = HLP_NONE;
+ break;
case INPUT_NONE:
default:
mi->apply = NULL;
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 1dc7e0c90e8..8a0ef06ef12 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -339,8 +339,9 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
wmWindowManager *wm = CTX_wm_manager(C);
struct Scene *scene = CTX_data_scene(C);
+ /* keep in sync with logic in view3d_panel_operator_redo() */
ARegion *ar = CTX_wm_region(C);
- ARegion *ar1 = BKE_area_find_region_type(CTX_wm_area(C), RGN_TYPE_WINDOW);
+ ARegion *ar1 = BKE_area_find_region_active_win(CTX_wm_area(C));
if (ar1)
CTX_wm_region_set(C, ar1);
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 5d3a5983030..7e3302e233e 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -1057,7 +1057,7 @@ static PFace *p_face_add(PHandle *handle)
e1->pair = NULL;
e2->pair = NULL;
e3->pair = NULL;
-
+
e1->flag = 0;
e2->flag = 0;
e3->flag = 0;
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index b1bb5c85e50..1b43d829947 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -650,7 +650,7 @@ static void stitch_uv_edge_generate_linked_edges(GHash *edge_hash, StitchState *
edge2 = BLI_ghash_lookup(edge_hash, &edgetmp);
/* here I am taking care of non manifold case, assuming more than two matching edges.
- * I am not too sure we want this though */
+ * I am not too sure we want this though */
last_set->next = edge2;
last_set = edge2;
/* set first, similarly to uv elements. Now we can iterate among common edges easily */
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index ca4cbd35edc..a742a45ec12 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -149,7 +149,7 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render* re, int render_count) : Str
freestyle_scene->camera = object_camera;
// Material
- material = BKE_material_add("stroke_material");
+ material = BKE_material_add(G.main, "stroke_material");
material->mode |= MA_VERTEXCOLP;
material->mode |= MA_TRANSP;
material->mode |= MA_SHLESS;
@@ -476,9 +476,9 @@ Object *BlenderStrokeRenderer::NewMesh() const
static unsigned int mesh_id = 0xffffffff;
BLI_snprintf(name, MAX_ID_NAME, "0%08xOB", mesh_id);
- ob = BKE_object_add_only_object(OB_MESH, name);
+ ob = BKE_object_add_only_object(G.main, OB_MESH, name);
BLI_snprintf(name, MAX_ID_NAME, "0%08xME", mesh_id);
- ob->data = BKE_mesh_add(name);
+ ob->data = BKE_mesh_add(G.main, name);
ob->lay = 1;
base = BKE_scene_base_add(freestyle_scene, ob);
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 543c47b2153..c5a3642e2c6 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -227,7 +227,7 @@ static Text *create_lineset_handler(char *layer_name, char *lineset_name)
{
char *s1 = escape_quotes(layer_name);
char *s2 = escape_quotes(lineset_name);
- Text *text = BKE_text_add(lineset_name);
+ Text *text = BKE_text_add(G.main, lineset_name);
BKE_text_write(text, "import parameter_editor; parameter_editor.process('");
BKE_text_write(text, s1);
BKE_text_write(text, "', '");
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h
index 6093b6e4dcd..3a5e45604b6 100644
--- a/source/blender/freestyle/intern/system/PythonInterpreter.h
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.h
@@ -90,7 +90,7 @@ public:
int status = BPY_filepath_exec(_context, fn, reports);
#else
int status;
- Text *text = BKE_text_load(fn, G.main->name);
+ Text *text = BKE_text_load(G.main, fn, G.main->name);
if (text) {
status = BPY_text_exec(_context, text, reports, false);
BKE_text_unlink(G.main, text);
@@ -167,7 +167,7 @@ private:
vector<string> pathnames;
StringUtils::getPathName(_path, "", pathnames);
- struct Text *text = BKE_text_add("tmp_freestyle_initpath.txt");
+ struct Text *text = BKE_text_add(G.main, "tmp_freestyle_initpath.txt");
string cmd = "import sys\n";
txt_insert_buf(text, const_cast<char*>(cmd.c_str()));
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index fedcb58e1a3..5bef7a8ae0b 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -1391,7 +1391,7 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
vert_data = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
if (vert_data) {
- /* Vertex data is shared if smooth-shaded, but seperate
+ /* Vertex data is shared if smooth-shaded, but separate
copies are made for flat shading because normals
shouldn't be shared. */
if (buffers->smooth) {
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 9731d7a6b3a..b5ef27a338d 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -1035,7 +1035,7 @@ static void do_material_tex(GPUShadeInput *shi)
GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, &tex->iuser, FALSE), &tin, &trgb);
rgbnor= TEX_RGB;
- talpha= 1;
+ talpha = (tex->ima->flag & IMA_IGNORE_ALPHA) == 0;
}
else {
continue;
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index 49e2e7fc80d..e30f1618c81 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -175,7 +175,7 @@ typedef struct ImBuf {
* The bit flag is stored in the ImBuf.ftype variable.
* Note that the lower 11 bits is used for storing custom flags
*/
-#define IB_CUSTOM_FLAGS_MASK 0x400
+#define IB_CUSTOM_FLAGS_MASK 0x7ff
#define PNG (1 << 30)
#define TGA (1 << 28)
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 86f47fe07c4..23804291a65 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -1353,6 +1353,23 @@ static void display_buffer_apply_threaded(ImBuf *ibuf, float *buffer, unsigned c
display_buffer_init_handle, do_display_buffer_apply_thread);
}
+static int is_ibuf_rect_in_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings,
+ const ColorManagedDisplaySettings *display_settings)
+{
+ if ((view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) == 0 &&
+ view_settings->exposure == 0.0f &&
+ view_settings->gamma == 1.0f)
+ {
+ const char *from_colorspace = ibuf->rect_colorspace->name;
+ const char *to_colorspace = display_transform_get_colorspace_name(view_settings, display_settings);
+
+ if (to_colorspace && !strcmp(from_colorspace, to_colorspace))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void colormanage_display_buffer_process_ex(ImBuf *ibuf, float *display_buffer, unsigned char *display_buffer_byte,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings)
@@ -1366,16 +1383,7 @@ static void colormanage_display_buffer_process_ex(ImBuf *ibuf, float *display_bu
* computation noticeable faster
*/
if (ibuf->rect_float == NULL && ibuf->rect_colorspace) {
- if ((view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) == 0 &&
- view_settings->exposure == 0.0f &&
- view_settings->gamma == 1.0f)
- {
- const char *from_colorspace = ibuf->rect_colorspace->name;
- const char *to_colorspace = display_transform_get_colorspace_name(view_settings, display_settings);
-
- if (to_colorspace && !strcmp(from_colorspace, to_colorspace))
- skip_transform = TRUE;
- }
+ skip_transform = is_ibuf_rect_in_display_space(ibuf, view_settings, display_settings);
}
if (skip_transform == FALSE)
@@ -2110,7 +2118,7 @@ static void colormanage_description_strip(char *description)
{
int i, n;
- for (i = strlen(description) - 1; i >= 0; i--) {
+ for (i = (int)strlen(description) - 1; i >= 0; i--) {
if (ELEM(description[i], '\r', '\n')) {
description[i] = '\0';
}
@@ -2332,37 +2340,67 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe
int is_data = ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA;
if (dither != 0.0f) {
+ /* cm_processor is NULL in cases byte_buffer's space matches display
+ * buffer's space
+ * in this case we could skip extra transform and only apply dither
+ * use 4 channels for easier byte->float->byte conversion here so
+ * (this is only needed to apply dither, in other cases we'll convert
+ * byte buffer to display directly)
+ */
+ if (!cm_processor)
+ channels = 4;
+
display_buffer_float = MEM_callocN(channels * width * height * sizeof(float), "display buffer for dither");
}
- for (y = ymin; y < ymax; y++) {
- for (x = xmin; x < xmax; x++) {
- int display_index = (y * display_stride + x) * channels;
- int linear_index = ((y - linear_offset_y) * linear_stride + (x - linear_offset_x)) * channels;
- float pixel[4];
-
- if (linear_buffer) {
- copy_v4_v4(pixel, (float *) linear_buffer + linear_index);
- }
- else if (byte_buffer) {
- rgba_uchar_to_float(pixel, byte_buffer + linear_index);
- IMB_colormanagement_colorspace_to_scene_linear_v3(pixel, rect_colorspace);
- straight_to_premul_v4(pixel);
- }
-
- if (!is_data) {
- IMB_colormanagement_processor_apply_v4_predivide(cm_processor, pixel);
+ if (cm_processor) {
+ for (y = ymin; y < ymax; y++) {
+ for (x = xmin; x < xmax; x++) {
+ int display_index = (y * display_stride + x) * channels;
+ int linear_index = ((y - linear_offset_y) * linear_stride + (x - linear_offset_x)) * channels;
+ float pixel[4];
+
+ if (linear_buffer) {
+ copy_v4_v4(pixel, (float *) linear_buffer + linear_index);
+ }
+ else if (byte_buffer) {
+ rgba_uchar_to_float(pixel, byte_buffer + linear_index);
+ IMB_colormanagement_colorspace_to_scene_linear_v3(pixel, rect_colorspace);
+ straight_to_premul_v4(pixel);
+ }
+
+ if (!is_data) {
+ IMB_colormanagement_processor_apply_v4_predivide(cm_processor, pixel);
+ }
+
+ if (display_buffer_float) {
+ int index = ((y - ymin) * width + (x - xmin)) * channels;
+
+ copy_v4_v4(display_buffer_float + index, pixel);
+ }
+ else {
+ float pixel_straight[4];
+ premul_to_straight_v4_v4(pixel_straight, pixel);
+ rgba_float_to_uchar(display_buffer + display_index, pixel_straight);
+ }
}
+ }
+ }
+ else {
+ if (display_buffer_float) {
+ /* huh, for dither we need float buffer first, no cheaper way. currently */
+ IMB_buffer_float_from_byte(display_buffer_float, byte_buffer,
+ IB_PROFILE_SRGB, IB_PROFILE_SRGB, TRUE,
+ width, height, width, display_stride);
+ }
+ else {
+ int i, width = xmax - xmin;
- if (display_buffer_float) {
- int index = ((y - ymin) * width + (x - xmin)) * channels;
+ for (i = ymin; i < ymax; i++) {
+ int byte_offset = (linear_stride * i + xmin) * 4;
+ int display_offset = (display_stride * i + xmin) * 4;
- copy_v4_v4(display_buffer_float + index, pixel);
- }
- else {
- float pixel_straight[4];
- premul_to_straight_v4_v4(pixel_straight, pixel);
- rgba_float_to_uchar(display_buffer + display_index, pixel_straight);
+ memcpy(display_buffer + display_offset, byte_buffer + byte_offset, 4 * sizeof(char) * width);
}
}
}
@@ -2371,7 +2409,7 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe
int display_index = (ymin * display_stride + xmin) * channels;
IMB_buffer_byte_from_float(display_buffer + display_index, display_buffer_float, channels, dither,
- IB_PROFILE_SRGB, IB_PROFILE_SRGB, FALSE, width, height, display_stride, width);
+ IB_PROFILE_SRGB, IB_PROFILE_SRGB, TRUE, width, height, display_stride, width);
MEM_freeN(display_buffer_float);
}
@@ -2426,14 +2464,24 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer,
BLI_unlock_thread(LOCK_COLORMANAGE);
if (display_buffer) {
- ColormanageProcessor *cm_processor;
+ ColormanageProcessor *cm_processor = NULL;
+ int skip_transform = 0;
+
+ /* byte buffer is assumed to be in imbuf's rect space, so if byte buffer
+ * is known we could skip display->linear->display conversion in case
+ * display color space matches imbuf's rect space
+ */
+ if (byte_buffer != NULL)
+ skip_transform = is_ibuf_rect_in_display_space(ibuf, view_settings, display_settings);
- cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings);
+ if (!skip_transform)
+ cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings);
partial_buffer_update_rect(ibuf, display_buffer, linear_buffer, byte_buffer, buffer_width, stride,
- offset_x, offset_y, cm_processor, xmin, ymin, xmax, ymax);
+ offset_x, offset_y, cm_processor, xmin, ymin, xmax, ymax);
- IMB_colormanagement_processor_free(cm_processor);
+ if (cm_processor)
+ IMB_colormanagement_processor_free(cm_processor);
IMB_display_buffer_release(cache_handle);
}
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 18b08c9b59b..1b7aa1e7e63 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -882,6 +882,12 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa
const char *token;
char tokenbuf[EXR_TOT_MAXNAME];
int len;
+
+ /* some multilayers have the combined buffer with names A B G R saved */
+ if (name[1] == 0) {
+ echan->chan_id = name[0];
+ return 1;
+ }
/* last token is single character channel identifier */
len = imb_exr_split_token(name, end, &token);
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 94bb85b49ea..c1d80ad9067 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -154,7 +154,7 @@ static void escape_uri_string(const char *string, char *escaped_string, int len,
*q++ = *p;
}
}
-
+
*q = '\0';
}
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h
index b445d59db2c..7c4772f24e8 100644
--- a/source/blender/makesdna/DNA_actuator_types.h
+++ b/source/blender/makesdna/DNA_actuator_types.h
@@ -277,10 +277,13 @@ typedef struct bActuator {
#define ACT_ANG_VEL_LOCAL 32
//#define ACT_ADD_LIN_VEL_LOCAL 64
#define ACT_ADD_LIN_VEL 64
+#define ACT_ADD_CHAR_LOC 128
+#define ACT_CHAR_JUMP 256
/* objectactuator->type */
-#define ACT_OBJECT_NORMAL 0
-#define ACT_OBJECT_SERVO 1
+#define ACT_OBJECT_NORMAL 0
+#define ACT_OBJECT_SERVO 1
+#define ACT_OBJECT_CHARACTER 2
/* actuator->type */
#define ACT_OBJECT 0
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 41c47f8de15..62d696ec255 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -164,7 +164,7 @@ typedef enum BrushSculptTool {
} BrushSculptTool;
/* ImagePaintSettings.tool */
-typedef enum BrushImagePaintTool{
+typedef enum BrushImagePaintTool {
PAINT_TOOL_DRAW = 0,
PAINT_TOOL_SOFTEN = 1,
PAINT_TOOL_SMEAR = 2,
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index 0f47ee224ae..682f54481fc 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -125,7 +125,7 @@ typedef struct Image {
#define IMA_DO_PREMUL 4 /* deprecated, should not be used */
#define IMA_REFLECT 16
#define IMA_NOCOLLECT 32
-#define IMA_DEPRECATED 64
+#define IMA_DONE_TAG 64
#define IMA_OLD_PREMUL 128
/*#define IMA_CM_PREDIVIDE 256*/ /* deprecated, should not be used */
#define IMA_USED_FOR_RENDER 512
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index a05ff66e683..7f2e388cd69 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -711,6 +711,13 @@ typedef struct NodeTrackPosData {
char track_name[64];
} NodeTrackPosData;
+typedef struct NodeTranslateData {
+ char wrap_axis;
+ char relative;
+ char pad[6];
+} NodeTranslateData;
+
+
typedef struct NodeShaderScript {
int mode;
int flag;
@@ -837,6 +844,12 @@ typedef struct NodeShaderNormalMap {
#define CMP_NODE_BLUR_ASPECT_Y 1
#define CMP_NODE_BLUR_ASPECT_X 2
+/* wrapping */
+#define CMP_NODE_WRAP_NONE 0
+#define CMP_NODE_WRAP_X 1
+#define CMP_NODE_WRAP_Y 2
+#define CMP_NODE_WRAP_XY 3
+
#define CMP_NODE_MASK_MBLUR_SAMPLES_MAX 64
#endif
diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h
index b70687be725..ca703130edc 100644
--- a/source/blender/makesdna/DNA_rigidbody_types.h
+++ b/source/blender/makesdna/DNA_rigidbody_types.h
@@ -76,11 +76,11 @@ typedef struct RigidBodyWorld {
/* Flags for RigidBodyWorld */
typedef enum eRigidBodyWorld_Flag {
/* should sim world be skipped when evaluating (user setting) */
- RBW_FLAG_MUTED = (1<<0),
+ RBW_FLAG_MUTED = (1 << 0),
/* sim data needs to be rebuilt */
- RBW_FLAG_NEEDS_REBUILD = (1<<1),
+ RBW_FLAG_NEEDS_REBUILD = (1 << 1),
/* usse split impulse when stepping the simulation */
- RBW_FLAG_USE_SPLIT_IMPULSE = (1<<2)
+ RBW_FLAG_USE_SPLIT_IMPULSE = (1 << 2)
} eRigidBodyWorld_Flag;
/* ******************************** */
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index d6100dcdbce..ceae4e28d1f 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -142,9 +142,11 @@ typedef struct ScrArea {
short winx, winy; /* size */
short headertype; /* OLD! 0=no header, 1= down, 2= up */
- short pad;
short do_refresh; /* private, for spacetype refresh callback */
- short cursor, flag;
+ short flag;
+ short region_active_win; /* index of last used region of 'RGN_TYPE_WINDOW'
+ * runtuime variable, updated by executing operators */
+ short pad;
struct SpaceType *type; /* callbacks for this space type */
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index c049c981be5..f4a992011a2 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -571,7 +571,8 @@ typedef enum eUserpref_UI_Flag {
/* uiflag2 */
typedef enum eUserpref_UI_Flag2 {
USER_KEEP_SESSION = (1 << 0),
- USER_REGION_OVERLAP = (1 << 1)
+ USER_REGION_OVERLAP = (1 << 1),
+ USER_TRACKPAD_NATURAL = (1 << 2)
} eUserpref_UI_Flag2;
/* Auto-Keying mode */
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index cd6d74c3488..5ab37c6d97b 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -43,6 +43,7 @@ BlenderRNA *RNA_create(void);
void RNA_define_free(BlenderRNA *brna);
void RNA_free(BlenderRNA *brna);
void RNA_define_verify_sdna(int verify);
+void RNA_define_animate_sdna(int animate);
void RNA_init(void);
void RNA_exit(void);
@@ -87,7 +88,6 @@ PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont, const char *identifier, c
PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
-PropertyRNA *RNA_def_string_py_translate(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index d3a8742ede7..d3cf7dc8095 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -134,7 +134,7 @@ typedef enum PropertySubType {
PROP_AXISANGLE = 28,
PROP_XYZ = 29,
PROP_XYZ_LENGTH = 29 | PROP_UNIT_LENGTH,
- PROP_COLOR_GAMMA = 30,
+ PROP_COLOR_GAMMA = 30, /* used for colors which would be color managed before display */
PROP_COORDS = 31, /* generic array, no units applied, only that x/y/z/w are used (python vec) */
/* booleans */
@@ -143,7 +143,7 @@ typedef enum PropertySubType {
} PropertySubType;
/* Make sure enums are updated with thses */
-/* HIGHEST FLAG IN USE: 1 << 29 */
+/* HIGHEST FLAG IN USE: 1 << 28 */
typedef enum PropertyFlag {
/* editable means the property is editable in the user
* interface, properties are editable by default except
@@ -200,11 +200,6 @@ typedef enum PropertyFlag {
*/
PROP_ENUM_FLAG = (1 << 21),
- /* A string which should be translated when converting from py string to RNA prop.
- * Should only be used in some functions' properties (currently only "text" one of funcs in UI API).
- */
- PROP_STRING_PY_TRANSLATE = (1 << 28),
-
/* need context for update function */
PROP_CONTEXT_UPDATE = (1 << 22),
PROP_CONTEXT_PROPERTY_UPDATE = (1 << 22) | (1 << 27),
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript
index f3beee8bc14..3b6745de470 100644
--- a/source/blender/makesrna/SConscript
+++ b/source/blender/makesrna/SConscript
@@ -38,7 +38,6 @@ incs += ' ../render/extern/include #/intern/cycles/blender'
incs += ' ../nodes'
incs += ' #/extern/glew/include'
incs += ' #/intern/smoke/extern'
-incs += ' ../rigidbody'
incs += ' ../bmesh'
@@ -49,7 +48,7 @@ if env['WITH_BF_SMOKE']:
if env['WITH_BF_BULLET']:
defs.append('WITH_BULLET')
- incs += ' ../../rigidbody'
+ incs += ' #/intern/rigidbody'
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 2fb1f0bf6b4..e9a0245210f 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -246,7 +246,7 @@ endif()
if(WITH_BULLET)
list(APPEND INC
- ../../rigidbody
+ ../../../../intern/rigidbody
)
add_definitions(-DWITH_BULLET)
endif()
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index e159b9fd8eb..fc520bdea2f 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -70,7 +70,7 @@ if env['WITH_BF_SMOKE']:
if env['WITH_BF_BULLET']:
defs.append('WITH_BULLET')
- incs += ' ../../rigidbody'
+ incs += ' #/intern/rigidbody'
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index b4bf241815d..57cd77bdf93 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -3430,7 +3430,7 @@ static const char *cpp_classes = ""
"namespace BL {\n"
"\n"
"#define BOOLEAN_PROPERTY(sname, identifier) \\\n"
-" inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr)? true: false; } \\\n"
+" inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr) ? true: false; } \\\n"
" inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n"
"\n"
"#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n"
@@ -3589,7 +3589,7 @@ static const char *cpp_classes = ""
"public:\n"
" Pointer(const PointerRNA &p) : ptr(p) { }\n"
" operator const PointerRNA&() { return ptr; }\n"
-" bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type)? true: false; }\n"
+" bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type) ? true: false; }\n"
" operator void*() { return ptr.data; }\n"
" operator bool() { return ptr.data != NULL; }\n"
"\n"
@@ -3885,6 +3885,13 @@ static int rna_preprocess(const char *outfile)
if (PROCESS_ITEMS[i].define) {
PROCESS_ITEMS[i].define(brna);
+ /* sanity check */
+ if (!DefRNA.animate) {
+ fprintf(stderr,
+ "Error: DefRNA.animate left disabled in %s\n",
+ PROCESS_ITEMS[i].filename);
+ }
+
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
if (!ds->filename)
ds->filename = PROCESS_ITEMS[i].filename;
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index aecc114f328..adfb096b25f 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -3147,6 +3147,21 @@ int RNA_raw_type_sizeof(RawPropertyType type)
}
}
+static int rna_property_array_length_all_dimensions(PointerRNA *ptr, PropertyRNA *prop)
+{
+ int i, len[RNA_MAX_ARRAY_DIMENSION];
+ const int dim = RNA_property_array_dimension(ptr, prop, len);
+ int size;
+
+ if (dim == 0)
+ return 0;
+
+ for (size = 1, i = 0; i < dim; i++)
+ size *= len[i];
+
+ return size;
+}
+
static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname,
void *inarray, RawPropertyType intype, int inlen, int set)
{
@@ -3181,12 +3196,18 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
return 0;
}
- /* check item array */
- itemlen = RNA_property_array_length(&itemptr, itemprop);
-
+ /* dynamic array? need to get length per item */
+ if (itemprop->getlength) {
+ itemprop = NULL;
+ }
/* try to access as raw array */
- if (RNA_property_collection_raw_array(ptr, prop, itemprop, &out)) {
- int arraylen = (itemlen == 0) ? 1 : itemlen;
+ else if (RNA_property_collection_raw_array(ptr, prop, itemprop, &out)) {
+ int arraylen;
+
+ /* check item array */
+ itemlen = RNA_property_array_length(&itemptr, itemprop);
+
+ arraylen = (itemlen == 0) ? 1 : itemlen;
if (in.len != arraylen * out.len) {
BKE_reportf(reports, RPT_ERROR, "Array length mismatch (expected %d, got %d)",
out.len * arraylen, in.len);
@@ -3243,7 +3264,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
iprop = RNA_struct_find_property(&itemptr, propname);
if (iprop) {
- itemlen = RNA_property_array_length(&itemptr, iprop);
+ itemlen = rna_property_array_length_all_dimensions(&itemptr, iprop);
itemtype = RNA_property_type(iprop);
}
else {
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index b653289e44d..fe4a23cb393 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -389,6 +389,12 @@ static void rna_ObjectActuator_type_set(struct PointerRNA *ptr, int value)
oa->forcerot[1] = 0.5f;
oa->forcerot[2] = 0.0f;
break;
+
+ case ACT_OBJECT_CHARACTER:
+ memset(oa, 0, sizeof(bObjectActuator));
+ oa->flag = ACT_DLOC_LOCAL | ACT_DROT_LOCAL;
+ oa->type = ACT_OBJECT_CHARACTER;
+ break;
}
}
}
@@ -701,6 +707,7 @@ static void rna_def_object_actuator(BlenderRNA *brna)
static EnumPropertyItem prop_type_items[] = {
{ACT_OBJECT_NORMAL, "OBJECT_NORMAL", 0, "Simple Motion", ""},
{ACT_OBJECT_SERVO, "OBJECT_SERVO", 0, "Servo Control", ""},
+ {ACT_OBJECT_CHARACTER, "OBJECT_CHARACTER", 0, "Character Motion", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -867,6 +874,11 @@ static void rna_def_object_actuator(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Add", "Toggles between ADD and SET linV");
RNA_def_property_update(prop, NC_LOGIC, NULL);
+ prop = RNA_def_property(srna, "use_add_character_location", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ADD_CHAR_LOC);
+ RNA_def_property_ui_text(prop, "Add", "Toggle between ADD and SET character location");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
+
prop = RNA_def_property(srna, "use_servo_limit_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_X);
RNA_def_property_ui_text(prop, "X", "Set limit to force along the X axis");
@@ -881,6 +893,11 @@ static void rna_def_object_actuator(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_Z);
RNA_def_property_ui_text(prop, "Z", "Set limit to force along the Z axis");
RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+ prop = RNA_def_property(srna, "use_character_jump", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CHAR_JUMP);
+ RNA_def_property_ui_text(prop, "Jump", "Make the character jump using the settings in the physics properties");
+ RNA_def_property_update(prop, NC_LOGIC, NULL);
}
static void rna_def_camera_actuator(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 21aed20ccc3..8f8136b0a28 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -460,7 +460,7 @@ static void rna_Curve_body_set(PointerRNA *ptr, const char *value)
/* don't know why this is +4, just duplicating load_editText() */
cu->strinfo = MEM_callocN((len + 4) * sizeof(CharInfo), "strinfo");
- /*BLI_strncpy_wchar_as_utf8(cu->str, value, len+1); *//* value is not wchar_t */
+ /*BLI_strncpy_wchar_as_utf8(cu->str, value, len + 1); *//* value is not wchar_t */
BLI_strncpy(cu->str, value, len + 1);
}
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 4e6c3748230..c32255ac645 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -61,7 +61,7 @@
/* Global used during defining */
-BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1};
+BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1, 1};
/* Duplicated code since we can't link in blenkernel or blenlib */
@@ -506,6 +506,13 @@ void RNA_define_verify_sdna(int verify)
DefRNA.verify = verify;
}
+#ifndef RNA_RUNTIME
+void RNA_define_animate_sdna(int animate)
+{
+ DefRNA.animate = animate;
+}
+#endif
+
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext)
{
#ifdef RNA_RUNTIME
@@ -1031,8 +1038,15 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
if (type != PROP_COLLECTION && type != PROP_POINTER) {
prop->flag = PROP_EDITABLE;
- if (type != PROP_STRING)
+ if (type != PROP_STRING) {
+#ifdef RNA_RUNTIME
prop->flag |= PROP_ANIMATABLE;
+#else
+ if (DefRNA.animate) {
+ prop->flag |= PROP_ANIMATABLE;
+ }
+#endif
+ }
}
if (type == PROP_STRING) {
@@ -2120,6 +2134,7 @@ void RNA_def_property_int_funcs_runtime(PropertyRNA *prop, IntPropertyGetFunc ge
if (getfunc) iprop->get_ex = getfunc;
if (setfunc) iprop->set_ex = setfunc;
+ if (rangefunc) iprop->range_ex = rangefunc;
if (getfunc || setfunc) {
/* don't save in id properties */
@@ -2136,6 +2151,7 @@ void RNA_def_property_int_array_funcs_runtime(PropertyRNA *prop, IntArrayPropert
if (getfunc) iprop->getarray_ex = getfunc;
if (setfunc) iprop->setarray_ex = setfunc;
+ if (rangefunc) iprop->range_ex = rangefunc;
if (getfunc || setfunc) {
/* don't save in id properties */
@@ -2558,21 +2574,6 @@ PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *id
return prop;
}
-PropertyRNA *RNA_def_string_py_translate(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
- int maxlen, const char *ui_name, const char *ui_description)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_NONE);
- RNA_def_property_flag(prop, PROP_STRING_PY_TRANSLATE);
- if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
- if (default_value) RNA_def_property_string_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
-
- return prop;
-}
-
PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items,
int default_value, const char *ui_name, const char *ui_description)
{
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 4250acf5848..82e2cb3b0ea 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -633,6 +633,81 @@ static void rna_fcurve_range(FCurve *fcu, float range[2])
calc_fcurve_range(fcu, range, range + 1, FALSE, FALSE);
}
+
+static FCM_EnvelopeData *rna_FModifierEnvelope_points_add(FModifier *fmod, ReportList *reports, float frame)
+{
+ FCM_EnvelopeData fed;
+ FMod_Envelope *env = (FMod_Envelope *)fmod->data;
+ int i;
+
+ /* init template data */
+ fed.min = -1.0f;
+ fed.max = 1.0f;
+ fed.time = frame;
+ fed.f1 = fed.f2 = 0;
+
+ if (env->data) {
+ short exists = -1;
+ i = BKE_fcm_envelope_find_index(env->data, frame, env->totvert, &exists);
+ if (exists) {
+ BKE_reportf(reports, RPT_ERROR, "Already a control point at frame %.6f", frame);
+ return NULL;
+ }
+
+ /* realloc memory for extra point */
+ env->data = (FCM_EnvelopeData *) MEM_reallocN((void *)env->data, (env->totvert + 1) * sizeof(FCM_EnvelopeData));
+
+ /* move the points after the added point */
+ if (i < env->totvert) {
+ memmove(env->data + i + 1, env->data + i, (env->totvert - i) * sizeof(FCM_EnvelopeData));
+ }
+
+ env->totvert++;
+ }
+ else {
+ env->data = MEM_mallocN(sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
+ env->totvert = 1;
+ i = 0;
+ }
+
+ /* add point to paste at index i */
+ *(env->data + i) = fed;
+ return (env->data + i);
+}
+
+void rna_FModifierEnvelope_points_remove(FModifier *fmod, ReportList *reports, PointerRNA *point)
+{
+ FCM_EnvelopeData *cp = point->data;
+ FMod_Envelope *env = (FMod_Envelope *)fmod->data;
+
+ int index = (int)(cp - env->data);
+
+ /* test point is in range */
+ if (index < 0 || index >= env->totvert) {
+ BKE_report(reports, RPT_ERROR, "Control point not in Envelope F-Modifier");
+ return;
+ }
+
+ if (env->totvert > 1) {
+ /* move data after the removed point */
+
+ memmove(env->data + index, env->data + (index + 1), sizeof(FCM_EnvelopeData) * ((env->totvert - index) - 1));
+
+ /* realloc smaller array */
+ env->totvert--;
+ env->data = (FCM_EnvelopeData *) MEM_reallocN((void *)env->data, (env->totvert) * sizeof(FCM_EnvelopeData));
+ }
+ else {
+ /* just free array, since the only vert was deleted */
+ if (env->data) {
+ MEM_freeN(env->data);
+ env->data = NULL;
+ }
+ env->totvert = 0;
+ }
+ RNA_POINTER_INVALIDATE(point);
+}
+
#else
static void rna_def_fmodifier_generator(BlenderRNA *brna)
@@ -770,6 +845,36 @@ static void rna_def_fmodifier_envelope_ctrl(BlenderRNA *brna)
/* - selection flags (not implemented in UI yet though) */
}
+static void rna_def_fmodifier_envelope_control_points(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "FModifierEnvelopeControlPoints");
+ srna = RNA_def_struct(brna, "FModifierEnvelopeControlPoints", NULL);
+ RNA_def_struct_sdna(srna, "FModifier");
+
+ RNA_def_struct_ui_text(srna, "Control Points", "Control points defining the shape of the envelope");
+
+ func = RNA_def_function(srna, "add", "rna_FModifierEnvelope_points_add");
+ RNA_def_function_ui_description(func, "Add a control point to a FModifierEnvelope");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_float(func, "frame", 0.0f, -FLT_MAX, FLT_MAX, "",
+ "Frame to add this control-point", -FLT_MAX, FLT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm = RNA_def_pointer(func, "point", "FModifierEnvelopeControlPoint", "", "Newly created control-point");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_FModifierEnvelope_points_remove");
+ RNA_def_function_ui_description(func, "Remove a control-point from an FModifierEnvelope");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "point", "FModifierEnvelopeControlPoint", "", "Control-point to remove");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+}
+
+
static void rna_def_fmodifier_envelope(BlenderRNA *brna)
{
StructRNA *srna;
@@ -784,6 +889,7 @@ static void rna_def_fmodifier_envelope(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "data", "totvert");
RNA_def_property_struct_type(prop, "FModifierEnvelopeControlPoint");
RNA_def_property_ui_text(prop, "Control Points", "Control points defining the shape of the envelope");
+ rna_def_fmodifier_envelope_control_points(brna, prop);
/* Range Settings */
prop = RNA_def_property(srna, "reference_value", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index b3c1f4dd505..9461a816652 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -118,7 +118,7 @@ static void rna_GPencil_stroke_point_add(bGPDstroke *stroke, int count)
if (stroke->points == NULL)
stroke->points = MEM_callocN(sizeof(bGPDspoint) * count, "gp_stroke_points");
else
- stroke->points = MEM_reallocN(stroke->points, sizeof(bGPDspoint) * (stroke->totpoints + count));
+ stroke->points = MEM_recallocN(stroke->points, sizeof(bGPDspoint) * (stroke->totpoints + count));
stroke->totpoints += count;
}
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 686e6c80f1d..5d45e0d23b6 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -318,9 +318,9 @@ void RNA_api_image(StructRNA *srna)
RNA_def_function_ui_description(func, "Delay the image from being cleaned from the cache due inactivity");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_int(func, "filter", GL_LINEAR_MIPMAP_NEAREST, -INT_MAX, INT_MAX, "Filter",
- "The texture minifying function to use if the image wan't loaded", -INT_MAX, INT_MAX);
+ "The texture minifying function to use if the image wasn't loaded", -INT_MAX, INT_MAX);
RNA_def_int(func, "mag", GL_LINEAR, -INT_MAX, INT_MAX, "Magnification",
- "The texture magnification function to use if the image wan't loaded", -INT_MAX, INT_MAX);
+ "The texture magnification function to use if the image wasn't loaded", -INT_MAX, INT_MAX);
/* return value */
parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX);
RNA_def_function_return(func, parm);
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 99dd0a860d2..204f4018d56 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -117,7 +117,7 @@ typedef struct BlenderDefRNA {
ListBase structs;
ListBase allocs;
struct StructRNA *laststruct;
- int error, silent, preprocess, verify;
+ int error, silent, preprocess, verify, animate;
} BlenderDefRNA;
extern BlenderDefRNA DefRNA;
@@ -404,6 +404,8 @@ PointerRNA rna_pointer_inherit_refine(struct PointerRNA *ptr, struct StructRNA *
int rna_parameter_size(struct PropertyRNA *parm);
int rna_parameter_size_alloc(struct PropertyRNA *parm);
+struct Mesh *rna_Main_meshes_new_from_object(struct Main *bmain, struct ReportList *reports, struct Scene *sce, struct Object *ob, int apply_modifiers, int settings);
+
/* XXX, these should not need to be defined here~! */
struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports);
struct MTex *rna_mtex_texture_slots_create(struct ID *self, struct bContext *C, struct ReportList *reports, int index);
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 6d182ed17f0..5b3a759697f 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -34,6 +34,7 @@
#include <errno.h>
#include "DNA_ID.h"
+#include "DNA_modifier_types.h"
#include "BLI_path_util.h"
@@ -48,6 +49,8 @@
#include "BKE_main.h"
#include "BKE_camera.h"
#include "BKE_curve.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_displist.h"
#include "BKE_mesh.h"
#include "BKE_armature.h"
#include "BKE_lamp.h"
@@ -102,17 +105,17 @@
#include "BLF_translation.h"
-static Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name)
+static Camera *rna_Main_cameras_new(Main *bmain, const char *name)
{
- ID *id = BKE_camera_add(name);
+ ID *id = BKE_camera_add(bmain, name);
id_us_min(id);
return (Camera *)id;
}
-static void rna_Main_cameras_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *camera_ptr)
+static void rna_Main_cameras_remove(Main *bmain, ReportList *reports, PointerRNA *camera_ptr)
{
Camera *camera = camera_ptr->data;
if (ID_REAL_USERS(camera) <= 0) {
- BKE_libblock_free(&G.main->camera, camera);
+ BKE_libblock_free(&bmain->camera, camera);
RNA_POINTER_INVALIDATE(camera_ptr);
}
else {
@@ -147,7 +150,7 @@ static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports
}
}
-static Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const char *name, ID *data)
+static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char *name, ID *data)
{
Object *ob;
int type = OB_EMPTY;
@@ -192,7 +195,7 @@ static Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, co
id_us_plus(data);
}
- ob = BKE_object_add_only_object(type, name);
+ ob = BKE_object_add_only_object(bmain, type, name);
id_us_min(&ob->id);
ob->data = data;
@@ -201,12 +204,12 @@ static Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, co
return ob;
}
-static void rna_Main_objects_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *object_ptr)
+static void rna_Main_objects_remove(Main *bmain, ReportList *reports, PointerRNA *object_ptr)
{
Object *object = object_ptr->data;
if (ID_REAL_USERS(object) <= 0) {
BKE_object_unlink(object); /* needed or ID pointers to this are not cleared */
- BKE_libblock_free(&G.main->object, object);
+ BKE_libblock_free(&bmain->object, object);
RNA_POINTER_INVALIDATE(object_ptr);
}
else {
@@ -215,17 +218,17 @@ static void rna_Main_objects_remove(Main *UNUSED(bmain), ReportList *reports, Po
}
}
-static Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name)
+static Material *rna_Main_materials_new(Main *bmain, const char *name)
{
- ID *id = (ID *)BKE_material_add(name);
+ ID *id = (ID *)BKE_material_add(bmain, name);
id_us_min(id);
return (Material *)id;
}
-static void rna_Main_materials_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *material_ptr)
+static void rna_Main_materials_remove(Main *bmain, ReportList *reports, PointerRNA *material_ptr)
{
Material *material = material_ptr->data;
if (ID_REAL_USERS(material) <= 0) {
- BKE_libblock_free(&G.main->mat, material);
+ BKE_libblock_free(&bmain->mat, material);
RNA_POINTER_INVALIDATE(material_ptr);
}
else {
@@ -234,18 +237,18 @@ static void rna_Main_materials_remove(Main *UNUSED(bmain), ReportList *reports,
}
}
-static bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, int type)
+static bNodeTree *rna_Main_nodetree_new(Main *bmain, const char *name, int type)
{
- bNodeTree *tree = ntreeAddTree(name, type, NODE_GROUP);
+ bNodeTree *tree = ntreeAddTree(bmain, name, type, NODE_GROUP);
id_us_min(&tree->id);
return tree;
}
-static void rna_Main_nodetree_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *tree_ptr)
+static void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, PointerRNA *tree_ptr)
{
bNodeTree *tree = tree_ptr->data;
if (ID_REAL_USERS(tree) <= 0) {
- BKE_libblock_free(&G.main->nodetree, tree);
+ BKE_libblock_free(&bmain->nodetree, tree);
RNA_POINTER_INVALIDATE(tree_ptr);
}
else {
@@ -254,18 +257,212 @@ static void rna_Main_nodetree_remove(Main *UNUSED(bmain), ReportList *reports, P
}
}
-static Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name)
+static Mesh *rna_Main_meshes_new(Main *bmain, const char *name)
{
- Mesh *me = BKE_mesh_add(name);
+ Mesh *me = BKE_mesh_add(bmain, name);
id_us_min(&me->id);
return me;
}
-static void rna_Main_meshes_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *mesh_ptr)
+
+/* copied from Mesh_getFromObject and adapted to RNA interface */
+/* settings: 1 - preview, 2 - render */
+Mesh *rna_Main_meshes_new_from_object(Main *bmain, ReportList *reports, Scene *sce, Object *ob, int apply_modifiers, int settings)
{
- Mesh *mesh = mesh_ptr->data;
+ Mesh *tmpmesh;
+ Curve *tmpcu = NULL, *copycu;
+ Object *tmpobj = NULL;
+ int render = settings == eModifierMode_Render, i;
+ int cage = !apply_modifiers;
+
+ /* perform the mesh extraction based on type */
+ switch (ob->type) {
+ case OB_FONT:
+ case OB_CURVE:
+ case OB_SURF:
+ {
+ ListBase dispbase = {NULL, NULL};
+ DerivedMesh *derivedFinal = NULL;
+ int uv_from_orco;
+
+ /* copies object and modifiers (but not the data) */
+ tmpobj = BKE_object_copy_ex(bmain, ob, TRUE);
+ tmpcu = (Curve *)tmpobj->data;
+ tmpcu->id.us--;
+
+ /* if getting the original caged mesh, delete object modifiers */
+ if (cage)
+ BKE_object_free_modifiers(tmpobj);
+
+ /* copies the data */
+ copycu = tmpobj->data = BKE_curve_copy((Curve *) ob->data);
+
+ /* temporarily set edit so we get updates from edit mode, but
+ * also because for text datablocks copying it while in edit
+ * mode gives invalid data structures */
+ copycu->editfont = tmpcu->editfont;
+ copycu->editnurb = tmpcu->editnurb;
+ /* get updated display list, and convert to a mesh */
+ BKE_displist_make_curveTypes_forRender(sce, tmpobj, &dispbase, &derivedFinal, FALSE);
+
+ copycu->editfont = NULL;
+ copycu->editnurb = NULL;
+
+ tmpobj->derivedFinal = derivedFinal;
+
+ /* convert object type to mesh */
+ uv_from_orco = (tmpcu->flag & CU_UV_ORCO) != 0;
+ BKE_mesh_from_nurbs_displist(tmpobj, &dispbase, uv_from_orco);
+
+ tmpmesh = tmpobj->data;
+
+ BKE_displist_free(&dispbase);
+
+ /* BKE_mesh_from_nurbs changes the type to a mesh, check it worked */
+ if (tmpobj->type != OB_MESH) {
+ BKE_libblock_free_us(&(G.main->object), tmpobj);
+ BKE_report(reports, RPT_ERROR, "Cannot convert curve to mesh (does the curve have any segments?)");
+ return NULL;
+ }
+
+ BKE_libblock_free_us(&bmain->object, tmpobj);
+ break;
+ }
+
+ case OB_MBALL:
+ {
+ /* metaballs don't have modifiers, so just convert to mesh */
+ Object *basis_ob = BKE_mball_basis_find(sce, ob);
+ /* todo, re-generatre for render-res */
+ /* metaball_polygonize(scene, ob) */
+
+ if (ob != basis_ob)
+ return NULL; /* only do basis metaball */
+
+ tmpmesh = BKE_mesh_add(bmain, "Mesh");
+ /* BKE_mesh_add gives us a user count we don't need */
+ tmpmesh->id.us--;
+
+ if (render) {
+ ListBase disp = {NULL, NULL};
+ BKE_displist_make_mball_forRender(sce, ob, &disp);
+ BKE_mesh_from_metaball(&disp, tmpmesh);
+ BKE_displist_free(&disp);
+ }
+ else
+ BKE_mesh_from_metaball(&ob->disp, tmpmesh);
+
+ break;
+
+ }
+ case OB_MESH:
+ /* copies object and modifiers (but not the data) */
+ if (cage) {
+ /* copies the data */
+ tmpmesh = BKE_mesh_copy_ex(bmain, ob->data);
+ /* if not getting the original caged mesh, get final derived mesh */
+ }
+ else {
+ /* Make a dummy mesh, saves copying */
+ DerivedMesh *dm;
+ /* CustomDataMask mask = CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL; */
+ CustomDataMask mask = CD_MASK_MESH; /* this seems more suitable, exporter,
+ * for example, needs CD_MASK_MDEFORMVERT */
+
+ /* Write the display mesh into the dummy mesh */
+ if (render)
+ dm = mesh_create_derived_render(sce, ob, mask);
+ else
+ dm = mesh_create_derived_view(sce, ob, mask);
+
+ tmpmesh = BKE_mesh_add(bmain, "Mesh");
+ DM_to_mesh(dm, tmpmesh, ob);
+ dm->release(dm);
+ }
+
+ /* BKE_mesh_add/copy gives us a user count we don't need */
+ tmpmesh->id.us--;
+
+ break;
+ default:
+ BKE_report(reports, RPT_ERROR, "Object does not have geometry data");
+ return NULL;
+ }
+
+ /* Copy materials to new mesh */
+ switch (ob->type) {
+ case OB_SURF:
+ case OB_FONT:
+ case OB_CURVE:
+ tmpmesh->totcol = tmpcu->totcol;
+
+ /* free old material list (if it exists) and adjust user counts */
+ if (tmpcu->mat) {
+ for (i = tmpcu->totcol; i-- > 0; ) {
+ /* are we an object material or data based? */
+
+ tmpmesh->mat[i] = ob->matbits[i] ? ob->mat[i] : tmpcu->mat[i];
+
+ if (tmpmesh->mat[i]) {
+ tmpmesh->mat[i]->id.us++;
+ }
+ }
+ }
+ break;
+
+#if 0
+ /* Crashes when assigning the new material, not sure why */
+ case OB_MBALL:
+ tmpmb = (MetaBall *)ob->data;
+ tmpmesh->totcol = tmpmb->totcol;
+
+ /* free old material list (if it exists) and adjust user counts */
+ if (tmpmb->mat) {
+ for (i = tmpmb->totcol; i-- > 0; ) {
+ tmpmesh->mat[i] = tmpmb->mat[i]; /* CRASH HERE ??? */
+ if (tmpmesh->mat[i]) {
+ tmpmb->mat[i]->id.us++;
+ }
+ }
+ }
+ break;
+#endif
+
+ case OB_MESH:
+ if (!cage) {
+ Mesh *origmesh = ob->data;
+ tmpmesh->flag = origmesh->flag;
+ tmpmesh->mat = MEM_dupallocN(origmesh->mat);
+ tmpmesh->totcol = origmesh->totcol;
+ tmpmesh->smoothresh = origmesh->smoothresh;
+ if (origmesh->mat) {
+ for (i = origmesh->totcol; i-- > 0; ) {
+ /* are we an object material or data based? */
+ tmpmesh->mat[i] = ob->matbits[i] ? ob->mat[i] : origmesh->mat[i];
+
+ if (tmpmesh->mat[i]) {
+ tmpmesh->mat[i]->id.us++;
+ }
+ }
+ }
+ }
+ break;
+ } /* end copy materials */
+
+ /* cycles and exporters rely on this still */
+ BKE_mesh_tessface_ensure(tmpmesh);
+
+ /* make sure materials get updated in objects */
+ test_object_materials(&tmpmesh->id);
+
+ return tmpmesh;
+}
+
+static void rna_Main_meshes_remove(Main *bmain, ReportList *reports, PointerRNA *mesh_ptr)
+{
+ Mesh *mesh = mesh_ptr->data;
if (ID_REAL_USERS(mesh) <= 0) {
- BKE_libblock_free(&G.main->mesh, mesh);
+ BKE_libblock_free(&bmain->mesh, mesh);
RNA_POINTER_INVALIDATE(mesh_ptr);
}
else {
@@ -274,18 +471,18 @@ static void rna_Main_meshes_remove(Main *UNUSED(bmain), ReportList *reports, Poi
}
}
-static Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type)
+static Lamp *rna_Main_lamps_new(Main *bmain, const char *name, int type)
{
- Lamp *lamp = BKE_lamp_add(name);
+ Lamp *lamp = BKE_lamp_add(bmain, name);
lamp->type = type;
id_us_min(&lamp->id);
return lamp;
}
-static void rna_Main_lamps_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *lamp_ptr)
+static void rna_Main_lamps_remove(Main *bmain, ReportList *reports, PointerRNA *lamp_ptr)
{
Lamp *lamp = lamp_ptr->data;
if (ID_REAL_USERS(lamp) <= 0) {
- BKE_libblock_free(&G.main->lamp, lamp);
+ BKE_libblock_free(&bmain->lamp, lamp);
RNA_POINTER_INVALIDATE(lamp_ptr);
}
else {
@@ -294,19 +491,19 @@ static void rna_Main_lamps_remove(Main *UNUSED(bmain), ReportList *reports, Poin
}
}
-static Image *rna_Main_images_new(Main *UNUSED(bmain), const char *name, int width, int height, int alpha, int float_buffer)
+static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, int alpha, int float_buffer)
{
float color[4] = {0.0, 0.0, 0.0, 1.0};
- Image *image = BKE_image_add_generated(width, height, name, alpha ? 32 : 24, float_buffer, 0, color);
+ Image *image = BKE_image_add_generated(bmain, width, height, name, alpha ? 32 : 24, float_buffer, 0, color);
id_us_min(&image->id);
return image;
}
-static Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
+static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath)
{
Image *ima;
errno = 0;
- ima = BKE_image_load(filepath);
+ ima = BKE_image_load(bmain, filepath);
if (!ima) {
BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
@@ -315,11 +512,11 @@ static Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, con
return ima;
}
-static void rna_Main_images_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *image_ptr)
+static void rna_Main_images_remove(Main *bmain, ReportList *reports, PointerRNA *image_ptr)
{
Image *image = image_ptr->data;
if (ID_REAL_USERS(image) <= 0) {
- BKE_libblock_free(&G.main->image, image);
+ BKE_libblock_free(&bmain->image, image);
RNA_POINTER_INVALIDATE(image_ptr);
}
else {
@@ -328,17 +525,17 @@ static void rna_Main_images_remove(Main *UNUSED(bmain), ReportList *reports, Poi
}
}
-static Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name)
+static Lattice *rna_Main_lattices_new(Main *bmain, const char *name)
{
- Lattice *lt = BKE_lattice_add(name);
+ Lattice *lt = BKE_lattice_add(bmain, name);
id_us_min(&lt->id);
return lt;
}
-static void rna_Main_lattices_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *lt_ptr)
+static void rna_Main_lattices_remove(Main *bmain, ReportList *reports, PointerRNA *lt_ptr)
{
Lattice *lt = lt_ptr->data;
if (ID_REAL_USERS(lt) <= 0) {
- BKE_libblock_free(&G.main->latt, lt);
+ BKE_libblock_free(&bmain->latt, lt);
RNA_POINTER_INVALIDATE(lt_ptr);
}
else {
@@ -347,17 +544,17 @@ static void rna_Main_lattices_remove(Main *UNUSED(bmain), ReportList *reports, P
}
}
-static Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int type)
+static Curve *rna_Main_curves_new(Main *bmain, const char *name, int type)
{
- Curve *cu = BKE_curve_add(name, type);
+ Curve *cu = BKE_curve_add(bmain, name, type);
id_us_min(&cu->id);
return cu;
}
-static void rna_Main_curves_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *cu_ptr)
+static void rna_Main_curves_remove(Main *bmain, ReportList *reports, PointerRNA *cu_ptr)
{
Curve *cu = cu_ptr->data;
if (ID_REAL_USERS(cu) <= 0) {
- BKE_libblock_free(&G.main->curve, cu);
+ BKE_libblock_free(&bmain->curve, cu);
RNA_POINTER_INVALIDATE(cu_ptr);
}
else {
@@ -366,17 +563,17 @@ static void rna_Main_curves_remove(Main *UNUSED(bmain), ReportList *reports, Poi
}
}
-static MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name)
+static MetaBall *rna_Main_metaballs_new(Main *bmain, const char *name)
{
- MetaBall *mb = BKE_mball_add(name);
+ MetaBall *mb = BKE_mball_add(bmain, name);
id_us_min(&mb->id);
return mb;
}
-static void rna_Main_metaballs_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *mb_ptr)
+static void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, PointerRNA *mb_ptr)
{
MetaBall *mb = mb_ptr->data;
if (ID_REAL_USERS(mb) <= 0) {
- BKE_libblock_free(&G.main->mball, mb);
+ BKE_libblock_free(&bmain->mball, mb);
RNA_POINTER_INVALIDATE(mb_ptr);
}
else {
@@ -412,18 +609,18 @@ static void rna_Main_fonts_remove(Main *bmain, ReportList *reports, PointerRNA *
}
}
-static Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int type)
+static Tex *rna_Main_textures_new(Main *bmain, const char *name, int type)
{
- Tex *tex = add_texture(name);
+ Tex *tex = add_texture(bmain, name);
tex_set_type(tex, type);
id_us_min(&tex->id);
return tex;
}
-static void rna_Main_textures_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *tex_ptr)
+static void rna_Main_textures_remove(Main *bmain, ReportList *reports, PointerRNA *tex_ptr)
{
Tex *tex = tex_ptr->data;
if (ID_REAL_USERS(tex) <= 0) {
- BKE_libblock_free(&G.main->tex, tex);
+ BKE_libblock_free(&bmain->tex, tex);
RNA_POINTER_INVALIDATE(tex_ptr);
}
else {
@@ -432,17 +629,17 @@ static void rna_Main_textures_remove(Main *UNUSED(bmain), ReportList *reports, P
}
}
-static Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name)
+static Brush *rna_Main_brushes_new(Main *bmain, const char *name)
{
- Brush *brush = BKE_brush_add(name);
+ Brush *brush = BKE_brush_add(bmain, name);
id_us_min(&brush->id);
return brush;
}
-static void rna_Main_brushes_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *brush_ptr)
+static void rna_Main_brushes_remove(Main *bmain, ReportList *reports, PointerRNA *brush_ptr)
{
Brush *brush = brush_ptr->data;
if (ID_REAL_USERS(brush) <= 0) {
- BKE_libblock_free(&G.main->brush, brush);
+ BKE_libblock_free(&bmain->brush, brush);
RNA_POINTER_INVALIDATE(brush_ptr);
}
else {
@@ -451,17 +648,17 @@ static void rna_Main_brushes_remove(Main *UNUSED(bmain), ReportList *reports, Po
}
}
-static World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name)
+static World *rna_Main_worlds_new(Main *bmain, const char *name)
{
- World *world = add_world(name);
+ World *world = add_world(bmain, name);
id_us_min(&world->id);
return world;
}
-static void rna_Main_worlds_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *world_ptr)
+static void rna_Main_worlds_remove(Main *bmain, ReportList *reports, PointerRNA *world_ptr)
{
Group *world = world_ptr->data;
if (ID_REAL_USERS(world) <= 0) {
- BKE_libblock_free(&G.main->world, world);
+ BKE_libblock_free(&bmain->world, world);
RNA_POINTER_INVALIDATE(world_ptr);
}
else {
@@ -470,29 +667,29 @@ static void rna_Main_worlds_remove(Main *UNUSED(bmain), ReportList *reports, Poi
}
}
-static Group *rna_Main_groups_new(Main *UNUSED(bmain), const char *name)
+static Group *rna_Main_groups_new(Main *bmain, const char *name)
{
- return add_group(name);
+ return add_group(bmain, name);
}
-static void rna_Main_groups_remove(Main *UNUSED(bmain), PointerRNA *group_ptr)
+static void rna_Main_groups_remove(Main *bmain, PointerRNA *group_ptr)
{
Group *group = group_ptr->data;
BKE_group_unlink(group);
- BKE_libblock_free(&G.main->group, group);
+ BKE_libblock_free(&bmain->group, group);
RNA_POINTER_INVALIDATE(group_ptr);
}
-static Speaker *rna_Main_speakers_new(Main *UNUSED(bmain), const char *name)
+static Speaker *rna_Main_speakers_new(Main *bmain, const char *name)
{
- Speaker *speaker = BKE_speaker_add(name);
+ Speaker *speaker = BKE_speaker_add(bmain, name);
id_us_min(&speaker->id);
return speaker;
}
-static void rna_Main_speakers_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *speaker_ptr)
+static void rna_Main_speakers_remove(Main *bmain, ReportList *reports, PointerRNA *speaker_ptr)
{
Speaker *speaker = speaker_ptr->data;
if (ID_REAL_USERS(speaker) <= 0) {
- BKE_libblock_free(&G.main->speaker, speaker);
+ BKE_libblock_free(&bmain->speaker, speaker);
RNA_POINTER_INVALIDATE(speaker_ptr);
}
else {
@@ -501,15 +698,15 @@ static void rna_Main_speakers_remove(Main *UNUSED(bmain), ReportList *reports, P
}
}
-static Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name)
+static Text *rna_Main_texts_new(Main *bmain, const char *name)
{
- return BKE_text_add(name);
+ return BKE_text_add(bmain, name);
}
-static void rna_Main_texts_remove(Main *UNUSED(bmain), PointerRNA *text_ptr)
+static void rna_Main_texts_remove(Main *bmain, PointerRNA *text_ptr)
{
Text *text = text_ptr->data;
- BKE_text_unlink(G.main, text);
- BKE_libblock_free(&G.main->text, text);
+ BKE_text_unlink(bmain, text);
+ BKE_libblock_free(&bmain->text, text);
RNA_POINTER_INVALIDATE(text_ptr);
}
@@ -518,7 +715,7 @@ static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *f
Text *txt;
errno = 0;
- txt = BKE_text_load(filepath, bmain->name);
+ txt = BKE_text_load(bmain, filepath, bmain->name);
if (!txt)
BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
@@ -527,17 +724,17 @@ static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *f
return txt;
}
-static bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name)
+static bArmature *rna_Main_armatures_new(Main *bmain, const char *name)
{
- bArmature *arm = BKE_armature_add(name);
+ bArmature *arm = BKE_armature_add(bmain, name);
id_us_min(&arm->id);
return arm;
}
-static void rna_Main_armatures_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *arm_ptr)
+static void rna_Main_armatures_remove(Main *bmain, ReportList *reports, PointerRNA *arm_ptr)
{
bArmature *arm = arm_ptr->data;
if (ID_REAL_USERS(arm) <= 0) {
- BKE_libblock_free(&G.main->armature, arm);
+ BKE_libblock_free(&bmain->armature, arm);
RNA_POINTER_INVALIDATE(arm_ptr);
}
else {
@@ -546,18 +743,18 @@ static void rna_Main_armatures_remove(Main *UNUSED(bmain), ReportList *reports,
}
}
-static bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name)
+static bAction *rna_Main_actions_new(Main *bmain, const char *name)
{
- bAction *act = add_empty_action(name);
+ bAction *act = add_empty_action(bmain, name);
id_us_min(&act->id);
act->id.flag &= ~LIB_FAKEUSER;
return act;
}
-static void rna_Main_actions_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *act_ptr)
+static void rna_Main_actions_remove(Main *bmain, ReportList *reports, PointerRNA *act_ptr)
{
bAction *act = act_ptr->data;
if (ID_REAL_USERS(act) <= 0) {
- BKE_libblock_free(&G.main->action, act);
+ BKE_libblock_free(&bmain->action, act);
RNA_POINTER_INVALIDATE(act_ptr);
}
else {
@@ -585,12 +782,12 @@ static void rna_Main_particles_remove(Main *bmain, ReportList *reports, PointerR
}
}
-static MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
+static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath)
{
MovieClip *clip;
errno = 0;
- clip = BKE_movieclip_file_add(filepath);
+ clip = BKE_movieclip_file_add(bmain, filepath);
if (!clip)
BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
@@ -599,28 +796,28 @@ static MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *repor
return clip;
}
-static void rna_Main_movieclips_remove(Main *UNUSED(bmain), PointerRNA *clip_ptr)
+static void rna_Main_movieclips_remove(Main *bmain, PointerRNA *clip_ptr)
{
MovieClip *clip = clip_ptr->data;
- BKE_movieclip_unlink(G.main, clip);
- BKE_libblock_free(&G.main->movieclip, clip);
+ BKE_movieclip_unlink(bmain, clip);
+ BKE_libblock_free(&bmain->movieclip, clip);
RNA_POINTER_INVALIDATE(clip_ptr);
}
-static Mask *rna_Main_mask_new(Main *UNUSED(bmain), const char *name)
+static Mask *rna_Main_mask_new(Main *bmain, const char *name)
{
Mask *mask;
- mask = BKE_mask_new("Mask");
+ mask = BKE_mask_new(bmain, "Mask");
return mask;
}
-static void rna_Main_masks_remove(Main *UNUSED(bmain), PointerRNA *mask_ptr)
+static void rna_Main_masks_remove(Main *bmain, PointerRNA *mask_ptr)
{
Mask *mask = mask_ptr->data;
- BKE_mask_free(G.main, mask);
- BKE_libblock_free(&G.main->mask, mask);
+ BKE_mask_free(bmain, mask);
+ BKE_libblock_free(&bmain->mask, mask);
RNA_POINTER_INVALIDATE(mask_ptr);
}
@@ -936,6 +1133,12 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
PropertyRNA *parm;
PropertyRNA *prop;
+ static EnumPropertyItem mesh_type_items[] = {
+ {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
+ {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
RNA_def_property_srna(cprop, "BlendDataMeshes");
srna = RNA_def_struct(brna, "BlendDataMeshes", NULL);
RNA_def_struct_sdna(srna, "Main");
@@ -949,6 +1152,21 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh datablock");
RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new_from_object", "rna_Main_meshes_new_from_object");
+ RNA_def_function_ui_description(func, "Add a new mesh created from object with modifiers applied");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object to create mesh from");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+ parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm = RNA_def_pointer(func, "mesh", "Mesh", "",
+ "Mesh created from object, remove it if it is only used for export");
+ RNA_def_function_return(func, parm);
+
func = RNA_def_function(srna, "remove", "rna_Main_meshes_remove");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile");
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 1221b84372c..35173c290de 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -114,7 +114,7 @@ static void rna_Material_update_previews(Main *bmain, Scene *scene, PointerRNA *
if (ma->nodetree)
ntreeClearPreview(ma->nodetree);
- rna_Material_update(bmain, scene, ptr);
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
}
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 60625cb0e0b..0ab6a690b92 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -2443,7 +2443,7 @@ static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
RNA_def_property_pointer_funcs(prop, "rna_Mesh_vertex_color_active_get",
"rna_Mesh_vertex_color_active_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
@@ -2471,7 +2471,7 @@ static void rna_def_uv_layers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_active_get",
"rna_Mesh_uv_layer_active_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
RNA_def_property_ui_text(prop, "Active UV loop layer", "Active UV loop layer");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
@@ -2621,7 +2621,7 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");
RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_active_get",
"rna_Mesh_uv_texture_active_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
RNA_def_property_ui_text(prop, "Active UV Map", "Active UV Map");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index fe5b6e15f44..fee4b429a11 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -4225,6 +4225,33 @@ static void def_cmp_trackpos(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
+static void def_cmp_translate(StructRNA *srna)
+{
+ static EnumPropertyItem translate_items[] = {
+ {CMP_NODE_WRAP_NONE, "NONE", 0, "None", "No wrapping on X and Y"},
+ {CMP_NODE_WRAP_X, "XAXIS", 0, "X Axis", "Wrap all pixels on the X axis"},
+ {CMP_NODE_WRAP_Y, "YAXIS", 0, "Y Axis", "Wrap all pixels on the Y axis"},
+ {CMP_NODE_WRAP_XY, "BOTH", 0, "Both Axes", "Wrap all pixels on both axes"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeTranslateData", "storage");
+
+ prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
+ RNA_def_property_ui_text(prop, "Relative", "Use relative (percent) values to define blur radius");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "wrap_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "wrap_axis");
+ RNA_def_property_enum_items(prop, translate_items);
+ RNA_def_property_ui_text(prop, "Wrapping", "Wrap image on a specific axis");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
+
/* -- Texture Nodes --------------------------------------------------------- */
static void def_tex_output(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index 46f2306f284..d6e0ce2f11a 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -127,7 +127,7 @@ DefNode( CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, "R_LAY
DefNode( CompositorNode, CMP_NODE_COMPOSITE, 0, "COMPOSITE", Composite, "Composite", "" )
DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, def_cmp_output_file, "OUTPUT_FILE", OutputFile, "File Output", "" )
DefNode( CompositorNode, CMP_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
-DefNode( CompositorNode, CMP_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" )
+DefNode( CompositorNode, CMP_NODE_TRANSLATE, def_cmp_translate, "TRANSLATE", Translate, "Translate", "" )
DefNode( CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, "ZCOMBINE", Zcombine, "Z Combine", "" )
DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" )
DefNode( CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" )
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 40b8d4cce66..51725bda7f9 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -65,8 +65,6 @@ static EnumPropertyItem space_items[] = {
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_depsgraph.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_displist.h"
#include "BKE_font.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -113,194 +111,7 @@ static void rna_Scene_mat_convert_space(Object *ob, ReportList *reports, bPoseCh
/* settings: 0 - preview, 1 - render */
static Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings)
{
- Mesh *tmpmesh;
- Curve *tmpcu = NULL, *copycu;
- Object *tmpobj = NULL;
- int render = settings == eModifierMode_Render, i;
- int cage = !apply_modifiers;
-
- /* perform the mesh extraction based on type */
- switch (ob->type) {
- case OB_FONT:
- case OB_CURVE:
- case OB_SURF:
- {
- ListBase dispbase = {NULL, NULL};
- DerivedMesh *derivedFinal = NULL;
- int uv_from_orco;
-
- /* copies object and modifiers (but not the data) */
- tmpobj = BKE_object_copy_with_caches(ob);
- tmpcu = (Curve *)tmpobj->data;
- tmpcu->id.us--;
-
- /* if getting the original caged mesh, delete object modifiers */
- if (cage)
- BKE_object_free_modifiers(tmpobj);
-
- /* copies the data */
- copycu = tmpobj->data = BKE_curve_copy((Curve *) ob->data);
-
- /* temporarily set edit so we get updates from edit mode, but
- * also because for text datablocks copying it while in edit
- * mode gives invalid data structures */
- copycu->editfont = tmpcu->editfont;
- copycu->editnurb = tmpcu->editnurb;
-
- /* get updated display list, and convert to a mesh */
- BKE_displist_make_curveTypes_forRender(sce, tmpobj, &dispbase, &derivedFinal, FALSE);
-
- copycu->editfont = NULL;
- copycu->editnurb = NULL;
-
- tmpobj->derivedFinal = derivedFinal;
-
- /* convert object type to mesh */
- uv_from_orco = (tmpcu->flag & CU_UV_ORCO) != 0;
- BKE_mesh_from_nurbs_displist(tmpobj, &dispbase, uv_from_orco);
-
- tmpmesh = tmpobj->data;
-
- BKE_displist_free(&dispbase);
-
- /* BKE_mesh_from_nurbs changes the type to a mesh, check it worked */
- if (tmpobj->type != OB_MESH) {
- BKE_libblock_free_us(&(G.main->object), tmpobj);
- BKE_report(reports, RPT_ERROR, "Cannot convert curve to mesh (does the curve have any segments?)");
- return NULL;
- }
-
- BKE_libblock_free_us(&G.main->object, tmpobj);
- break;
- }
-
- case OB_MBALL:
- {
- /* metaballs don't have modifiers, so just convert to mesh */
- Object *basis_ob = BKE_mball_basis_find(sce, ob);
- /* todo, re-generatre for render-res */
- /* metaball_polygonize(scene, ob) */
-
- if (ob != basis_ob)
- return NULL; /* only do basis metaball */
-
- tmpmesh = BKE_mesh_add("Mesh");
- /* BKE_mesh_add gives us a user count we don't need */
- tmpmesh->id.us--;
-
- if (render) {
- ListBase disp = {NULL, NULL};
- BKE_displist_make_mball_forRender(sce, ob, &disp);
- BKE_mesh_from_metaball(&disp, tmpmesh);
- BKE_displist_free(&disp);
- }
- else
- BKE_mesh_from_metaball(&ob->disp, tmpmesh);
-
- break;
-
- }
- case OB_MESH:
- /* copies object and modifiers (but not the data) */
- if (cage) {
- /* copies the data */
- tmpmesh = BKE_mesh_copy(ob->data);
- /* if not getting the original caged mesh, get final derived mesh */
- }
- else {
- /* Make a dummy mesh, saves copying */
- DerivedMesh *dm;
- /* CustomDataMask mask = CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL; */
- CustomDataMask mask = CD_MASK_MESH; /* this seems more suitable, exporter,
- * for example, needs CD_MASK_MDEFORMVERT */
-
- /* Write the display mesh into the dummy mesh */
- if (render)
- dm = mesh_create_derived_render(sce, ob, mask);
- else
- dm = mesh_create_derived_view(sce, ob, mask);
-
- tmpmesh = BKE_mesh_add("Mesh");
- DM_to_mesh(dm, tmpmesh, ob);
- dm->release(dm);
- }
-
- /* BKE_mesh_add/copy gives us a user count we don't need */
- tmpmesh->id.us--;
-
- break;
- default:
- BKE_report(reports, RPT_ERROR, "Object does not have geometry data");
- return NULL;
- }
-
- /* Copy materials to new mesh */
- switch (ob->type) {
- case OB_SURF:
- case OB_FONT:
- case OB_CURVE:
- tmpmesh->totcol = tmpcu->totcol;
-
- /* free old material list (if it exists) and adjust user counts */
- if (tmpcu->mat) {
- for (i = tmpcu->totcol; i-- > 0; ) {
- /* are we an object material or data based? */
-
- tmpmesh->mat[i] = ob->matbits[i] ? ob->mat[i] : tmpcu->mat[i];
-
- if (tmpmesh->mat[i]) {
- tmpmesh->mat[i]->id.us++;
- }
- }
- }
- break;
-
-#if 0
- /* Crashes when assigning the new material, not sure why */
- case OB_MBALL:
- tmpmb = (MetaBall *)ob->data;
- tmpmesh->totcol = tmpmb->totcol;
-
- /* free old material list (if it exists) and adjust user counts */
- if (tmpmb->mat) {
- for (i = tmpmb->totcol; i-- > 0; ) {
- tmpmesh->mat[i] = tmpmb->mat[i]; /* CRASH HERE ??? */
- if (tmpmesh->mat[i]) {
- tmpmb->mat[i]->id.us++;
- }
- }
- }
- break;
-#endif
-
- case OB_MESH:
- if (!cage) {
- Mesh *origmesh = ob->data;
- tmpmesh->flag = origmesh->flag;
- tmpmesh->mat = MEM_dupallocN(origmesh->mat);
- tmpmesh->totcol = origmesh->totcol;
- tmpmesh->smoothresh = origmesh->smoothresh;
- if (origmesh->mat) {
- for (i = origmesh->totcol; i-- > 0; ) {
- /* are we an object material or data based? */
- tmpmesh->mat[i] = ob->matbits[i] ? ob->mat[i] : origmesh->mat[i];
-
- if (tmpmesh->mat[i]) {
- tmpmesh->mat[i]->id.us++;
- }
- }
- }
- }
- break;
- } /* end copy materials */
-
- /* cycles and exporters rely on this still */
- BKE_mesh_tessface_ensure(tmpmesh);
-
- /* make sure materials get updated in objects */
- test_object_materials(&tmpmesh->id);
-
- return tmpmesh;
+ return rna_Main_meshes_new_from_object(G.main, reports, sce, ob, apply_modifiers, settings);
}
/* mostly a copy from convertblender.c */
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index bd3e4e6862d..dbf80f01335 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -289,8 +289,8 @@ static void rna_Particle_uv_on_emitter(ParticleData *particle, ParticleSystemMod
}
}
-static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object, ParticleSystemModifierData *modifier, int particle_no, int step,
- float n_co[3])
+static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object, ParticleSystemModifierData *modifier,
+ int particle_no, int step, float n_co[3])
{
ParticleSettings *part = 0;
ParticleData *pars = 0;
@@ -299,6 +299,7 @@ static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *o
int path_nbr = 0;
int totpart;
int max_k = 0;
+ int step_nbr = 0;
if (particlesystem == NULL)
return;
@@ -306,14 +307,21 @@ static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *o
part = particlesystem->part;
pars = particlesystem->particles;
+ if (particlesystem->renderdata) {
+ step_nbr = part->ren_step;
+ totchild = particlesystem->totchild;
+ }
+ else {
+ step_nbr = part->draw_step;
+ totchild = (int)((float)particlesystem->totchild * (float)(part->disp) / 100.0f);
+ }
+
if (part == NULL || pars == NULL || !psys_check_enabled(object, particlesystem))
return;
if (part->ren_as == PART_DRAW_OB || part->ren_as == PART_DRAW_GR || part->ren_as == PART_DRAW_NOT)
return;
- totchild = particlesystem->totchild * part->disp / 100;
-
/* can happen for disconnected/global hair */
if (part->type == PART_HAIR && !particlesystem->childcache)
totchild = 0;
@@ -324,7 +332,7 @@ static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *o
return;
if (part->ren_as == PART_DRAW_PATH && particlesystem->pathcache)
- path_nbr = (int)pow(2.0, part->draw_step);
+ path_nbr = (int)pow(2.0, step_nbr);
if (particle_no < totpart) {
@@ -373,7 +381,12 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, Par
part = particlesystem->part;
+ if (particlesystem->renderdata) {
totchild = particlesystem->totchild;
+ }
+ else {
+ totchild = (int)((float)particlesystem->totchild * (float)(part->disp) / 100.0f);
+ }
/* can happen for disconnected/global hair */
if (part->type == PART_HAIR && !particlesystem->childcache)
@@ -419,7 +432,7 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, Par
if (n_uv && ELEM(PART_FROM_FACE, PART_FROM_FACE, PART_FROM_VOLUME)) {
if (cpa->num != DMCACHE_NOTFOUND) {
MFace *mface = modifier->dm->getTessFaceData(modifier->dm, cpa->num, CD_MFACE);
- MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, 0);
+ MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, uv_no);
mtface += cpa->num;
psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, n_uv);
@@ -441,7 +454,7 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, Par
if (n_uv && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
if (num != DMCACHE_NOTFOUND) {
MFace *mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE);
- MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, 0);
+ MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, uv_no);
mtface += num;
psys_interpolate_uvs(mtface, mface->v4, parent->fuv, n_uv);
@@ -455,10 +468,11 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, Par
}
}
-static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, ParticleSystemModifierData *modifier, ParticleData *particle, int particle_no, int vcol_no,
- float n_mcol[3])
+static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, ParticleSystemModifierData *modifier,
+ ParticleData *particle, int particle_no, int vcol_no,
+ float n_mcol[3])
{
- ParticleSettings *part = 0;
+ ParticleSettings *part;
int totpart;
int totchild = 0;
int num;
@@ -470,7 +484,12 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, P
part = particlesystem->part;
+ if (particlesystem->renderdata) {
totchild = particlesystem->totchild;
+ }
+ else {
+ totchild = (int)((float)particlesystem->totchild * (float)(part->disp) / 100.0f);
+ }
/* can happen for disconnected/global hair */
if (part->type == PART_HAIR && !particlesystem->childcache)
@@ -481,7 +500,7 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, P
if (particle_no >= totpart + totchild)
return;
-/* 3. start creating renderable things */
+ /* 3. start creating renderable things */
/* setup per particle individual stuff */
if (particle_no < totpart) {
@@ -520,7 +539,7 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, P
if (n_mcol && ELEM(PART_FROM_FACE, PART_FROM_FACE, PART_FROM_VOLUME)) {
if (cpa->num != DMCACHE_NOTFOUND) {
MFace *mface = modifier->dm->getTessFaceData(modifier->dm, cpa->num, CD_MFACE);
- MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, 0);
+ MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, vcol_no);
mc += cpa->num * 4;
psys_interpolate_mcol(mc, mface->v4, cpa->fuv, &mcol);
@@ -546,7 +565,7 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, P
if (n_mcol && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
if (num != DMCACHE_NOTFOUND) {
MFace *mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE);
- MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, 0);
+ MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MCOL, vcol_no);
mc += num * 4;
psys_interpolate_mcol(mc, mface->v4, parent->fuv, &mcol);
@@ -564,6 +583,24 @@ static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, P
}
}
+static void rna_ParticleSystem_set_resolution(ParticleSystem *particlesystem, Scene *scene, Object *object, int resolution)
+{
+ if (resolution == eModifierMode_Render) {
+ ParticleSystemModifierData *psmd = psys_get_modifier(object, particlesystem);
+ float mat[4][4];
+
+ unit_m4(mat);
+
+ psys_render_set(object, particlesystem, mat, mat, 1, 1, 0.f);
+ psmd->flag &= ~eParticleSystemFlag_psys_updated;
+ particle_system_update(scene, object, particlesystem);
+ }
+ else {
+ if (particlesystem->renderdata)
+ psys_render_restore(object, particlesystem);
+ }
+}
+
static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr, short flag)
{
if (ptr->type == &RNA_ParticleSystem) {
@@ -3047,6 +3084,12 @@ static void rna_def_particle_system(BlenderRNA *brna)
PropertyRNA *prop;
FunctionRNA *func;
+ static EnumPropertyItem resolution_items[] = {
+ {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
+ {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
srna = RNA_def_struct(brna, "ParticleSystem", NULL);
RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object");
RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
@@ -3345,6 +3388,13 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_ParticleSystem_path");
+ /* set viewport or render resolution */
+ func = RNA_def_function(srna, "set_resolution", "rna_ParticleSystem_set_resolution");
+ RNA_def_function_ui_description(func, "Set the resolution to use for the number of particles");
+ prop = RNA_def_pointer(func, "scene", "Scene", "", "Scene");
+ prop = RNA_def_pointer(func, "object", "Object", "", "Object");
+ prop = RNA_def_enum(func, "resolution", resolution_items, 0, "", "Resolution settings to apply");
+
/* extract cached hair location data */
func = RNA_def_function(srna, "co_hair", "rna_ParticleSystem_co_hair");
RNA_def_function_ui_description(func, "Obtain cache hair data");
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index 938ef7a5032..b737410bbab 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -64,13 +64,13 @@ EnumPropertyItem rigidbody_ob_shape_items[] = {
/* collision shapes of constraints in rigid body sim */
EnumPropertyItem rigidbody_con_type_items[] = {
- {RBC_TYPE_FIXED, "FIXED", ICON_FORCE_FORCE, "Fixed", "Glue rigid bodies together"},
- {RBC_TYPE_POINT, "POINT", ICON_FORCE_FORCE, "Point", "Constrain rigid bodies to move around common pivot point"},
- {RBC_TYPE_HINGE, "HINGE", ICON_FORCE_FORCE, "Hinge", "Restrict rigid body rotation to one axis"},
- {RBC_TYPE_SLIDER, "SLIDER", ICON_FORCE_FORCE, "Slider", "Restrict rigid body translation to one axis"},
- {RBC_TYPE_PISTON, "PISTON", ICON_FORCE_FORCE, "Piston", "Restrict rigid body translation and rotation to one axis"},
- {RBC_TYPE_6DOF, "GENERIC", ICON_FORCE_FORCE, "Generic", "Restrict translation and rotation to specified axes"},
- {RBC_TYPE_6DOF_SPRING, "GENERIC_SPRING", ICON_FORCE_FORCE, "Generic Spring",
+ {RBC_TYPE_FIXED, "FIXED", ICON_NONE, "Fixed", "Glue rigid bodies together"},
+ {RBC_TYPE_POINT, "POINT", ICON_NONE, "Point", "Constrain rigid bodies to move around common pivot point"},
+ {RBC_TYPE_HINGE, "HINGE", ICON_NONE, "Hinge", "Restrict rigid body rotation to one axis"},
+ {RBC_TYPE_SLIDER, "SLIDER", ICON_NONE, "Slider", "Restrict rigid body translation to one axis"},
+ {RBC_TYPE_PISTON, "PISTON", ICON_NONE, "Piston", "Restrict rigid body translation and rotation to one axis"},
+ {RBC_TYPE_6DOF, "GENERIC", ICON_NONE, "Generic", "Restrict translation and rotation to specified axes"},
+ {RBC_TYPE_6DOF_SPRING, "GENERIC_SPRING", ICON_NONE, "Generic Spring",
"Restrict translation and rotation to specified axes with springs"},
{0, NULL, 0, NULL, NULL}};
@@ -188,25 +188,6 @@ static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value)
#endif
}
-static void rna_RigidBodyOb_shape_set(PointerRNA *ptr, int value)
-{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- Object *ob = (Object *)ptr->id.data;
-
- rbo->shape = value;
-
- /* force creation of new collision shape reflecting this */
- BKE_rigidbody_validate_sim_shape(ob, TRUE);
-
-#ifdef WITH_BULLET
- /* now tell RB sim about it */
- if (rbo->physics_object && rbo->physics_shape) {
- RB_body_set_collision_shape(rbo->physics_object, rbo->physics_shape);
- }
-#endif
-}
-
-
static void rna_RigidBodyOb_mass_set(PointerRNA *ptr, float value)
{
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
@@ -642,8 +623,8 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "collision_shape", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shape");
RNA_def_property_enum_items(prop, rigidbody_ob_shape_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_shape_set", NULL);
RNA_def_property_ui_text(prop, "Collision Shape", "Collision Shape of object in Rigid Body Simulations");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
prop = RNA_def_property(srna, "kinematic", PROP_BOOLEAN, PROP_NONE);
@@ -970,7 +951,7 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Upper Z Angle Limit", "Upper limit of Z axis rotation");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
- prop = RNA_def_property(srna, "spring_stiffness_x", PROP_FLOAT, PROP_UNIT_LENGTH);
+ prop = RNA_def_property(srna, "spring_stiffness_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_x");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
@@ -979,7 +960,7 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "X Axis Stiffness", "Stiffness on the X axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
- prop = RNA_def_property(srna, "spring_stiffness_y", PROP_FLOAT, PROP_UNIT_LENGTH);
+ prop = RNA_def_property(srna, "spring_stiffness_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_y");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
@@ -988,7 +969,7 @@ static void rna_def_rigidbody_constraint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Y Axis Stiffness", "Stiffness on the Y axis");
RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
- prop = RNA_def_property(srna, "spring_stiffness_z", PROP_FLOAT, PROP_UNIT_LENGTH);
+ prop = RNA_def_property(srna, "spring_stiffness_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_z");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 843743b9a9a..c4269e1ddff 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3167,8 +3167,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_DBVT_CULLING);
RNA_def_property_ui_text(prop, "DBVT Culling",
- "Use optimized Bullet DBVT tree for view frustum and occlusion culling "
- "(more efficient, but it can waste unecessary CPU if the scene doesn't have Occluder objects");
+ "Use optimized Bullet DBVT tree for view frustum and occlusion culling (more efficient, "
+ "but it can waste unnecessary CPU if the scene doesn't have occluder objects)");
/* not used *//* deprecated !!!!!!!!!!!!! */
prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
@@ -4232,27 +4232,33 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
"(note that this disables save_buffers and full_sample)");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+
prop = RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "border.xmin");
RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Border Minimum X", "Minimum X value to for the render border");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "border_min_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "border.ymin");
RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Border Minimum Y", "Minimum Y value for the render border");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "border_max_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "border.xmax");
RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Border Maximum X", "Maximum X value for the render border");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "border_max_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "border.ymax");
RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Border Maximum Y", "Maximum Y value for the render border");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
@@ -5220,15 +5226,19 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Sequencer Color Space Settings", "Settings of color space sequencer is working in");
/* Nestled Data */
+ /* *** Non-Animated *** */
+ RNA_define_animate_sdna(false);
rna_def_tool_settings(brna);
rna_def_unified_paint_settings(brna);
rna_def_unit_settings(brna);
rna_def_scene_image_format_data(brna);
- rna_def_scene_render_data(brna);
rna_def_scene_game_data(brna);
- rna_def_scene_render_layer(brna);
rna_def_transform_orientation(brna);
rna_def_selected_uv_element(brna);
+ RNA_define_animate_sdna(true);
+ /* *** Animated *** */
+ rna_def_scene_render_data(brna);
+ rna_def_scene_render_layer(brna);
/* Scene API */
RNA_api_scene(srna);
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 08bac1da7a7..ff0c9d9dec6 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -676,12 +676,15 @@ static void rna_def_particle_edit(BlenderRNA *brna)
void RNA_def_sculpt_paint(BlenderRNA *brna)
{
+ /* *** Non-Animated *** */
+ RNA_define_animate_sdna(false);
rna_def_paint(brna);
rna_def_sculpt(brna);
rna_def_uv_sculpt(brna);
rna_def_vertex_paint(brna);
rna_def_image_paint(brna);
rna_def_particle_edit(brna);
+ RNA_define_animate_sdna(true);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index f7daf6a3b06..a2704619ee6 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -413,7 +413,7 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value)
/* fix all the animation data which may link to this */
/* don't rename everywhere because these are per scene */
- /* BKE_all_animdata_fix_paths_rename(NULL, "sequence_editor.sequences_all", oldname, seq->name+2); */
+ /* BKE_all_animdata_fix_paths_rename(NULL, "sequence_editor.sequences_all", oldname, seq->name + 2); */
adt = BKE_animdata_from_id(&scene->id);
if (adt)
BKE_animdata_fix_paths_rename(&scene->id, adt, NULL, "sequence_editor.sequences_all", oldname, seq->name + 2, 0, 0, 1);
@@ -2111,7 +2111,7 @@ static void rna_def_solid_color(StructRNA *srna)
RNA_def_struct_sdna_from(srna, "SolidColorVars", "effectdata");
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "col");
RNA_def_property_ui_text(prop, "Color", "");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index cccdf3258d2..f58c9456386 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -80,9 +80,9 @@ EnumPropertyItem space_type_items[] = {
};
static EnumPropertyItem draw_channels_items[] = {
- {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
{SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
"Draw image with RGB colors and alpha transparency"},
+ {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
{SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
{SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer",
"Draw Z-buffer associated with image (mapped from camera clip start to end)"},
@@ -633,15 +633,18 @@ static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUS
if (alpha && zbuf)
return draw_channels_items;
- RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
-
if (alpha) {
RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_USE_ALPHA);
+ RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ALPHA);
}
else if (zbuf) {
+ RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ZBUF);
}
+ else {
+ RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
+ }
RNA_enum_item_end(&item, &totitem);
*free = 1;
@@ -1547,6 +1550,14 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{ICON_MATCAP_14, "14", ICON_MATCAP_14, "", ""},
{ICON_MATCAP_15, "15", ICON_MATCAP_15, "", ""},
{ICON_MATCAP_16, "16", ICON_MATCAP_16, "", ""},
+ {ICON_MATCAP_17, "17", ICON_MATCAP_17, "", ""},
+ {ICON_MATCAP_18, "18", ICON_MATCAP_18, "", ""},
+ {ICON_MATCAP_19, "19", ICON_MATCAP_19, "", ""},
+ {ICON_MATCAP_20, "20", ICON_MATCAP_20, "", ""},
+ {ICON_MATCAP_21, "21", ICON_MATCAP_21, "", ""},
+ {ICON_MATCAP_22, "22", ICON_MATCAP_22, "", ""},
+ {ICON_MATCAP_23, "23", ICON_MATCAP_23, "", ""},
+ {ICON_MATCAP_24, "24", ICON_MATCAP_24, "", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -2043,7 +2054,7 @@ static void rna_def_space_buttons(BlenderRNA *brna)
/* note: custom set function is ONLY to avoid rna setting a user for this. */
RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set",
"rna_SpaceProperties_pin_id_typef", NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update");
prop = RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
@@ -3063,9 +3074,9 @@ static void rna_def_space_node(BlenderRNA *brna)
};
static EnumPropertyItem backdrop_channels_items[] = {
- {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
{SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
"Draw image with RGB colors and alpha transparency"},
+ {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
{SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
{SNODE_SHOW_R, "RED", ICON_COLOR_RED, "Red", ""},
{SNODE_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""},
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 787a5d6487e..2043832a3f8 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -32,12 +32,17 @@
#include <stdlib.h>
#include <stdio.h>
+#include "BLI_utildefines.h"
+
+#include "BLF_translation.h"
+
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "DNA_screen_types.h"
#include "UI_resources.h"
+#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "rna_internal.h"
@@ -55,9 +60,44 @@ EnumPropertyItem icon_items[] = {
#ifdef RNA_RUNTIME
-static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, int icon,
- int expand, int slider, int toggle, int icon_only, int event, int full_event,
- int emboss, int index)
+static const char *rna_translate_ui_text(const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop,
+ int translate)
+{
+ /* Also return text if UI labels translation is disabled. */
+ if (!text || !text[0] || !translate || !BLF_translate_iface()) {
+ return text;
+ }
+
+ /* If a text_ctxt is specified, use it! */
+ if (text_ctxt && text_ctxt[0]) {
+ return BLF_pgettext(text_ctxt, text);
+ }
+
+ /* Else, if an RNA type or property is specified, use its context. */
+#if 0
+ /* XXX Disabled for now. Unfortunately, their is absolutely no way from py code to get the RNA struct corresponding
+ * to the 'data' (in functions like prop() & co), as this is pure runtime data. Hence, messages extraction
+ * script can't determine the correct context it should use for such 'text' messages...
+ * So for now, one have to explicitly specify the 'text_ctxt' when using prop() etc. functions,
+ * if default context is not suitable.
+ */
+ if (prop) {
+ return BLF_pgettext(RNA_property_translation_context(prop), text);
+ }
+#else
+ (void)prop;
+#endif
+ if (type) {
+ return BLF_pgettext(RNA_struct_translation_context(type), text);
+ }
+
+ /* Else, default context! */
+ return BLF_pgettext(BLF_I18NCONTEXT_DEFAULT, text);
+}
+
+static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt,
+ int translate, int icon, int expand, int slider, int toggle, int icon_only, int event,
+ int full_event, int emboss, int index)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
int flag = 0;
@@ -67,6 +107,9 @@ static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname,
return;
}
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
flag |= (slider) ? UI_ITEM_R_SLIDER : 0;
flag |= (expand) ? UI_ITEM_R_EXPAND : 0;
flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0;
@@ -78,15 +121,102 @@ static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname,
uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon);
}
-static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, int icon, int emboss)
+static void rna_uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name,
+ const char *text_ctxt, int translate, int icon)
{
- int flag = UI_ITEM_O_RETURN_PROPS;
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ /* XXX This will search property again :( */
+ uiItemMenuEnumR(layout, ptr, propname, name, icon);
+}
+
+static void rna_uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value,
+ const char *name, const char *text_ctxt, int translate, int icon)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ /* XXX This will search property again :( */
+ uiItemEnumR_string(layout, ptr, propname, value, name, icon);
+}
+
+static void rna_uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
+ struct PointerRNA *searchptr, const char *searchpropname,
+ const char *name, const char *text_ctxt, int translate, int icon)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ /* XXX This will search property again :( */
+ uiItemPointerR(layout, ptr, propname, searchptr, searchpropname, name, icon);
+}
+
+static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, const char *text_ctxt,
+ int translate, int icon, int emboss)
+{
+ wmOperatorType *ot;
+ int flag;
+
+ ot = WM_operatortype_find(opname, 0); /* print error next */
+ if (!ot || !ot->srna) {
+ RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
+ return PointerRNA_NULL;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
+
+ flag = UI_ITEM_O_RETURN_PROPS;
flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;
- return uiItemFullO(layout, opname, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
+
+ return uiItemFullO_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
}
-static void rna_uiItemL(uiLayout *layout, const char *name, int icon, int icon_value)
+static void rna_uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname, const char *name,
+ const char *text_ctxt, int translate, int icon)
{
+ wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
+
+ if (!ot || !ot->srna) {
+ RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
+
+ /* XXX This will search operator again :( */
+ uiItemMenuEnumO(layout, opname, propname, name, icon);
+}
+
+static void rna_uiItemL(uiLayout *layout, const char *name, const char *text_ctxt, int translate,
+ int icon, int icon_value)
+{
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
+
if (icon_value && !icon) {
icon = icon_value;
}
@@ -94,6 +224,49 @@ static void rna_uiItemL(uiLayout *layout, const char *name, int icon, int icon_v
uiItemL(layout, name, icon);
}
+static void rna_uiItemM(uiLayout *layout, bContext *C, const char *menuname, const char *name, const char *text_ctxt,
+ int translate, int icon)
+{
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
+
+ uiItemM(layout, C, menuname, name, icon);
+}
+
+static void rna_uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename,
+ const char *name, const char *text_ctxt, int translate)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ /* XXX This will search property again :( */
+ uiTemplateAnyID(layout, ptr, propname, proptypename, name);
+}
+
+static void rna_uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *root_ptr,
+ const char *name, const char *text_ctxt, int translate)
+{
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ /* XXX This will search property again :( */
+ uiTemplatePathBuilder(layout, ptr, propname, root_ptr, name);
+}
+
static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon)
{
return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), FALSE);
@@ -192,11 +365,18 @@ static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propna
#else
+static void api_ui_item_common_text(FunctionRNA *func)
+{
+ RNA_def_string(func, "text", "", 0, "", "Override automatic text of the item");
+ RNA_def_string(func, "text_ctxt", "", 0, "", "Override automatic translation context of the given text");
+ RNA_def_boolean(func, "translate", true, "", "Translate the given text, when UI translation is enabled");
+}
+
static void api_ui_item_common(FunctionRNA *func)
{
PropertyRNA *prop;
- RNA_def_string_py_translate(func, "text", "", 0, "", "Override automatic text of the item");
+ api_ui_item_common_text(func);
prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, icon_items);
@@ -333,17 +513,17 @@ void RNA_api_ui_layout(StructRNA *srna)
func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
api_ui_item_rna_common(func);
- func = RNA_def_function(srna, "prop_menu_enum", "uiItemMenuEnumR");
+ func = RNA_def_function(srna, "prop_menu_enum", "rna_uiItemMenuEnumR");
api_ui_item_rna_common(func);
api_ui_item_common(func);
- func = RNA_def_function(srna, "prop_enum", "uiItemEnumR_string");
+ func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string");
api_ui_item_rna_common(func);
parm = RNA_def_string(func, "value", "", 0, "", "Enum property value");
RNA_def_property_flag(parm, PROP_REQUIRED);
api_ui_item_common(func);
- func = RNA_def_function(srna, "prop_search", "uiItemPointerR");
+ func = RNA_def_function(srna, "prop_search", "rna_uiItemPointerR");
api_ui_item_rna_common(func);
parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
@@ -366,7 +546,7 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
RNA_def_property_flag(parm, PROP_REQUIRED);
- func = RNA_def_function(srna, "operator_menu_enum", "uiItemMenuEnumO");
+ func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -415,13 +595,13 @@ void RNA_api_ui_layout(StructRNA *srna)
func = RNA_def_function(srna, "label", "rna_uiItemL");
RNA_def_function_ui_description(func, "Item. Display text and/or icon in the layout");
- api_ui_item_common(func);
+ api_ui_item_common(func);
parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(parm, "Icon Value",
"Override automatic icon of the item "
"(use it e.g. with custom material icons returned by icon()...)");
- func = RNA_def_function(srna, "menu", "uiItemM");
+ func = RNA_def_function(srna, "menu", "rna_uiItemM");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu");
api_ui_item_common(func);
@@ -458,7 +638,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);
- func = RNA_def_function(srna, "template_any_ID", "uiTemplateAnyID");
+ func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID");
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
@@ -466,16 +646,16 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_string(func, "type_property", "", 0, "",
"Identifier of property in data giving the type of the ID-blocks to use");
RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_string_py_translate(func, "text", "", 0, "", "Custom label to display in UI");
+ api_ui_item_common_text(func);
- func = RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder");
+ func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder");
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL);
parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
- RNA_def_string_py_translate(func, "text", "", 0, "", "Custom label to display in UI");
+ api_ui_item_common_text(func);
func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 8ebf83532de..34c244bf6f2 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3563,7 +3563,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
"Draw tool/property regions over the main region, when using Triple Buffer");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
-
#ifdef WITH_CYCLES
prop = RNA_def_property(srna, "compute_device_type", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
@@ -3769,6 +3768,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_range(prop, 0, 32);
RNA_def_property_ui_text(prop, "Wheel Scroll Lines", "Number of lines scrolled at a time with the mouse wheel");
+ prop = RNA_def_property(srna, "use_trackpad_natural", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_TRACKPAD_NATURAL);
+ RNA_def_property_ui_text(prop, "Trackpad Natural",
+ "If your system uses 'natural' scrolling, this option keeps consistent trackpad usage throughout the UI");
+
prop = RNA_def_property(srna, "active_keyconfig", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "keyconfigstr");
RNA_def_property_ui_text(prop, "Key Config", "The name of the active key configuration");
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c
index 0cf4f6a008f..a3d93b5437e 100644
--- a/source/blender/modifiers/intern/MOD_boolean_util.c
+++ b/source/blender/modifiers/intern/MOD_boolean_util.c
@@ -46,6 +46,7 @@
#include "BKE_cdderivedmesh.h"
#include "BKE_depsgraph.h"
+#include "BKE_global.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
@@ -295,7 +296,7 @@ static Object *AddNewBlenderMesh(Scene *scene, Base *base)
basen->flag &= ~SELECT;
/* Initialize the mesh data associated with this object. */
- ob_new->data = BKE_mesh_add("Mesh");
+ ob_new->data = BKE_mesh_add(G.main, "Mesh");
/* Finally assign the object type. */
ob_new->type = OB_MESH;
diff --git a/source/blender/modifiers/intern/MOD_triangulate.c b/source/blender/modifiers/intern/MOD_triangulate.c
index 645fd5eb2cf..1c22e9bf364 100644
--- a/source/blender/modifiers/intern/MOD_triangulate.c
+++ b/source/blender/modifiers/intern/MOD_triangulate.c
@@ -33,8 +33,6 @@
#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;
@@ -44,13 +42,7 @@ static DerivedMesh *triangulate_dm(DerivedMesh *dm, const int flag)
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);
+ BM_mesh_triangulate(bm, (flag & MOD_TRIANGULATE_BEAUTY), false, NULL, NULL);
result = CDDM_from_bmesh(bm, FALSE);
BM_mesh_free(bm);
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
index 8324b77b2d1..fa21e122ebf 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
@@ -36,7 +36,7 @@
#include "../node_composite_util.h"
/* **************** Bokeh image Tools ******************** */
-
+
static bNodeSocketTemplate cmp_node_bokehimage_out[] = {
{ SOCK_RGBA, 0, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
index a54a8507882..bfeeb7ddc99 100644
--- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
@@ -34,12 +34,12 @@
/* ******************* Channel Matte Node ********************************* */
-static bNodeSocketTemplate cmp_node_channel_matte_in[] ={
+static bNodeSocketTemplate cmp_node_channel_matte_in[] = {
{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{-1, 0, ""}
};
-static bNodeSocketTemplate cmp_node_channel_matte_out[] ={
+static bNodeSocketTemplate cmp_node_channel_matte_out[] = {
{SOCK_RGBA, 0, N_("Image")},
{SOCK_FLOAT, 0, N_("Matte")},
{-1, 0, ""}
diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c
index e7fbdeaedd7..8a9966a2420 100644
--- a/source/blender/nodes/composite/nodes/node_composite_gamma.c
+++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c
@@ -34,7 +34,7 @@
#include "node_composite_util.h"
/* **************** Gamma Tools ******************** */
-
+
static bNodeSocketTemplate cmp_node_gamma_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Gamma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED},
diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.c b/source/blender/nodes/composite/nodes/node_composite_mask.c
index 0bac68ab1ac..8be6ecd27fd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mask.c
@@ -47,7 +47,7 @@ static bNodeSocketTemplate cmp_node_mask_out[] = {
static void node_composit_init_mask(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
- NodeMask *data = MEM_callocN(sizeof(NodeMask), STRINGIFY(NodeMask));
+ NodeMask *data = MEM_callocN(sizeof(NodeMask), "NodeMask");
data->size_x = data->size_y = 256;
node->storage = data;
diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c
index 7c7c6304d27..60b32563569 100644
--- a/source/blender/nodes/composite/nodes/node_composite_translate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_translate.c
@@ -46,6 +46,12 @@ static bNodeSocketTemplate cmp_node_translate_out[] = {
{ -1, 0, "" }
};
+static void node_composit_init_translate(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ NodeTranslateData *data = MEM_callocN(sizeof(NodeTranslateData), "node translate data");
+ node->storage = data;
+}
+
void register_node_type_cmp_translate(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -53,6 +59,8 @@ void register_node_type_cmp_translate(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_translate_in, cmp_node_translate_out);
node_type_size(&ntype, 140, 100, 320);
+ node_type_init(&ntype, node_composit_init_translate);
+ node_type_storage(&ntype, "NodeTranslateData", node_free_standard_storage, node_copy_standard_storage);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index dc8d427c0ae..d59061dfc0a 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -197,7 +197,7 @@ void node_group_remove_socket(bNodeTree *ngroup, bNodeSocket *gsock, int in_out)
/* groups display their internal tree name as label */
const char *node_group_label(bNode *node)
{
- return (node->id)? node->id->name+2: IFACE_("Missing Datablock");
+ return (node->id)? node->id->name + 2: IFACE_("Missing Datablock");
}
int node_group_valid(bNodeTree *ntree, bNodeTemplate *ntemp)
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index f567e36cc19..3eb2cdc8ab7 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -277,7 +277,7 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs)
bNodeStack *stack;
bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
- GPUNodeStack gpuin[MAX_SOCKET+1], gpuout[MAX_SOCKET+1];
+ GPUNodeStack gpuin[MAX_SOCKET + 1], gpuout[MAX_SOCKET + 1];
int do_it;
stack= exec->stack;
diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.c b/source/blender/nodes/shader/nodes/node_shader_gamma.c
index c49554c44be..365bac77004 100644
--- a/source/blender/nodes/shader/nodes/node_shader_gamma.c
+++ b/source/blender/nodes/shader/nodes/node_shader_gamma.c
@@ -29,7 +29,7 @@
#include "node_shader_util.h"
/* **************** Gamma Tools ******************** */
-
+
static bNodeSocketTemplate sh_node_gamma_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Gamma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED},
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index cde977288d1..0abff03da46 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -419,6 +419,14 @@ static PyObject *bpy_bmedge_is_manifold_get(BPy_BMEdge *self)
return PyBool_FromLong(BM_edge_is_manifold(self->e));
}
+PyDoc_STRVAR(bpy_bmedge_is_contiguous_doc,
+"True when this edge is manifold, between two faces with the same winding (read-only).\n\n:type: boolean"
+);
+static PyObject *bpy_bmedge_is_contiguous_get(BPy_BMEdge *self)
+{
+ BPY_BM_CHECK_OBJ(self);
+ return PyBool_FromLong(BM_edge_is_contiguous(self->e));
+}
PyDoc_STRVAR(bpy_bmedge_is_wire_doc,
"True when this edge is not connected to any faces (read-only).\n\n:type: boolean"
@@ -566,6 +574,15 @@ static PyObject *bpy_bmloop_link_loop_radial_prev_get(BPy_BMLoop *self)
return BPy_BMLoop_CreatePyObject(self->bm, self->l->radial_prev);
}
+PyDoc_STRVAR(bpy_bm_is_convex_doc,
+"True when this loop is at the convex corner of a face, depends on a valid face normal (read-only).\n\n:type: :class:`BMLoop`"
+);
+static PyObject *bpy_bm_is_convex_get(BPy_BMLoop *self)
+{
+ BPY_BM_CHECK_OBJ(self);
+ return PyBool_FromLong(BM_loop_is_convex(self->l));
+}
+
/* ElemSeq
* ^^^^^^^ */
@@ -680,10 +697,11 @@ static PyGetSetDef bpy_bmedge_getseters[] = {
{(char *)"link_loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_link_loops_doc, (void *)BM_LOOPS_OF_EDGE},
/* readonly checks */
- {(char *)"is_manifold", (getter)bpy_bmedge_is_manifold_get, (setter)NULL, (char *)bpy_bmedge_is_manifold_doc, NULL},
- {(char *)"is_wire", (getter)bpy_bmedge_is_wire_get, (setter)NULL, (char *)bpy_bmedge_is_wire_doc, NULL},
+ {(char *)"is_manifold", (getter)bpy_bmedge_is_manifold_get, (setter)NULL, (char *)bpy_bmedge_is_manifold_doc, NULL},
+ {(char *)"is_contiguous", (getter)bpy_bmedge_is_contiguous_get, (setter)NULL, (char *)bpy_bmedge_is_contiguous_doc, NULL},
+ {(char *)"is_wire", (getter)bpy_bmedge_is_wire_get, (setter)NULL, (char *)bpy_bmedge_is_wire_doc, NULL},
{(char *)"is_boundary", (getter)bpy_bmedge_is_boundary_get, (setter)NULL, (char *)bpy_bmedge_is_boundary_doc, NULL},
- {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+ {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -736,7 +754,8 @@ static PyGetSetDef bpy_bmloop_getseters[] = {
{(char *)"link_loop_radial_prev", (getter)bpy_bmloop_link_loop_radial_prev_get, (setter)NULL, (char *)bpy_bmloop_link_loop_radial_prev_doc, NULL},
/* readonly checks */
- {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+ {(char *)"is_convex", (getter)bpy_bm_is_convex_get, (setter)NULL, (char *)bpy_bm_is_convex_doc, NULL},
+ {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 10ca7a943cb..a0e2f1a0854 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -1454,6 +1454,8 @@ static PyObject *BPyInit_idprop_types(void)
submodule = PyModule_Create(&IDProp_types_module_def);
+ IDProp_Init_Types();
+
#define MODULE_TYPE_ADD(s, t) \
PyModule_AddObject(s, t.tp_name, (PyObject *)&t); Py_INCREF((PyObject *)&t)
@@ -1497,7 +1499,7 @@ PyObject *BPyInit_idprop(void)
mod = PyModule_Create(&IDProp_module_def);
- /* bmesh.types */
+ /* idprop.types */
PyModule_AddObject(mod, "types", (submodule = BPyInit_idprop_types()));
PyDict_SetItemString(sys_modules, PyModule_GetName(submodule), submodule);
Py_INCREF(submodule);
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index e9fa00c7868..632018f2bf0 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -310,11 +310,33 @@ void BPY_python_start(int argc, const char **argv)
(void)argv;
/* must run before python initializes */
- PyImport_ExtendInittab(bpy_internal_modules);
+ /* broken in py3.3, load explicitly below */
+ // PyImport_ExtendInittab(bpy_internal_modules);
#endif
bpy_intern_string_init();
+
+#ifdef WITH_PYTHON_MODULE
+ {
+ /* Manually load all modules */
+ struct _inittab *inittab_item;
+ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ for (inittab_item = bpy_internal_modules; inittab_item->name; inittab_item++) {
+ PyObject *mod = inittab_item->initfunc();
+ if (mod) {
+ PyDict_SetItemString(sys_modules, inittab_item->name, mod);
+ }
+ else {
+ PyErr_Print();
+ PyErr_Clear();
+ }
+ // Py_DECREF(mod); /* ideally would decref, but in this case we never want to free */
+ }
+ }
+#endif
+
/* bpy.* and lets us import it */
BPy_init_modules();
@@ -743,6 +765,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
//result->ptr = ((BPy_StructRNA *)item)->ptr;
CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
+ CTX_data_type_set(result, CTX_DATA_TYPE_POINTER);
done = true;
}
else if (PySequence_Check(item)) {
@@ -773,12 +796,12 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
}
Py_DECREF(seq_fast);
-
+ CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
done = true;
}
}
- if (done == 0) {
+ if (done == false) {
if (item) printf("PyContext '%s' not a valid type\n", member);
else printf("PyContext '%s' not found\n", member);
}
diff --git a/source/blender/python/intern/bpy_intern_string.c b/source/blender/python/intern/bpy_intern_string.c
index 70ea57bb33f..294f230ce99 100644
--- a/source/blender/python/intern/bpy_intern_string.c
+++ b/source/blender/python/intern/bpy_intern_string.c
@@ -35,6 +35,7 @@
PyObject *bpy_intern_str_register;
PyObject *bpy_intern_str_unregister;
PyObject *bpy_intern_str_bl_rna;
+PyObject *bpy_intern_str_bl_property;
PyObject *bpy_intern_str_order;
PyObject *bpy_intern_str_attr;
PyObject *bpy_intern_str___slots__;
@@ -46,6 +47,7 @@ void bpy_intern_string_init(void)
bpy_intern_str_register = PyUnicode_FromString("register");
bpy_intern_str_unregister = PyUnicode_FromString("unregister");
bpy_intern_str_bl_rna = PyUnicode_FromString("bl_rna");
+ bpy_intern_str_bl_property = PyUnicode_FromString("bl_property");
bpy_intern_str_order = PyUnicode_FromString("order");
bpy_intern_str_attr = PyUnicode_FromString("attr");
bpy_intern_str___slots__ = PyUnicode_FromString("__slots__");
@@ -58,6 +60,7 @@ void bpy_intern_string_exit(void)
Py_DECREF(bpy_intern_str_register);
Py_DECREF(bpy_intern_str_unregister);
Py_DECREF(bpy_intern_str_bl_rna);
+ Py_DECREF(bpy_intern_str_bl_property);
Py_DECREF(bpy_intern_str_order);
Py_DECREF(bpy_intern_str_attr);
Py_DECREF(bpy_intern_str___slots__);
diff --git a/source/blender/python/intern/bpy_intern_string.h b/source/blender/python/intern/bpy_intern_string.h
index 0b7ca2cd47b..2e0d18d8b7f 100644
--- a/source/blender/python/intern/bpy_intern_string.h
+++ b/source/blender/python/intern/bpy_intern_string.h
@@ -30,6 +30,7 @@ void bpy_intern_string_exit(void);
extern PyObject *bpy_intern_str_register;
extern PyObject *bpy_intern_str_unregister;
extern PyObject *bpy_intern_str_bl_rna;
+extern PyObject *bpy_intern_str_bl_property;
extern PyObject *bpy_intern_str_order;
extern PyObject *bpy_intern_str_attr;
extern PyObject *bpy_intern_str___slots__;
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index cb2e12ba996..9d92ff51213 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -29,10 +29,8 @@
* functionality.
*/
-
#include <Python.h>
-#include "bpy_operator_wrap.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -42,6 +40,8 @@
#include "RNA_define.h"
#include "bpy_rna.h"
+#include "bpy_intern_string.h"
+#include "bpy_operator_wrap.h" /* own include */
static void operator_properties_init(wmOperatorType *ot)
{
@@ -57,6 +57,66 @@ static void operator_properties_init(wmOperatorType *ot)
PyErr_Print(); /* failed to register operator props */
PyErr_Clear();
}
+
+ /* set the default property: ot->prop */
+ {
+ /* picky developers will notice that 'bl_property' won't work with inheritance
+ * get direct from the dict to avoid raising a load of attribute errors (yes this isnt ideal) - campbell */
+ PyTypeObject *py_class = ot->ext.data;
+ PyObject *py_class_dict = py_class->tp_dict;
+ PyObject *bl_property = PyDict_GetItem(py_class_dict, bpy_intern_str_bl_property);
+ const char *prop_id;
+ bool prop_raise_error;
+
+ if (bl_property) {
+ if (PyUnicode_Check(bl_property)) {
+ /* since the property is explicitly given, raise an error if its not found */
+ prop_id = _PyUnicode_AsString(bl_property);
+ prop_raise_error = true;
+ }
+ else {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s.bl_property should be a string, not %.200s",
+ ot->idname, Py_TYPE(bl_property)->tp_name);
+
+ /* this could be done cleaner, for now its OK */
+ PyErr_Print();
+ PyErr_Clear();
+
+ prop_id = NULL;
+ prop_raise_error = false;
+ }
+ }
+ else {
+ /* fallback to hard-coded string (pre 2.66, could be deprecated) */
+ prop_id = "type";
+ prop_raise_error = false;
+ }
+
+ if (prop_id) {
+ PointerRNA ptr;
+ PropertyRNA *prop;
+
+ RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
+ prop = RNA_struct_find_property(&ptr, prop_id);
+ if (prop) {
+ ot->prop = prop;
+ }
+ else {
+ if (prop_raise_error) {
+ PyErr_Format(PyExc_ValueError,
+ "%.200s.bl_property '%.200s' not found",
+ ot->idname, prop_id);
+
+ /* this could be done cleaner, for now its OK */
+ PyErr_Print();
+ PyErr_Clear();
+ }
+ }
+ }
+ }
+ /* end 'ot->prop' assignment */
+
}
void operator_wrapper(wmOperatorType *ot, void *userdata)
@@ -68,18 +128,6 @@ void operator_wrapper(wmOperatorType *ot, void *userdata)
ot->srna = srna; /* restore */
operator_properties_init(ot);
-
- /* XXX - not nice, set the first enum as searchable, should have a way for python to set */
- {
- PointerRNA ptr;
- PropertyRNA *prop;
-
- RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
- prop = RNA_struct_find_property(&ptr, "type");
- if (prop) {
- ot->prop = prop;
- }
- }
}
void macro_wrapper(wmOperatorType *ot, void *userdata)
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 4de92d090fc..19ec35ae357 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1624,10 +1624,6 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
else {
/* Unicode String */
-#ifdef WITH_INTERNATIONAL
- bool do_translate = RNA_property_flag(prop) & PROP_STRING_PY_TRANSLATE;
-#endif /* WITH_INTERNATIONAL */
-
#ifdef USE_STRING_COERCE
PyObject *value_coerce = NULL;
if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
@@ -1641,13 +1637,6 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
param = _PyUnicode_AsString(value);
#endif /* USE_STRING_COERCE */
- /* Any half-brained compiler should be able to optimize this out when WITH_INTERNATIONAL is off */
-#ifdef WITH_INTERNATIONAL
- if (do_translate) {
- param = IFACE_(param);
- }
-#endif
-
if (param == NULL) {
if (PyUnicode_Check(value)) {
/* there was an error assigning a string type,
@@ -4527,7 +4516,7 @@ PyDoc_STRVAR(pyrna_prop_collection_foreach_get_doc,
"\n"
" .. code-block:: python\n"
"\n"
-" collection.foreach_get(someseq, attr)\n"
+" collection.foreach_get(attr, someseq)\n"
"\n"
" # Python equivalent\n"
" for i in range(len(seq)): someseq[i] = getattr(collection, attr)\n"
@@ -4547,7 +4536,7 @@ PyDoc_STRVAR(pyrna_prop_collection_foreach_set_doc,
"\n"
" .. code-block:: python\n"
"\n"
-" collection.foreach_set(seq, attr)\n"
+" collection.foreach_set(attr, seq)\n"
"\n"
" # Python equivalent\n"
" for i in range(len(seq)): setattr(collection[i], attr, seq[i])\n"
@@ -6542,6 +6531,9 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self)
static PyTypeObject pyrna_basetype_Type = BLANK_PYTHON_TYPE;
+/**
+ * Accessed from Python as 'bpy.types'
+ */
PyObject *BPY_rna_types(void)
{
BPy_BaseTypeRNA *self;
diff --git a/source/blender/render/intern/source/bake.c b/source/blender/render/intern/source/bake.c
index d4451d570a4..cb6f9611bfd 100644
--- a/source/blender/render/intern/source/bake.c
+++ b/source/blender/render/intern/source/bake.c
@@ -734,8 +734,8 @@ static void bake_single_vertex(BakeShade *bs, VertRen *vert, float u, float v)
}
/* Bake all vertices of a face. Actually, this still works on a face-by-face
- basis, and each vertex on each face is shaded. Vertex colors are a property
- of loops, not vertices. */
+ * basis, and each vertex on each face is shaded. Vertex colors are a property
+ * of loops, not vertices. */
static void shade_verts(BakeShade *bs)
{
VlakRen *vlr = bs->vlr;
@@ -756,7 +756,7 @@ static void shade_verts(BakeShade *bs)
zero_v3(bs->dyco);
/* Shade each vertex of the face. u and v are barycentric coordinates; since
- we're only interested in vertices, these will be 0 or 1. */
+ * we're only interested in vertices, these will be 0 or 1. */
if ((vlr->flag & R_FACE_SPLIT) == 0) {
/* Processing triangle face, whole quad, or first half of split quad. */
@@ -818,10 +818,13 @@ static void shade_tface(BakeShade *bs)
BLI_lock_thread(LOCK_CUSTOM1);
userdata = bs->ibuf->userdata;
if (userdata == NULL) /* since the thread was locked, its possible another thread alloced the value */
- userdata = MEM_callocN(sizeof(BakeImBufuserData), "BakeMask");
+ userdata = MEM_callocN(sizeof(BakeImBufuserData), "BakeImBufuserData");
- if (bs->use_mask)
- userdata->mask_buffer = MEM_callocN(sizeof(char) * bs->rectx * bs->recty, "BakeMask");
+ if (bs->use_mask) {
+ if (userdata->mask_buffer == NULL) {
+ userdata->mask_buffer = MEM_callocN(sizeof(char) * bs->rectx * bs->recty, "BakeMask");
+ }
+ }
if (bs->use_displacement_buffer)
userdata->displacement_buffer = MEM_callocN(sizeof(float) * bs->rectx * bs->recty, "BakeDisp");
@@ -1069,12 +1072,14 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
if (!ibuf)
continue;
- userdata = (BakeImBufuserData *) ibuf->userdata;
- RE_bake_ibuf_filter(ibuf, userdata->mask_buffer, re->r.bake_filter);
+ userdata = (BakeImBufuserData *)ibuf->userdata;
+ if (userdata) {
+ RE_bake_ibuf_filter(ibuf, userdata->mask_buffer, re->r.bake_filter);
- if (use_displacement_buffer) {
- RE_bake_ibuf_normalize_displacement(ibuf, userdata->displacement_buffer, userdata->mask_buffer,
- displacement_min, displacement_max);
+ if (use_displacement_buffer) {
+ RE_bake_ibuf_normalize_displacement(ibuf, userdata->displacement_buffer, userdata->mask_buffer,
+ displacement_min, displacement_max);
+ }
}
ibuf->userflags |= IB_BITMAPDIRTY;
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 9e9dff63c04..28065002773 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -3310,7 +3310,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
}
/* origindex currently only used when baking to vertex colors */
- if(re->flag & R_BAKING && re->r.bake_flag & R_BAKE_VCOL)
+ if (re->flag & R_BAKING && re->r.bake_flag & R_BAKE_VCOL)
need_origindex= 1;
/* check autosmooth and displacement, we then have to skip only-verts optimize */
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 0a427d57ebc..55dadc14989 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -224,8 +224,10 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
}
/* keep this before interpolation [#29761] */
- if ((tex->imaflag & TEX_CALCALPHA) == 0) {
- texres->talpha = TRUE;
+ if (tex->ima && (tex->ima->flag & IMA_IGNORE_ALPHA) == 0) {
+ if ((tex->imaflag & TEX_CALCALPHA) == 0) {
+ texres->talpha = TRUE;
+ }
}
/* interpolate */
@@ -1092,8 +1094,10 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
/* mipmap test */
image_mipmap_test(tex, ibuf);
- if ((tex->imaflag & TEX_CALCALPHA) == 0)
- texres->talpha = 1;
+ if (tex->ima && (tex->ima->flag & IMA_IGNORE_ALPHA) == 0) {
+ if ((tex->imaflag & TEX_CALCALPHA) == 0)
+ texres->talpha = 1;
+ }
texr.talpha = texres->talpha;
if (tex->imaflag & TEX_IMAROT) {
@@ -1506,8 +1510,10 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
/* mipmap test */
image_mipmap_test(tex, ibuf);
- if ((tex->imaflag & TEX_CALCALPHA) == 0) {
- texres->talpha = TRUE;
+ if (tex->ima && (tex->ima->flag & IMA_IGNORE_ALPHA) == 0) {
+ if ((tex->imaflag & TEX_CALCALPHA) == 0) {
+ texres->talpha = TRUE;
+ }
}
texr.talpha= texres->talpha;
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index d77ca10e0b2..73c3b1c9366 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1371,6 +1371,19 @@ static int composite_needs_render(Scene *sce, int this_scene)
return 0;
}
+static bool rlayer_node_uses_alpha(bNodeTree *ntree, bNode *node)
+{
+ bNodeSocket *sock;
+
+ for (sock = node->outputs.first; sock; sock = sock->next) {
+ /* Weak! but how to make it better? */
+ if (!strcmp(sock->name, "Alpha") && nodeCountSocketLinks(ntree, sock) > 0)
+ return true;
+ }
+
+ return false;
+}
+
static void tag_scenes_for_render(Render *re)
{
bNode *node;
@@ -1388,6 +1401,21 @@ static void tag_scenes_for_render(Render *re)
for (node = re->scene->nodetree->nodes.first; node; node = node->next) {
if (node->type == CMP_NODE_R_LAYERS) {
if (node->id) {
+ if (!MAIN_VERSION_ATLEAST(re->main, 265, 5)) {
+ if (rlayer_node_uses_alpha(re->scene->nodetree, node)) {
+ Scene *scene = (Scene*) node->id;
+
+ if (scene->r.alphamode != R_ALPHAPREMUL) {
+ BKE_reportf(re->reports, RPT_WARNING, "Setting scene %s alpha mode to Premul\n", scene->id.name + 2);
+
+ /* also print, so feedback is immediate */
+ printf("2.66 versioning fix: setting scene %s alpha mode to Premul\n", scene->id.name + 2);
+
+ scene->r.alphamode = R_ALPHAPREMUL;
+ }
+ }
+ }
+
if (node->id != (ID *)re->scene)
node->id->flag |= LIB_DOIT;
}
diff --git a/source/blender/render/intern/source/pixelblending.c b/source/blender/render/intern/source/pixelblending.c
index 21ff1151cfb..66fd2209881 100644
--- a/source/blender/render/intern/source/pixelblending.c
+++ b/source/blender/render/intern/source/pixelblending.c
@@ -120,7 +120,7 @@ void addalphaAddfacFloat(float dest[4], const float source[4], char addfac)
else
#endif
dest[0] = c;
-
+
c = (m * dest[1]) + source[1];
#ifdef RE_FLOAT_COLOR_CLIPPING
if (c >= RE_FULL_COLOR_FLOAT) dest[1] = RE_FULL_COLOR_FLOAT;
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 3420648cb52..8a023a2c009 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -286,7 +286,7 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz,
/* fill in col */
float t, zn, radist, ringf=0.0f, linef=0.0f, alpha, si, co;
int a;
-
+
if (R.wrld.mode & WO_MIST) {
if (har->type & HA_ONLYSKY) {
/* stars but no mist */
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index bef5902588c..fe23f31c6d7 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -433,14 +433,18 @@ void makeraytree(Render *re)
* This is ONLY needed to kept a bogus behavior of SUN and HEMI lights */
INIT_MINMAX(min, max);
RE_rayobject_merge_bb(re->raytree, min, max);
+ if (min[0] > max[0]) { /* empty raytree */
+ zero_v3(min);
+ zero_v3(max);
+ }
for (i=0; i<3; i++) {
+ /* TODO: explain why add top both min and max??? */
min[i] += 0.01f;
max[i] += 0.01f;
sub[i] = max[i]-min[i];
}
- re->maxdist = dot_v3v3(sub, sub);
- if (re->maxdist > 0.0f) re->maxdist= sqrt(re->maxdist);
+ re->maxdist = len_v3(sub);
re->i.infostr= "Raytree finished";
re->stats_draw(re->sdh, &re->i);
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index b25f2f4201a..0a8af1c368b 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -361,8 +361,8 @@ int *RE_vlakren_get_origindex(ObjectRen *obr, VlakRen *vlak, int verify)
int nr= vlak->index>>8;
origindex= obr->vlaknodes[nr].origindex;
- if(origindex==NULL) {
- if(verify)
+ if (origindex==NULL) {
+ if (verify)
origindex= obr->vlaknodes[nr].origindex= MEM_callocN(256*RE_VLAK_ORIGINDEX_ELEMS*sizeof(int), "origindex table");
else
return NULL;
@@ -440,7 +440,7 @@ VlakRen *RE_vlakren_copy(ObjectRen *obr, VlakRen *vlr)
}
origindex= RE_vlakren_get_origindex(obr, vlr, 0);
- if(origindex) {
+ if (origindex) {
origindex1= RE_vlakren_get_origindex(obr, vlr1, 1);
/* Just an int, but memcpy for consistency. */
memcpy(origindex1, origindex, sizeof(int)*RE_VLAK_ORIGINDEX_ELEMS);
@@ -791,7 +791,7 @@ void free_renderdata_vlaknodes(VlakTableNode *vlaknodes)
MEM_freeN(vlaknodes[a].mtface);
if (vlaknodes[a].mcol)
MEM_freeN(vlaknodes[a].mcol);
- if(vlaknodes[a].origindex)
+ if (vlaknodes[a].origindex)
MEM_freeN(vlaknodes[a].origindex);
if (vlaknodes[a].surfnor)
MEM_freeN(vlaknodes[a].surfnor);
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index a37ffb1eb28..8b83ca4b6c3 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -676,14 +676,14 @@ static void strand_render(Render *re, StrandSegment *sseg, float winmat[4][4], S
else {
float hoco1[4], hoco2[4];
int a, obi, index;
-
+
obi= sseg->obi - re->objectinstance;
index= sseg->strand->index;
projectvert(p1->co, winmat, hoco1);
projectvert(p2->co, winmat, hoco2);
-
+
for (a=0; a<totzspan; a++) {
#if 0
/* render both strand and single pixel wire to counter aliasing */
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index bea54154e47..e91d4f388af 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -148,11 +148,11 @@ void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap);
struct wmEventHandler *WM_event_add_ui_handler(
const struct bContext *C, ListBase *handlers,
- int (*func)(struct bContext *C, struct wmEvent *event, void *userdata),
+ int (*func)(struct bContext *C, const struct wmEvent *event, void *userdata),
void (*remove)(struct bContext *C, void *userdata), void *userdata);
void WM_event_remove_ui_handler(ListBase *handlers,
- int (*func)(struct bContext *C, struct wmEvent *event, void *userdata),
+ int (*func)(struct bContext *C, const struct wmEvent *event, void *userdata),
void (*remove)(struct bContext *C, void *userdata),
void *userdata, int postpone);
void WM_event_remove_area_handler(struct ListBase *handlers, void *area);
@@ -311,6 +311,8 @@ void WM_event_fileselect_event(struct bContext *C, void *ophandle, int eventval
void WM_event_print(struct wmEvent *event);
#endif
+void WM_operator_region_active_win_set(struct bContext *C);
+
/* drag and drop */
struct wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value);
void WM_event_drag_image(struct wmDrag *, struct ImBuf *, float scale, int sx, int sy);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 942cce1b6dd..881d4464ed6 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -188,7 +188,7 @@ enum {
#define WM_UI_HANDLER_CONTINUE 0
#define WM_UI_HANDLER_BREAK 1
-typedef int (*wmUIHandlerFunc)(struct bContext *C, struct wmEvent *event, void *userdata);
+typedef int (*wmUIHandlerFunc)(struct bContext *C, const struct wmEvent *event, void *userdata);
typedef void (*wmUIHandlerRemoveFunc)(struct bContext *C, void *userdata);
/* ************** Notifiers ****************** */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 84fee9ff34c..9e3722777ba 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -282,7 +282,7 @@ void wm_event_do_notifiers(bContext *C)
/* XXX context in notifiers? */
CTX_wm_window_set(C, win);
- /* printf("notifier win %d screen %s cat %x\n", win->winid, win->screen->id.name+2, note->category); */
+ /* printf("notifier win %d screen %s cat %x\n", win->winid, win->screen->id.name + 2, note->category); */
ED_screen_do_listen(C, note);
for (ar = win->screen->regionbase.first; ar; ar = ar->next) {
@@ -453,6 +453,22 @@ static void wm_operator_print(bContext *C, wmOperator *op)
MEM_freeN(buf);
}
+/**
+ * Sets the active region for this space from the context.
+ *
+ * \see #BKE_area_find_region_active_win
+ */
+void WM_operator_region_active_win_set(bContext *C)
+{
+ ScrArea *sa = CTX_wm_area(C);
+ if (sa) {
+ ARegion *ar = CTX_wm_region(C);
+ if (ar && ar->regiontype == RGN_TYPE_WINDOW) {
+ sa->region_active_win = BLI_findindex(&sa->regionbase, ar);
+ }
+ }
+}
+
/* for debugging only, getting inspecting events manually is tedious */
#ifndef NDEBUG
@@ -573,10 +589,13 @@ static void wm_operator_finished(bContext *C, wmOperator *op, int repeat)
MEM_freeN(buf);
}
- if (wm_operator_register_check(wm, op->type))
+ if (wm_operator_register_check(wm, op->type)) {
wm_operator_register(C, op);
- else
+ WM_operator_region_active_win_set(C);
+ }
+ else {
WM_operator_free(op);
+ }
}
}
@@ -1045,7 +1064,14 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
}
if (!(ar && ar->regiontype == type) && area) {
- ARegion *ar1 = BKE_area_find_region_type(area, type);
+ ARegion *ar1;
+ if (type == RGN_TYPE_WINDOW) {
+ ar1 = BKE_area_find_region_active_win(area);
+ }
+ else {
+ ar1 = BKE_area_find_region_type(area, type);
+ }
+
if (ar1)
CTX_wm_region_set(C, ar1);
}
@@ -1357,8 +1383,8 @@ static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *eve
}
else {
/* modal keymap checking returns handled events fine, but all hardcoded modal
- handling typically swallows all events (OPERATOR_RUNNING_MODAL).
- This bypass just disables support for double clicks in hardcoded modal handlers */
+ * handling typically swallows all events (OPERATOR_RUNNING_MODAL).
+ * This bypass just disables support for double clicks in hardcoded modal handlers */
if (event->val == KM_DBL_CLICK) {
event->prevval = event->val;
event->val = KM_PRESS;
@@ -1417,20 +1443,10 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
if (ot->flag & OPTYPE_UNDO)
wm->op_undo_depth--;
- /* putting back screen context, reval can pass trough after modal failures! */
- if ((retval & OPERATOR_PASS_THROUGH) || wm_event_always_pass(event)) {
- CTX_wm_area_set(C, area);
- CTX_wm_region_set(C, region);
- }
- else {
- /* this special cases is for areas and regions that get removed */
- CTX_wm_area_set(C, NULL);
- CTX_wm_region_set(C, NULL);
- }
-
if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED))
wm_operator_reports(C, op, retval, FALSE);
+ /* important to run 'wm_operator_finished' before NULLing the context members */
if (retval & OPERATOR_FINISHED) {
wm_operator_finished(C, op, 0);
handler->op = NULL;
@@ -1440,6 +1456,17 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
handler->op = NULL;
}
+ /* putting back screen context, reval can pass trough after modal failures! */
+ if ((retval & OPERATOR_PASS_THROUGH) || wm_event_always_pass(event)) {
+ CTX_wm_area_set(C, area);
+ CTX_wm_region_set(C, region);
+ }
+ else {
+ /* this special cases is for areas and regions that get removed */
+ CTX_wm_area_set(C, NULL);
+ CTX_wm_region_set(C, NULL);
+ }
+
/* remove modal handler, operator itself should have been canceled and freed */
if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) {
WM_cursor_grab_disable(CTX_wm_window(C), NULL);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 2d4e4a5334a..d1156f77e41 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -527,14 +527,15 @@ int wm_homefile_read(bContext *C, ReportList *UNUSED(reports), short from_memory
/* put aside screens to match with persistent windows later */
wm_window_match_init(C, &wmbase);
- if (!from_memory && BLI_exists(startstr)) {
- success = (BKE_read_file(C, startstr, NULL) != BKE_READ_FILE_FAIL);
-
- }
-
- if (U.themes.first == NULL) {
- printf("\nNote: No (valid) "STRINGIFY (BLENDER_STARTUP_FILE)" found, fall back to built-in default.\n\n");
- success = 0;
+ if (!from_memory) {
+ if (BLI_exists(startstr)) {
+ success = (BKE_read_file(C, startstr, NULL) != BKE_READ_FILE_FAIL);
+ }
+
+ if (U.themes.first == NULL) {
+ printf("\nNote: No (valid) '%s' found, fall back to built-in default.\n\n", startstr);
+ success = 0;
+ }
}
if (success == 0) {
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 44c5693c3e3..d8b987a196c 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -43,6 +43,7 @@
#include "GHOST_C-api.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -114,6 +115,17 @@ void wm_get_screensize(int *width_r, int *height_r)
*height_r = uiheight;
}
+/* size of all screens, useful since the mouse is bound by this */
+void wm_get_screensize_all(int *width_r, int *height_r)
+{
+ unsigned int uiwidth;
+ unsigned int uiheight;
+
+ GHOST_GetAllDisplayDimensions(g_system, &uiwidth, &uiheight);
+ *width_r = uiwidth;
+ *height_r = uiheight;
+}
+
/* keeps offset and size within monitor bounds */
/* XXX solve dual screen... */
static void wm_window_check_position(rcti *rect)
@@ -425,10 +437,19 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
wm_set_apple_prefsize(wm_init_state.size_x, wm_init_state.size_y);
}
#else
+ /* note!, this isnt quite correct, active screen maybe offset 1000s if PX,
+ * we'd need a wm_get_screensize like function that gives offset,
+ * in practice the window manager will likely move to the correct monitor */
wm_init_state.start_x = 0;
wm_init_state.start_y = 0;
-
#endif
+
+#if !defined(__APPLE__) && !defined(WIN32) /* X11 */
+ /* X11, start maximized but use default same size */
+ wm_init_state.size_x = min_ii(wm_init_state.size_x, WM_WIN_INIT_SIZE_X);
+ wm_init_state.size_y = min_ii(wm_init_state.size_y, WM_WIN_INIT_SIZE_Y);
+#endif
+
}
for (win = wm->windows.first; win; win = win->next) {
@@ -439,8 +460,18 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
win->sizex = wm_init_state.size_x;
win->sizey = wm_init_state.size_y;
- /* we can't properly resize a maximized window */
+#if !defined(__APPLE__) && !defined(WIN32) /* X11 */
+ if (wm_init_state.override_flag & WIN_OVERRIDE_GEOM) {
+ /* we can't properly resize a maximized window */
+ win->windowstate = GHOST_kWindowStateNormal;
+ }
+ else {
+ /* loading without userpref, default to maximized */
+ win->windowstate = GHOST_kWindowStateMaximized;
+ }
+#else
win->windowstate = GHOST_kWindowStateNormal;
+#endif
wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM;
}
@@ -820,7 +851,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
GHOST_DisposeRectangle(client_rect);
- wm_get_screensize(&scr_w, &scr_h);
+ wm_get_screensize_all(&scr_w, &scr_h);
sizex = r - l;
sizey = b - t;
posx = l;
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index ce360f5ef56..c4c64ed429f 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -40,6 +40,7 @@ void wm_ghost_init (bContext *C);
void wm_ghost_exit(void);
void wm_get_screensize(int *width_r, int *height_r);
+void wm_get_screensize_all(int *width_r, int *height_r);
wmWindow *wm_window_new (bContext *C);
void wm_window_free (bContext *C, wmWindowManager *wm, wmWindow *win);
@@ -68,5 +69,11 @@ void wm_window_testbreak (void);
int wm_window_duplicate_exec(bContext *C, struct wmOperator *op);
int wm_window_fullscreen_toggle_exec(bContext *C, struct wmOperator *op);
+/* Initial (unmaximized) size to start with for
+ * systems that can't find it for themselves (X11).
+ * Clamped by real desktop limits */
+#define WM_WIN_INIT_SIZE_X 1800
+#define WM_WIN_INIT_SIZE_Y 1000
+
#endif /* __WM_WINDOW_H__ */
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index b2a47115630..fb06c5e4477 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -95,7 +95,7 @@ endif()
bf_rna
bf_bmesh
bf_blenkernel
- bf_rigidbody
+ bf_intern_rigidbody
bf_blenloader
ge_blen_routines
bf_editor_datafiles
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 2603df2aec8..deb7cae9f77 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -390,6 +390,7 @@ void make_editNurb(struct Object *obedit) {}
void uiItemR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int flag, char *name, int icon) {}
struct PointerRNA uiItemFullO(struct uiLayout *layout, char *idname, char *name, int icon, struct IDProperty *properties, int context, int flag) {struct PointerRNA a = {{0}}; return a;}
+PointerRNA uiItemFullO_ptr(struct uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, struct IDProperty *properties, int context, int flag) {struct PointerRNA a = {{0}}; return a;}
struct uiLayout *uiLayoutRow(struct uiLayout *layout, int align) {return (struct uiLayout *) NULL;}
struct uiLayout *uiLayoutColumn(struct uiLayout *layout, int align) {return (struct uiLayout *) NULL;}
struct uiLayout *uiLayoutColumnFlow(struct uiLayout *layout, int number, int align) {return (struct uiLayout *) NULL;}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 4ac8364aa19..8fe7d5e6faf 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -933,7 +933,7 @@ endif()
if(WITH_COMPOSITOR)
# added for opencl compositor
list_insert_before(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_compositor")
- list_insert_after(BLENDER_SORTED_LIBS "bf_compositor" "bf_opencl")
+ list_insert_after(BLENDER_SORTED_LIBS "bf_compositor" "bf_intern_opencl")
endif()
if(WITH_LIBMV)
@@ -986,7 +986,7 @@ endif()
endif()
if(WITH_BULLET)
- list_insert_after(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_rigidbody")
+ list_insert_after(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_intern_rigidbody")
endif()
if(WITH_BULLET AND NOT WITH_BULLET_SYSTEM)
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 5aa0ca51a58..c664ae4540a 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -162,7 +162,10 @@ extern char build_system[];
#endif
/* Local Function prototypes */
-#ifndef WITH_PYTHON_MODULE
+#ifdef WITH_PYTHON_MODULE
+int main_python_enter(int argc, const char **argv);
+void main_python_exit(void);
+#else
static int print_help(int argc, const char **argv, void *data);
static int print_version(int argc, const char **argv, void *data);
#endif
@@ -177,10 +180,10 @@ static int print_version(int argc, const char **argv, void *data);
/* Initialize callbacks for the modules that need them */
static void setCallbacks(void);
-static bool use_crash_handler = true;
-
#ifndef WITH_PYTHON_MODULE
+static bool use_crash_handler = true;
+
/* set breakpoints here when running in debug mode, useful to catch floating point errors */
#if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE)
static void fpe_handler(int UNUSED(sig))
@@ -549,10 +552,10 @@ static void blender_crash_handler(int signum)
char fname[FILE_MAX];
if (!G.main->name[0]) {
- BLI_make_file_string("/", fname, BLI_temporary_dir(), "blender.crash.txt");
+ BLI_join_dirfile(fname, sizeof(fname), BLI_temporary_dir(), "blender.crash.txt");
}
else {
- BLI_strncpy(fname, G.main->name, sizeof(fname));
+ BLI_join_dirfile(fname, sizeof(fname), BLI_temporary_dir(), BLI_path_basename(G.main->name));
BLI_replace_extension(fname, sizeof(fname), ".crash.txt");
}
@@ -925,7 +928,7 @@ static int set_ge_parameters(int argc, const char **argv, void *data)
}
- } /* if (*(argv[a+1]) == '=') */
+ } /* if (*(argv[a + 1]) == '=') */
}
return a;
@@ -1478,12 +1481,15 @@ int main(int argc, const char **argv)
setupArguments(C, ba, &syshandle);
BLI_argsParse(ba, 1, NULL, NULL);
-#endif
if (use_crash_handler) {
/* after parsing args */
signal(SIGSEGV, blender_crash_handler);
}
+#else
+ G.factory_startup = true; /* using preferences or user startup makes no sense for py-as-module */
+ (void)syshandle;
+#endif
/* after level 1 args, this is so playanim skips RNA init */
RNA_init();
@@ -1494,10 +1500,12 @@ int main(int argc, const char **argv)
#if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS)
- G.background = 1; /* python module mode ALWAYS runs in background mode (for now) */
+ G.background = true; /* python module mode ALWAYS runs in background mode (for now) */
#else
/* for all platforms, even windos has it! */
- if (G.background) signal(SIGINT, blender_esc); /* ctrl c out bg render */
+ if (G.background) {
+ signal(SIGINT, blender_esc); /* ctrl c out bg render */
+ }
#endif
/* background render uses this font too */
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
index 719041e8d41..6ab1d032bf2 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
@@ -154,11 +154,11 @@ SetViewPort(
int x1, int y1,
int x2, int y2
) {
- /* x1 and y1 are the min pixel coordinate (e.g. 0)
- x2 and y2 are the max pixel coordinate
- the width,height is calculated including both pixels
- therefore: max - min + 1
- */
+ /* x1 and y1 are the min pixel coordinate (e.g. 0)
+ * x2 and y2 are the max pixel coordinate
+ * the width,height is calculated including both pixels
+ * therefore: max - min + 1
+ */
int vp_width = (x2 - x1) + 1;
int vp_height = (y2 - y1) + 1;
int minx = m_frame_rect.GetLeft();
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
index 4117c13aede..430f956bc7f 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
@@ -58,8 +58,9 @@ struct wmWindow;
class KX_BlenderCanvas : public RAS_ICanvas
{
private:
- /** Rect that defines the area used for rendering,
- relative to the context */
+ /**
+ * Rect that defines the area used for rendering,
+ * relative to the context */
RAS_Rect m_displayarea;
int m_viewport[4];
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
index 19ba46ed6d7..5917ce40440 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
@@ -49,8 +49,8 @@ KX_BlenderKeyboardDevice::~KX_BlenderKeyboardDevice()
}
/**
- IsPressed gives boolean information about keyboard status, true if pressed, false if not
-*/
+ * IsPressed gives boolean information about keyboard status, true if pressed, false if not
+ */
bool KX_BlenderKeyboardDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
{
@@ -64,11 +64,11 @@ bool KX_BlenderKeyboardDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputco
return m_eventStatusTables[m_currentTable][inputcode];
}
*/
-/**
- NextFrame toggles currentTable with previousTable,
- and copy relevant event information from previous to current
- (pressed keys need to be remembered)
-*/
+/**
+ * NextFrame toggles currentTable with previousTable,
+ * and copy relevant event information from previous to current
+ * (pressed keys need to be remembered)
+ */
void KX_BlenderKeyboardDevice::NextFrame()
{
SCA_IInputDevice::NextFrame();
@@ -87,13 +87,11 @@ void KX_BlenderKeyboardDevice::NextFrame()
}
}
-/**
- ConvertBlenderEvent translates blender keyboard events into ketsji kbd events
- extra event information is stored, like ramp-mode (just released/pressed)
+/**
+ * ConvertBlenderEvent translates blender keyboard events into ketsji kbd events
+ * extra event information is stored, like ramp-mode (just released/pressed)
*/
-
-
-bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode,short val)
+bool KX_BlenderKeyboardDevice::ConvertBlenderEvent(unsigned short incode, short val)
{
bool result = false;
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp
index 8d90eacd27f..0cdc10264a5 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp
@@ -46,8 +46,8 @@ KX_BlenderMouseDevice::~KX_BlenderMouseDevice()
}
/**
- IsPressed gives boolean information about mouse status, true if pressed, false if not
-*/
+ * IsPressed gives boolean information about mouse status, true if pressed, false if not
+ */
bool KX_BlenderMouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
{
@@ -62,11 +62,11 @@ bool KX_BlenderMouseDevice::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
}
*/
-/**
- NextFrame toggles currentTable with previousTable,
- and copy relevant event information from previous to current
- (pressed keys need to be remembered)
-*/
+/**
+ * NextFrame toggles currentTable with previousTable,
+ * and copy relevant event information from previous to current
+ * (pressed keys need to be remembered)
+ */
void KX_BlenderMouseDevice::NextFrame()
{
SCA_IInputDevice::NextFrame();
@@ -104,13 +104,11 @@ void KX_BlenderMouseDevice::NextFrame()
}
-/**
- ConvertBlenderEvent translates blender mouse events into ketsji kbd events
- extra event information is stored, like ramp-mode (just released/pressed)
-*/
-
-
-bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode,short val)
+/**
+ * ConvertBlenderEvent translates blender mouse events into ketsji kbd events
+ * extra event information is stored, like ramp-mode (just released/pressed)
+ */
+bool KX_BlenderMouseDevice::ConvertBlenderEvent(unsigned short incode, short val)
{
bool result = false;
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index ae902e23d65..e5503dfd0a7 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -933,7 +933,7 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
if (ma) {
alpha_blend = ma->game.alpha_blend;
/* Commented out for now. If we ever get rid of
- * "Texture Face/Singletexture" we can then think about it */
+ * "Texture Face/Singletexture" we can then think about it */
/* Texture Face mode ignores texture but requires "Face Textures to be True "*/
#if 0
@@ -1982,7 +1982,7 @@ static KX_GameObject *gameobject_from_blenderobject(
for (int i=0;i<mesh->totcol;i++) {
mat=mesh->mat[i];
if (!mat) break;
- if ((mat->shade_flag &= MA_OBCOLOR)) {
+ if ((mat->shade_flag & MA_OBCOLOR)) {
bUseObjectColor = true;
break;
}
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index 695bf0c4dc8..05da38dd1af 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -180,7 +180,10 @@ void BL_ConvertActuators(const char* maggiename,
bitLocalFlag.LinearVelocity = bool((obact->flag & ACT_LIN_VEL_LOCAL)!=0);
bitLocalFlag.AngularVelocity = bool((obact->flag & ACT_ANG_VEL_LOCAL)!=0);
bitLocalFlag.ServoControl = bool(obact->type == ACT_OBJECT_SERVO);
+ bitLocalFlag.CharacterMotion = bool(obact->type == ACT_OBJECT_CHARACTER);
+ bitLocalFlag.CharacterJump = bool((obact->flag & ACT_CHAR_JUMP)!=0);
bitLocalFlag.AddOrSetLinV = bool((obact->flag & ACT_ADD_LIN_VEL)!=0);
+ bitLocalFlag.AddOrSetCharLoc = bool((obact->flag & ACT_ADD_CHAR_LOC)!=0);
if (obact->reference && bitLocalFlag.ServoControl)
{
obref = converter->FindGameObject(obact->reference);
diff --git a/source/gameengine/Expressions/EmptyValue.cpp b/source/gameengine/Expressions/EmptyValue.cpp
index 2bb8f69ac51..8170c588a28 100644
--- a/source/gameengine/Expressions/EmptyValue.cpp
+++ b/source/gameengine/Expressions/EmptyValue.cpp
@@ -30,9 +30,9 @@
CEmptyValue::CEmptyValue()
/*
-pre:
-effect: constructs a new CEmptyValue
-*/
+ * pre:
+ * effect: constructs a new CEmptyValue
+ */
{
SetModified(false);
}
@@ -41,9 +41,9 @@ effect: constructs a new CEmptyValue
CEmptyValue::~CEmptyValue()
/*
-pre:
-effect: deletes the object
-*/
+ * pre:
+ * effect: deletes the object
+ */
{
}
@@ -52,10 +52,10 @@ effect: deletes the object
CValue * CEmptyValue::Calc(VALUE_OPERATOR op, CValue * val)
/*
-pre:
-ret: a new object containing the result of applying operator op to this
-object and val
-*/
+ * pre:
+ * ret: a new object containing the result of applying operator op to this
+ * object and val
+ */
{
return val->CalcFinal(VALUE_EMPTY_TYPE, op, this);
@@ -65,10 +65,10 @@ object and val
CValue * CEmptyValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue * val)
/*
-pre: the type of val is dtype
-ret: a new object containing the result of applying operator op to val and
-this object
-*/
+ * pre: the type of val is dtype
+ * ret: a new object containing the result of applying operator op to val and
+ * this object
+ */
{
return val->AddRef();
}
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 4e910a885eb..52ad95c71b6 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -43,7 +43,7 @@
* Center for the Neural Basis of Cognition (CNBC)
* http://www.python.org/doc/PyCPP.html
*
-------------------------------*/
+ * ----------------------------- */
#include <stdlib.h>
#include <stddef.h>
@@ -103,7 +103,7 @@ void PyObjectPlus::InvalidateProxy() // check typename of each parent
/*------------------------------
* PyObjectPlus Type -- Every class, even the abstract one should have a Type
-------------------------------*/
+ * ----------------------------- */
PyTypeObject PyObjectPlus::Type = {
@@ -217,8 +217,8 @@ PyObject *PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObject
}
/**
- * \param self A PyObjectPlus_Proxy
- */
+ * \param self A PyObjectPlus_Proxy
+ */
void PyObjectPlus::py_base_dealloc(PyObject *self) // python wrapper
{
#ifdef USE_WEAKREFS
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.h b/source/gameengine/GameLogic/SCA_IInputDevice.h
index 1a403f40955..ceb9c1e1d4f 100644
--- a/source/gameengine/GameLogic/SCA_IInputDevice.h
+++ b/source/gameengine/GameLogic/SCA_IInputDevice.h
@@ -269,7 +269,7 @@ public:
KX_MAX_KEYS
- } ; // enum
+ }; // enum
protected:
@@ -301,17 +301,18 @@ public:
virtual void HookEscape();
- /* Next frame: we calculate the new key states. This goes as follows:
- *
- * KX_NO_INPUTSTATUS -> KX_NO_INPUTSTATUS
- * KX_JUSTACTIVATED -> KX_ACTIVE
- * KX_ACTIVE -> KX_ACTIVE
- * KX_JUSTRELEASED -> KX_NO_INPUTSTATUS
- *
- * Getting new events provides the
- * KX_NO_INPUTSTATUS->KX_JUSTACTIVATED and
- * KX_ACTIVE->KX_JUSTRELEASED transitions.
- */
+ /**
+ * Next frame: we calculate the new key states. This goes as follows:
+ *
+ * KX_NO_INPUTSTATUS -> KX_NO_INPUTSTATUS
+ * KX_JUSTACTIVATED -> KX_ACTIVE
+ * KX_ACTIVE -> KX_ACTIVE
+ * KX_JUSTRELEASED -> KX_NO_INPUTSTATUS
+ *
+ * Getting new events provides the
+ * KX_NO_INPUTSTATUS->KX_JUSTACTIVATED and
+ * KX_ACTIVE->KX_JUSTRELEASED transitions.
+ */
virtual void NextFrame();
diff --git a/source/gameengine/GameLogic/SCA_IObject.h b/source/gameengine/GameLogic/SCA_IObject.h
index 0189af00322..365e2b0c853 100644
--- a/source/gameengine/GameLogic/SCA_IObject.h
+++ b/source/gameengine/GameLogic/SCA_IObject.h
@@ -221,7 +221,7 @@ public:
OBJ_ARMATURE=0,
OBJ_CAMERA=1,
OBJ_LIGHT=2,
- }ObjectTypes;
+ } ObjectTypes;
};
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
index 690930196b3..4d8c20065b5 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ b/source/gameengine/GameLogic/SCA_LogicManager.h
@@ -52,7 +52,7 @@ using namespace std;
typedef std::list<class SCA_IController*> controllerlist;
typedef std::map<class SCA_ISensor*,controllerlist > sensormap_t;
-/**
+/**
* This manager handles sensor, controllers and actuators.
* logic executes each frame the following way:
* find triggering sensors
@@ -63,7 +63,7 @@ typedef std::map<class SCA_ISensor*,controllerlist > sensormap_t;
* clear triggering sensors
* clear triggered controllers
* (actuators may be active during a longer timeframe)
-*/
+ */
#include "SCA_ILogicBrick.h"
#include "SCA_IActuator.h"
@@ -117,8 +117,8 @@ public:
void RemoveGameObject(const STR_String& gameobjname);
/**
- * remove Logic Bricks from the running logicmanager
- */
+ * remove Logic Bricks from the running logicmanager
+ */
void RemoveSensor(SCA_ISensor* sensor);
void RemoveController(SCA_IController* controller);
void RemoveActuator(SCA_IActuator* actuator);
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index 5568072abcf..db6b4a63423 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -178,23 +178,15 @@ bool SCA_RandomActuator::Update()
case KX_RANDOMACT_FLOAT_NORMAL: {
/* normal (big numbers): para1 = mean, para2 = std dev */
- /*
-
- 070301 - nzc - Changed the termination condition. I think I
- made a small mistake here, but it only affects distro's where
- the seed equals 0. In that case, the algorithm locks. Let's
- just guard that case separately.
-
- */
+ /* 070301 - nzc: Changed the termination condition. I think I
+ * made a small mistake here, but it only affects distro's where
+ * the seed equals 0. In that case, the algorithm locks. Let's
+ * just guard that case separately.
+ */
float x = 0.0, y = 0.0, s = 0.0, t = 0.0;
if (m_base->GetSeed() == 0) {
- /*
-
- 070301 - nzc
- Just taking the mean here seems reasonable.
-
- */
+ /* 070301 - nzc: Just taking the mean here seems reasonable. */
tmpval = new CFloatValue(m_parameter1);
}
else {
diff --git a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp b/source/gameengine/GamePlayer/common/GPC_RawImage.cpp
index c0d66541800..0e2585b0baa 100644
--- a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RawImage.cpp
@@ -29,7 +29,6 @@
* \ingroup player
*/
-
#include <iostream>
#include <string.h>
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 26e9bcbf65d..5b2cfddd141 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -258,10 +258,10 @@ static void usage(const char* program, bool isBlenderPlayer)
static void get_filename(int argc, char **argv, char *filename)
{
#ifdef __APPLE__
-/* On Mac we park the game file (called game.blend) in the application bundle.
-* The executable is located in the bundle as well.
-* Therefore, we can locate the game relative to the executable.
- */
+ /* On Mac we park the game file (called game.blend) in the application bundle.
+ * The executable is located in the bundle as well.
+ * Therefore, we can locate the game relative to the executable.
+ */
int srclen = ::strlen(argv[0]);
int len = 0;
char *gamefile = NULL;
@@ -471,7 +471,7 @@ int main(int argc, char** argv)
break;
case SCREEN_SAVER_MODE_PASSWORD:
/* This is W95 only, which we currently do not support.
- Fall-back to normal screen saver behavior in that case... */
+ * Fall-back to normal screen saver behavior in that case... */
case SCREEN_SAVER_MODE_SAVER:
fullScreen = true;
fullScreenParFound = true;
@@ -907,7 +907,7 @@ int main(int argc, char** argv)
if (domeWarp)
{
//XXX to do: convert relative to absolute path
- domeText= BKE_text_load(domeWarp, "");
+ domeText= BKE_text_load(G.main, domeWarp, "");
if (!domeText)
printf("error: invalid warpdata text file - %s\n", domeWarp);
else
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
index 6ef0aed9fe2..262ec541cf9 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
@@ -75,6 +75,11 @@ void KX_BulletPhysicsController::SetLinVelocityMin(float val)
CcdPhysicsController::SetLinVelocityMin(val);
}
+void KX_BulletPhysicsController::Jump()
+{
+ CcdPhysicsController::Jump();
+}
+
float KX_BulletPhysicsController::GetLinVelocityMax()
{
return (float)CcdPhysicsController::GetLinVelocityMax();
@@ -119,6 +124,11 @@ void KX_BulletPhysicsController::RelativeTranslate(const MT_Vector3& dloc,bool l
}
+void KX_BulletPhysicsController::SetWalkDirection(const MT_Vector3& dloc,bool local)
+{
+ CcdPhysicsController::SetWalkDirection(dloc[0],dloc[1],dloc[2],local);
+}
+
void KX_BulletPhysicsController::RelativeRotate(const MT_Matrix3x3& drot,bool local)
{
float rotval[9];
@@ -155,6 +165,13 @@ MT_Vector3 KX_BulletPhysicsController::GetVelocity(const MT_Point3& pos)
return MT_Vector3(linVel[0],linVel[1],linVel[2]);
}
+MT_Vector3 KX_BulletPhysicsController::GetWalkDirection()
+{
+ float dir[3];
+ CcdPhysicsController::GetWalkDirection(dir[0], dir[1], dir[2]);
+ return MT_Vector3(dir[0], dir[1], dir[2]);
+}
+
void KX_BulletPhysicsController::SetAngularVelocity(const MT_Vector3& ang_vel,bool local)
{
CcdPhysicsController::SetAngularVelocity(ang_vel.x(),ang_vel.y(),ang_vel.z(),local);
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
index aa42bf61a78..3d13744567b 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
@@ -40,11 +40,14 @@ public:
virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local);
virtual void ApplyTorque(const MT_Vector3& torque,bool local);
virtual void ApplyForce(const MT_Vector3& force,bool local);
+ virtual void SetWalkDirection(const MT_Vector3& dir,bool local);
virtual MT_Vector3 GetLinearVelocity();
virtual MT_Vector3 GetAngularVelocity();
virtual MT_Vector3 GetVelocity(const MT_Point3& pos);
+ virtual MT_Vector3 GetWalkDirection();
virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local);
virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local);
+ virtual void Jump();
virtual void getOrientation(MT_Quaternion& orn);
virtual void setOrientation(const MT_Matrix3x3& orn);
virtual void setPosition(const MT_Point3& pos);
diff --git a/source/gameengine/Ketsji/KX_CharacterWrapper.cpp b/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
index 64bbbb7d344..a669bdd2586 100644
--- a/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_CharacterWrapper.cpp
@@ -5,6 +5,7 @@
#include "KX_CharacterWrapper.h"
#include "PHY_ICharacter.h"
+#include "KX_PyMath.h"
KX_CharacterWrapper::KX_CharacterWrapper(PHY_ICharacter* character) :
PyObjectPlus(),
@@ -47,6 +48,7 @@ PyAttributeDef KX_CharacterWrapper::Attributes[] = {
KX_PYATTRIBUTE_RW_FUNCTION("gravity", KX_CharacterWrapper, pyattr_get_gravity, pyattr_set_gravity),
KX_PYATTRIBUTE_RW_FUNCTION("maxJumps", KX_CharacterWrapper, pyattr_get_max_jumps, pyattr_set_max_jumps),
KX_PYATTRIBUTE_RO_FUNCTION("jumpCount", KX_CharacterWrapper, pyattr_get_jump_count),
+ KX_PYATTRIBUTE_RW_FUNCTION("walkDirection", KX_CharacterWrapper, pyattr_get_walk_dir, pyattr_set_walk_dir),
{ NULL } //Sentinel
};
@@ -108,6 +110,33 @@ PyObject *KX_CharacterWrapper::pyattr_get_jump_count(void *self_v, const KX_PYAT
return PyLong_FromLong(self->m_character->GetJumpCount());
}
+PyObject *KX_CharacterWrapper::pyattr_get_walk_dir(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+ KX_CharacterWrapper* self = static_cast<KX_CharacterWrapper*>(self_v);
+ PHY__Vector3 vec = self->m_character->GetWalkDirection();
+ MT_Vector3 retval = MT_Vector3(vec[0], vec[1], vec[2]);
+
+ return PyObjectFrom(retval);
+}
+
+int KX_CharacterWrapper::pyattr_set_walk_dir(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+ KX_CharacterWrapper* self = static_cast<KX_CharacterWrapper*>(self_v);
+ MT_Vector3 dir;
+ if (!PyVecTo(value, dir)) {
+ PyErr_SetString(PyExc_TypeError, "KX_CharacterWrapper.walkDirection: expected a vector");
+ return PY_SET_ATTR_FAIL;
+ }
+
+ PHY__Vector3 vec;
+ vec[0] = dir[0];
+ vec[1] = dir[1];
+ vec[2] = dir[2];
+
+ self->m_character->SetWalkDirection(vec);
+ return PY_SET_ATTR_SUCCESS;
+}
+
PyMethodDef KX_CharacterWrapper::Methods[] = {
KX_PYMETHODTABLE_NOARGS(KX_CharacterWrapper, jump),
{NULL,NULL} //Sentinel
diff --git a/source/gameengine/Ketsji/KX_CharacterWrapper.h b/source/gameengine/Ketsji/KX_CharacterWrapper.h
index f1c977f4e5d..d4d8f195102 100644
--- a/source/gameengine/Ketsji/KX_CharacterWrapper.h
+++ b/source/gameengine/Ketsji/KX_CharacterWrapper.h
@@ -29,6 +29,8 @@ public:
static PyObject* pyattr_get_max_jumps(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_max_jumps(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_jump_count(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_walk_dir(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static int pyattr_set_walk_dir(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
#endif // WITH_PYTHON
private:
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index e71af674a79..253b5e26ebe 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -501,8 +501,8 @@ public:
void SetUserCollisionGroup(short filter);
void SetUserCollisionMask(short mask);
/**
- * Extra broadphase check for user controllable collisions
- */
+ * Extra broadphase check for user controllable collisions
+ */
bool CheckCollision(KX_GameObject *other);
/**
diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.h b/source/gameengine/Ketsji/KX_IPhysicsController.h
index 280b1816a1e..2019be57679 100644
--- a/source/gameengine/Ketsji/KX_IPhysicsController.h
+++ b/source/gameengine/Ketsji/KX_IPhysicsController.h
@@ -70,11 +70,14 @@ public:
virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local)=0;
virtual void ApplyTorque(const MT_Vector3& torque,bool local)=0;
virtual void ApplyForce(const MT_Vector3& force,bool local)=0;
+ virtual void SetWalkDirection(const MT_Vector3& dir,bool local)=0;
virtual MT_Vector3 GetLinearVelocity()=0;
virtual MT_Vector3 GetAngularVelocity()=0;
virtual MT_Vector3 GetVelocity(const MT_Point3& pos)=0;
+ virtual MT_Vector3 GetWalkDirection()=0;
virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local)=0;
virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local)=0;
+ virtual void Jump()=0;
virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) = 0;
virtual void getOrientation(MT_Quaternion& orn)=0;
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index 931039bc54c..9355ad0adfd 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -81,6 +81,16 @@ KX_ObjectActuator(
m_pid = m_torque;
}
+ if (m_bitLocalFlag.CharacterMotion)
+ {
+ KX_GameObject *parent = static_cast<KX_GameObject *>(GetParent());
+
+ if (!parent->GetPhysicsController() || !parent->GetPhysicsController()->IsCharacter())
+ {
+ printf("Character motion enabled on non-character object (%s), falling back to simple motion.\n", parent->GetName().Ptr());
+ m_bitLocalFlag.CharacterMotion = false;
+ }
+ }
if (m_reference)
m_reference->RegisterActuator(this);
UpdateFuzzyFlags();
@@ -116,10 +126,10 @@ bool KX_ObjectActuator::Update()
m_active_combined_velocity = false;
}
- // Explicitly stop the movement if we're using a character (apply movement is a little different for characters)
- if (parent->GetPhysicsController() && parent->GetPhysicsController()->IsCharacter()) {
+ // Explicitly stop the movement if we're using character motion
+ if (m_bitLocalFlag.CharacterMotion) {
MT_Vector3 vec(0.0, 0.0, 0.0);
- parent->ApplyMovement(vec, true);
+ parent->GetPhysicsController()->SetWalkDirection(vec, true);
}
m_linear_damping_active = false;
@@ -205,8 +215,31 @@ bool KX_ObjectActuator::Update()
m_previous_error = e;
m_error_accumulator = I;
parent->ApplyForce(m_force,(m_bitLocalFlag.LinearVelocity) != 0);
- } else
+ } else if(m_bitLocalFlag.CharacterMotion)
{
+ MT_Vector3 dir = m_dloc;
+
+ if (m_bitLocalFlag.AddOrSetCharLoc) {
+ MT_Vector3 old_dir = parent->GetPhysicsController()->GetWalkDirection();
+ MT_Scalar mag = old_dir.length();
+ if (mag < MT_EPSILON)
+ mag = dir.length();
+ dir = (dir + old_dir).normalized() * mag;
+ }
+
+ // We always want to set the walk direction since a walk direction of (0, 0, 0) should stop the character
+ parent->GetPhysicsController()->SetWalkDirection(dir, (m_bitLocalFlag.DLoc) != 0);
+
+ if (!m_bitLocalFlag.ZeroDRot)
+ {
+ parent->ApplyRotation(m_drot,(m_bitLocalFlag.DRot) != 0);
+ }
+ if (m_bitLocalFlag.CharacterJump)
+ {
+ parent->GetPhysicsController()->Jump();
+ }
+ }
+ else {
if (!m_bitLocalFlag.ZeroForce)
{
parent->ApplyForce(m_force,(m_bitLocalFlag.Force) != 0);
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h
index b0efee550af..1f2453e3700 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.h
@@ -54,7 +54,12 @@ struct KX_LocalFlags {
LinearVelocity(false),
AngularVelocity(false),
AddOrSetLinV(false),
+ AddOrSetCharLoc(false),
+ ServoControl(false),
+ CharacterMotion(false),
+ CharacterJump(false),
ZeroForce(false),
+ ZeroTorque(false),
ZeroDRot(false),
ZeroDLoc(false),
ZeroLinearVelocity(false),
@@ -69,7 +74,10 @@ struct KX_LocalFlags {
bool LinearVelocity;
bool AngularVelocity;
bool AddOrSetLinV;
+ bool AddOrSetCharLoc;
bool ServoControl;
+ bool CharacterMotion;
+ bool CharacterJump;
bool ZeroForce;
bool ZeroTorque;
bool ZeroDRot;
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index 2a4f2b3e7d9..5438ae5a97c 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -132,10 +132,13 @@ void KX_SoundActuator::play()
handle3d->setConeVolumeOuter(m_3d.cone_outer_gain);
}
- if (loop)
- m_handle->setLoopCount(-1);
- m_handle->setPitch(m_pitch);
- m_handle->setVolume(m_volume);
+ if (m_handle.get()) {
+ if (loop)
+ m_handle->setLoopCount(-1);
+ m_handle->setPitch(m_pitch);
+ m_handle->setVolume(m_volume);
+ }
+
m_isplaying = true;
}
diff --git a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h
index 7581486c80a..8bbb1e91e35 100644
--- a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h
+++ b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h
@@ -45,8 +45,8 @@ public:
virtual ~NG_LoopBackNetworkDeviceInterface();
/**
- * Clear message buffer
- */
+ * Clear message buffer
+ */
virtual void NextFrame();
bool Connect(char *address, unsigned int port, char *password,
diff --git a/source/gameengine/Network/NG_NetworkDeviceInterface.h b/source/gameengine/Network/NG_NetworkDeviceInterface.h
index 6da478ecda5..7fcf799db31 100644
--- a/source/gameengine/Network/NG_NetworkDeviceInterface.h
+++ b/source/gameengine/Network/NG_NetworkDeviceInterface.h
@@ -49,16 +49,16 @@ public:
virtual void NextFrame()=0;
/**
- * Mark network connection online
- */
+ * Mark network connection online
+ */
void Online(void) { m_online = true; }
/**
- * Mark network connection offline
- */
+ * Mark network connection offline
+ */
void Offline(void) { m_online = false; }
/**
- * Is the network connection established ?
- */
+ * Is the network connection established ?
+ */
bool IsOnline(void) { return m_online; }
virtual bool Connect(char *address, unsigned int port, char *password,
@@ -67,9 +67,9 @@ public:
virtual void SendNetworkMessage(NG_NetworkMessage* msg)=0;
/**
- * read NG_NetworkMessage from library buffer, may be
- * irrelevant for loopbackdevices
- */
+ * read NG_NetworkMessage from library buffer, may be
+ * irrelevant for loopbackdevices
+ */
virtual std::vector<NG_NetworkMessage*> RetrieveNetworkMessages()=0;
diff --git a/source/gameengine/Network/NG_NetworkMessage.h b/source/gameengine/Network/NG_NetworkMessage.h
index 5185849f8d7..6ed266557fc 100644
--- a/source/gameengine/Network/NG_NetworkMessage.h
+++ b/source/gameengine/Network/NG_NetworkMessage.h
@@ -123,8 +123,8 @@ public:
}
/**
- * get the unique Network Message ID
- */
+ * get the unique Network Message ID
+ */
int GetMessageID() {
return m_uniqueMessageID;
}
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index cf96f22a345..0de21e33eff 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -78,6 +78,9 @@ BlenderBulletCharacterController::BlenderBulletCharacterController(btMotionState
void BlenderBulletCharacterController::updateAction(btCollisionWorld *collisionWorld, btScalar dt)
{
+ if (onGround())
+ m_jumps = 0;
+
btKinematicCharacterController::updateAction(collisionWorld,dt);
m_motionState->setWorldTransform(getGhostObject()->getWorldTransform());
}
@@ -104,9 +107,6 @@ bool BlenderBulletCharacterController::canJump() const
void BlenderBulletCharacterController::jump()
{
- if (onGround())
- m_jumps = 0;
-
if (!canJump())
return;
@@ -115,6 +115,11 @@ void BlenderBulletCharacterController::jump()
m_jumps++;
}
+const btVector3& BlenderBulletCharacterController::getWalkDirection()
+{
+ return m_walkDirection;
+}
+
CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci)
:m_cci(ci)
{
@@ -670,9 +675,9 @@ CcdPhysicsController::~CcdPhysicsController()
}
- /**
- SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
- */
+/**
+ * SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
+ */
bool CcdPhysicsController::SynchronizeMotionStates(float time)
{
//sync non-static to motionstate, and static from motionstate (todo: add kinematic etc.)
@@ -755,8 +760,8 @@ bool CcdPhysicsController::SynchronizeMotionStates(float time)
}
/**
- WriteMotionStateToDynamics synchronizes dynas, kinematic and deformable entities (and do 'late binding')
- */
+ * WriteMotionStateToDynamics synchronizes dynas, kinematic and deformable entities (and do 'late binding')
+ */
void CcdPhysicsController::WriteMotionStateToDynamics(bool nondynaonly)
{
@@ -926,20 +931,27 @@ void CcdPhysicsController::RelativeTranslate(float dlocX,float dlocY,float dloc
if (local)
dloc = xform.getBasis()*dloc;
- if (m_characterController)
- {
- m_characterController->setWalkDirection(dloc/GetPhysicsEnvironment()->getNumTimeSubSteps());
- }
- else
- {
-
- xform.setOrigin(xform.getOrigin() + dloc);
- SetCenterOfMassTransform(xform);
- }
+ xform.setOrigin(xform.getOrigin() + dloc);
+ SetCenterOfMassTransform(xform);
}
}
+void CcdPhysicsController::SetWalkDirection(float dirX,float dirY,float dirZ,bool local)
+{
+
+ if (m_object && m_characterController)
+ {
+ btVector3 dir(dirX,dirY,dirZ);
+ btTransform xform = m_object->getWorldTransform();
+
+ if (local)
+ dir = xform.getBasis()*dir;
+
+ m_characterController->setWalkDirection(dir/GetPhysicsEnvironment()->getNumTimeSubSteps());
+ }
+}
+
void CcdPhysicsController::RelativeRotate(const float rotval[9],bool local)
{
if (m_object)
@@ -1267,6 +1279,13 @@ void CcdPhysicsController::applyImpulse(float attachX,float attachY,float attac
}
}
+
+void CcdPhysicsController::Jump()
+{
+ if (m_object && m_characterController)
+ m_characterController->jump();
+}
+
void CcdPhysicsController::SetActive(bool active)
{
}
@@ -1323,6 +1342,24 @@ void CcdPhysicsController::GetVelocity(const float posX,const float posY,const
linvZ = 0.f;
}
}
+
+void CcdPhysicsController::GetWalkDirection(float& dirX,float& dirY,float& dirZ)
+{
+ if (m_object && m_characterController)
+ {
+ const btVector3 dir = m_characterController->getWalkDirection();
+ dirX = dir.x();
+ dirY = dir.y();
+ dirZ = dir.z();
+ }
+ else
+ {
+ dirX = 0.f;
+ dirY = 0.f;
+ dirZ = 0.f;
+ }
+}
+
void CcdPhysicsController::getReactionForce(float& forceX,float& forceY,float& forceZ)
{
}
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
index b151c2f6b59..b271b9c424f 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
@@ -417,6 +417,8 @@ public:
virtual bool canJump() const;
virtual void jump();
+
+ const btVector3& getWalkDirection();
};
///CcdPhysicsController is a physics object that supports continuous collision detection and time of impact based physics resolution.
@@ -424,7 +426,7 @@ class CcdPhysicsController : public PHY_IPhysicsController
{
protected:
btCollisionObject* m_object;
- btKinematicCharacterController* m_characterController;
+ BlenderBulletCharacterController* m_characterController;
class PHY_IMotionState* m_MotionState;
@@ -501,12 +503,12 @@ protected:
/**
- SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
- */
+ * SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
+ */
virtual bool SynchronizeMotionStates(float time);
/**
- WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
- */
+ * WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
+ */
virtual void WriteMotionStateToDynamics(bool nondynaonly);
virtual void WriteDynamicsToMotionState();
@@ -517,6 +519,7 @@ protected:
// kinematic methods
virtual void RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local);
+ virtual void SetWalkDirection(float dirX,float dirY,float dirZ,bool local);
virtual void RelativeRotate(const float drot[9],bool local);
virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal);
virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal);
@@ -531,6 +534,7 @@ protected:
virtual void SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local);
virtual void SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local);
virtual void applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ);
+ virtual void Jump();
virtual void SetActive(bool active);
// reading out information from physics
@@ -538,6 +542,7 @@ protected:
virtual void GetAngularVelocity(float& angVelX,float& angVelY,float& angVelZ);
virtual void GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ);
virtual void getReactionForce(float& forceX,float& forceY,float& forceZ);
+ virtual void GetWalkDirection(float& dirX,float& dirY,float& dirZ);
// dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted
virtual void setRigidBody(bool rigid);
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index cadba97023e..254624cd8a0 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -310,6 +310,22 @@ public:
{
return m_controller->getJumpCount();
}
+
+ virtual void SetWalkDirection(PHY__Vector3 dir)
+ {
+ btVector3 vec = btVector3(dir[0], dir[1], dir[2]);
+ m_controller->setWalkDirection(vec);
+ }
+
+ virtual PHY__Vector3 GetWalkDirection()
+ {
+ btVector3 vec = m_controller->getWalkDirection();
+ PHY__Vector3 retval;
+ retval[0] = vec[0];
+ retval[1] = vec[1];
+ retval[2] = vec[2];
+ return retval;
+ }
};
class CcdOverlapFilterCallBack : public btOverlapFilterCallback
diff --git a/source/gameengine/Physics/common/PHY_ICharacter.h b/source/gameengine/Physics/common/PHY_ICharacter.h
index 63f6c0bd18a..8a599452816 100644
--- a/source/gameengine/Physics/common/PHY_ICharacter.h
+++ b/source/gameengine/Physics/common/PHY_ICharacter.h
@@ -15,6 +15,7 @@
class PHY_ICharacter
{
public:
+ virtual ~PHY_ICharacter(){};
virtual void Jump()= 0;
virtual bool OnGround()= 0;
@@ -27,6 +28,9 @@ public:
virtual int GetJumpCount()= 0;
+ virtual void SetWalkDirection(PHY__Vector3 dir)=0;
+ virtual PHY__Vector3 GetWalkDirection()=0;
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_ICharacter")
#endif
diff --git a/source/gameengine/Physics/common/PHY_IController.h b/source/gameengine/Physics/common/PHY_IController.h
index 003c4edf598..77864b740bd 100644
--- a/source/gameengine/Physics/common/PHY_IController.h
+++ b/source/gameengine/Physics/common/PHY_IController.h
@@ -41,10 +41,10 @@ class PHY_IPhysicsEnvironment;
#endif
/**
- PHY_IController is the abstract simplified Interface to objects
- controlled by the physics engine. This includes the physics objects
- and the graphics object for view frustrum and occlusion culling.
-*/
+ * PHY_IController is the abstract simplified Interface to objects
+ * controlled by the physics engine. This includes the physics objects
+ * and the graphics object for view frustrum and occlusion culling.
+ */
class PHY_IController
{
public:
diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.h b/source/gameengine/Physics/common/PHY_IGraphicController.h
index cb13eda4f18..fb36481ddbc 100644
--- a/source/gameengine/Physics/common/PHY_IGraphicController.h
+++ b/source/gameengine/Physics/common/PHY_IGraphicController.h
@@ -36,16 +36,16 @@
/**
- PHY_IPhysicsController is the abstract simplified Interface to a physical object.
- It contains the IMotionState and IDeformableMesh Interfaces.
-*/
+ * PHY_IPhysicsController is the abstract simplified Interface to a physical object.
+ * It contains the IMotionState and IDeformableMesh Interfaces.
+ */
class PHY_IGraphicController : public PHY_IController
{
public:
virtual ~PHY_IGraphicController();
/**
- SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
- */
+ * SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
+ */
virtual bool SetGraphicTransform()=0;
virtual void Activate(bool active=true)=0;
virtual void setLocalAabb(const PHY__Vector3& aabbMin,const PHY__Vector3& aabbMax)=0;
diff --git a/source/gameengine/Physics/common/PHY_IMotionState.h b/source/gameengine/Physics/common/PHY_IMotionState.h
index ccf7cf74724..61ed87362c0 100644
--- a/source/gameengine/Physics/common/PHY_IMotionState.h
+++ b/source/gameengine/Physics/common/PHY_IMotionState.h
@@ -37,9 +37,9 @@
#endif
/**
- PHY_IMotionState is the Interface to explicitly synchronize the world transformation.
- Default implementations for mayor graphics libraries like OpenGL and DirectX can be provided.
-*/
+ * PHY_IMotionState is the Interface to explicitly synchronize the world transformation.
+ * Default implementations for mayor graphics libraries like OpenGL and DirectX can be provided.
+ */
class PHY_IMotionState
{
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.h b/source/gameengine/Physics/common/PHY_IPhysicsController.h
index bc7671abe80..871edeec752 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsController.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsController.h
@@ -38,21 +38,21 @@ class PHY_IMotionState;
class PHY_IPhysicsEnvironment;
/**
- PHY_IPhysicsController is the abstract simplified Interface to a physical object.
- It contains the IMotionState and IDeformableMesh Interfaces.
-*/
+ * PHY_IPhysicsController is the abstract simplified Interface to a physical object.
+ * It contains the IMotionState and IDeformableMesh Interfaces.
+ */
class PHY_IPhysicsController : public PHY_IController
{
public:
virtual ~PHY_IPhysicsController();
/**
- SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
- */
+ * SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
+ */
virtual bool SynchronizeMotionStates(float time)=0;
/**
- WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
- */
+ * WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
+ */
virtual void WriteMotionStateToDynamics(bool nondynaonly)=0;
virtual void WriteDynamicsToMotionState()=0;
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp
index 142318cc7c2..110ffc705fe 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.cpp
@@ -33,9 +33,10 @@
#include "PHY_IPhysicsEnvironment.h"
/**
-* Physics Environment takes care of stepping the simulation and is a container for physics entities (rigidbodies,constraints, materials etc.)
-* A derived class may be able to 'construct' entities by loading and/or converting
-*/
+ * Physics Environment takes care of stepping the simulation and is a container for physics entities
+ * (rigidbodies,constraints, materials etc.)
+ * A derived class may be able to 'construct' entities by loading and/or converting
+ */
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
index bfbe570ad0c..6a76745c7ca 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
@@ -96,9 +96,10 @@ public:
};
/**
-* Physics Environment takes care of stepping the simulation and is a container for physics entities (rigidbodies,constraints, materials etc.)
-* A derived class may be able to 'construct' entities by loading and/or converting
-*/
+ * Physics Environment takes care of stepping the simulation and is a container for physics entities
+ * (rigidbodies,constraints, materials etc.)
+ * A derived class may be able to 'construct' entities by loading and/or converting
+ */
class PHY_IPhysicsEnvironment
{
public:
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
index b267879611e..7aeeb364b47 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
@@ -177,8 +177,8 @@ public:
virtual void Replace_IScene(SCA_IScene *val) {} /* overridden by KX_BlenderMaterial */
/**
- * \return the equivalent drawing mode for the material settings (equivalent to old TexFace tface->mode).
- */
+ * \return the equivalent drawing mode for the material settings (equivalent to old TexFace tface->mode).
+ */
int ConvertFaceMode(struct GameSettings *game, bool image) const;
/*
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
index 5ff2709747d..64c07358d95 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
@@ -117,8 +117,9 @@ protected:
/** Stores the caching information for the last material activated. */
RAS_IPolyMaterial::TCachingInfo m_materialCachingInfo;
- /** Making use of a Strategy desing pattern for storage behavior.
- Examples of concrete strategies: Vertex Arrays, VBOs, Immediate Mode*/
+ /**
+ * Making use of a Strategy desing pattern for storage behavior.
+ * Examples of concrete strategies: Vertex Arrays, VBOs, Immediate Mode*/
int m_storage_type;
RAS_IStorage* m_storage;
RAS_IStorage* m_failsafe_storage; //So derived mesh can use immediate mode
diff --git a/source/gameengine/SceneGraph/SG_ParentRelation.h b/source/gameengine/SceneGraph/SG_ParentRelation.h
index 6e314996456..ce45b42c148 100644
--- a/source/gameengine/SceneGraph/SG_ParentRelation.h
+++ b/source/gameengine/SceneGraph/SG_ParentRelation.h
@@ -29,7 +29,7 @@
/** \file SG_ParentRelation.h
* \ingroup bgesg
* \page SG_ParentRelationPage SG_ParentRelation
-
+ *
* \section SG_ParentRelationSection SG_ParentRelation
*
* This is an abstract interface class to the Scene Graph library.
@@ -48,7 +48,7 @@
* should not be value types and should be allocated on the heap.
*
*/
-
+
#ifndef __SG_PARENTRELATION_H__
#define __SG_PARENTRELATION_H__
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index 10eef9e0cf2..93a1d09869b 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -1022,7 +1022,7 @@ AVFrame *VideoFFmpeg::grabFrame(long position)
AVFrame * input = m_frame;
/* This means the data wasnt read properly,
- this check stops crashing */
+ * this check stops crashing */
if ( input->data[0]==0 && input->data[1]==0
&& input->data[2]==0 && input->data[3]==0)
{
diff --git a/source/tests/batch_import.py b/source/tests/batch_import.py
index 77595bd091f..a2c5fb59055 100644
--- a/source/tests/batch_import.py
+++ b/source/tests/batch_import.py
@@ -134,8 +134,7 @@ def batch_import(operator="",
print("\tSaving: %r" % fout_blend)
fout_dir = os.path.dirname(fout_blend)
- if not os.path.exists(fout_dir):
- os.makedirs(fout_dir)
+ os.makedirs(fout_dir, exist_ok=True)
bpy.ops.wm.save_as_mainfile(filepath=fout_blend)