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-16 22:38:03 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-16 22:38:03 +0400
commit92436c94d3adbbfc285bd7b3041db36e66dae5d5 (patch)
tree2083c8ad4fa810a781e9631161aa88b12008453d
parent90ed5ea4ea278b4aadf9187e4e2b92ef3221001b (diff)
parentfda8927d01ba719963154a56b45952ee541a869d (diff)
Merged changes in the trunk up to revision 54594.
-rw-r--r--SConstruct167
-rw-r--r--build_files/scons/config/win32-vc-config.py2
-rw-r--r--doc/manpage/blender.124
-rw-r--r--intern/bsp/intern/CSG_BooleanOps.cpp20
-rw-r--r--intern/cycles/SConscript2
-rw-r--r--intern/cycles/blender/blender_session.cpp12
-rw-r--r--intern/cycles/blender/blender_sync.cpp5
-rw-r--r--intern/cycles/blender/blender_util.h2
-rw-r--r--intern/cycles/bvh/bvh.cpp8
-rw-r--r--intern/cycles/device/device_cpu.cpp24
-rw-r--r--intern/cycles/device/device_cuda.cpp32
-rw-r--r--intern/cycles/kernel/kernel_emission.h12
-rw-r--r--intern/cycles/kernel/kernel_light.h2
-rw-r--r--intern/cycles/kernel/kernel_passes.h9
-rw-r--r--intern/cycles/kernel/kernel_shader.h6
-rw-r--r--intern/cycles/kernel/kernel_types.h3
-rw-r--r--intern/cycles/render/buffers.cpp1
-rw-r--r--intern/cycles/render/image.cpp30
-rw-r--r--intern/cycles/render/image.h4
-rw-r--r--intern/cycles/render/light.cpp15
-rw-r--r--intern/cycles/render/mesh.cpp10
-rw-r--r--intern/cycles/render/nodes.cpp20
-rw-r--r--intern/cycles/render/nodes.h2
-rw-r--r--intern/cycles/render/osl.cpp13
-rw-r--r--intern/cycles/render/osl.h4
-rw-r--r--intern/cycles/render/scene.cpp16
-rw-r--r--intern/cycles/render/scene.h4
-rw-r--r--intern/cycles/render/session.cpp21
-rw-r--r--intern/cycles/render/shader.h2
-rw-r--r--intern/cycles/render/svm.cpp4
-rw-r--r--intern/cycles/render/svm.h2
-rw-r--r--intern/cycles/util/util_boundbox.h10
-rw-r--r--intern/cycles/util/util_cache.h8
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm6
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp136
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h61
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp44
-rw-r--r--intern/smoke/intern/FFT_NOISE.h6
-rw-r--r--intern/smoke/intern/FLUID_3D.cpp4
-rw-r--r--release/scripts/modules/bl_i18n_utils/bl_process_msg.py2
-rw-r--r--release/scripts/modules/bl_i18n_utils/settings.py8
-rw-r--r--release/scripts/modules/bl_i18n_utils/spell_check_utils.py1
-rwxr-xr-xrelease/scripts/modules/bl_i18n_utils/update_po.py11
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils.py109
-rw-r--r--release/scripts/modules/bpy/__init__.py1
-rw-r--r--release/scripts/modules/rna_prop_ui.py2
-rw-r--r--release/scripts/presets/interface_theme/back_to_black.xml4
-rw-r--r--release/scripts/presets/interface_theme/blender_24x.xml2
-rw-r--r--release/scripts/presets/interface_theme/elsyiun.xml2
-rw-r--r--release/scripts/presets/interface_theme/hexagon.xml2
-rw-r--r--release/scripts/presets/interface_theme/ubuntu_ambiance.xml2
-rw-r--r--release/scripts/presets/keyconfig/maya.py40
-rw-r--r--release/scripts/startup/bl_operators/rigidbody.py17
-rw-r--r--release/scripts/startup/bl_ui/properties_data_armature.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_material.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_particle.py6
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_common.py16
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_fluid.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_rigidbody.py44
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_scene.py1
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py11
-rw-r--r--release/scripts/startup/bl_ui/space_image.py9
-rw-r--r--release/scripts/startup/bl_ui/space_info.py2
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py19
-rw-r--r--release/scripts/startup/bl_ui/space_text.py6
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py4
-rw-r--r--release/scripts/startup/bl_ui/space_userpref_keymap.py4
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py2
-rw-r--r--source/blender/blenfont/BLF_translation.h11
-rw-r--r--source/blender/blenfont/intern/blf_translation.c6
-rw-r--r--source/blender/blenkernel/BKE_deform.h1
-rw-r--r--source/blender/blenkernel/BKE_object.h4
-rw-r--r--source/blender/blenkernel/BKE_rigidbody.h2
-rw-r--r--source/blender/blenkernel/BKE_text.h4
-rw-r--r--source/blender/blenkernel/intern/anim.c4
-rw-r--r--source/blender/blenkernel/intern/brush.c7
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c2
-rw-r--r--source/blender/blenkernel/intern/deform.c16
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c7
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c6
-rw-r--r--source/blender/blenkernel/intern/effect.c2
-rw-r--r--source/blender/blenkernel/intern/image.c8
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/mball.c61
-rw-r--r--source/blender/blenkernel/intern/mesh.c35
-rw-r--r--source/blender/blenkernel/intern/object.c38
-rw-r--r--source/blender/blenkernel/intern/particle_system.c2
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c7
-rw-r--r--source/blender/blenkernel/intern/scene.c39
-rw-r--r--source/blender/blenkernel/intern/sequencer.c32
-rw-r--r--source/blender/blenkernel/intern/smoke.c3
-rw-r--r--source/blender/blenkernel/intern/text.c14
-rw-r--r--source/blender/blenkernel/intern/unit.c8
-rw-r--r--source/blender/blenlib/BLI_math_geom.h1
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h2
-rw-r--r--source/blender/blenlib/BLI_string_cursor_utf8.h2
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c4
-rw-r--r--source/blender/blenlib/intern/fileops.c4
-rw-r--r--source/blender/blenlib/intern/math_geom.c69
-rw-r--r--source/blender/blenlib/intern/math_matrix.c16
-rw-r--r--source/blender/blenlib/intern/math_rotation.c2
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c4
-rw-r--r--source/blender/blenlib/intern/scanfill.c68
-rw-r--r--source/blender/blenlib/intern/string_cursor_utf8.c16
-rw-r--r--source/blender/blenlib/intern/string_utf8.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c12
-rw-r--r--source/blender/bmesh/bmesh_class.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators_inline.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c2
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c2
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c50
-rw-r--r--source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c2
-rw-r--r--source/blender/collada/AnimationExporter.cpp41
-rw-r--r--source/blender/collada/ArmatureExporter.cpp2
-rw-r--r--source/blender/collada/ArmatureImporter.cpp22
-rw-r--r--source/blender/collada/ControllerExporter.cpp8
-rw-r--r--source/blender/collada/DocumentImporter.cpp91
-rw-r--r--source/blender/collada/DocumentImporter.h2
-rw-r--r--source/blender/collada/GeometryExporter.cpp10
-rw-r--r--source/blender/collada/MeshImporter.cpp11
-rw-r--r--source/blender/collada/MeshImporter.h6
-rw-r--r--source/blender/collada/SceneExporter.cpp6
-rw-r--r--source/blender/collada/TransformReader.cpp2
-rw-r--r--source/blender/collada/TransformWriter.cpp10
-rw-r--r--source/blender/collada/collada.cpp1
-rw-r--r--source/blender/collada/collada.h1
-rw-r--r--source/blender/collada/collada_internal.cpp24
-rw-r--r--source/blender/collada/collada_internal.h9
-rw-r--r--source/blender/collada/collada_utils.cpp79
-rw-r--r--source/blender/collada/collada_utils.h6
-rw-r--r--source/blender/compositor/nodes/COM_CompositorNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_ViewerNode.cpp1
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_InpaintOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ViewerBaseOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_ViewerBaseOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cpp11
-rw-r--r--source/blender/editors/armature/editarmature.c4
-rw-r--r--source/blender/editors/armature/poselib.c2
-rw-r--r--source/blender/editors/include/ED_mball.h4
-rw-r--r--source/blender/editors/include/ED_object.h1
-rw-r--r--source/blender/editors/interface/interface.c26
-rw-r--r--source/blender/editors/interface/interface_handlers.c6
-rw-r--r--source/blender/editors/interface/interface_panel.c4
-rw-r--r--source/blender/editors/interface/interface_templates.c5
-rw-r--r--source/blender/editors/interface/interface_widgets.c10
-rw-r--r--source/blender/editors/interface/resources.c16
-rw-r--r--source/blender/editors/io/io_collada.c16
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c8
-rw-r--r--source/blender/editors/mesh/meshtools.c3
-rw-r--r--source/blender/editors/metaball/mball_edit.c24
-rw-r--r--source/blender/editors/metaball/mball_ops.c7
-rw-r--r--source/blender/editors/object/CMakeLists.txt5
-rw-r--r--source/blender/editors/object/SConscript5
-rw-r--r--source/blender/editors/object/object_constraint.c150
-rw-r--r--source/blender/editors/object/object_hook.c71
-rw-r--r--source/blender/editors/object/object_modifier.c5
-rw-r--r--source/blender/editors/object/object_relations.c24
-rw-r--r--source/blender/editors/object/object_transform.c11
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c9
-rw-r--r--source/blender/editors/physics/particle_edit.c2
-rw-r--r--source/blender/editors/physics/rigidbody_constraint.c2
-rw-r--r--source/blender/editors/physics/rigidbody_object.c19
-rw-r--r--source/blender/editors/physics/rigidbody_world.c3
-rw-r--r--source/blender/editors/render/render_preview.c11
-rw-r--r--source/blender/editors/render/render_view.c5
-rw-r--r--source/blender/editors/screen/screen_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c49
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c10
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c39
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h2
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c5
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c4
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c4
-rw-r--r--source/blender/editors/space_clip/space_clip.c9
-rw-r--r--source/blender/editors/space_console/console_draw.c6
-rw-r--r--source/blender/editors/space_console/console_ops.c42
-rw-r--r--source/blender/editors/space_file/file_draw.c39
-rw-r--r--source/blender/editors/space_file/filesel.c43
-rw-r--r--source/blender/editors/space_file/space_file.c1
-rw-r--r--source/blender/editors/space_image/image_buttons.c8
-rw-r--r--source/blender/editors/space_image/image_draw.c53
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_info/info_stats.c33
-rw-r--r--source/blender/editors/space_node/drawnode.c16
-rw-r--r--source/blender/editors/space_node/node_draw.c3
-rw-r--r--source/blender/editors/space_node/node_header.c2
-rw-r--r--source/blender/editors/space_node/space_node.c1
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c2
-rw-r--r--source/blender/editors/space_text/text_ops.c10
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c13
-rw-r--r--source/blender/editors/transform/transform.c93
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_input.c17
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c30
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c88
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl11
-rw-r--r--source/blender/imbuf/IMB_colormanagement.h2
-rw-r--r--source/blender/imbuf/IMB_imbuf_types.h3
-rw-r--r--source/blender/imbuf/intern/colormanagement.c27
-rw-r--r--source/blender/imbuf/intern/filter.c4
-rw-r--r--source/blender/imbuf/intern/rectop.c6
-rw-r--r--source/blender/makesdna/DNA_meshdata_types.h11
-rw-r--r--source/blender/makesdna/DNA_meta_types.h2
-rw-r--r--source/blender/makesdna/DNA_rigidbody_types.h4
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h3
-rw-r--r--source/blender/makesrna/RNA_types.h1
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt1
-rw-r--r--source/blender/makesrna/intern/makesrna.c2
-rw-r--r--source/blender/makesrna/intern/rna_brush.c4
-rw-r--r--source/blender/makesrna/intern/rna_define.c8
-rw-r--r--source/blender/makesrna/intern/rna_internal.h5
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c12
-rw-r--r--source/blender/makesrna/intern/rna_meta.c2
-rw-r--r--source/blender/makesrna/intern/rna_meta_api.c60
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c15
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h34
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c9
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c7
-rw-r--r--source/blender/makesrna/intern/rna_scene.c4
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c6
-rw-r--r--source/blender/makesrna/intern/rna_texture.c2
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c2
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_composite.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_viewer.c2
-rw-r--r--source/blender/nodes/shader/node_shader_util.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_brightness.c7
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_compose.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_decompose.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops_call.c5
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c54
-rw-r--r--source/blender/python/intern/bpy_app_translations.c107
-rw-r--r--source/blender/render/intern/source/imagetexture.c4
-rw-r--r--source/blender/render/intern/source/multires_bake.c9
-rw-r--r--source/blender/render/intern/source/pipeline.c1
-rw-r--r--source/blender/render/intern/source/render_result.c4
-rw-r--r--source/blender/render/intern/source/render_texture.c16
-rw-r--r--source/blender/render/intern/source/voxeldata.c2
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/WM_keymap.h3
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c23
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c12
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c33
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c20
-rw-r--r--source/blender/windowmanager/intern/wm_window.c3
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c2
-rw-r--r--source/creator/creator.c50
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp8
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp18
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_BucketManager.cpp3
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp4
-rw-r--r--source/tests/bl_load_py_modules.py22
-rw-r--r--source/tests/bl_run_operators.py173
267 files changed, 2713 insertions, 1305 deletions
diff --git a/SConstruct b/SConstruct
index 545805d4b63..aa84fed262b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -518,88 +518,89 @@ def data_to_c_simple(FILE_FROM):
data_to_c(FILE_FROM, FILE_TO, VAR_NAME)
-data_to_c("source/blender/compositor/operations/COM_OpenCLKernels.cl",
- B.root_build_dir + "data_headers/COM_OpenCLKernels.cl.h",
- "datatoc_COM_OpenCLKernels_cl")
-
-data_to_c_simple("release/datafiles/startup.blend")
-data_to_c_simple("release/datafiles/preview.blend")
-data_to_c_simple("release/datafiles/preview_cycles.blend")
-
-# --- glsl ---
-data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
-data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vertex.glsl")
-data_to_c_simple("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_frag.glsl")
-data_to_c_simple("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_vert.glsl")
-data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
-data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl")
-data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl")
-
-# --- blender ---
-data_to_c_simple("release/datafiles/bfont.pfb")
-data_to_c_simple("release/datafiles/bfont.ttf")
-data_to_c_simple("release/datafiles/bmonofont.ttf")
-
-data_to_c_simple("release/datafiles/splash.png")
-data_to_c_simple("release/datafiles/blender_icons16.png")
-data_to_c_simple("release/datafiles/blender_icons32.png")
-data_to_c_simple("release/datafiles/prvicons.png")
-
-data_to_c_simple("release/datafiles/brushicons/add.png")
-data_to_c_simple("release/datafiles/brushicons/blob.png")
-data_to_c_simple("release/datafiles/brushicons/blur.png")
-data_to_c_simple("release/datafiles/brushicons/clay.png")
-data_to_c_simple("release/datafiles/brushicons/claystrips.png")
-data_to_c_simple("release/datafiles/brushicons/clone.png")
-data_to_c_simple("release/datafiles/brushicons/crease.png")
-data_to_c_simple("release/datafiles/brushicons/darken.png")
-data_to_c_simple("release/datafiles/brushicons/draw.png")
-data_to_c_simple("release/datafiles/brushicons/fill.png")
-data_to_c_simple("release/datafiles/brushicons/flatten.png")
-data_to_c_simple("release/datafiles/brushicons/grab.png")
-data_to_c_simple("release/datafiles/brushicons/inflate.png")
-data_to_c_simple("release/datafiles/brushicons/layer.png")
-data_to_c_simple("release/datafiles/brushicons/lighten.png")
-data_to_c_simple("release/datafiles/brushicons/mask.png")
-data_to_c_simple("release/datafiles/brushicons/mix.png")
-data_to_c_simple("release/datafiles/brushicons/multiply.png")
-data_to_c_simple("release/datafiles/brushicons/nudge.png")
-data_to_c_simple("release/datafiles/brushicons/pinch.png")
-data_to_c_simple("release/datafiles/brushicons/scrape.png")
-data_to_c_simple("release/datafiles/brushicons/smear.png")
-data_to_c_simple("release/datafiles/brushicons/smooth.png")
-data_to_c_simple("release/datafiles/brushicons/snake_hook.png")
-data_to_c_simple("release/datafiles/brushicons/soften.png")
-data_to_c_simple("release/datafiles/brushicons/subtract.png")
-data_to_c_simple("release/datafiles/brushicons/texdraw.png")
-data_to_c_simple("release/datafiles/brushicons/thumb.png")
-data_to_c_simple("release/datafiles/brushicons/twist.png")
-data_to_c_simple("release/datafiles/brushicons/vertexdraw.png")
-
-data_to_c_simple("release/datafiles/matcaps/mc01.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc02.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc03.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc04.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc05.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc06.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc07.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc08.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc09.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc10.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc11.jpg")
-data_to_c_simple("release/datafiles/matcaps/mc12.jpg")
-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")
+if B.targets != ['cudakernels']:
+ data_to_c("source/blender/compositor/operations/COM_OpenCLKernels.cl",
+ B.root_build_dir + "data_headers/COM_OpenCLKernels.cl.h",
+ "datatoc_COM_OpenCLKernels_cl")
+
+ data_to_c_simple("release/datafiles/startup.blend")
+ data_to_c_simple("release/datafiles/preview.blend")
+ data_to_c_simple("release/datafiles/preview_cycles.blend")
+
+ # --- glsl ---
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vertex.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_frag.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_vert.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl")
+
+ # --- blender ---
+ data_to_c_simple("release/datafiles/bfont.pfb")
+ data_to_c_simple("release/datafiles/bfont.ttf")
+ data_to_c_simple("release/datafiles/bmonofont.ttf")
+
+ data_to_c_simple("release/datafiles/splash.png")
+ data_to_c_simple("release/datafiles/blender_icons16.png")
+ data_to_c_simple("release/datafiles/blender_icons32.png")
+ data_to_c_simple("release/datafiles/prvicons.png")
+
+ data_to_c_simple("release/datafiles/brushicons/add.png")
+ data_to_c_simple("release/datafiles/brushicons/blob.png")
+ data_to_c_simple("release/datafiles/brushicons/blur.png")
+ data_to_c_simple("release/datafiles/brushicons/clay.png")
+ data_to_c_simple("release/datafiles/brushicons/claystrips.png")
+ data_to_c_simple("release/datafiles/brushicons/clone.png")
+ data_to_c_simple("release/datafiles/brushicons/crease.png")
+ data_to_c_simple("release/datafiles/brushicons/darken.png")
+ data_to_c_simple("release/datafiles/brushicons/draw.png")
+ data_to_c_simple("release/datafiles/brushicons/fill.png")
+ data_to_c_simple("release/datafiles/brushicons/flatten.png")
+ data_to_c_simple("release/datafiles/brushicons/grab.png")
+ data_to_c_simple("release/datafiles/brushicons/inflate.png")
+ data_to_c_simple("release/datafiles/brushicons/layer.png")
+ data_to_c_simple("release/datafiles/brushicons/lighten.png")
+ data_to_c_simple("release/datafiles/brushicons/mask.png")
+ data_to_c_simple("release/datafiles/brushicons/mix.png")
+ data_to_c_simple("release/datafiles/brushicons/multiply.png")
+ data_to_c_simple("release/datafiles/brushicons/nudge.png")
+ data_to_c_simple("release/datafiles/brushicons/pinch.png")
+ data_to_c_simple("release/datafiles/brushicons/scrape.png")
+ data_to_c_simple("release/datafiles/brushicons/smear.png")
+ data_to_c_simple("release/datafiles/brushicons/smooth.png")
+ data_to_c_simple("release/datafiles/brushicons/snake_hook.png")
+ data_to_c_simple("release/datafiles/brushicons/soften.png")
+ data_to_c_simple("release/datafiles/brushicons/subtract.png")
+ data_to_c_simple("release/datafiles/brushicons/texdraw.png")
+ data_to_c_simple("release/datafiles/brushicons/thumb.png")
+ data_to_c_simple("release/datafiles/brushicons/twist.png")
+ data_to_c_simple("release/datafiles/brushicons/vertexdraw.png")
+
+ data_to_c_simple("release/datafiles/matcaps/mc01.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc02.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc03.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc04.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc05.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc06.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc07.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc08.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc09.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc10.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc11.jpg")
+ data_to_c_simple("release/datafiles/matcaps/mc12.jpg")
+ 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 ##########
@@ -869,6 +870,8 @@ if env['OURPLATFORM']=='linux':
td, tf = os.path.split(targetdir)
iconinstall.append(env.Install(dir=td, source=srcfile))
+ scriptinstall.append(env.Install(dir=env['BF_INSTALLDIR'], source='release/bin/blender-thumbnailer.py'))
+
# dlls for linuxcross
# TODO - add more libs, for now this lets blenderlite run
if env['OURPLATFORM']=='linuxcross':
diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py
index cf0afec0ee1..06c925ac7da 100644
--- a/build_files/scons/config/win32-vc-config.py
+++ b/build_files/scons/config/win32-vc-config.py
@@ -182,7 +182,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/doc/manpage/blender.1 b/doc/manpage/blender.1
index 2addb60c5f7..9cefe7a2b24 100644
--- a/doc/manpage/blender.1
+++ b/doc/manpage/blender.1
@@ -1,4 +1,4 @@
-.TH "BLENDER" "1" "December 04, 2012" "Blender Blender 2\&.65"
+.TH "BLENDER" "1" "February 14, 2013" "Blender Blender 2\&.66"
.SH NAME
blender \- a 3D modelling and rendering package
@@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business
http://www.blender.org
.SH OPTIONS
-Blender 2.65
+Blender 2.66
Usage: blender [args ...] [file] [args ...]
.br
.SS "Render Options:"
@@ -218,6 +218,12 @@ Turn debugging on
Enable floating point exceptions
.br
+.TP
+.B \-\-disable\-crash\-handler
+.br
+Disable the crash handler
+.br
+
.IP
.TP
@@ -301,7 +307,13 @@ Disable automatic python script execution (pydrivers & startup scripts)
.TP
.B \-P or \-\-python <filename>
.br
-Run the given Python script (filename or Blender Text)
+Run the given Python script file
+.br
+
+.TP
+.B \-\-python\-text <name>
+.br
+Run the given Python script text block
.br
.TP
@@ -398,6 +410,12 @@ Register .blend extension, then exit (Windows only)
Silently register .blend extension, then exit (Windows only)
.br
+.TP
+.B \-\-no\-native\-pixels
+.br
+Do not use native pixel size, for high resolution displays (MacBook 'Retina')
+.br
+
.SS "Argument Parsing:"
arguments must be separated by white space. eg
diff --git a/intern/bsp/intern/CSG_BooleanOps.cpp b/intern/bsp/intern/CSG_BooleanOps.cpp
index 4f71e7992a1..f74dfc3c253 100644
--- a/intern/bsp/intern/CSG_BooleanOps.cpp
+++ b/intern/bsp/intern/CSG_BooleanOps.cpp
@@ -88,16 +88,16 @@ CSG_PerformBooleanOperation(
BoolOpType boolType;
- switch( op_type ) {
- case e_csg_union:
- boolType = BOP_UNION;
- break;
- case e_csg_difference:
- boolType = BOP_DIFFERENCE;
- break;
- default:
- boolType = BOP_INTERSECTION;
- break;
+ switch (op_type) {
+ case e_csg_union:
+ boolType = BOP_UNION;
+ break;
+ case e_csg_difference:
+ boolType = BOP_DIFFERENCE;
+ break;
+ default:
+ boolType = BOP_INTERSECTION;
+ break;
}
BoolOpState boolOpResult;
diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript
index 8a8ef9cce39..7b4d2db6861 100644
--- a/intern/cycles/SConscript
+++ b/intern/cycles/SConscript
@@ -43,6 +43,8 @@ incs = []
defs = []
cxxflags = Split(env['CXXFLAGS'])
+defs.append('GLEW_STATIC')
+
defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {')
defs.append('CCL_NAMESPACE_END=}')
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 951f7022a10..dda7eb053c4 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -128,7 +128,8 @@ void BlenderSession::reset_session(BL::BlendData b_data_, BL::Scene b_scene_)
height = b_engine.resolution_y();
if(scene->params.modified(scene_params) ||
- session->params.modified(session_params))
+ session->params.modified(session_params) ||
+ !scene_params.persistent_data)
{
/* if scene or session parameters changed, it's easier to simply re-create
* them rather than trying to distinguish which settings need to be updated
@@ -410,8 +411,10 @@ void BlenderSession::do_write_update_render_result(BL::RenderResult b_rr, BL::Re
int components = b_pass.channels();
/* copy pixels */
- if(buffers->get_pass_rect(pass_type, exposure, rtile.sample, components, &pixels[0]))
- b_pass.rect(&pixels[0]);
+ if(!buffers->get_pass_rect(pass_type, exposure, rtile.sample, components, &pixels[0]))
+ memset(&pixels[0], 0, pixels.size()*sizeof(float));
+
+ b_pass.rect(&pixels[0]);
}
}
@@ -517,6 +520,9 @@ bool BlenderSession::draw(int w, int h)
session->reset(buffer_params, session_params.samples);
}
}
+ else {
+ tag_update();
+ }
/* update status and progress for 3d view draw */
update_status_progress();
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 7ad663b7e26..f6ff78ab2ac 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -307,7 +307,10 @@ SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background)
params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
params.use_bvh_cache = (background)? RNA_boolean_get(&cscene, "use_cache"): false;
- params.persistent_images = (background)? r.use_persistent_data(): false;
+ if(background && params.shadingsystem != SceneParams::OSL)
+ params.persistent_data = r.use_persistent_data();
+ else
+ params.persistent_data = false;
return params;
}
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index 0947b5a2e9d..976ed875211 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -41,7 +41,7 @@ CCL_NAMESPACE_BEGIN
static inline BL::Mesh object_to_mesh(BL::BlendData data, BL::Object object, BL::Scene scene, bool apply_modifiers, bool render)
{
- return data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1);
+ return data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, true);
}
static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 011406344ea..f11b3c4c0bc 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -30,6 +30,7 @@
#include "util_foreach.h"
#include "util_map.h"
#include "util_progress.h"
+#include "util_system.h"
#include "util_types.h"
CCL_NAMESPACE_BEGIN
@@ -71,6 +72,7 @@ BVH *BVH::create(const BVHParams& params, const vector<Object*>& objects)
bool BVH::cache_read(CacheData& key)
{
+ key.add(system_cpu_bits());
key.add(&params, sizeof(params));
foreach(Object *ob, objects) {
@@ -340,6 +342,10 @@ void BVH::pack_primitives()
Object *ob = objects[tob];
pack.prim_visibility[i] = ob->visibility;
}
+ else {
+ memset(&pack.tri_woop[i * nsize], 0, sizeof(float4)*3);
+ pack.prim_visibility[i] = 0;
+ }
}
}
@@ -476,7 +482,7 @@ void BVH::pack_instances(size_t nodes_size)
}
/* merge nodes */
- if( bvh->pack.nodes.size()) {
+ if(bvh->pack.nodes.size()) {
size_t nsize_bbox = (use_qbvh)? nsize-2: nsize-1;
int4 *bvh_nodes = &bvh->pack.nodes[0];
size_t bvh_nodes_size = bvh->pack.nodes.size();
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 1915245bb55..c2ba91faf69 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -171,7 +171,7 @@ public:
int end_sample = tile.start_sample + tile.num_samples;
#ifdef WITH_OPTIMIZED_KERNEL
- if(system_cpu_support_sse2()) {
+ 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)
@@ -180,7 +180,7 @@ 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_sse2_path_trace(&kg, render_buffer, rng_state,
+ kernel_cpu_sse3_path_trace(&kg, render_buffer, rng_state,
sample, x, y, tile.offset, tile.stride);
}
}
@@ -190,7 +190,7 @@ public:
task.update_progress(tile);
}
}
- else if(system_cpu_support_sse3()) {
+ else 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)
@@ -199,7 +199,7 @@ 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_sse3_path_trace(&kg, render_buffer, rng_state,
+ kernel_cpu_sse2_path_trace(&kg, render_buffer, rng_state,
sample, x, y, tile.offset, tile.stride);
}
}
@@ -247,16 +247,16 @@ public:
void thread_tonemap(DeviceTask& task)
{
#ifdef WITH_OPTIMIZED_KERNEL
- if(system_cpu_support_sse2()) {
+ 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_sse2_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 if(system_cpu_support_sse3()) {
+ else 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_sse3_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer,
+ kernel_cpu_sse2_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer,
task.sample, task.resolution, x, y, task.offset, task.stride);
}
else
@@ -278,17 +278,17 @@ public:
#endif
#ifdef WITH_OPTIMIZED_KERNEL
- if(system_cpu_support_sse2()) {
+ if(system_cpu_support_sse3()) {
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);
+ kernel_cpu_sse3_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()) {
+ else if(system_cpu_support_sse2()) {
for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) {
- kernel_cpu_sse3_shader(&kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
+ kernel_cpu_sse2_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/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 0c590645808..77082006169 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -109,11 +109,11 @@ public:
}
}
-#ifdef NDEBUG
+/*#ifdef NDEBUG
#define cuda_abort()
#else
#define cuda_abort() abort()
-#endif
+#endif*/
#define cuda_assert(stmt) \
{ \
@@ -128,19 +128,21 @@ public:
} \
}
- bool cuda_error(CUresult result)
+ bool cuda_error_(CUresult result, const string& stmt)
{
if(result == CUDA_SUCCESS)
return false;
- string message = string_printf("CUDA error: %s", cuda_error_string(result));
+ string message = string_printf("CUDA error at %s: %s", stmt.c_str(), cuda_error_string(result));
if(error_msg == "")
error_msg = message;
fprintf(stderr, "%s\n", message.c_str());
return true;
}
- void cuda_error(const string& message)
+#define cuda_error(stmt) cuda_error_(stmt, #stmt)
+
+ void cuda_error_message(const string& message)
{
if(error_msg == "")
error_msg = message;
@@ -187,7 +189,7 @@ public:
}
}
- if(cuda_error(result))
+ if(cuda_error_(result, "cuCtxCreate"))
return;
cuda_pop_context();
@@ -208,7 +210,7 @@ public:
cuDeviceComputeCapability(&major, &minor, cuDevId);
if(major <= 1 && minor <= 2) {
- cuda_error(string_printf("CUDA device supported only with compute capability 1.3 or up, found %d.%d.", major, minor));
+ cuda_error_message(string_printf("CUDA device supported only with compute capability 1.3 or up, found %d.%d.", major, minor));
return false;
}
}
@@ -241,9 +243,9 @@ public:
#ifdef _WIN32
if(cuHavePrecompiledKernels()) {
if(major <= 1 && minor <= 2)
- cuda_error(string_printf("CUDA device requires compute capability 1.3 or up, found %d.%d. Your GPU is not supported.", major, minor));
+ cuda_error_message(string_printf("CUDA device requires compute capability 1.3 or up, found %d.%d. Your GPU is not supported.", major, minor));
else
- cuda_error(string_printf("CUDA binary kernel for this graphics card compute capability (%d.%d) not found.", major, minor));
+ cuda_error_message(string_printf("CUDA binary kernel for this graphics card compute capability (%d.%d) not found.", major, minor));
return "";
}
#endif
@@ -252,7 +254,7 @@ public:
string nvcc = cuCompilerPath();
if(nvcc == "") {
- cuda_error("CUDA nvcc compiler not found. Install CUDA toolkit in default location.");
+ cuda_error_message("CUDA nvcc compiler not found. Install CUDA toolkit in default location.");
return "";
}
@@ -272,13 +274,13 @@ public:
nvcc.c_str(), major, minor, machine, kernel.c_str(), cubin.c_str(), maxreg, include.c_str());
if(system(command.c_str()) == -1) {
- cuda_error("Failed to execute compilation command, see console for details.");
+ cuda_error_message("Failed to execute compilation command, see console for details.");
return "";
}
/* verify if compilation succeeded */
if(!path_exists(cubin)) {
- cuda_error("CUDA kernel compilation failed, see console for details.");
+ cuda_error_message("CUDA kernel compilation failed, see console for details.");
return "";
}
@@ -306,8 +308,8 @@ public:
cuda_push_context();
CUresult result = cuModuleLoad(&cuModule, cubin.c_str());
- if(cuda_error(result))
- cuda_error(string_printf("Failed loading CUDA kernel %s.", cubin.c_str()));
+ if(cuda_error_(result, "cuModuleLoad"))
+ cuda_error_message(string_printf("Failed loading CUDA kernel %s.", cubin.c_str()));
cuda_pop_context();
@@ -737,7 +739,7 @@ public:
CUresult result = cuGraphicsGLRegisterBuffer(&pmem.cuPBOresource, pmem.cuPBO, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
- if(!cuda_error(result)) {
+ if(result == CUDA_SUCCESS) {
cuda_pop_context();
mem.device_pointer = pmem.cuTexId;
diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h
index 4048bbd9dfc..9787af535bb 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -20,7 +20,7 @@ CCL_NAMESPACE_BEGIN
/* Direction Emission */
-__device float3 direct_emissive_eval(KernelGlobals *kg, float rando,
+__device_noinline float3 direct_emissive_eval(KernelGlobals *kg, float rando,
LightSample *ls, float u, float v, float3 I, float t, float time)
{
/* setup shading at emitter */
@@ -74,7 +74,7 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando,
return eval;
}
-__device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
+__device_noinline bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
float randt, float rando, float randu, float randv, Ray *ray, BsdfEval *eval,
bool *is_lamp)
{
@@ -141,14 +141,14 @@ __device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
}
/* return if it's a lamp for shadow pass */
- *is_lamp = (ls.prim == ~0);
+ *is_lamp = (ls.prim == ~0 && ls.type != LIGHT_BACKGROUND);
return true;
}
/* Indirect Primitive Emission */
-__device float3 indirect_primitive_emission(KernelGlobals *kg, ShaderData *sd, float t, int path_flag, float bsdf_pdf)
+__device_noinline float3 indirect_primitive_emission(KernelGlobals *kg, ShaderData *sd, float t, int path_flag, float bsdf_pdf)
{
/* evaluate emissive closure */
float3 L = shader_emissive_eval(kg, sd);
@@ -171,7 +171,7 @@ __device float3 indirect_primitive_emission(KernelGlobals *kg, ShaderData *sd, f
/* Indirect Lamp Emission */
-__device bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf, float randt, float3 *emission)
+__device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf, float randt, float3 *emission)
{
LightSample ls;
int lamp = lamp_light_eval_sample(kg, randt);
@@ -200,7 +200,7 @@ __device bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int path_flag,
/* Indirect Background */
-__device float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf)
+__device_noinline float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf)
{
#ifdef __BACKGROUND__
/* evaluate background closure */
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index 10a32226f17..f6fbd3599ad 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -454,7 +454,7 @@ __device void triangle_light_sample(KernelGlobals *kg, int prim, int object,
ls->lamp = ~0;
ls->shader |= SHADER_USE_MIS;
ls->t = 0.0f;
- ls->type = LIGHT_AREA;
+ ls->type = LIGHT_TRIANGLE;
ls->eval_fac = 1.0f;
object_transform_light_sample(kg, ls, object, time);
diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h
index 727639386ed..57dbdc2ffc1 100644
--- a/intern/cycles/kernel/kernel_passes.h
+++ b/intern/cycles/kernel/kernel_passes.h
@@ -125,14 +125,7 @@ __device_inline void kernel_write_light_passes(KernelGlobals *kg, __global float
kernel_write_pass_float3(buffer + kernel_data.film.pass_transmission_color, sample, L->color_transmission);
if(flag & PASS_SHADOW) {
float4 shadow = L->shadow;
-
- /* bit of an ugly hack to compensate for emitting triangles influencing
- * amount of samples we get for this pass */
- if(kernel_data.integrator.progressive && kernel_data.integrator.pdf_triangles != 0.0f)
- shadow.w = 0.5f;
- else
- shadow.w = 1.0f;
-
+ shadow.w = kernel_data.film.pass_shadow_scale;
kernel_write_pass_float4(buffer + kernel_data.film.pass_shadow, sample, shadow);
}
#endif
diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h
index b7d87427bd3..df86b352697 100644
--- a/intern/cycles/kernel/kernel_shader.h
+++ b/intern/cycles/kernel/kernel_shader.h
@@ -53,7 +53,7 @@ __device_noinline void shader_setup_object_transforms(KernelGlobals *kg, ShaderD
}
#endif
-__device void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
+__device_noinline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
const Intersection *isect, const Ray *ray)
{
#ifdef __INSTANCING__
@@ -160,7 +160,7 @@ __device void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
/* ShaderData setup from position sampled on mesh */
-__device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
+__device_noinline void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
const float3 P, const float3 Ng, const float3 I,
int shader, int object, int prim, float u, float v, float t, float time, int segment = ~0)
{
@@ -283,7 +283,7 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
/* ShaderData setup for displacement */
-__device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
+__device_noinline void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
int object, int prim, float u, float v)
{
/* Note: no OSLShader::init call here, this is done in shader_setup_from_sample! */
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 52bdddc72fb..ddbda9240fb 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -299,6 +299,7 @@ typedef enum LightType {
LIGHT_AREA,
LIGHT_AO,
LIGHT_SPOT,
+ LIGHT_TRIANGLE,
LIGHT_STRAND
} LightType;
@@ -609,9 +610,9 @@ typedef struct KernelFilm {
int pass_ao;
int pass_shadow;
+ float pass_shadow_scale;
int pass_pad1;
int pass_pad2;
- int pass_pad3;
} KernelFilm;
typedef struct KernelBackground {
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp
index 3b61ccd176d..572cfae45cd 100644
--- a/intern/cycles/render/buffers.cpp
+++ b/intern/cycles/render/buffers.cpp
@@ -83,6 +83,7 @@ RenderTile::RenderTile()
w = 0;
h = 0;
+ sample = 0;
start_sample = 0;
num_samples = 0;
resolution = 0;
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index 6bfaf48c0c9..8e844bc788e 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -85,9 +85,10 @@ bool ImageManager::set_animation_frame_update(int frame)
return false;
}
-bool ImageManager::is_float_image(const string& filename, void *builtin_data)
+bool ImageManager::is_float_image(const string& filename, void *builtin_data, bool& is_linear)
{
bool is_float = false;
+ is_linear = false;
if(builtin_data) {
if(builtin_image_info_cb) {
@@ -95,6 +96,9 @@ bool ImageManager::is_float_image(const string& filename, void *builtin_data)
builtin_image_info_cb(filename, builtin_data, is_float, width, height, channels);
}
+ if(is_float)
+ is_linear = true;
+
return is_float;
}
@@ -106,13 +110,29 @@ bool ImageManager::is_float_image(const string& filename, void *builtin_data)
if(in->open(filename, spec)) {
/* check the main format, and channel formats;
* if any take up more than one byte, we'll need a float texture slot */
- if(spec.format.basesize() > 1)
+ if(spec.format.basesize() > 1) {
is_float = true;
+ is_linear = true;
+ }
for(size_t channel = 0; channel < spec.channelformats.size(); channel++) {
- if(spec.channelformats[channel].basesize() > 1)
+ if(spec.channelformats[channel].basesize() > 1) {
is_float = true;
+ is_linear = true;
+ }
+ }
+
+ /* basic color space detection, not great but better than nothing
+ * before we do OpenColorIO integration */
+ if(is_float) {
+ string colorspace = spec.get_string_attribute("oiio:ColorSpace");
+
+ is_linear = !(colorspace == "sRGB" ||
+ colorspace == "GammaCorrected" ||
+ strcmp(in->format_name(), "png") == 0);
}
+ else
+ is_linear = false;
in->close();
}
@@ -123,13 +143,13 @@ bool ImageManager::is_float_image(const string& filename, void *builtin_data)
return is_float;
}
-int ImageManager::add_image(const string& filename, void *builtin_data, bool animated, bool& is_float)
+int ImageManager::add_image(const string& filename, void *builtin_data, bool animated, bool& is_float, bool& is_linear)
{
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, builtin_data);
+ is_float = (pack_images)? false: is_float_image(filename, builtin_data, is_linear);
if(is_float) {
/* find existing image */
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 464b87ff530..b20ff23fbbb 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, void *builtin_data, bool animated, bool& is_float);
+ int add_image(const string& filename, void *builtin_data, bool animated, bool& is_float, bool& is_linear);
void remove_image(const string& filename, void *builtin_data);
- bool is_float_image(const string& filename, void *builtin_data);
+ bool is_float_image(const string& filename, void *builtin_data, bool& is_linear);
void device_update(Device *device, DeviceScene *dscene, Progress& progress);
void device_free(Device *device, DeviceScene *dscene);
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index e7fb9514371..ccc6c5142bd 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -143,6 +143,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
/* count */
size_t num_lights = scene->lights.size();
+ size_t num_background_lights = 0;
size_t num_triangles = 0;
size_t num_curve_segments = 0;
@@ -306,6 +307,8 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
if(light->size > 0.0f && light->use_mis)
use_lamp_mis = true;
+ if(light->type == LIGHT_BACKGROUND)
+ num_background_lights++;
}
/* normalize cumulative distribution functions */
@@ -324,6 +327,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
/* update device */
KernelIntegrator *kintegrator = &dscene->data.integrator;
+ KernelFilm *kfilm = &dscene->data.film;
kintegrator->use_direct_light = (totarea > 0.0f);
if(kintegrator->use_direct_light) {
@@ -354,6 +358,16 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
kintegrator->use_lamp_mis = use_lamp_mis;
+ /* bit of an ugly hack to compensate for emitting triangles influencing
+ * amount of samples we get for this pass */
+ if(scene->integrator->progressive && kintegrator->pdf_triangles != 0.0f)
+ kfilm->pass_shadow_scale = 0.5f;
+ else
+ kfilm->pass_shadow_scale = 1.0f;
+
+ if(num_background_lights < num_lights)
+ kfilm->pass_shadow_scale *= (float)(num_lights - num_background_lights)/(float)num_lights;
+
/* CDF */
device->tex_alloc("__light_distribution", dscene->light_distribution);
}
@@ -366,6 +380,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
kintegrator->pdf_lights = 0.0f;
kintegrator->inv_pdf_lights = 0.0f;
kintegrator->use_lamp_mis = false;
+ kfilm->pass_shadow_scale = 1.0f;
}
}
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 57776e4cfa6..8d12ace4252 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -966,6 +966,16 @@ void MeshManager::device_free(Device *device, DeviceScene *dscene)
dscene->attributes_map.clear();
dscene->attributes_float.clear();
dscene->attributes_float3.clear();
+
+#ifdef WITH_OSL
+ OSLGlobals *og = (OSLGlobals*)device->osl_memory();
+
+ if(og) {
+ og->object_name_map.clear();
+ og->attribute_map.clear();
+ og->object_names.clear();
+ }
+#endif
}
void MeshManager::tag_update(Scene *scene)
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index a0a933ef682..8ac12242e15 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -141,6 +141,7 @@ ImageTextureNode::ImageTextureNode()
image_manager = NULL;
slot = -1;
is_float = -1;
+ is_linear = false;
filename = "";
builtin_data = NULL;
color_space = ustring("Color");
@@ -165,6 +166,7 @@ ShaderNode *ImageTextureNode::clone() const
node->image_manager = NULL;
node->slot = -1;
node->is_float = -1;
+ node->is_linear = false;
return node;
}
@@ -177,7 +179,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, builtin_data, animated, is_float_bool);
+ slot = image_manager->add_image(filename, builtin_data, animated, is_float_bool, is_linear);
is_float = (int)is_float_bool;
}
@@ -189,7 +191,7 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
if(slot != -1) {
compiler.stack_assign(vector_in);
- int srgb = (is_float || color_space != "Color")? 0: 1;
+ int srgb = (is_linear || color_space != "Color")? 0: 1;
int vector_offset = vector_in->stack_offset;
if(!tex_mapping.skip()) {
@@ -238,10 +240,10 @@ void ImageTextureNode::compile(OSLCompiler& compiler)
tex_mapping.compile(compiler);
if(is_float == -1)
- is_float = (int)image_manager->is_float_image(filename, NULL);
+ is_float = (int)image_manager->is_float_image(filename, NULL, is_linear);
compiler.parameter("filename", filename.c_str());
- if(is_float || color_space != "Color")
+ if(is_linear || color_space != "Color")
compiler.parameter("color_space", "Linear");
else
compiler.parameter("color_space", "sRGB");
@@ -271,6 +273,7 @@ EnvironmentTextureNode::EnvironmentTextureNode()
image_manager = NULL;
slot = -1;
is_float = -1;
+ is_linear = false;
filename = "";
builtin_data = NULL;
color_space = ustring("Color");
@@ -294,6 +297,7 @@ ShaderNode *EnvironmentTextureNode::clone() const
node->image_manager = NULL;
node->slot = -1;
node->is_float = -1;
+ node->is_linear = false;
return node;
}
@@ -306,7 +310,7 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
image_manager = compiler.image_manager;
if(slot == -1) {
bool is_float_bool;
- slot = image_manager->add_image(filename, builtin_data, animated, is_float_bool);
+ slot = image_manager->add_image(filename, builtin_data, animated, is_float_bool, is_linear);
is_float = (int)is_float_bool;
}
@@ -318,7 +322,7 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
if(slot != -1) {
compiler.stack_assign(vector_in);
- int srgb = (is_float || color_space != "Color")? 0: 1;
+ int srgb = (is_linear || color_space != "Color")? 0: 1;
int vector_offset = vector_in->stack_offset;
if(!tex_mapping.skip()) {
@@ -356,11 +360,11 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler)
tex_mapping.compile(compiler);
if(is_float == -1)
- is_float = (int)image_manager->is_float_image(filename, NULL);
+ is_float = (int)image_manager->is_float_image(filename, NULL, is_linear);
compiler.parameter("filename", filename.c_str());
compiler.parameter("projection", projection);
- if(is_float || color_space != "Color")
+ if(is_linear || color_space != "Color")
compiler.parameter("color_space", "Linear");
else
compiler.parameter("color_space", "sRGB");
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 66be919d098..3609497e5ce 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -69,6 +69,7 @@ public:
ImageManager *image_manager;
int slot;
int is_float;
+ bool is_linear;
string filename;
void *builtin_data;
ustring color_space;
@@ -89,6 +90,7 @@ public:
ImageManager *image_manager;
int slot;
int is_float;
+ bool is_linear;
string filename;
void *builtin_data;
ustring color_space;
diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index 28de56f3a72..56158278e29 100644
--- a/intern/cycles/render/osl.cpp
+++ b/intern/cycles/render/osl.cpp
@@ -47,15 +47,25 @@ OSLShaderManager::OSLShaderManager()
{
services = new OSLRenderServices();
- shading_system_init();
texture_system_init();
+ shading_system_init();
}
OSLShaderManager::~OSLShaderManager()
{
OSL::ShadingSystem::destroy(ss);
OSL::TextureSystem::destroy(ts);
+
+ delete services;
+}
+
+void OSLShaderManager::reset(Scene *scene)
+{
+ OSL::ShadingSystem::destroy(ss);
delete services;
+
+ services = new OSLRenderServices();
+ shading_system_init();
}
void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
@@ -88,6 +98,7 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
og->ss = ss;
og->ts = ts;
og->services = services;
+
int background_id = scene->shader_manager->get_shader_id(scene->default_background);
og->background_state = og->surface_state[background_id & SHADER_MASK];
og->use = true;
diff --git a/intern/cycles/render/osl.h b/intern/cycles/render/osl.h
index 3c599caa893..4b4ed6cba00 100644
--- a/intern/cycles/render/osl.h
+++ b/intern/cycles/render/osl.h
@@ -36,7 +36,7 @@ class Device;
class DeviceScene;
class ImageManager;
class OSLRenderServices;
-class OSLGlobals;
+struct OSLGlobals;
class Scene;
class ShaderGraph;
class ShaderNode;
@@ -64,6 +64,8 @@ public:
OSLShaderManager();
~OSLShaderManager();
+ void reset(Scene *scene);
+
bool use_osl() { return true; }
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp
index 093bfecf88e..7b82a91cae8 100644
--- a/intern/cycles/render/scene.cpp
+++ b/intern/cycles/render/scene.cpp
@@ -85,6 +85,12 @@ void Scene::free_memory(bool final)
foreach(ParticleSystem *p, particle_systems)
delete p;
+ shaders.clear();
+ meshes.clear();
+ objects.clear();
+ lights.clear();
+ particle_systems.clear();
+
if(device) {
camera->device_free(device, &dscene);
filter->device_free(device, &dscene);
@@ -100,7 +106,7 @@ void Scene::free_memory(bool final)
particle_system_manager->device_free(device, &dscene);
curve_system_manager->device_free(device, &dscene);
- if(!params.persistent_images || final)
+ if(!params.persistent_data || final)
image_manager->device_free(device, &dscene);
}
@@ -118,13 +124,6 @@ void Scene::free_memory(bool final)
delete curve_system_manager;
delete image_manager;
}
- else {
- shaders.clear();
- meshes.clear();
- objects.clear();
- lights.clear();
- particle_systems.clear();
- }
}
void Scene::device_update(Device *device_, Progress& progress)
@@ -257,6 +256,7 @@ bool Scene::need_reset()
void Scene::reset()
{
+ shader_manager->reset(this);
shader_manager->add_default(this);
/* ensure all objects are updated */
diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h
index f6e1daea80d..fc6b538af03 100644
--- a/intern/cycles/render/scene.h
+++ b/intern/cycles/render/scene.h
@@ -125,7 +125,7 @@ public:
bool use_bvh_cache;
bool use_bvh_spatial_split;
bool use_qbvh;
- bool persistent_images;
+ bool persistent_data;
SceneParams()
{
@@ -146,7 +146,7 @@ public:
&& use_bvh_cache == params.use_bvh_cache
&& use_bvh_spatial_split == params.use_bvh_spatial_split
&& use_qbvh == params.use_qbvh
- && persistent_images == params.persistent_images); }
+ && persistent_data == params.persistent_data); }
};
/* Scene */
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 94cb69102d2..6ed14452c6b 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -132,6 +132,8 @@ bool Session::ready_to_reset()
void Session::reset_gpu(BufferParams& buffer_params, int samples)
{
+ thread_scoped_lock pause_lock(pause_mutex);
+
/* block for buffer acces and reset immediately. we can't do this
* in the thread, because we need to allocate an OpenGL buffer, and
* that only works in the main thread */
@@ -208,7 +210,12 @@ void Session::run_gpu()
* wait for pause condition notify to wake up again */
thread_scoped_lock pause_lock(pause_mutex);
- if(pause || no_tiles) {
+ if(!pause && !tile_manager.done()) {
+ /* reset could have happened after no_tiles was set, before this lock.
+ * in this case we shall not wait for pause condition
+ */
+ }
+ else if(pause || no_tiles) {
update_status_time(pause, no_tiles);
while(1) {
@@ -295,6 +302,7 @@ void Session::run_gpu()
void Session::reset_cpu(BufferParams& buffer_params, int samples)
{
thread_scoped_lock reset_lock(delayed_reset.mutex);
+ thread_scoped_lock pause_lock(pause_mutex);
display_outdated = true;
reset_time = time_dt();
@@ -484,7 +492,16 @@ void Session::run_cpu()
* wait for pause condition notify to wake up again */
thread_scoped_lock pause_lock(pause_mutex);
- if(pause || no_tiles) {
+ if(!pause && delayed_reset.do_reset) {
+ /* reset once to start */
+ thread_scoped_lock reset_lock(delayed_reset.mutex);
+ thread_scoped_lock buffers_lock(buffers_mutex);
+ thread_scoped_lock display_lock(display_mutex);
+
+ reset_(delayed_reset.params, delayed_reset.samples);
+ delayed_reset.do_reset = false;
+ }
+ else if(pause || no_tiles) {
update_status_time(pause, no_tiles);
while(1) {
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h
index d4421002ceb..b38e098e3cb 100644
--- a/intern/cycles/render/shader.h
+++ b/intern/cycles/render/shader.h
@@ -110,6 +110,8 @@ public:
static ShaderManager *create(Scene *scene, int shadingsystem);
virtual ~ShaderManager();
+ virtual void reset(Scene *scene) = 0;
+
virtual bool use_osl() { return false; }
/* device update */
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index f7cb8f62247..5cb11a4ec1a 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -40,6 +40,10 @@ SVMShaderManager::~SVMShaderManager()
{
}
+void SVMShaderManager::reset(Scene *scene)
+{
+}
+
void SVMShaderManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
{
if(!need_update)
diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h
index 0b15c5aaa1e..c1ce619e12a 100644
--- a/intern/cycles/render/svm.h
+++ b/intern/cycles/render/svm.h
@@ -45,6 +45,8 @@ public:
SVMShaderManager();
~SVMShaderManager();
+ void reset(Scene *scene);
+
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
void device_free(Device *device, DeviceScene *dscene);
};
diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h
index 0c857f906ee..7564c1f3c5c 100644
--- a/intern/cycles/util/util_boundbox.h
+++ b/intern/cycles/util/util_boundbox.h
@@ -61,15 +61,17 @@ public:
__forceinline void grow(const float3& pt)
{
- min = ccl::min(min, pt);
- max = ccl::max(max, pt);
+ /* the order of arguments to min is such that if pt is nan, it will not
+ * influence the resulting bounding box */
+ min = ccl::min(pt, min);
+ max = ccl::max(pt, max);
}
__forceinline void grow(const float3& pt, float border)
{
float3 shift = {border, border, border, 0.0f};
- min = ccl::min(min, pt - shift);
- max = ccl::max(max, pt + shift);
+ min = ccl::min(pt - shift, min);
+ max = ccl::max(pt + shift, max);
}
__forceinline void grow(const BoundBox& bbox)
diff --git a/intern/cycles/util/util_cache.h b/intern/cycles/util/util_cache.h
index e8f111a5397..deff05fff16 100644
--- a/intern/cycles/util/util_cache.h
+++ b/intern/cycles/util/util_cache.h
@@ -72,7 +72,7 @@ public:
buffers.push_back(buffer);
}
- void add(void *data, size_t size)
+ void add(const void *data, size_t size)
{
if(size) {
CacheBuffer buffer(data, size);
@@ -80,19 +80,19 @@ public:
}
}
- void add(int& data)
+ void add(const int& data)
{
CacheBuffer buffer(&data, sizeof(int));
buffers.push_back(buffer);
}
- void add(float& data)
+ void add(const float& data)
{
CacheBuffer buffer(&data, sizeof(float));
buffers.push_back(buffer);
}
- void add(size_t& data)
+ void add(const size_t& data)
{
CacheBuffer buffer(&data, sizeof(size_t));
buffers.push_back(buffer);
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index e4245aaf095..6cf4ada6311 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1028,8 +1028,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
if (!validWindow(window)) {
return GHOST_kFailure;
}
- switch(eventType)
- {
+ switch (eventType) {
case GHOST_kEventWindowClose:
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window) );
break;
@@ -1086,8 +1085,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
if (!validWindow(window)) {
return GHOST_kFailure;
}
- switch(eventType)
- {
+ switch (eventType) {
case GHOST_kEventDraggingEntered:
case GHOST_kEventDraggingUpdated:
case GHOST_kEventDraggingExited:
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 7ba8889fd1e..48fb8375303 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -109,32 +109,37 @@ GHOST_SystemX11(
m_xim = NULL;
#endif
- m_delete_window_atom
- = XInternAtom(m_display, "WM_DELETE_WINDOW", True);
-
- m_wm_protocols = XInternAtom(m_display, "WM_PROTOCOLS", False);
- m_wm_take_focus = XInternAtom(m_display, "WM_TAKE_FOCUS", False);
- m_wm_state = XInternAtom(m_display, "WM_STATE", False);
- m_wm_change_state = XInternAtom(m_display, "WM_CHANGE_STATE", False);
- m_net_state = XInternAtom(m_display, "_NET_WM_STATE", False);
- m_net_max_horz = XInternAtom(m_display,
- "_NET_WM_STATE_MAXIMIZED_HORZ", False);
- m_net_max_vert = XInternAtom(m_display,
- "_NET_WM_STATE_MAXIMIZED_VERT", False);
- m_net_fullscreen = XInternAtom(m_display,
- "_NET_WM_STATE_FULLSCREEN", False);
- m_motif = XInternAtom(m_display, "_MOTIF_WM_HINTS", False);
- m_targets = XInternAtom(m_display, "TARGETS", False);
- m_string = XInternAtom(m_display, "STRING", False);
- m_compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False);
- m_text = XInternAtom(m_display, "TEXT", False);
- m_clipboard = XInternAtom(m_display, "CLIPBOARD", False);
- m_primary = XInternAtom(m_display, "PRIMARY", False);
- m_xclip_out = XInternAtom(m_display, "XCLIP_OUT", False);
- m_incr = XInternAtom(m_display, "INCR", False);
- m_utf8_string = XInternAtom(m_display, "UTF8_STRING", False);
- m_last_warp = 0;
+#define GHOST_INTERN_ATOM_IF_EXISTS(atom) { m_atom.atom = XInternAtom(m_display, #atom , True); } (void)0
+#define GHOST_INTERN_ATOM(atom) { m_atom.atom = XInternAtom(m_display, #atom , False); } (void)0
+
+ GHOST_INTERN_ATOM_IF_EXISTS(WM_DELETE_WINDOW);
+ GHOST_INTERN_ATOM(WM_PROTOCOLS);
+ GHOST_INTERN_ATOM(WM_TAKE_FOCUS);
+ GHOST_INTERN_ATOM(WM_STATE);
+ GHOST_INTERN_ATOM(WM_CHANGE_STATE);
+ GHOST_INTERN_ATOM(_NET_WM_STATE);
+ GHOST_INTERN_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ);
+ GHOST_INTERN_ATOM(_NET_WM_STATE_MAXIMIZED_VERT);
+
+ GHOST_INTERN_ATOM(_NET_WM_STATE_FULLSCREEN);
+ GHOST_INTERN_ATOM(_MOTIF_WM_HINTS);
+ GHOST_INTERN_ATOM(TARGETS);
+ GHOST_INTERN_ATOM(STRING);
+ GHOST_INTERN_ATOM(COMPOUND_TEXT);
+ GHOST_INTERN_ATOM(TEXT);
+ GHOST_INTERN_ATOM(CLIPBOARD);
+ GHOST_INTERN_ATOM(PRIMARY);
+ GHOST_INTERN_ATOM(XCLIP_OUT);
+ GHOST_INTERN_ATOM(INCR);
+ GHOST_INTERN_ATOM(UTF8_STRING);
+#ifdef WITH_X11_XINPUT
+ m_atom.TABLET = XInternAtom(m_display, XI_TABLET, False);
+#endif
+#undef GHOST_INTERN_ATOM_IF_EXISTS
+#undef GHOST_INTERN_ATOM
+
+ m_last_warp = 0;
/* compute the initial time */
timeval tv;
@@ -959,7 +964,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
{
XClientMessageEvent & xcme = xe->xclient;
- if (((Atom)xcme.data.l[0]) == m_delete_window_atom) {
+ if (((Atom)xcme.data.l[0]) == m_atom.WM_DELETE_WINDOW) {
g_event = new
GHOST_Event(
getMilliSeconds(),
@@ -967,7 +972,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
window
);
}
- else if (((Atom)xcme.data.l[0]) == m_wm_take_focus) {
+ else if (((Atom)xcme.data.l[0]) == m_atom.WM_TAKE_FOCUS) {
XWindowAttributes attr;
Window fwin;
int revert_to;
@@ -1520,7 +1525,7 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
}
/* Send a selection request */
- XConvertSelection(m_display, sel, target, m_xclip_out, win, CurrentTime);
+ XConvertSelection(m_display, sel, target, m_atom.XCLIP_OUT, win, CurrentTime);
*context = XCLIB_XCOUT_SENTCONVSEL;
return;
@@ -1528,28 +1533,28 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
if (evt.type != SelectionNotify)
return;
- if (target == m_utf8_string && evt.xselection.property == None) {
+ if (target == m_atom.UTF8_STRING && evt.xselection.property == None) {
*context = XCLIB_XCOUT_FALLBACK_UTF8;
return;
}
- else if (target == m_compound_text && evt.xselection.property == None) {
+ else if (target == m_atom.COMPOUND_TEXT && evt.xselection.property == None) {
*context = XCLIB_XCOUT_FALLBACK_COMP;
return;
}
- else if (target == m_text && evt.xselection.property == None) {
+ else if (target == m_atom.TEXT && evt.xselection.property == None) {
*context = XCLIB_XCOUT_FALLBACK_TEXT;
return;
}
/* find the size and format of the data in property */
- XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
+ XGetWindowProperty(m_display, win, m_atom.XCLIP_OUT, 0, 0, False,
AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, &buffer);
XFree(buffer);
- if (pty_type == m_incr) {
+ if (pty_type == m_atom.INCR) {
/* start INCR mechanism by deleting property */
- XDeleteProperty(m_display, win, m_xclip_out);
+ XDeleteProperty(m_display, win, m_atom.XCLIP_OUT);
XFlush(m_display);
*context = XCLIB_XCOUT_INCR;
return;
@@ -1564,12 +1569,12 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
}
// not using INCR mechanism, just read the property
- XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size,
+ XGetWindowProperty(m_display, win, m_atom.XCLIP_OUT, 0, (long) pty_size,
False, AnyPropertyType, &pty_type,
&pty_format, &pty_items, &pty_size, &buffer);
/* finished with property, delete it */
- XDeleteProperty(m_display, win, m_xclip_out);
+ XDeleteProperty(m_display, win, m_atom.XCLIP_OUT);
/* copy the buffer to the pointer for returned data */
ltxt = (unsigned char *) malloc(pty_items);
@@ -1602,7 +1607,7 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
return;
/* check size and format of the property */
- XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
+ XGetWindowProperty(m_display, win, m_atom.XCLIP_OUT, 0, 0, False,
AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, &buffer);
@@ -1611,14 +1616,14 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
* to tell the other X client that we have read
* it and to send the next property */
XFree(buffer);
- XDeleteProperty(m_display, win, m_xclip_out);
+ XDeleteProperty(m_display, win, m_atom.XCLIP_OUT);
return;
}
if (pty_size == 0) {
/* no more data, exit from loop */
XFree(buffer);
- XDeleteProperty(m_display, win, m_xclip_out);
+ XDeleteProperty(m_display, win, m_atom.XCLIP_OUT);
*context = XCLIB_XCOUT_NONE;
/* this means that an INCR transfer is now
@@ -1630,7 +1635,7 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
/* if we have come this far, the property contains
* text, we know the size. */
- XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size,
+ XGetWindowProperty(m_display, win, m_atom.XCLIP_OUT, 0, (long) pty_size,
False, AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, &buffer);
@@ -1651,7 +1656,7 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
XFree(buffer);
/* delete property to get the next item */
- XDeleteProperty(m_display, win, m_xclip_out);
+ XDeleteProperty(m_display, win, m_atom.XCLIP_OUT);
XFlush(m_display);
return;
}
@@ -1661,7 +1666,7 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
{
Atom sseln;
- Atom target = m_utf8_string;
+ Atom target = m_atom.UTF8_STRING;
Window owner;
/* from xclip.c doOut() v0.11 */
@@ -1671,9 +1676,9 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
unsigned int context = XCLIB_XCOUT_NONE;
if (selection == True)
- sseln = m_primary;
+ sseln = m_atom.PRIMARY;
else
- sseln = m_clipboard;
+ sseln = m_atom.CLIPBOARD;
vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
vector<GHOST_IWindow *>::iterator win_it = win_vec.begin();
@@ -1683,7 +1688,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
/* check if we are the owner. */
owner = XGetSelectionOwner(m_display, sseln);
if (owner == win) {
- if (sseln == m_clipboard) {
+ if (sseln == m_atom.CLIPBOARD) {
sel_buf = (unsigned char *)malloc(strlen(txt_cut_buffer) + 1);
strcpy((char *)sel_buf, txt_cut_buffer);
return sel_buf;
@@ -1708,19 +1713,19 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
/* fallback is needed. set XA_STRING to target and restart the loop. */
if (context == XCLIB_XCOUT_FALLBACK) {
context = XCLIB_XCOUT_NONE;
- target = m_string;
+ target = m_atom.STRING;
continue;
}
else if (context == XCLIB_XCOUT_FALLBACK_UTF8) {
/* utf8 fail, move to compouned text. */
context = XCLIB_XCOUT_NONE;
- target = m_compound_text;
+ target = m_atom.COMPOUND_TEXT;
continue;
}
else if (context == XCLIB_XCOUT_FALLBACK_COMP) {
/* compouned text faile, move to text. */
context = XCLIB_XCOUT_NONE;
- target = m_text;
+ target = m_atom.TEXT;
continue;
}
@@ -1737,7 +1742,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
memcpy((char *)tmp_data, (char *)sel_buf, sel_len);
tmp_data[sel_len] = '\0';
- if (sseln == m_string)
+ if (sseln == m_atom.STRING)
XFree(sel_buf);
else
free(sel_buf);
@@ -1758,8 +1763,8 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
if (buffer) {
if (selection == False) {
- XSetSelectionOwner(m_display, m_clipboard, m_window, CurrentTime);
- owner = XGetSelectionOwner(m_display, m_clipboard);
+ XSetSelectionOwner(m_display, m_atom.CLIPBOARD, m_window, CurrentTime);
+ owner = XGetSelectionOwner(m_display, m_atom.CLIPBOARD);
if (txt_cut_buffer)
free((void *)txt_cut_buffer);
@@ -1767,8 +1772,8 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
strcpy(txt_cut_buffer, buffer);
}
else {
- XSetSelectionOwner(m_display, m_primary, m_window, CurrentTime);
- owner = XGetSelectionOwner(m_display, m_primary);
+ XSetSelectionOwner(m_display, m_atom.PRIMARY, m_window, CurrentTime);
+ owner = XGetSelectionOwner(m_display, m_atom.PRIMARY);
if (txt_select_buffer)
free((void *)txt_select_buffer);
@@ -1939,7 +1944,9 @@ void GHOST_SystemX11::initXInputDevices()
// printf("Tablet type:'%s', name:'%s', index:%d\n", device_type, device_info[i].name, i);
- if (m_xtablet.StylusDevice == NULL && is_stylus(device_info[i].name, device_type)) {
+ if ((m_xtablet.StylusDevice == NULL) &&
+ (is_stylus(device_info[i].name, device_type) || (device_info[i].type == m_atom.TABLET)))
+ {
// printf("\tfound stylus\n");
m_xtablet.StylusID = device_info[i].id;
m_xtablet.StylusDevice = XOpenDevice(m_display, m_xtablet.StylusID);
@@ -1952,11 +1959,18 @@ void GHOST_SystemX11::initXInputDevices()
// printf("\t\tfound ValuatorClass\n");
XValuatorInfo *xvi = (XValuatorInfo *)ici;
m_xtablet.PressureLevels = xvi->axes[2].max_value;
-
- /* this is assuming that the tablet has the same tilt resolution in both
- * positive and negative directions. It would be rather weird if it didn't.. */
- m_xtablet.XtiltLevels = xvi->axes[3].max_value;
- m_xtablet.YtiltLevels = xvi->axes[4].max_value;
+
+ if (xvi->num_axes > 3) {
+ /* this is assuming that the tablet has the same tilt resolution in both
+ * positive and negative directions. It would be rather weird if it didn't.. */
+ m_xtablet.XtiltLevels = xvi->axes[3].max_value;
+ m_xtablet.YtiltLevels = xvi->axes[4].max_value;
+ }
+ else {
+ m_xtablet.XtiltLevels = 0;
+ m_xtablet.YtiltLevels = 0;
+ }
+
break;
}
@@ -1967,7 +1981,9 @@ void GHOST_SystemX11::initXInputDevices()
m_xtablet.StylusID = 0;
}
}
- else if (m_xtablet.EraserDevice == NULL && is_eraser(device_info[i].name, device_type)) {
+ else if ((m_xtablet.EraserDevice == NULL) &&
+ (is_eraser(device_info[i].name, device_type)))
+ {
// printf("\tfound eraser\n");
m_xtablet.EraserID = device_info[i].id;
m_xtablet.EraserDevice = XOpenDevice(m_display, m_xtablet.EraserID);
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index 5fd494637f9..a11aea240be 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -274,34 +274,6 @@ public:
return 0;
}
- /**
- * Atom used for ICCCM, WM-spec and Motif.
- * We only need get this atom at the start, it's relative
- * to the display not the window and are public for every
- * window that need it.
- */
- Atom m_wm_state;
- Atom m_wm_change_state;
- Atom m_net_state;
- Atom m_net_max_horz;
- Atom m_net_max_vert;
- Atom m_net_fullscreen;
- Atom m_motif;
- Atom m_wm_take_focus;
- Atom m_wm_protocols;
- Atom m_delete_window_atom;
-
- /* Atoms for Selection, copy & paste. */
- Atom m_targets;
- Atom m_string;
- Atom m_compound_text;
- Atom m_text;
- Atom m_clipboard;
- Atom m_primary;
- Atom m_xclip_out;
- Atom m_incr;
- Atom m_utf8_string;
-
#ifdef WITH_X11_XINPUT
typedef struct GHOST_TabletX11 {
XDevice *StylusDevice;
@@ -323,6 +295,39 @@ public:
}
#endif // WITH_X11_XINPUT
+ struct {
+ /**
+ * Atom used for ICCCM, WM-spec and Motif.
+ * We only need get this atom at the start, it's relative
+ * to the display not the window and are public for every
+ * window that need it.
+ */
+ Atom WM_STATE;
+ Atom WM_CHANGE_STATE;
+ Atom _NET_WM_STATE;
+ Atom _NET_WM_STATE_MAXIMIZED_HORZ;
+ Atom _NET_WM_STATE_MAXIMIZED_VERT;
+ Atom _NET_WM_STATE_FULLSCREEN;
+ Atom _MOTIF_WM_HINTS;
+ Atom WM_TAKE_FOCUS;
+ Atom WM_PROTOCOLS;
+ Atom WM_DELETE_WINDOW;
+
+ /* Atoms for Selection, copy & paste. */
+ Atom TARGETS;
+ Atom STRING;
+ Atom COMPOUND_TEXT;
+ Atom TEXT;
+ Atom CLIPBOARD;
+ Atom PRIMARY;
+ Atom XCLIP_OUT;
+ Atom INCR;
+ Atom UTF8_STRING;
+#ifdef WITH_X11_XINPUT
+ Atom TABLET;
+#endif
+ } m_atom;
+
private:
Display *m_display;
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 7ef3a739b7e..50520b7eda5 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -395,16 +395,16 @@ GHOST_WindowX11(
XFree(xclasshint);
/* The basic for a good ICCCM "work" */
- if (m_system->m_wm_protocols) {
+ if (m_system->m_atom.WM_PROTOCOLS) {
natom = 0;
- if (m_system->m_delete_window_atom) {
- atoms[natom] = m_system->m_delete_window_atom;
+ if (m_system->m_atom.WM_DELETE_WINDOW) {
+ atoms[natom] = m_system->m_atom.WM_DELETE_WINDOW;
natom++;
}
- if (m_system->m_wm_take_focus) {
- atoms[natom] = m_system->m_wm_take_focus;
+ if (m_system->m_atom.WM_TAKE_FOCUS) {
+ atoms[natom] = m_system->m_atom.WM_TAKE_FOCUS;
natom++;
}
@@ -744,7 +744,7 @@ void GHOST_WindowX11::icccmSetState(int state)
xev.xclient.display = m_display;
xev.xclient.window = m_window;
xev.xclient.format = 32;
- xev.xclient.message_type = m_system->m_wm_change_state;
+ xev.xclient.message_type = m_system->m_atom.WM_CHANGE_STATE;
xev.xclient.data.l[0] = state;
XSendEvent(m_display, RootWindow(m_display, DefaultScreen(m_display)),
False, SubstructureNotifyMask | SubstructureRedirectMask, &xev);
@@ -758,8 +758,8 @@ int GHOST_WindowX11::icccmGetState(void) const
int format_ret, st;
prop_ret = NULL;
- st = XGetWindowProperty(m_display, m_window, m_system->m_wm_state, 0,
- 0x7fffffff, False, m_system->m_wm_state, &type_ret,
+ st = XGetWindowProperty(m_display, m_window, m_system->m_atom.WM_STATE, 0,
+ 0x7fffffff, False, m_system->m_atom.WM_STATE, &type_ret,
&format_ret, &num_ret, &bytes_after, &prop_ret);
if ((st == Success) && (prop_ret) && (num_ret == 2))
@@ -780,7 +780,7 @@ void GHOST_WindowX11::netwmMaximized(bool set)
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.window = m_window;
- xev.xclient.message_type = m_system->m_net_state;
+ xev.xclient.message_type = m_system->m_atom._NET_WM_STATE;
xev.xclient.format = 32;
if (set == True)
@@ -788,8 +788,8 @@ void GHOST_WindowX11::netwmMaximized(bool set)
else
xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
- xev.xclient.data.l[1] = m_system->m_net_max_horz;
- xev.xclient.data.l[2] = m_system->m_net_max_vert;
+ xev.xclient.data.l[1] = m_system->m_atom._NET_WM_STATE_MAXIMIZED_HORZ;
+ xev.xclient.data.l[2] = m_system->m_atom._NET_WM_STATE_MAXIMIZED_VERT;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
XSendEvent(m_display, RootWindow(m_display, DefaultScreen(m_display)),
@@ -806,15 +806,15 @@ bool GHOST_WindowX11::netwmIsMaximized(void) const
prop_ret = NULL;
st = False;
- ret = XGetWindowProperty(m_display, m_window, m_system->m_net_state, 0,
+ ret = XGetWindowProperty(m_display, m_window, m_system->m_atom._NET_WM_STATE, 0,
0x7fffffff, False, XA_ATOM, &type_ret, &format_ret,
&num_ret, &bytes_after, &prop_ret);
if ((ret == Success) && (prop_ret) && (format_ret == 32)) {
count = 0;
for (i = 0; i < num_ret; i++) {
- if (((unsigned long *) prop_ret)[i] == m_system->m_net_max_horz)
+ if (((unsigned long *) prop_ret)[i] == m_system->m_atom._NET_WM_STATE_MAXIMIZED_HORZ)
count++;
- if (((unsigned long *) prop_ret)[i] == m_system->m_net_max_vert)
+ if (((unsigned long *) prop_ret)[i] == m_system->m_atom._NET_WM_STATE_MAXIMIZED_VERT)
count++;
if (count == 2) {
st = True;
@@ -836,7 +836,7 @@ void GHOST_WindowX11::netwmFullScreen(bool set)
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.window = m_window;
- xev.xclient.message_type = m_system->m_net_state;
+ xev.xclient.message_type = m_system->m_atom._NET_WM_STATE;
xev.xclient.format = 32;
if (set == True)
@@ -844,7 +844,7 @@ void GHOST_WindowX11::netwmFullScreen(bool set)
else
xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
- xev.xclient.data.l[1] = m_system->m_net_fullscreen;
+ xev.xclient.data.l[1] = m_system->m_atom._NET_WM_STATE_FULLSCREEN;
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
@@ -862,12 +862,12 @@ bool GHOST_WindowX11::netwmIsFullScreen(void) const
prop_ret = NULL;
st = False;
- ret = XGetWindowProperty(m_display, m_window, m_system->m_net_state, 0,
+ ret = XGetWindowProperty(m_display, m_window, m_system->m_atom._NET_WM_STATE, 0,
0x7fffffff, False, XA_ATOM, &type_ret, &format_ret,
&num_ret, &bytes_after, &prop_ret);
if ((ret == Success) && (prop_ret) && (format_ret == 32)) {
for (i = 0; i < num_ret; i++) {
- if (((unsigned long *) prop_ret)[i] == m_system->m_net_fullscreen) {
+ if (((unsigned long *) prop_ret)[i] == m_system->m_atom._NET_WM_STATE_FULLSCREEN) {
st = True;
break;
}
@@ -889,8 +889,8 @@ void GHOST_WindowX11::motifFullScreen(bool set)
else
hints.decorations = 1;
- XChangeProperty(m_display, m_window, m_system->m_motif,
- m_system->m_motif, 32, PropModeReplace,
+ XChangeProperty(m_display, m_window, m_system->m_atom._MOTIF_WM_HINTS,
+ m_system->m_atom._MOTIF_WM_HINTS, 32, PropModeReplace,
(unsigned char *) &hints, 4);
}
@@ -905,8 +905,8 @@ bool GHOST_WindowX11::motifIsFullScreen(void) const
prop_ret = NULL;
state = False;
- st = XGetWindowProperty(m_display, m_window, m_system->m_motif, 0,
- 0x7fffffff, False, m_system->m_motif,
+ st = XGetWindowProperty(m_display, m_window, m_system->m_atom._MOTIF_WM_HINTS, 0,
+ 0x7fffffff, False, m_system->m_atom._MOTIF_WM_HINTS,
&type_ret, &format_ret, &num_ret,
&bytes_after, &prop_ret);
if ((st == Success) && (prop_ret)) {
diff --git a/intern/smoke/intern/FFT_NOISE.h b/intern/smoke/intern/FFT_NOISE.h
index 8b7e4f2728b..0d8be7db602 100644
--- a/intern/smoke/intern/FFT_NOISE.h
+++ b/intern/smoke/intern/FFT_NOISE.h
@@ -94,9 +94,9 @@ static void generatTile_FFT(float* const noiseTileData, std::string filename)
for (int x = 0; x < xRes; x++)
{
int index = x + y * xRes + z * xRes * yRes;
- float diff[] = {abs(x - xRes/2),
- abs(y - yRes/2),
- abs(z - zRes/2)};
+ float diff[] = {(float)abs(x - xRes / 2),
+ (float)abs(y - yRes / 2),
+ (float)abs(z - zRes / 2)};
float radius = sqrtf(diff[0] * diff[0] +
diff[1] * diff[1] +
diff[2] * diff[2]) / (xRes / 2);
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index a1d39286a90..5f0b2439200 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -1654,7 +1654,7 @@ void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame
fuel[index] -= burning_rate * dt;
if (fuel[index] < 0.0f) fuel[index] = 0.0f;
/* process reaction coordinate */
- if (orig_fuel) {
+ if (orig_fuel > FLT_EPSILON) {
react[index] *= fuel[index]/orig_fuel;
react_coord = react[index];
}
@@ -1681,7 +1681,7 @@ void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame
heat[index] = (1.0f-flame[index])*ignition_point + flame[index]*temp_max;
/* mix new color */
- if (r && smoke_emit) {
+ if (r && smoke_emit > FLT_EPSILON) {
float smoke_factor = smoke[index]/(orig_smoke+smoke_emit);
r[index] = (r[index] + _flame_smoke_color[0] * smoke_emit) * smoke_factor;
g[index] = (g[index] + _flame_smoke_color[1] * smoke_emit) * smoke_factor;
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 f0adc700a45..5381af8d543 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py
@@ -387,7 +387,7 @@ def dump_py_messages_from_files(messages, check_ctxt, files):
estr_ls.append(estr)
nds_ls.extend(nds)
ret = _extract_string_merge(estr_ls, nds_ls)
- print(ret)
+ #print(ret)
return ret
def extract_strings_split(node):
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index d9e0de64622..01bc925cedd 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -83,6 +83,7 @@ LANGUAGES = (
(37, "Amharic (አማርኛ)", "am_ET"),
(38, "Uzbek (Oʻzbek)", "uz_UZ"),
(39, "Uzbek Cyrillic (Ўзбек)", "uz_UZ@cyrillic"),
+ (40, "Hindi (मानक हिन्दी)", "hi_IN"),
)
# Name of language file used by Blender to generate translations' menu.
@@ -93,7 +94,7 @@ LANGUAGES_FILE = "languages"
IMPORT_MIN_LEVEL = -1
# Languages in /branches we do not want to import in /trunk currently...
-IMPORT_LANGUAGES_SKIP = {'am', 'bg', 'fi', 'el', 'et', 'ko', 'ne', 'pl', 'ro', 'uz', 'uz@cyrillic'}
+IMPORT_LANGUAGES_SKIP = {'am', 'bg', 'fi', 'el', 'et', 'hi', 'ne', 'pl', 'ro', 'uz', 'uz@cyrillic'}
# The comment prefix used in generated messages.txt file.
MSG_COMMENT_PREFIX = "#~ "
@@ -367,7 +368,10 @@ FILE_NAME_POT = os.path.join(TRUNK_PO_DIR, ".".join((DOMAIN, "pot")))
# Other py files that should be searched for ui strings, relative to SOURCE_DIR.
# Needed for Cycles, currently...
-CUSTOM_PY_UI_FILES = [os.path.join("intern", "cycles", "blender", "addon", "ui.py"),]
+CUSTOM_PY_UI_FILES = [
+ os.path.join("intern", "cycles", "blender", "addon", "ui.py"),
+ os.path.join("release", "scripts", "modules", "rna_prop_ui.py"),
+]
# A cache storing validated msgids, to avoid re-spellchecking them.
diff --git a/release/scripts/modules/bl_i18n_utils/spell_check_utils.py b/release/scripts/modules/bl_i18n_utils/spell_check_utils.py
index 2aa3598e4a1..f2d777d22f1 100644
--- a/release/scripts/modules/bl_i18n_utils/spell_check_utils.py
+++ b/release/scripts/modules/bl_i18n_utils/spell_check_utils.py
@@ -225,6 +225,7 @@ dict_uimsgs = {
"loc", "rot", "pos",
"lorem",
"luma",
+ "mem",
"multicam",
"num",
"ok",
diff --git a/release/scripts/modules/bl_i18n_utils/update_po.py b/release/scripts/modules/bl_i18n_utils/update_po.py
index 6e03226f6d3..eb12782264a 100755
--- a/release/scripts/modules/bl_i18n_utils/update_po.py
+++ b/release/scripts/modules/bl_i18n_utils/update_po.py
@@ -97,10 +97,13 @@ def main():
if os.path.exists(po):
pool_data.append((po, lang, pot_msgs))
- with concurrent.futures.ProcessPoolExecutor() as executor:
- for r in executor.map(process_po, pool_data, timeout=600):
- if r != 0:
- ret = r
+ for r in map(process_po, pool_data):
+ if r != 0:
+ ret = r
+ #with concurrent.futures.ProcessPoolExecutor() as executor:
+ #for r in executor.map(process_po, pool_data, timeout=600):
+ #if r != 0:
+ #ret = r
return ret
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py
index d04e8bead7a..f7a74808d47 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -21,6 +21,7 @@
# Some misc utilities...
import collections
+import concurrent.futures
import copy
import os
import re
@@ -61,6 +62,35 @@ def is_valid_po_path(path):
return bool(_valid_po_path_re.match(path))
+def get_best_similar(data):
+ import difflib
+ key, use_similar, similar_pool = data
+
+ # try to find some close key in existing messages...
+ # Optimized code inspired by difflib.get_close_matches (as we only need the best match).
+ # We also consider to never make a match when len differs more than -len_key / 2, +len_key * 2 (which is valid
+ # as long as use_similar is not below ~0.7).
+ # Gives an overall ~20% of improvement!
+ #tmp = difflib.get_close_matches(key[1], similar_pool, n=1, cutoff=use_similar)
+ #if tmp:
+ #tmp = tmp[0]
+ tmp = None
+ s = difflib.SequenceMatcher()
+ s.set_seq2(key[1])
+ len_key = len(key[1])
+ min_len = len_key // 2
+ max_len = len_key * 2
+ for x in similar_pool:
+ if min_len < len(x) < max_len:
+ s.set_seq1(x)
+ if s.real_quick_ratio() >= use_similar and s.quick_ratio() >= use_similar:
+ sratio = s.ratio()
+ if sratio >= use_similar:
+ tmp = x
+ use_similar = sratio
+ return key, tmp
+
+
class I18nMessage:
"""
Internal representation of a message.
@@ -233,40 +263,71 @@ class I18nMessages:
existing one. Messages no more found in ref will be marked as commented if keep_old_commented is True,
or removed.
"""
- import difflib
similar_pool = {}
if use_similar > 0.0:
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():
- if key in self.msgs:
- msgs[key] = self.msgs[key]
- msgs[key].sources = msg.sources
- else:
- skey = None
- if use_similar > 0.0:
- # try to find some close key in existing messages...
- tmp = difflib.get_close_matches(key[1], similar_pool, n=1, cutoff=use_similar)
- if tmp:
- tmp = tmp[0]
+ msgs = self._new_messages().fromkeys(ref.msgs.keys())
+ ref_keys = set(ref.msgs.keys())
+ org_keys = set(self.msgs.keys())
+ new_keys = ref_keys - org_keys
+ removed_keys = org_keys - ref_keys
+
+ # First process keys present in both org and ref messages.
+ for key in ref_keys - new_keys:
+ msg, refmsg = self.msgs[key], ref.msgs[key]
+ msg.sources = refmsg.sources
+ msg.is_commented = refmsg.is_commented
+ msg.is_fuzzy = refmsg.is_fuzzy
+ msgs[key] = msg
+
+ # Next process new keys.
+ if use_similar > 0.0:
+ with concurrent.futures.ProcessPoolExecutor() as exctr:
+ for key, msgid in exctr.map(get_best_similar,
+ tuple((nk, use_similar, tuple(similar_pool.keys())) for nk in new_keys)):
+ if msgid:
# Try to get the same context, else just get one...
- skey = (key[0], tmp)
- if skey not in similar_pool[tmp]:
- skey = tuple(similar_pool[tmp])[0]
- msgs[key] = msg
- if skey:
- msgs[key].msgstr = self.msgs[skey].msgstr
- msgs[key].is_fuzzy = True
+ skey = (key[0], msgid)
+ if skey not in similar_pool[msgid]:
+ skey = tuple(similar_pool[msgid])[0]
+ # We keep org translation and comments, and mark message as fuzzy.
+ msg, refmsg = copy.deepcopy(self.msgs[skey]), ref.msgs[key]
+ msg.msgctxt = refmsg.msgctxt
+ msg.msgid = refmsg.msgid
+ msg.sources = refmsg.sources
+ msg.is_fuzzy = True
+ msg.is_commented = refmsg.is_commented
+ msgs[key] = msg
+ else:
+ msgs[key] = ref.msgs[key]
+ else:
+ for key in new_keys:
+ msgs[key] = ref.msgs[key]
+
# 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 and msg.msgstr:
- msgs[key] = msg
- msgs[key].is_commented = True
+ for key in removed_keys:
+ msgs[key] = self.msgs[key]
+ msgs[key].is_commented = True
+ msgs[key].sources = []
+
+ # Special 'meta' message, change project ID version and pot creation date...
+ key = ("", "")
+ rep = []
+ markers = ("Project-Id-Version:", "POT-Creation-Date:")
+ for mrk in markers:
+ for rl in ref.msgs[key].msgstr_lines:
+ if rl.startswith(mrk):
+ for idx, ml in enumerate(msgs[key].msgstr_lines):
+ if ml.startswith(mrk):
+ rep.append((idx, rl))
+ for idx, txt in rep:
+ msgs[key].msgstr_lines[idx] = txt
+
# And finalize the update!
self.msgs = msgs
diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py
index 34b7a9ea7b6..3a2f9bde2c7 100644
--- a/release/scripts/modules/bpy/__init__.py
+++ b/release/scripts/modules/bpy/__init__.py
@@ -58,6 +58,7 @@ def main():
# from bpy.types import Panel
sys.modules["bpy.app"] = app
sys.modules["bpy.app.handlers"] = app.handlers
+ sys.modules["bpy.app.translations"] = app.translations
sys.modules["bpy.types"] = types
#~ if "-d" in sys.argv: # Enable this to measure start up speed
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index 5e8bccb815e..dd0cd632413 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -148,7 +148,7 @@ def draw(layout, context, context_member, property_type, use_edit=True):
if use_edit:
row = split.row(align=True)
- props = row.operator("wm.properties_edit", text="edit")
+ props = row.operator("wm.properties_edit", text="Edit")
assign_props(props, val_draw, key)
props = row.operator("wm.properties_remove", text="", icon='ZOOMOUT')
diff --git a/release/scripts/presets/interface_theme/back_to_black.xml b/release/scripts/presets/interface_theme/back_to_black.xml
index 3af07c0cb4e..bb625c6452c 100644
--- a/release/scripts/presets/interface_theme/back_to_black.xml
+++ b/release/scripts/presets/interface_theme/back_to_black.xml
@@ -296,8 +296,8 @@
</panelcolors>
<gradients>
<ThemeGradientColors show_grad="FALSE"
- gradient="#000000"
- high_gradient="#393939">
+ gradient="#393939"
+ high_gradient="#000000">
</ThemeGradientColors>
</gradients>
</ThemeSpaceGradient>
diff --git a/release/scripts/presets/interface_theme/blender_24x.xml b/release/scripts/presets/interface_theme/blender_24x.xml
index 1c3df142c77..3e84d2aee41 100644
--- a/release/scripts/presets/interface_theme/blender_24x.xml
+++ b/release/scripts/presets/interface_theme/blender_24x.xml
@@ -297,7 +297,7 @@
<gradients>
<ThemeGradientColors show_grad="FALSE"
gradient="#000000"
- high_gradient="#393939">
+ high_gradient="#757575">
</ThemeGradientColors>
</gradients>
</ThemeSpaceGradient>
diff --git a/release/scripts/presets/interface_theme/elsyiun.xml b/release/scripts/presets/interface_theme/elsyiun.xml
index ef49cb31cbd..3cb75323c97 100644
--- a/release/scripts/presets/interface_theme/elsyiun.xml
+++ b/release/scripts/presets/interface_theme/elsyiun.xml
@@ -297,7 +297,7 @@
<gradients>
<ThemeGradientColors show_grad="FALSE"
gradient="#000000"
- high_gradient="#393939">
+ high_gradient="#4b4b4b">
</ThemeGradientColors>
</gradients>
</ThemeSpaceGradient>
diff --git a/release/scripts/presets/interface_theme/hexagon.xml b/release/scripts/presets/interface_theme/hexagon.xml
index 0b6e626268f..4072b36a169 100644
--- a/release/scripts/presets/interface_theme/hexagon.xml
+++ b/release/scripts/presets/interface_theme/hexagon.xml
@@ -297,7 +297,7 @@
<gradients>
<ThemeGradientColors show_grad="FALSE"
gradient="#000000"
- high_gradient="#393939">
+ high_gradient="#7f818d">
</ThemeGradientColors>
</gradients>
</ThemeSpaceGradient>
diff --git a/release/scripts/presets/interface_theme/ubuntu_ambiance.xml b/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
index 9786d609983..d51d34f041d 100644
--- a/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
+++ b/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
@@ -297,7 +297,7 @@
<gradients>
<ThemeGradientColors show_grad="FALSE"
gradient="#000000"
- high_gradient="#393939">
+ high_gradient="#131311">
</ThemeGradientColors>
</gradients>
</ThemeSpaceGradient>
diff --git a/release/scripts/presets/keyconfig/maya.py b/release/scripts/presets/keyconfig/maya.py
index cea2f451305..d6805fb3484 100644
--- a/release/scripts/presets/keyconfig/maya.py
+++ b/release/scripts/presets/keyconfig/maya.py
@@ -133,46 +133,54 @@ kmi = km.keymap_items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.value_1 = 'TEXTURED'
kmi.properties.value_2 = 'SOLID'
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'CLICK')
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE')
kmi.properties.extend = False
kmi.properties.center = False
kmi.properties.object = False
kmi.properties.enumerate = False
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'CLICK', shift=True)
-kmi.properties.extend = True
+kmi.properties.toggle = False
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True)
+kmi.properties.extend = False
kmi.properties.center = False
kmi.properties.object = False
kmi.properties.enumerate = False
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'CLICK', ctrl=True)
+kmi.properties.toggle = True
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', ctrl=True)
kmi.properties.extend = False
kmi.properties.center = True
kmi.properties.object = False
kmi.properties.enumerate = False
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'CLICK', alt=True)
+kmi.properties.toggle = False
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', alt=True)
kmi.properties.extend = False
kmi.properties.center = False
kmi.properties.object = False
kmi.properties.enumerate = True
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'CLICK', shift=True, ctrl=True)
+kmi.properties.toggle = False
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True, ctrl=True)
kmi.properties.extend = True
kmi.properties.center = True
kmi.properties.object = False
kmi.properties.enumerate = False
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'CLICK', ctrl=True, alt=True)
+kmi.properties.toggle = True
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', ctrl=True, alt=True)
kmi.properties.extend = False
kmi.properties.center = True
kmi.properties.object = False
kmi.properties.enumerate = True
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'CLICK', shift=True, alt=True)
+kmi.properties.toggle = False
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True, alt=True)
kmi.properties.extend = True
kmi.properties.center = False
kmi.properties.object = False
kmi.properties.enumerate = True
-kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'CLICK', shift=True, ctrl=True, alt=True)
+kmi.properties.toggle = True
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True, ctrl=True, alt=True)
kmi.properties.extend = True
kmi.properties.center = True
kmi.properties.object = False
kmi.properties.enumerate = True
+kmi.properties.toggle = True
kmi = km.keymap_items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY')
kmi.properties.extend = False
kmi = km.keymap_items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
@@ -218,7 +226,7 @@ kmi.properties.use = True
kmi = km.keymap_items.new('transform.mirror', 'M', 'PRESS', ctrl=True)
kmi = km.keymap_items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True)
kmi.properties.data_path = 'tool_settings.use_snap'
-kmi = km.keymap_items.new('WM_OT_context_menu_enum', 'TAB', 'PRESS', shift=True, ctrl=True);
+kmi = km.keymap_items.new('WM_OT_context_menu_enum', 'TAB', 'PRESS', shift=True, ctrl=True)
kmi.properties.data_path = 'tool_settings.snap_element'
kmi = km.keymap_items.new('view3d.enable_manipulator', 'W', 'PRESS')
@@ -310,10 +318,8 @@ kmi = km.keymap_items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True)
kmi.properties.level = 4
kmi = km.keymap_items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True)
kmi.properties.level = 5
-# TODO: only used to de-seletc everything when click outside of object,
-# and that's not best way to do this and this way is completely unpredictable
-#kmi = km.keymap_items.new('object.select_all', 'SELECTMOUSE', 'CLICK')
-#kmi.properties.action = 'DESELECT'
+kmi = km.keymap_items.new('object.select_all', 'SELECTMOUSE', 'CLICK')
+kmi.properties.action = 'DESELECT'
# Map Mesh
km = kc.keymaps.new('Mesh', space_type='EMPTY', region_type='WINDOW', modal=False)
@@ -399,10 +405,8 @@ kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
kmi.properties.data_path = 'tool_settings.proportional_edit'
kmi.properties.value_1 = 'DISABLED'
kmi.properties.value_2 = 'CONNECTED'
-# TODO: only used to de-seletc everything when click outside of object,
-# and that's not best way to do this and this way is completely unpredictable
-#kmi = km.keymap_items.new('mesh.select_all', 'SELECTMOUSE', 'CLICK')
-#kmi.properties.action = 'DESELECT'
+kmi = km.keymap_items.new('mesh.select_all', 'SELECTMOUSE', 'CLICK')
+kmi.properties.action = 'DESELECT'
kmi = km.keymap_items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True)
kmi.properties.level = 0
kmi = km.keymap_items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True)
diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py
index 161349152d5..bb3a9a6330f 100644
--- a/release/scripts/startup/bl_operators/rigidbody.py
+++ b/release/scripts/startup/bl_operators/rigidbody.py
@@ -54,7 +54,7 @@ class CopyRigidbodySettings(Operator):
for o in objects:
if o.rigid_body is None:
continue
-
+
o.rigid_body.type = obj.rigid_body.type
o.rigid_body.kinematic = obj.rigid_body.kinematic
o.rigid_body.mass = obj.rigid_body.mass
@@ -144,7 +144,7 @@ class BakeToKeyframes(Operator):
# this is a little roundabout but there's no better way right now
aa = mat.to_quaternion().to_axis_angle()
obj.rotation_axis_angle = (aa[1], ) + aa[0][:]
- else: # euler
+ else: # euler
# make sure euler rotation is compatible to previous frame
obj.rotation_euler = mat.to_euler(rot_mode, obj_prev.rotation_euler)
@@ -190,7 +190,8 @@ class BakeToKeyframes(Operator):
class ConnectRigidBodies(Operator):
- '''Create rigid body constraints between selected and active rigid bodies'''
+ """Create rigid body constraints between """ \
+ """selected and active rigid bodies"""
bl_idname = "rigidbody.connect"
bl_label = "Connect Rigid Bodies"
bl_options = {'REGISTER', 'UNDO'}
@@ -232,7 +233,11 @@ class ConnectRigidBodies(Operator):
loc = obj.location
else:
loc = (obj_act.location + obj.location) / 2.0
- bpy.ops.object.add(type='EMPTY', view_align=False, enter_editmode=False, location=loc)
+ # TODO: use bpy.data.objects.new(...)
+ bpy.ops.object.add(type='EMPTY',
+ view_align=False,
+ enter_editmode=False,
+ location=loc)
bpy.ops.rigidbody.constraint_add()
con_obj = context.active_object
con_obj.empty_draw_type = 'ARROWS'
@@ -241,12 +246,12 @@ class ConnectRigidBodies(Operator):
con.object1 = obj_act
con.object2 = obj
change = True
-
+
if change:
# restore selection
bpy.ops.object.select_all(action='DESELECT')
for obj in objects:
- obj.select = True;
+ obj.select = True
scene.objects.active = obj_act
return {'FINISHED'}
else:
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index 1643210704e..0f9d525f168 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -124,7 +124,7 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, Panel):
rows = 2
if group:
rows = 5
- row.template_list("UI_UL_list", "", pose, "bone_groups", pose.bone_groups, "active_index", rows=rows)
+ row.template_list("UI_UL_list", "bone_groups", pose, "bone_groups", pose.bone_groups, "active_index", rows=rows)
col = row.column(align=True)
col.active = (ob.proxy is None)
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 679b33292e5..7be00193fb4 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Panel
+from bpy.app.translations import pgettext_iface as iface_
class ModifierButtonsPanel():
@@ -265,8 +266,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.prop(md, "angle_limit")
layout.prop(md, "use_dissolve_boundaries")
- pgettext = bpy.app.translations.pgettext
- layout.label(text=pgettext("Face Count: %d") % md.face_count, translate=False)
+ layout.label(text=iface_("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_material.py b/release/scripts/startup/bl_ui/properties_material.py
index 9b7cfe89a08..273b2450200 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -20,6 +20,7 @@
import bpy
from bpy.types import Menu, Panel, UIList
from rna_prop_ui import PropertyPanel
+from bpy.app.translations import pgettext_iface as iface_
def active_node_mat(mat):
@@ -80,8 +81,7 @@ class MATERIAL_UL_matslots(UIList):
if ma and not context.scene.render.use_shading_nodes:
manode = ma.active_node_material
if manode:
- pgettext = bpy.app.translations.pgettext
- layout.label(text=pgettext("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode))
+ layout.label(text=iface_("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode))
elif ma.use_nodes:
layout.label(text="Node <none>")
else:
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 022f2500940..7c06aefe575 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -82,7 +82,7 @@ def brush_texture_settings(layout, brush, sculpt):
else:
layout.row().prop(tex_slot, "tex_paint_map_mode", text="")
layout.separator()
-
+
# angle and texture_angle_source
col = layout.column()
if sculpt:
@@ -101,7 +101,7 @@ def brush_texture_settings(layout, brush, sculpt):
split = layout.split()
split.prop(tex_slot, "offset")
split.prop(tex_slot, "scale")
-
+
if sculpt:
# texture_sample_bias
col = layout.column(align=True)
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index aef860e774b..0aa2c14a0c7 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -20,6 +20,7 @@
import bpy
from bpy.types import Panel
from rna_prop_ui import PropertyPanel
+from bpy.app.translations import pgettext_iface as iface_
from bl_ui.properties_physics_common import (point_cache_ui,
effector_weights_ui,
@@ -148,8 +149,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
#row.label(text="Render")
if part.is_fluid:
- pgettext = bpy.app.translations.pgettext
- layout.label(text=pgettext("%d fluid particles for this frame") % part.count, translate=False)
+ layout.label(text=iface_("%d fluid particles for this frame") % part.count, translate=False)
return
row = col.row()
@@ -543,7 +543,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
# spacing between particles when the fluid is at rest. This
# makes it easier to set stable initial conditions.
particle_volume = part.mass / fluid.rest_density
- spacing = pow(particle_volume, 1/3)
+ spacing = pow(particle_volume, 1.0 / 3.0)
sub = col.row()
sub.label(text="Spacing: %g" % spacing)
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
index 17a44a523dc..90cf397f526 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -21,6 +21,8 @@
import bpy
from bpy.types import Panel
+i18n_default_ctxt = bpy.app.translations.contexts.default
+
class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
@@ -37,19 +39,21 @@ def physics_add(self, layout, md, name, type, typeicon, toggles):
sub = layout.row(align=True)
if md:
sub.context_pointer_set("modifier", md)
- sub.operator("object.modifier_remove", text=name, icon='X')
+ sub.operator("object.modifier_remove", text=name, text_ctxt=i18n_default_ctxt, icon='X')
if(toggles):
sub.prop(md, "show_render", text="")
sub.prop(md, "show_viewport", text="")
else:
- sub.operator("object.modifier_add", text=name, icon=typeicon).type = type
+ sub.operator("object.modifier_add", text=name, text_ctxt=i18n_default_ctxt, icon=typeicon).type = type
+
def physics_add_special(self, layout, data, name, addop, removeop, typeicon):
sub = layout.row(align=True)
if data:
- sub.operator(removeop, text=name, icon='X')
+ sub.operator(removeop, text=name, text_ctxt=i18n_default_ctxt, icon='X')
else:
- sub.operator(addop, text=name, icon=typeicon)
+ sub.operator(addop, text=name, text_ctxt=i18n_default_ctxt, icon=typeicon)
+
class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
bl_label = ""
@@ -86,13 +90,13 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
physics_add_special(self, col, ob.rigid_body, "Rigid Body",
"rigidbody.object_add",
"rigidbody.object_remove",
- 'MESH_ICOSPHERE') # XXX: need dedicated icon
+ 'MESH_ICOSPHERE') # XXX: need dedicated icon
# all types of objects can have rigid body constraint
physics_add_special(self, col, ob.rigid_body_constraint, "Rigid Body Constraint",
"rigidbody.constraint_add",
"rigidbody.constraint_remove",
- 'CONSTRAINT') # RB_TODO needs better icon
+ 'CONSTRAINT') # RB_TODO needs better icon
# cache-type can be 'PSYS' 'HAIR' 'SMOKE' etc
diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py
index c03b5323105..2164b86f486 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fluid.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py
@@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Panel, Menu
+from bpy.app.translations import pgettext_iface as iface_
class FLUID_MT_presets(Menu):
@@ -64,8 +65,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
if fluid.type == 'DOMAIN':
# odd formatting here so translation script can extract string
- pgettext = bpy.app.translations.pgettext
- layout.operator("fluid.bake", text=pgettext("Bake (Req. Memory: %s)") % fluid.memory_estimate,
+ layout.operator("fluid.bake", text=iface_("Bake (Req. Memory: %s)") % fluid.memory_estimate,
translate=False, icon='MOD_FLUIDSIM')
split = layout.split()
diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
index f335c560f7b..922eee66ddc 100644
--- a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
+++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
@@ -32,22 +32,22 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
@classmethod
def poll(cls, context):
- ob = context.object
- rd = context.scene.render
- return (ob and ob.rigid_body and (not rd.use_game_engine))
+ obj = context.object
+ return (obj and obj.rigid_body and
+ (not context.scene.render.use_game_engine))
def draw_header(self, context):
obj = context.object
rbo = obj.rigid_body
if rbo is not None:
- self.layout.prop(rbo, "enabled", text="");
+ self.layout.prop(rbo, "enabled", text="")
def draw(self, context):
layout = self.layout
ob = context.object
rbo = ob.rigid_body
-
+
if rbo is not None:
layout.prop(rbo, "type", text="Type")
layout.prop(rbo, "kinematic", text="Animated")
@@ -61,34 +61,35 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
@classmethod
def poll(cls, context):
- return (context.object and context.object.rigid_body and
+ obj = context.object
+ return (obj and obj.rigid_body and
(not context.scene.render.use_game_engine))
-
+
def draw(self, context):
layout = self.layout
ob = context.object
rbo = ob.rigid_body
-
+
layout.prop(rbo, "collision_shape", text="Shape")
-
+
split = layout.split()
-
+
col = split.column()
col.label(text="Surface Response:")
col.prop(rbo, "friction")
col.prop(rbo, "restitution", text="Bounciness")
-
+
col = split.column()
col.label(text="Sensitivity:")
if rbo.collision_shape in {'MESH', 'CONE'}:
col.prop(rbo, "collision_margin", text="Margin")
else:
- col.prop(rbo, "use_margin");
+ col.prop(rbo, "use_margin")
sub = col.column()
sub.active = rbo.use_margin
sub.prop(rbo, "collision_margin", text="Margin")
-
+
layout.prop(rbo, "collision_groups")
@@ -98,22 +99,23 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
@classmethod
def poll(cls, context):
- return (context.object and context.object.rigid_body and
- context.object.rigid_body.type == 'ACTIVE' and
+ obj = context.object
+ return (obj and obj.rigid_body and
+ obj.rigid_body.type == 'ACTIVE' and
(not context.scene.render.use_game_engine))
-
+
def draw(self, context):
layout = self.layout
ob = context.object
rbo = ob.rigid_body
-
+
#col = layout.column(align=1)
#col.label(text="Activation:")
# XXX: settings such as activate on collison/etc.
-
- split = layout.split();
-
+
+ split = layout.split()
+
col = split.column()
col.label(text="Deactivation:")
col.prop(rbo, "use_deactivation")
@@ -123,7 +125,7 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
sub.prop(rbo, "deactivate_linear_velocity", text="Linear Vel")
sub.prop(rbo, "deactivate_angular_velocity", text="Angular Vel")
# TODO: other params such as time?
-
+
col = split.column()
col.label(text="Damping:")
col.prop(rbo, "linear_damping", text="Translation")
diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
index 49b760ef546..e4e5b94407d 100644
--- a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
@@ -173,7 +173,7 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa
sub.prop(rbc, "limit_ang_z_lower", text="Lower")
sub.prop(rbc, "limit_ang_z_upper", text="Upper")
- if rbc.type == 'GENERIC_SPRING':
+ if rbc.type == 'GENERIC_SPRING':
col = layout.column(align=True)
col.label("Springs:")
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index b9b57923420..68a097e6188 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -26,6 +26,7 @@ from bl_ui.properties_physics_common import (
effector_weights_ui,
)
+
class SCENE_UL_keying_set_paths(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
# assert(isinstance(item, bpy.types.KeyingSetPath)
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 84f26acb4cc..bc5d89fd45b 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -20,6 +20,7 @@
import bpy
from bpy.types import Panel, Header, Menu, UIList
+from bpy.app.translations import pgettext_iface as iface_
class CLIP_UL_tracking_objects(UIList):
@@ -28,10 +29,14 @@ class CLIP_UL_tracking_objects(UIList):
# assert(isinstance(item, bpy.types.MovieTrackingObject)
tobj = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
- layout.label(text=tobj.name, translate=False, 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(text="", 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):
@@ -907,7 +912,7 @@ 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")
+ text = iface_("Zoom %d:%d")
for a, b in ratios:
layout.operator("clip.view_zoom_ratio",
text=text % (a, b),
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 6d08663006f..01b67667cfb 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -19,8 +19,9 @@
# <pep8 compliant>
import bpy
from bpy.types import Header, Menu, Panel
-from bl_ui.properties_paint_common import UnifiedPaintPanel
-from bl_ui.properties_paint_common import brush_texture_settings
+from bl_ui.properties_paint_common import UnifiedPaintPanel, brush_texture_settings
+from bpy.app.translations import pgettext_iface as iface_
+
class ImagePaintPanel(UnifiedPaintPanel):
bl_space_type = 'IMAGE_EDITOR'
@@ -70,10 +71,8 @@ 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=pgettext("Zoom %d:%d") % (a, b),
- translate=False).ratio = a / b
+ layout.operator("image.view_zoom_ratio", text=iface_("Zoom %d:%d") % (a, b), translate=False).ratio = a / b
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index 47e8844742a..51c975c3e70 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -65,7 +65,7 @@ class INFO_HT_header(Header):
row = layout.row(align=True)
row.operator("wm.splash", text="", icon='BLENDER', emboss=False)
- row.label(text=scene.statistics())
+ row.label(text=scene.statistics(), translate=False)
# XXX: BEFORE RELEASE, MOVE FILE MENU OUT OF INFO!!!
"""
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index b8f44a621a9..7841acf01b3 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Header, Menu, Panel
+from bpy.app.translations import pgettext_iface as iface_
def act_strip(context):
@@ -420,19 +421,17 @@ 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=pgettext("Final Length: %s") % bpy.utils.smpte_from_frame(strip.frame_final_duration),
+ row.label(text=iface_("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=pgettext("Playhead: %d") % (frame_current - strip.frame_start), translate=False)
+ row.label(text=iface_("Playhead: %d") % (frame_current - strip.frame_start), translate=False)
- 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),
+ col.label(text=iface_("Frame Offset %d:%d") % (strip.frame_offset_start, strip.frame_offset_end),
translate=False)
+ col.label(text=iface_("Frame Still %d:%d") % (strip.frame_still_start, strip.frame_still_end), translate=False)
elem = False
@@ -442,7 +441,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=pgettext("Original Dimension: %dx%d") % (elem.orig_width, elem.orig_height), translate=False)
+ col.label(text=iface_("Original Dimension: %dx%d") % (elem.orig_width, elem.orig_height), translate=False)
else:
col.label(text="Original Dimension: None")
@@ -719,8 +718,7 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
if scene:
sta = scene.frame_start
end = scene.frame_end
- pgettext = bpy.app.translations.pgettext
- layout.label(text=pgettext("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
+ layout.label(text=iface_("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
@@ -749,8 +747,7 @@ class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
if mask:
sta = mask.frame_start
end = mask.frame_end
- pgettext = bpy.app.translations.pgettext
- layout.label(text=pgettext("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
+ layout.label(text=iface_("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 b32172e25e0..4264fc95cea 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -19,6 +19,7 @@
# <pep8-80 compliant>
import bpy
from bpy.types import Header, Menu, Panel
+from bpy.app.translations import pgettext_iface as iface_
class TEXT_HT_header(Header):
@@ -71,12 +72,11 @@ class TEXT_HT_header(Header):
row = layout.row()
if text.filepath:
- pgettext = bpy.app.translations.pgettext
if text.is_dirty:
- row.label(text=pgettext("File: *%r (unsaved)") %
+ row.label(text=iface_("File: *%r (unsaved)") %
text.filepath, translate=False)
else:
- row.label(text=pgettext("File: %r") %
+ row.label(text=iface_("File: %r") %
text.filepath, translate=False)
else:
row.label(text="Text: External"
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 5bb83e7f429..017f75b7583 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Header, Menu, Panel
+from bpy.app.translations import pgettext_iface as iface_
def ui_style_items(col, context):
@@ -778,10 +779,9 @@ 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=pgettext("Color Set %d:") % (i + 1), translate=False) # i starts from 0
+ col.label(text=iface_("Color Set %d:") % (i + 1), translate=False) # i starts from 0
row = col.row()
diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py
index db78adcb576..e9eb2aa8b8f 100644
--- a/release/scripts/startup/bl_ui/space_userpref_keymap.py
+++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py
@@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Menu
+from bpy.app.translations import pgettext_iface as iface_
class USERPREF_MT_keyconfigs(Menu):
@@ -97,8 +98,7 @@ class InputKeyMapPanel:
subcol = self.indented_layout(col, level + 1)
subrow = subcol.row()
subrow.prop(km, "show_expanded_items", text="", emboss=False)
- pgettext = bpy.app.translations.pgettext
- subrow.label(text=pgettext("%s (Global)") % km.name, translate=False)
+ subrow.label(text=iface_("%s (Global)") % km.name, translate=False)
else:
km.show_expanded_items = True
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 0e35a154f86..aafa4f1fe06 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2710,7 +2710,7 @@ class VIEW3D_PT_etch_a_ton(Panel):
colsub = col.column(align=True)
colsub.prop(toolsettings, "use_etch_autoname")
- sub = colsub.column()
+ sub = colsub.column()
sub.enabled = not toolsettings.use_etch_autoname
sub.prop(toolsettings, "etch_number")
sub.prop(toolsettings, "etch_side")
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index 5b2c4e87165..8a99f486783 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -112,9 +112,13 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
/* Default, void context.
* WARNING! The "" context is not the same as no (NULL) context at mo/boost::locale level!
+ * NOTE: We translate BLF_I18NCONTEXT_DEFAULT as BLF_I18NCONTEXT_DEFAULT_BPY in Python, as we can’t use "natural"
+ * None value in rna string properties... :/
+ * For perf reason, we only use the first char to detect this context, so other contexts should never start
+ * with the same char!
*/
-#define BLF_I18NCONTEXT_DEFAULT NULL /* Translated as None in Python. */
-#define BLF_I18NCONTEXT_DEFAULT_BPY_INTERN "" /* Only used in code, never exposed to user! */
+#define BLF_I18NCONTEXT_DEFAULT NULL
+#define BLF_I18NCONTEXT_DEFAULT_BPY "*"
/* Default context for operator names/labels. */
#define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
@@ -168,7 +172,8 @@ typedef struct
#define BLF_I18NCONTEXTS_ITEM(ctxt_id, py_id) {#ctxt_id, py_id, ctxt_id}
#define BLF_I18NCONTEXTS_DESC { \
- BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT, "default"), \
+ BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT, "default_real"), \
+ BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT_BPY, "default"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "operator_default"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ACTION, "id_action"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ARMATURE, "id_armature"), \
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index a77b464822b..b5b72b68677 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -94,9 +94,9 @@ const char *BLF_pgettext(const char *msgctxt, const char *msgid)
const char *ret;
/*if (msgctxt && !strcmp(msgctxt, BLF_I18NCONTEXT_DEFAULT_BPY_INTERN)) { */
- if (msgctxt && !msgctxt[0]) {
- /* BLF_I18NCONTEXT_DEFAULT_BPY_INTERN context is reserved and considered the same as default NULL one. */
- msgctxt = NULL;
+ if (msgctxt && msgctxt[0] == BLF_I18NCONTEXT_DEFAULT_BPY[0]) {
+ /* BLF_I18NCONTEXT_DEFAULT_BPY context is reserved and considered the same as default NULL one. */
+ msgctxt = BLF_I18NCONTEXT_DEFAULT;
}
ret = bl_locale_pgettext(msgctxt, msgid);
/* We assume if the returned string is the same (memory level) as the msgid, no translation was found,
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index ab27421b383..0fa7356b64e 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -56,6 +56,7 @@ void defvert_remove_group(struct MDeformVert *dvert, struct
void defvert_clear(struct MDeformVert *dvert);
int defvert_find_shared(const struct MDeformVert *dvert_a, const struct MDeformVert *dvert_b);
+void BKE_defvert_array_free_elems(struct MDeformVert *dvert, int totvert);
void BKE_defvert_array_free(struct MDeformVert *dvert, int totvert);
void BKE_defvert_array_copy(struct MDeformVert *dst, const struct MDeformVert *src, int totvert);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 54189e26c92..19c04676548 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -50,6 +50,7 @@ struct RenderData;
struct rctf;
struct MovieClip;
struct Main;
+struct RigidBodyWorld;
void BKE_object_workob_clear(struct Object *workob);
void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
@@ -100,7 +101,9 @@ int BKE_object_pose_context_check(struct Object *ob);
struct Object *BKE_object_pose_armature_get(struct Object *ob);
void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob);
+void BKE_object_where_is_calc_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob);
void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime);
+void BKE_object_where_is_calc_time_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float ctime);
void BKE_object_where_is_calc_simul(struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]);
@@ -146,6 +149,7 @@ void BKE_object_tfm_protected_restore(struct Object *ob,
const short protectflag);
void BKE_object_handle_update(struct Scene *scene, struct Object *ob);
+void BKE_object_handle_update_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob);
void BKE_object_sculpt_modifiers_changed(struct Object *ob);
int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot);
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index 2b19f60b5e4..12779a697b6 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -89,7 +89,7 @@ void BKE_rigidbody_remove_constraint(struct Scene *scene, struct Object *ob);
/* Simulation */
void BKE_rigidbody_aftertrans_update(struct Object *ob, float loc[3], float rot[3], float quat[4], float rotAxis[3], float rotAngle);
-void BKE_rigidbody_sync_transforms(struct Scene *scene, struct Object *ob, float ctime);
+void BKE_rigidbody_sync_transforms(struct RigidBodyWorld *rbw, struct Object *ob, float ctime);
void BKE_rigidbody_cache_reset(struct RigidBodyWorld *rbw);
void BKE_rigidbody_do_simulation(struct Scene *scene, float ctime);
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index dc84bc67647..3e882a048eb 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -66,8 +66,8 @@ void txt_move_up (struct Text *text, short sel);
void txt_move_down (struct Text *text, short sel);
void txt_move_left (struct Text *text, short sel);
void txt_move_right (struct Text *text, short sel);
-void txt_jump_left (struct Text *text, short sel);
-void txt_jump_right (struct Text *text, short sel);
+void txt_jump_left (struct Text *text, bool sel, bool use_init_step);
+void txt_jump_right (struct Text *text, bool sel, bool use_init_step);
void txt_move_bof (struct Text *text, short sel);
void txt_move_eof (struct Text *text, short sel);
void txt_move_bol (struct Text *text, short sel);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index bc9c8a7ad50..a6b3008e00a 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -967,7 +967,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
dm = editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
}
else
- dm = mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH);
+ dm = mesh_get_derived_final(scene, par, CD_MASK_BAREMESH);
if (flag & DUPLILIST_FOR_RENDER) {
vdd.orco = (float(*)[3])BKE_mesh_orco_verts_get(par);
@@ -1094,7 +1094,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
dm = editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
}
else {
- dm = mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH);
+ dm = mesh_get_derived_final(scene, par, CD_MASK_BAREMESH);
}
totface = dm->getNumPolys(dm);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 2ce5053bdcc..ba69fa4336e 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -588,11 +588,16 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf
else if (texfall == 1) {
BKE_brush_sample_tex_2D(scene, brush, xy, dstf, 0);
}
- else {
+ else if (texfall == 2) {
BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0);
mul_v3_v3v3(dstf, rgba, brush_rgb);
dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
}
+ else {
+ BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0);
+ copy_v3_v3(dstf, brush_rgb);
+ dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
+ }
}
}
}
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 66b457ec502..7f2d9437c3d 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1431,7 +1431,7 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
*/
if (cddm->pbvh && cddm->pbvh_draw && BKE_pbvh_type(cddm->pbvh) == PBVH_BMESH) {
if (dm->numTessFaceData) {
- setMaterial(userData, 1, NULL);
+ setMaterial(userData, 1, &gattribs);
BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, FALSE);
}
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index cea92d53916..de15100de0b 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -809,7 +809,7 @@ void BKE_defvert_array_copy(MDeformVert *dst, const MDeformVert *src, int copyco
}
-void BKE_defvert_array_free(MDeformVert *dvert, int totvert)
+void BKE_defvert_array_free_elems(MDeformVert *dvert, int totvert)
{
/* Instead of freeing the verts directly,
* call this function to delete any special
@@ -823,6 +823,18 @@ void BKE_defvert_array_free(MDeformVert *dvert, int totvert)
for (i = 0; i < totvert; i++) {
if (dvert[i].dw) MEM_freeN(dvert[i].dw);
}
- MEM_freeN(dvert);
}
+void BKE_defvert_array_free(MDeformVert *dvert, int totvert)
+{
+ /* Instead of freeing the verts directly,
+ * call this function to delete any special
+ * vert data */
+ if (!dvert)
+ return;
+
+ /* Free any special data from the verts */
+ BKE_defvert_array_free_elems(dvert, totvert);
+
+ MEM_freeN(dvert);
+}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index dab4235559a..99d0c5ed964 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -2353,6 +2353,7 @@ static void dag_object_time_update_flags(Scene *scene, Object *ob)
if (object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
if ((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
+ // XXX: scene here may not be the scene that contains the rigidbody world affecting this!
if (ob->rigidbody_object && BKE_scene_check_rigidbody_active(scene))
ob->recalc |= OB_RECALC_OB;
@@ -2440,7 +2441,11 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const s
if (do_time) {
/* now if DagNode were part of base, the node->lay could be checked... */
/* we do all now, since the scene_flush checks layers and clears recalc flags even */
- dag_object_time_update_flags(scene, ob);
+
+ /* NOTE: "sce_iter" not "scene" so that rigidbodies in background scenes work
+ * (i.e. muting + rbw availability can be checked and tagged properly) [#33970]
+ */
+ dag_object_time_update_flags(sce_iter, ob);
}
/* handled in next loop */
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index c92c52a7651..685d66195c7 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2379,7 +2379,8 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
dot11 = d2[0] * d2[0] + d2[1] * d2[1];
dot12 = d2[0] * d3[0] + d2[1] * d3[1];
- invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
+ invDenom = (dot00 * dot11 - dot01 * dot01);
+ invDenom = invDenom ? 1.0f / invDenom : 1.0f;
u = (dot11 * dot02 - dot01 * dot12) * invDenom;
v = (dot00 * dot12 - dot01 * dot02) * invDenom;
@@ -2399,7 +2400,8 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
dot11 = d2[0] * d2[0] + d2[1] * d2[1];
dot12 = d2[0] * d3[0] + d2[1] * d3[1];
- invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
+ invDenom = (dot00 * dot11 - dot01 * dot01);
+ invDenom = invDenom ? 1.0f / invDenom : 1.0f;
u = (dot11 * dot02 - dot01 * dot12) * invDenom;
v = (dot00 * dot12 - dot01 * dot02) * invDenom;
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 1880cb42f4d..9e8693e957e 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -562,7 +562,7 @@ int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], floa
if (mface->v4)
add_v3_v3(surface_vel, surmd->v[mface->v4].co);
- mul_v3_fl(surface_vel, mface->v4 ? 0.25f : 0.333f);
+ mul_v3_fl(surface_vel, mface->v4 ? 0.25f : (1.0f / 3.0f));
}
return 1;
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 018cd25187a..de85cb54cfd 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2737,6 +2737,14 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
if (rres.have_combined && layer == 0) {
/* pass */
}
+ else if (rect && layer == 0) {
+ /* rect32 is set when there's a Sequence pass, this pass seems
+ * to have layer=0 (this is from image_buttons.c)
+ * in this case we ignore float buffer, because it could have
+ * hung from previous pass which was float
+ */
+ rectf = NULL;
+ }
else if (rres.layers.first) {
RenderLayer *rl = BLI_findlink(&rres.layers, layer - (rres.have_combined ? 1 : 0));
if (rl) {
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index fd57a88e279..c3e7a963c04 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -912,7 +912,7 @@ void outside_lattice(Lattice *lt)
bp->vec[1] += (1.0f - fac1) * bp1->vec[1] + fac1 * bp2->vec[1];
bp->vec[2] += (1.0f - fac1) * bp1->vec[2] + fac1 * bp2->vec[2];
- mul_v3_fl(bp->vec, 0.3333333f);
+ mul_v3_fl(bp->vec, 1.0f / 3.0f);
}
}
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index d939b9cc3c0..5cc3145213c 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -1654,6 +1654,14 @@ static void polygonize(PROCESS *mbproc, MetaBall *mb)
}
}
+/* could move to math api */
+BLI_INLINE void copy_v3_fl3(float v[3], float x, float y, float z)
+{
+ v[0] = x;
+ v[1] = y;
+ v[2] = z;
+}
+
static float init_meta(Scene *scene, Object *ob) /* return totsize */
{
Scene *sce_iter = scene;
@@ -1730,6 +1738,7 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */
float temp1[4][4], temp2[4][4], temp3[4][4];
float (*mat)[4] = NULL, (*imat)[4] = NULL;
float max_x, max_y, max_z, min_x, min_y, min_z;
+ float expx, expy, expz;
max_x = max_y = max_z = -3.4e38;
min_x = min_y = min_z = 3.4e38;
@@ -1770,39 +1779,27 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */
G_mb.mainb[a]->mat = (float *) mat;
G_mb.mainb[a]->imat = (float *) imat;
+ if (!MB_TYPE_SIZE_SQUARED(ml->type)) {
+ expx = ml->expx;
+ expy = ml->expy;
+ expz = ml->expz;
+ }
+ else {
+ expx = ml->expx * ml->expx;
+ expy = ml->expy * ml->expy;
+ expz = ml->expz * ml->expz;
+ }
+
/* untransformed Bounding Box of MetaElem */
- /* 0 */
- G_mb.mainb[a]->bb->vec[0][0] = -ml->expx;
- G_mb.mainb[a]->bb->vec[0][1] = -ml->expy;
- G_mb.mainb[a]->bb->vec[0][2] = -ml->expz;
- /* 1 */
- G_mb.mainb[a]->bb->vec[1][0] = ml->expx;
- G_mb.mainb[a]->bb->vec[1][1] = -ml->expy;
- G_mb.mainb[a]->bb->vec[1][2] = -ml->expz;
- /* 2 */
- G_mb.mainb[a]->bb->vec[2][0] = ml->expx;
- G_mb.mainb[a]->bb->vec[2][1] = ml->expy;
- G_mb.mainb[a]->bb->vec[2][2] = -ml->expz;
- /* 3 */
- G_mb.mainb[a]->bb->vec[3][0] = -ml->expx;
- G_mb.mainb[a]->bb->vec[3][1] = ml->expy;
- G_mb.mainb[a]->bb->vec[3][2] = -ml->expz;
- /* 4 */
- G_mb.mainb[a]->bb->vec[4][0] = -ml->expx;
- G_mb.mainb[a]->bb->vec[4][1] = -ml->expy;
- G_mb.mainb[a]->bb->vec[4][2] = ml->expz;
- /* 5 */
- G_mb.mainb[a]->bb->vec[5][0] = ml->expx;
- G_mb.mainb[a]->bb->vec[5][1] = -ml->expy;
- G_mb.mainb[a]->bb->vec[5][2] = ml->expz;
- /* 6 */
- G_mb.mainb[a]->bb->vec[6][0] = ml->expx;
- G_mb.mainb[a]->bb->vec[6][1] = ml->expy;
- G_mb.mainb[a]->bb->vec[6][2] = ml->expz;
- /* 7 */
- G_mb.mainb[a]->bb->vec[7][0] = -ml->expx;
- G_mb.mainb[a]->bb->vec[7][1] = ml->expy;
- G_mb.mainb[a]->bb->vec[7][2] = ml->expz;
+ /* TODO, its possible the elem type has been changed and the exp* values can use a fallback */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[0], -expx, -expy, -expz); /* 0 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[1], +expx, -expy, -expz); /* 1 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[2], +expx, +expy, -expz); /* 2 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[3], -expx, +expy, -expz); /* 3 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[4], -expx, -expy, +expz); /* 4 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[5], +expx, -expy, +expz); /* 5 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[6], +expx, +expy, +expz); /* 6 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[7], -expx, +expy, +expz); /* 7 */
/* transformation of Metalem bb */
for (i = 0; i < 8; i++)
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 21641e77b0b..c9c86e6739f 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -2999,6 +2999,36 @@ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart,
}
}
+/* note, results won't be correct if polygon is non-planar */
+static float mesh_calc_poly_planar_area_centroid(MPoly *mpoly, MLoop *loopstart, MVert *mvarray, float cent[3])
+{
+ int i;
+ float tri_area;
+ float total_area = 0.0f;
+ float v1[3], v2[3], v3[3], normal[3], tri_cent[3];
+
+ BKE_mesh_calc_poly_normal(mpoly, loopstart, mvarray, normal);
+ copy_v3_v3(v1, mvarray[loopstart[0].v].co);
+ copy_v3_v3(v2, mvarray[loopstart[1].v].co);
+ zero_v3(cent);
+
+ for (i = 2; i < mpoly->totloop; i++) {
+ copy_v3_v3(v3, mvarray[loopstart[i].v].co);
+
+ tri_area = area_tri_signed_v3(v1, v2, v3, normal);
+ total_area += tri_area;
+
+ cent_tri_v3(tri_cent, v1, v2, v3);
+ madd_v3_v3fl(cent, tri_cent, tri_area);
+
+ copy_v3_v3(v2, v3);
+ }
+
+ mul_v3_fl(cent, 1.0f / total_area);
+
+ return total_area;
+}
+
/**
* This function takes the difference between 2 vertex-coord-arrays
* (\a vert_cos_src, \a vert_cos_dst),
@@ -3292,9 +3322,8 @@ int BKE_mesh_center_centroid(Mesh *me, float cent[3])
/* calculate a weighted average of polygon centroids */
for (mpoly = me->mpoly; i--; mpoly++) {
- BKE_mesh_calc_poly_center(mpoly, me->mloop + mpoly->loopstart, me->mvert, poly_cent);
- poly_area = BKE_mesh_calc_poly_area(mpoly, me->mloop + mpoly->loopstart, me->mvert, NULL);
-
+ poly_area = mesh_calc_poly_planar_area_centroid(mpoly, me->mloop + mpoly->loopstart, me->mvert, poly_cent);
+
madd_v3_v3fl(cent, poly_cent, poly_area);
total_area += poly_area;
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 498b3b226f6..119dc8c7d11 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -58,6 +58,7 @@
#include "DNA_world_types.h"
#include "DNA_object_types.h"
#include "DNA_property_types.h"
+#include "DNA_rigidbody_types.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
@@ -2027,7 +2028,7 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4])
else {
add_v3_v3v3(mat[3], v1, v2);
add_v3_v3(mat[3], v3);
- mul_v3_fl(mat[3], 0.3333333f);
+ mul_v3_fl(mat[3], 1.0f / 3.0f);
}
}
}
@@ -2130,7 +2131,8 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
return 1;
}
-void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
+/* note, scene is the active scene while actual_scene is the scene the object resides in */
+void BKE_object_where_is_calc_time_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob, float ctime)
{
if (ob == NULL) return;
@@ -2155,8 +2157,9 @@ void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
else {
BKE_object_to_mat4(ob, ob->obmat);
}
-
- BKE_rigidbody_sync_transforms(scene, ob, ctime);
+
+ /* read values pushed into RBO from sim/cache... */
+ BKE_rigidbody_sync_transforms(rbw, ob, ctime);
/* solve constraints */
if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
@@ -2172,6 +2175,11 @@ void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
else ob->transflag &= ~OB_NEG_SCALE;
}
+void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
+{
+ BKE_object_where_is_calc_time_ex(scene, NULL, ob, ctime);
+}
+
/* get object transformation matrix without recalculating dependencies and
* constraints -- assume dependencies are already solved by depsgraph.
* no changes to object and it's parent would be done.
@@ -2193,9 +2201,13 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4])
}
}
-void BKE_object_where_is_calc(struct Scene *scene, Object *ob)
+void BKE_object_where_is_calc_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob)
{
- BKE_object_where_is_calc_time(scene, ob, BKE_scene_frame_get(scene));
+ BKE_object_where_is_calc_time_ex(scene, rbw, ob, BKE_scene_frame_get(scene));
+}
+void BKE_object_where_is_calc(Scene *scene, Object *ob)
+{
+ BKE_object_where_is_calc_time_ex(scene, NULL, ob, BKE_scene_frame_get(scene));
}
void BKE_object_where_is_calc_simul(Scene *scene, Object *ob)
@@ -2631,7 +2643,8 @@ int BKE_object_parent_loop_check(const Object *par, const Object *ob)
/* the main object update call, for object matrix, constraints, keys and displist (modifiers) */
/* requires flags to be set! */
-void BKE_object_handle_update(Scene *scene, Object *ob)
+/* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */
+void BKE_object_handle_update_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob)
{
if (ob->recalc & OB_RECALC_ALL) {
/* speed optimization for animation lookups */
@@ -2672,7 +2685,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
copy_m4_m4(ob->obmat, ob->proxy_from->obmat);
}
else
- BKE_object_where_is_calc(scene, ob);
+ BKE_object_where_is_calc_ex(scene, rbw, ob);
}
if (ob->recalc & OB_RECALC_DATA) {
@@ -2826,6 +2839,15 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
// printf("set proxy pointer for later group stuff %s\n", ob->id.name);
}
}
+/* WARNING: "scene" here may not be the scene object actually resides in.
+ * When dealing with background-sets, "scene" is actually the active scene.
+ * e.g. "scene" <-- set 1 <-- set 2 ("ob" lives here) <-- set 3 <-- ... <-- set n
+ * rigid bodies depend on their world so use BKE_object_handle_update_ex() to also pass along the corrent rigid body world
+ */
+void BKE_object_handle_update(Scene *scene, Object *ob)
+{
+ BKE_object_handle_update_ex(scene, NULL, ob);
+}
void BKE_object_sculpt_modifiers_changed(Object *ob)
{
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index fda5f6f2ecb..6e4937d11ec 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -802,7 +802,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
if (mface->v4)
psys_uv_to_w(0.5f, 0.5f, mface->v4, pa->fuv);
else
- psys_uv_to_w(0.33333f, 0.33333f, mface->v4, pa->fuv);
+ psys_uv_to_w(1.0f / 3.0f, 1.0f / 3.0f, mface->v4, pa->fuv);
}
else {
ctx->jitoff[i] = fmod(ctx->jitoff[i],(float)ctx->jitlevel);
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 24355149926..26f0c25617f 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1130,11 +1130,9 @@ static void rigidbody_update_simulation_post_step(RigidBodyWorld *rbw)
}
}
}
-
/* Sync rigid body and object transformations */
-void BKE_rigidbody_sync_transforms(Scene *scene, Object *ob, float ctime)
+void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime)
{
- RigidBodyWorld *rbw = scene->rigidbody_world;
RigidBodyOb *rbo = ob->rigidbody_object;
/* keep original transform for kinematic and passive objects */
@@ -1165,6 +1163,7 @@ void BKE_rigidbody_sync_transforms(Scene *scene, Object *ob, float ctime)
}
}
+/* Used when cancelling transforms - return rigidbody and object to initial states */
void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], float quat[4], float rotAxis[3], float rotAngle)
{
RigidBodyOb *rbo = ob->rigidbody_object;
@@ -1216,6 +1215,8 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
cache = rbw->pointcache;
+ rbw->flag &= ~RBW_FLAG_FRAME_UPDATE;
+
/* flag cache as outdated if we don't have a world or number of objects in the simulation has changed */
if (rbw->physics_world == NULL || rbw->numbodies != BLI_countlist(&rbw->group->gobject)) {
cache->flag |= PTCACHE_OUTDATED;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 81084661368..9934d9b6e9a 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1115,11 +1115,19 @@ static void scene_depsgraph_hack(Scene *scene, Scene *scene_parent)
}
+static void scene_flag_rbw_recursive(Scene *scene)
+{
+ if (scene->set)
+ scene_flag_rbw_recursive(scene->set);
+
+ if (BKE_scene_check_rigidbody_active(scene))
+ scene->rigidbody_world->flag |= RBW_FLAG_FRAME_UPDATE;
+}
+
static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent)
{
Base *base;
-
scene->customdata_mask = scene_parent->customdata_mask;
/* sets first, we allow per definition current scene to have
@@ -1127,11 +1135,27 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
if (scene->set)
scene_update_tagged_recursive(bmain, scene->set, scene_parent);
+ /* run rigidbody sim
+ * - calculate/read values from cache into RBO's, to get flushed
+ * later when objects are evaluated (if they're tagged for eval)
+ */
+ // XXX: this position may still change, objects not being updated correctly before simulation is run
+ // NOTE: current position is so that rigidbody sim affects other objects
+ if (BKE_scene_check_rigidbody_active(scene) && scene->rigidbody_world->flag & RBW_FLAG_FRAME_UPDATE) {
+ /* we use frame time of parent (this is "scene" itself for top-level of sets recursion),
+ * as that is the active scene controlling all timing in file at the moment
+ */
+ float ctime = BKE_scene_frame_get(scene_parent);
+
+ /* however, "scene" contains the rigidbody world needed for eval... */
+ BKE_rigidbody_do_simulation(scene, ctime);
+ }
+
/* scene objects */
for (base = scene->base.first; base; base = base->next) {
Object *ob = base->object;
- BKE_object_handle_update(scene_parent, ob);
+ BKE_object_handle_update_ex(scene_parent, scene->rigidbody_world, ob);
if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
group_handle_recalc_and_update(scene_parent, ob, ob->dup_group);
@@ -1232,13 +1256,7 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
* such as Scene->World->MTex/Texture) can still get correctly overridden.
*/
BKE_animsys_evaluate_all_animation(bmain, sce, ctime);
- /*...done with recusrive funcs */
-
- /* run rigidbody sim */
- // XXX: this position may still change, objects not being updated correctly before simulation is run
- // NOTE: current position is so that rigidbody sim affects other objects
- if (BKE_scene_check_rigidbody_active(sce))
- BKE_rigidbody_do_simulation(sce, ctime);
+ /*...done with recursive funcs */
/* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later
* when trying to find materials with drivers that need evaluating [#32017]
@@ -1246,6 +1264,9 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
tag_main_idcode(bmain, ID_MA, FALSE);
tag_main_idcode(bmain, ID_LA, FALSE);
+ /* flag rigid body worlds for update */
+ scene_flag_rbw_recursive(sce);
+
/* BKE_object_handle_update() on all objects, groups and sets */
scene_update_tagged_recursive(bmain, sce, sce);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index f1724bdfc6b..45393726add 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1820,8 +1820,6 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
StripCrop c = {0};
StripTransform t = {0};
int sx, sy, dx, dy;
- double xscale = 1.0;
- double yscale = 1.0;
if (is_proxy_image) {
double f = seq_rendersize_to_scale_factor(context.preview_render_size);
@@ -1838,21 +1836,23 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
t = *seq->strip->transform;
}
- xscale = context.scene->r.xsch ? ((double)context.rectx / (double)context.scene->r.xsch) : 1.0;
- yscale = context.scene->r.ysch ? ((double)context.recty / (double)context.scene->r.ysch) : 1.0;
-
- xscale /= (double)context.rectx / (double)ibuf->x;
- yscale /= (double)context.recty / (double)ibuf->y;
-
- c.left *= xscale; c.right *= xscale;
- c.top *= yscale; c.bottom *= yscale;
-
- t.xofs *= xscale; t.yofs *= yscale;
+ if (is_preprocessed) {
+ double xscale = context.scene->r.xsch ? ((double)context.rectx / (double)context.scene->r.xsch) : 1.0;
+ double yscale = context.scene->r.ysch ? ((double)context.recty / (double)context.scene->r.ysch) : 1.0;
+ if (seq->flag & SEQ_USE_TRANSFORM) {
+ t.xofs *= xscale;
+ t.yofs *= yscale;
+ }
+ if (seq->flag & SEQ_USE_CROP) {
+ c.left *= xscale;
+ c.right *= xscale;
+ c.top *= yscale;
+ c.bottom *= yscale;
+ }
+ }
sx = ibuf->x - c.left - c.right;
sy = ibuf->y - c.top - c.bottom;
- dx = sx;
- dy = sy;
if (seq->flag & SEQ_USE_TRANSFORM) {
if (is_preprocessed) {
@@ -1864,6 +1864,10 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
dy = context.scene->r.ysch;
}
}
+ else {
+ dx = sx;
+ dy = sy;
+ }
if (c.top + c.bottom >= ibuf->y ||
c.left + c.right >= ibuf->x ||
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index f56d03bfb57..248cd689258 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1583,7 +1583,7 @@ BLI_INLINE void apply_inflow_fields(SmokeFlowSettings *sfs, float emission_value
}
/* set fire reaction coordinate */
- if (fuel && fuel[index]) {
+ if (fuel && fuel[index] > FLT_EPSILON) {
/* instead of using 1.0 for all new fuel add slight falloff
* to reduce flow blockiness */
float value = 1.0f - powf(1.0f - emission_value, 2.0f);
@@ -1591,6 +1591,7 @@ BLI_INLINE void apply_inflow_fields(SmokeFlowSettings *sfs, float emission_value
if (value > react[index]) {
float f = fuel_flow / fuel[index];
react[index] = value * f + (1.0f - f) * react[index];
+ CLAMP(react[index], 0.0f, value);
}
}
}
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 3be9097ce82..86e7a152a4a 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -38,12 +38,12 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_cursor_utf8.h"
#include "BLI_string_utf8.h"
#include "BLI_listbase.h"
-#include "BLI_utildefines.h"
#include "BLI_fileops.h"
#include "DNA_constraint_types.h"
@@ -936,7 +936,7 @@ void txt_move_right(Text *text, short sel)
if (!sel) txt_pop_sel(text);
}
-void txt_jump_left(Text *text, short sel)
+void txt_jump_left(Text *text, bool sel, bool use_init_step)
{
TextLine **linep;
int *charp;
@@ -948,12 +948,12 @@ void txt_jump_left(Text *text, short sel)
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
charp, STRCUR_DIR_PREV,
- STRCUR_JUMP_DELIM);
+ STRCUR_JUMP_DELIM, use_init_step);
if (!sel) txt_pop_sel(text);
}
-void txt_jump_right(Text *text, short sel)
+void txt_jump_right(Text *text, bool sel, bool use_init_step)
{
TextLine **linep;
int *charp;
@@ -965,7 +965,7 @@ void txt_jump_right(Text *text, short sel)
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
charp, STRCUR_DIR_NEXT,
- STRCUR_JUMP_DELIM);
+ STRCUR_JUMP_DELIM, use_init_step);
if (!sel) txt_pop_sel(text);
}
@@ -2402,7 +2402,7 @@ void txt_delete_char(Text *text)
void txt_delete_word(Text *text)
{
- txt_jump_right(text, 1);
+ txt_jump_right(text, true, true);
txt_delete_sel(text);
}
@@ -2451,7 +2451,7 @@ void txt_backspace_char(Text *text)
void txt_backspace_word(Text *text)
{
- txt_jump_left(text, 1);
+ txt_jump_left(text, true, true);
txt_delete_sel(text);
}
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 84e1f29f6c0..dd6ed42bd92 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -142,7 +142,7 @@ static struct bUnitCollection buImperialLenCollecton = {buImperialLenDef, 4, 0,
/* Areas */
static struct bUnitDef buMetricAreaDef[] = {
{"square kilometer", "square kilometers", "km²", "km2", "Square Kilometers", UN_SC_KM * UN_SC_KM, 0.0, B_UNIT_DEF_NONE},
- {"square hectometer", "square hectometers", "hm²", "hm2", "Square Hectometers", UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_NONE}, /* hectare */
+ {"square hectometer", "square hectometers", "hm²", "hm2", "Square Hectometers", UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS}, /* hectare */
{"square dekameter", "square dekameters", "dam²", "dam2", "Square Dekameters", UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, /* are */
{"square meter", "square meters", "m²", "m2", "Square Meters", UN_SC_M * UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"square decimeter", "square decimetees", "dm²", "dm2", "Square Decimeters", UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
@@ -168,7 +168,7 @@ static struct bUnitCollection buImperialAreaCollecton = {buImperialAreaDef, 4, 0
/* Volumes */
static struct bUnitDef buMetricVolDef[] = {
{"cubic kilometer", "cubic kilometers", "km³", "km3", "Cubic Kilometers", UN_SC_KM * UN_SC_KM * UN_SC_KM, 0.0, B_UNIT_DEF_NONE},
- {"cubic hectometer", "cubic hectometers", "hm³", "hm3", "Cubic Hectometers", UN_SC_HM * UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_NONE},
+ {"cubic hectometer", "cubic hectometers", "hm³", "hm3", "Cubic Hectometers", UN_SC_HM * UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS},
{"cubic dekameter", "cubic dekameters", "dam³", "dam3", "Cubic Dekameters", UN_SC_DAM * UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},
{"cubic meter", "cubic meters", "m³", "m3", "Cubic Meters", UN_SC_M * UN_SC_M * UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"cubic decimeter", "cubic decimeters", "dm³", "dm3", "Cubic Decimeters", UN_SC_DM * UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
@@ -194,9 +194,9 @@ static struct bUnitCollection buImperialVolCollecton = {buImperialVolDef, 4, 0,
/* Mass */
static struct bUnitDef buMetricMassDef[] = {
{"ton", "tonnes", "ton", "t", "1000 Kilograms", UN_SC_MTON, 0.0, B_UNIT_DEF_NONE},
- {"quintal", "quintals", "ql", "q", "100 Kilograms", UN_SC_QL, 0.0, B_UNIT_DEF_NONE},
+ {"quintal", "quintals", "ql", "q", "100 Kilograms", UN_SC_QL, 0.0, B_UNIT_DEF_SUPPRESS},
{"kilogram", "kilograms", "kg", NULL, "Kilograms", UN_SC_KG, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"hectogram", "hectograms", "hg", NULL, "Hectograms", UN_SC_HG, 0.0, B_UNIT_DEF_NONE},
+ {"hectogram", "hectograms", "hg", NULL, "Hectograms", UN_SC_HG, 0.0, B_UNIT_DEF_SUPPRESS},
{"dekagram", "dekagrams", "dag", NULL, "10 Grams", UN_SC_DAG, 0.0, B_UNIT_DEF_SUPPRESS},
{"gram", "grams", "g", NULL, "Grams", UN_SC_G, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index a822bdb9414..c4e17b1ed48 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -51,6 +51,7 @@ float normal_quad_v3(float r[3], const float a[3], const float b[3], const float
float area_tri_v2(const float a[2], const float b[2], const float c[2]);
float area_tri_signed_v2(const float v1[2], const float v2[2], const float v3[2]);
float area_tri_v3(const float a[3], const float b[3], const float c[3]);
+float area_tri_signed_v3(const float v1[3], const float v2[3], const float v3[3], const float normal[3]);
float area_quad_v3(const float a[3], const float b[3], const float c[3], const float d[3]);
float area_poly_v3(int nr, float verts[][3], const float normal[3]);
float area_poly_v2(int nr, float verts[][2]);
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index a5ab2373b89..97cd6a60862 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -88,6 +88,7 @@ void mul_serie_m4(float R[4][4],
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_v2_m2v2(float r[2], float M[2][2], const float v[2]);
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], const float v[4]);
@@ -170,6 +171,7 @@ void mat4_to_size(float r[3], float M[4][4]);
void translate_m4(float mat[4][4], float tx, float ty, float tz);
void rotate_m4(float mat[4][4], const char axis, const float angle);
+void rotate_m2(float mat[2][2], const float angle);
void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3]);
diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h
index 3c38c0380e0..04d9df2abda 100644
--- a/source/blender/blenlib/BLI_string_cursor_utf8.h
+++ b/source/blender/blenlib/BLI_string_cursor_utf8.h
@@ -46,6 +46,6 @@ int BLI_str_cursor_step_prev_utf8(const char *str, size_t maxlen, int *pos);
void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
int *pos, strCursorJumpDirection direction,
- strCursorJumpType jump);
+ strCursorJumpType jump, bool use_init_step);
#endif /* __BLI_STRING_CURSOR_UTF8_H__ */
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index bf228f7456a..7670b057a7f 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -245,6 +245,10 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
BLI_freenode *newhead = addr;
if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
+#ifndef NDEBUG
+ /* this will detect double free's */
+ BLI_assert(newhead->freeword != FREEWORD);
+#endif
newhead->freeword = FREEWORD;
}
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 0f42fca9f12..24b3c36a329 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -111,7 +111,7 @@ int BLI_file_gzip(const char *from, const char *to)
return rval;
}
-/* gzip the file in from_file and write it to memery to_mem, at most size bytes.
+/* gzip the file in from_file and write it to memory to_mem, at most size bytes.
* return the unziped size
*/
char *BLI_file_ungzip_to_mem(const char *from_file, int *size_r)
@@ -283,7 +283,7 @@ int BLI_move(const char *file, const char *to)
{
int err;
- /* windows doesn't support moveing to a directory
+ /* windows doesn't support moving to a directory
* it has to be 'mv filename filename' and not
* 'mv filename destdir' */
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index ac9534dac25..810c15437dc 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -39,9 +39,9 @@
void cent_tri_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3])
{
- cent[0] = 0.33333f * (v1[0] + v2[0] + v3[0]);
- cent[1] = 0.33333f * (v1[1] + v2[1] + v3[1]);
- cent[2] = 0.33333f * (v1[2] + v2[2] + v3[2]);
+ cent[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;
+ cent[1] = (v1[1] + v2[1] + v3[1]) / 3.0f;
+ cent[2] = (v1[2] + v2[2] + v3[2]) / 3.0f;
}
void cent_quad_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
@@ -129,6 +129,22 @@ float area_tri_v3(const float v1[3], const float v2[3], const float v3[3])
return (len / 2.0f);
}
+float area_tri_signed_v3(const float v1[3], const float v2[3], const float v3[3], const float normal[3])
+{
+ float area, vec1[3], vec2[3], n[3];
+
+ sub_v3_v3v3(vec1, v3, v2);
+ sub_v3_v3v3(vec2, v1, v2);
+ cross_v3_v3v3(n, vec1, vec2);
+ area = len_v3(n) / 2.0f;
+
+ /* negate area for flipped triangles */
+ if (dot_v3v3(n, normal) < 0.0f)
+ area = -area;
+
+ return area;
+}
+
float area_poly_v3(int nr, float verts[][3], const float normal[3])
{
int a, px, py;
@@ -3578,25 +3594,42 @@ float form_factor_hemi_poly(float p[3], float n[3], float v1[3], float v2[3], fl
/* evaluate if entire quad is a proper convex quad */
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];
+ float nor[3], nor_a[3], nor_b[3], vec[4][2];
float mat[3][3];
+ const bool is_ok_a = (normal_tri_v3(nor_a, v1, v2, v3) > FLT_EPSILON);
+ const bool is_ok_b = (normal_tri_v3(nor_b, v1, v3, v4) > FLT_EPSILON);
/* define projection, do both trias apart, quad is undefined! */
- normal_tri_v3(nor1, v1, v2, v3);
- normal_tri_v3(nor2, v1, v3, v4);
+ /* check normal length incase one size is zero area */
+ if (is_ok_a) {
+ if (is_ok_b) {
+ /* use both, most common outcome */
+
+ /* when the face is folded over as 2 tris we probably don't want to create
+ * a quad from it, but go ahead with the intersection test since this
+ * isn't a function for degenerate faces */
+ if (UNLIKELY(dot_v3v3(nor_a, nor_b) < 0.0f)) {
+ /* flip so adding normals in the opposite direction
+ * doesn't give a zero length vector */
+ negate_v3(nor_b);
+ }
- /* when the face is folded over as 2 tris we probably don't want to create
- * a quad from it, but go ahead with the intersection test since this
- * isn't a function for degenerate faces */
- if (UNLIKELY(dot_v3v3(nor1, nor2) < 0.0f)) {
- /* flip so adding normals in the opposite direction
- * doesnt give a zero length vector */
- negate_v3(nor2);
+ add_v3_v3v3(nor, nor_a, nor_b);
+ normalize_v3(nor);
+ }
+ else {
+ copy_v3_v3(nor, nor_a); /* only 'a' */
+ }
+ }
+ else {
+ if (is_ok_b) {
+ copy_v3_v3(nor, nor_b); /* only 'b' */
+ }
+ else {
+ return false; /* both zero, we can't do anything useful here */
+ }
}
-
- add_v3_v3v3(nor, nor1, nor2);
- normalize_v3(nor);
axis_dominant_v3_to_m3(mat, nor);
@@ -3606,12 +3639,12 @@ int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], c
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;
+ return (isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0);
}
int is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
{
/* linetests, the 2 diagonals have to instersect to be convex */
- return (isect_line_line_v2(v1, v3, v2, v4) > 0) ? TRUE : FALSE;
+ return (isect_line_line_v2(v1, v3, v2, v4) > 0);
}
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 5c443b9b1f3..9d9e3e611e1 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -344,6 +344,15 @@ void mul_v3_m4v3(float in[3], float mat[4][4], const float vec[3])
in[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2] + mat[3][2];
}
+void mul_v2_m2v2(float r[2], float mat[2][2], const float vec[2])
+{
+ float x;
+
+ x = vec[0];
+ r[0] = mat[0][0] * x + mat[1][0] * vec[1];
+ r[1] = mat[0][1] * x + mat[1][1] * vec[1];
+}
+
/* same as mul_m4_v3() but doesnt apply translation component */
void mul_mat3_m4_v3(float mat[4][4], float vec[3])
{
@@ -1304,6 +1313,13 @@ void rotate_m4(float mat[4][4], const char axis, const float angle)
}
}
+void rotate_m2(float mat[2][2], const float angle)
+{
+ mat[0][0] = mat[1][1] = cosf(angle);
+ mat[0][1] = sinf(angle);
+ mat[1][0] = -mat[0][1];
+}
+
void blend_m3_m3m3(float out[3][3], float dst[3][3], float src[3][3], const float srcweight)
{
float srot[3][3], drot[3][3];
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index e6399ed356e..c0ea817ae4a 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1662,7 +1662,7 @@ void quat_apply_track(float quat[4], short axis, short upflag)
axis = axis - 3;
/* there are 2 possible up-axis for each axis used, the 'quat_track' applies so the first
- * up axis is used X->Y, Y->X, Z->X, if this first up axis isn used then rotate 90d
+ * up axis is used X->Y, Y->X, Z->X, if this first up axis isn't used then rotate 90d
* the strange bit shift below just find the low axis {X:Y, Y:X, Z:X} */
if (upflag != (2 - axis) >> 1) {
float q[4] = {M_SQRT1_2, 0.0, 0.0, 0.0}; /* assign 90d rotation axis */
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index c4def539c10..48e7de43a86 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -663,7 +663,7 @@ MINLINE float normalize_v3_v3(float r[3], const float a[3])
float d = dot_v3v3(a, a);
/* a larger value causes normalize errors in a
- * scaled down models with camera xtreme close */
+ * scaled down models with camera extreme close */
if (d > 1.0e-35f) {
d = sqrtf(d);
mul_v3_v3fl(r, a, 1.0f / d);
@@ -681,7 +681,7 @@ MINLINE double normalize_v3_d(double n[3])
double d = n[0] * n[0] + n[1] * n[1] + n[2] * n[2];
/* a larger value causes normalize errors in a
- * scaled down models with camera xtreme close */
+ * scaled down models with camera extreme close */
if (d > 1.0e-35) {
double mul;
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 771295b4b78..298e37137ce 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -325,7 +325,9 @@ static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
fac1 = 1.0e10f * (eed->v2->xy[0] - x);
}
- else fac1 = (x - eed->v2->xy[0]) / fac1;
+ else {
+ fac1 = (x - eed->v2->xy[0]) / fac1;
+ }
for (ed = sc->edge_first; ed; ed = ed->next) {
@@ -509,7 +511,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
ScanFillVert *eve, *v1, *v2, *v3;
ScanFillEdge *eed, *nexted, *ed1, *ed2, *ed3;
int a, b, verts, maxface, totface;
- short nr, test, twoconnected = 0;
+ short nr, twoconnected = 0;
nr = pf->nr;
@@ -565,6 +567,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
verts++;
eve->f = 0; /* flag for connectedges later on */
sc->vert = eve;
+ /* if (even->tmp.v == NULL) eve->tmp.u = verts; */ /* Note, debug print only will work for curve polyfill, union is in use for mesh */
sc++;
}
}
@@ -639,7 +642,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
sc = sf_ctx->_scdata;
for (a = 0; a < verts; a++) {
- /* printf("VERTEX %d %x\n", a, sc->v1); */
+ /* printf("VERTEX %d index %d\n", a, sc->vert->tmp.u); */
ed1 = sc->edge_first;
while (ed1) { /* set connectflags */
nexted = ed1->next;
@@ -649,7 +652,9 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
if (ed1->v1->h > 1) ed1->v1->h--;
if (ed1->v2->h > 1) ed1->v2->h--;
}
- else ed1->v2->f = SF_VERT_UNKNOWN;
+ else {
+ ed1->v2->f = SF_VERT_UNKNOWN;
+ }
ed1 = nexted;
}
@@ -674,39 +679,67 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
}
else {
/* test rest of vertices */
+ ScanFillVertLink *best_sc = NULL;
+ float best_angle = 3.14f;
float miny;
+ bool firsttime = false;
+
v1 = ed1->v2;
v2 = ed1->v1;
v3 = ed2->v2;
+
/* this happens with a serial of overlapping edges */
if (v1 == v2 || v2 == v3) break;
- /* printf("test verts %x %x %x\n", v1, v2, v3); */
+
+ /* printf("test verts %d %d %d\n", v1->tmp.u, v2->tmp.u, v3->tmp.u); */
miny = min_ff(v1->xy[1], v3->xy[1]);
- /* miny = min_ff(v1->xy[1], v3->xy[1]); */
sc1 = sc + 1;
- test = 0;
- for (b = a + 1; b < verts; b++) {
+ for (b = a + 1; b < verts; b++, sc1++) {
if (sc1->vert->f == 0) {
if (sc1->vert->xy[1] <= miny) break;
if (testedgeside(v1->xy, v2->xy, sc1->vert->xy)) {
if (testedgeside(v2->xy, v3->xy, sc1->vert->xy)) {
if (testedgeside(v3->xy, v1->xy, sc1->vert->xy)) {
- /* point in triangle */
-
- test = 1;
- break;
+ /* point is in triangle */
+
+ /* because multiple points can be inside triangle (concave holes) */
+ /* we continue searching and pick the one with sharpest corner */
+
+ if (best_sc == NULL) {
+ best_sc = sc1;
+ /* only need to continue checking with holes */
+ if ((flag & BLI_SCANFILL_CALC_HOLES) == 0) {
+ break;
+ }
+ }
+ else {
+ float angle;
+
+ /* prevent angle calc for the simple cases only 1 vertex is found */
+ if (firsttime == false) {
+ best_angle = angle_v2v2v2(v2->co, v1->co, best_sc->vert->co);
+ firsttime = true;
+ }
+
+ angle = angle_v2v2v2(v2->co, v1->co, sc1->vert->co);
+ if (angle < best_angle) {
+ best_sc = sc1;
+ best_angle = angle;
+ }
+ }
+
}
}
}
}
- sc1++;
}
- if (test) {
+
+ if (best_sc) {
/* make new edge, and start over */
- /* printf("add new edge %x %x and start again\n", v2, sc1->vert); */
+ /* printf("add new edge %d %d and start again\n", v2->tmp.u, best_sc->vert->tmp.u); */
- ed3 = BLI_scanfill_edge_add(sf_ctx, v2, sc1->vert);
+ ed3 = BLI_scanfill_edge_add(sf_ctx, v2, best_sc->vert);
BLI_remlink(&sf_ctx->filledgebase, ed3);
BLI_insertlinkbefore((ListBase *)&(sc->edge_first), ed2, ed3);
ed3->v2->f = SF_VERT_UNKNOWN;
@@ -716,7 +749,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
}
else {
/* new triangle */
- /* printf("add face %x %x %x\n", v1, v2, v3); */
+ /* printf("add face %d %d %d\n", v1->tmp.u, v2->tmp.u, v3->tmp.u); */
addfillface(sf_ctx, v1, v2, v3);
totface++;
BLI_remlink((ListBase *)&(sc->edge_first), ed1);
@@ -762,7 +795,6 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
ed3 = ed3->next;
}
}
-
}
}
/* test for loose edges */
diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c
index 65763f21b0f..674d5ae5c8d 100644
--- a/source/blender/blenlib/intern/string_cursor_utf8.c
+++ b/source/blender/blenlib/intern/string_cursor_utf8.c
@@ -139,12 +139,17 @@ int BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int *p
void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
int *pos, strCursorJumpDirection direction,
- strCursorJumpType jump)
+ strCursorJumpType jump, bool use_init_step)
{
const int pos_prev = *pos;
if (direction == STRCUR_DIR_NEXT) {
- BLI_str_cursor_step_next_utf8(str, maxlen, pos);
+ if (use_init_step) {
+ BLI_str_cursor_step_next_utf8(str, maxlen, pos);
+ }
+ else {
+ BLI_assert(jump == STRCUR_JUMP_DELIM);
+ }
if (jump != STRCUR_JUMP_NONE) {
const strCursorDelimType delim_type = (*pos) < maxlen ? cursor_delim_type(&str[*pos]) : STRCUR_DELIM_NONE;
@@ -163,7 +168,12 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
}
}
else if (direction == STRCUR_DIR_PREV) {
- BLI_str_cursor_step_prev_utf8(str, maxlen, pos);
+ if (use_init_step) {
+ BLI_str_cursor_step_prev_utf8(str, maxlen, pos);
+ }
+ else {
+ BLI_assert(jump == STRCUR_JUMP_DELIM);
+ }
if (jump != STRCUR_JUMP_NONE) {
const strCursorDelimType delim_type = (*pos) > 1 ? cursor_delim_type(&str[(*pos) - 1]) : STRCUR_DELIM_NONE;
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index bf98f2ae77c..9e0f9197ca3 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -114,7 +114,7 @@ int BLI_utf8_invalid_byte(const char *str, int length)
/* Check for valid bytes after the 2nd, if any; all must start 10 */
while (--ab > 0) {
- if ((*(p+1) & 0xc0) != 0x80) goto utf8_error;
+ if ((*(p + 1) & 0xc0) != 0x80) goto utf8_error;
p++; /* do this after so we get usable offset - campbell */
}
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index abede57b3ce..7d6ea1be77d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8873,7 +8873,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (scene->world) {
World *world = blo_do_versions_newlibadr(fd, scene->id.lib, scene->world);
- if (is_zero_v3(&world->horr)) {
+ if (world && is_zero_v3(&world->horr)) {
if ((world->skytype & WO_SKYBLEND) == 0 || is_zero_v3(&world->zenr)) {
set_premul = true;
}
@@ -9004,13 +9004,15 @@ 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;
+ bNodeTree *ntree;
ntreetype = ntreeGetType(NTREE_COMPOSIT);
if (ntreetype && ntreetype->foreach_nodetree)
ntreetype->foreach_nodetree(main, NULL, do_version_node_fix_translate_wrapping);
- }
-
+ for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next)
+ do_version_node_fix_translate_wrapping(NULL, NULL, ntree);
+ }
// if (main->versionfile < 265 || (main->versionfile == 265 && main->subversionfile < 7)) {
@@ -9132,6 +9134,10 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
bfd->user = user= read_struct(fd, bhead, "user def");
+ /* User struct has separate do-version handling */
+ user->versionfile = bfd->main->versionfile;
+ user->subversionfile = bfd->main->subversionfile;
+
/* read all data into fd->datamap */
bhead = read_data_into_oldnewmap(fd, bhead, "user def");
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 4461a7afdd7..3dd2e7a6131 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -45,7 +45,7 @@ struct Object;
* pointers. this is a requirement of mempool's method of
* iteration.
*
- * hrm. it doesn't but stull works ok, remove the comment above? - campbell.
+ * hrm. it doesn't but still works ok, remove the comment above? - campbell.
*/
// #pragma GCC diagnostic error "-Wpadded"
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index a2f2a9a0dba..643e73e02b4 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2103,7 +2103,7 @@ bool bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep)
}
/**
- * \brief Unglue Region Make Vert (URMV)
+ * \brief Un-glue Region Make Vert (URMV)
*
* Disconnects a face from its vertex fan at loop \a sl
*
diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.h b/source/blender/bmesh/intern/bmesh_iterators_inline.h
index d9784ac9b2a..eef6544be89 100644
--- a/source/blender/bmesh/intern/bmesh_iterators_inline.h
+++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h
@@ -35,7 +35,7 @@
/**
* \brief Iterator Step
*
- * Calls an iterators step fucntion to return the next element.
+ * Calls an iterators step function to return the next element.
*/
BLI_INLINE void *BM_iter_step(BMIter *iter)
{
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index 2284e183d97..44dc483d5a7 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -472,7 +472,7 @@ BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step)
* The function takes a vertex at the center of a fan and returns the opposite edge in the fan.
* All edges in the fan must be manifold, otherwise return NULL.
*
- * \note This could (probably) be done more effieiently.
+ * \note This could (probably) be done more efficiently.
*/
BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e_first)
{
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index c7c33aa2775..36ad8ef506b 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -165,7 +165,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
}
/* apply the new difference to the rest of the shape keys,
- * note that this dosn't take rotations into account, we _could_ support
+ * note that this doesn't take rotations into account, we _could_ support
* this by getting the normals and coords for each shape key and
* re-calculate the smooth value for each but this is quite involved.
* for now its ok to simply apply the difference IMHO - campbell */
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 3d78ff64876..1f04c7ce845 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -75,9 +75,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
stop = 1;
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
- float v1_xy[2], v2_xy[2], v3_xy[2], v4_xy[2];
- float no[3];
- float axis_mat[3][3];
+ BMVert *v1, *v2, *v3, *v4;
if (!BM_edge_is_manifold(e) || !BMO_elem_flag_test(bm, e, EDGE_MARK)) {
continue;
@@ -88,45 +86,31 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
{
continue;
}
-
- {
- 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)) {
+ 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 len1, len2, len3, len4, len5, len6, opp1, opp2, fac1, fac2;
/* testing rule:
* the area divided by the total edge lengths
*/
- 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);
+ 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);
- opp1 = area_tri_v2(v1_xy, v2_xy, v3_xy);
- opp2 = area_tri_v2(v1_xy, v3_xy, v4_xy);
+ opp1 = area_tri_v3(v1->co, v2->co, v3->co);
+ opp2 = area_tri_v3(v1->co, v3->co, v4->co);
fac1 = opp1 / (len1 + len2 + len5) + opp2 / (len3 + len4 + len5);
- opp1 = area_tri_v2(v2_xy, v3_xy, v4_xy);
- opp2 = area_tri_v2(v2_xy, v4_xy, v1_xy);
+ opp1 = area_tri_v3(v2->co, v3->co, v4->co);
+ opp2 = area_tri_v3(v2->co, v4->co, v1->co);
fac2 = opp1 / (len2 + len3 + len6) + opp2 / (len4 + len1 + len6);
diff --git a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
index 9dc4b596568..7e9a5784552 100644
--- a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
+++ b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
@@ -189,7 +189,7 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool
int iter_step;
- /* if tag_only is set, we assyme the caller knows what verts to tag
+ /* if tag_only is set, we assume the caller knows what verts to tag
* needed for the operator */
if (tag_only == false) {
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 4a0696dc857..a69f7918e40 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -161,9 +161,9 @@ void AnimationExporter::export_morph_animation(Object *ob)
FCurve *fcu;
char *transformName;
Key *key = BKE_key_from_object(ob);
- if(!key) return;
+ if (!key) return;
- if(key->adt && key->adt->action){
+ if (key->adt && key->adt->action) {
fcu = (FCurve *)key->adt->action->curves.first;
while (fcu) {
@@ -177,17 +177,17 @@ void AnimationExporter::export_morph_animation(Object *ob)
}
-void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<float> &frames ){
-
+void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<float> &frames )
+{
ListBase *conlist = get_active_constraints(ob);
- if(conlist == NULL) return;
+ if (conlist == NULL) return;
bConstraint *con;
for (con = (bConstraint*)conlist->first; con; con = con->next) {
ListBase targets = {NULL, NULL};
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
- if(!validateConstraints(con)) continue;
+ if (!validateConstraints(con)) continue;
if (cti && cti->get_constraint_targets) {
bConstraintTarget *ct;
@@ -197,8 +197,8 @@ void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<fl
* - ct->matrix members have not yet been calculated here!
*/
cti->get_constraint_targets(con, &targets);
- if(cti){
- for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next){
+ if (cti) {
+ for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) {
obtar = ct->tar;
find_frames(obtar, frames);
}
@@ -901,7 +901,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
bPoseChannel *parchan = NULL;
bPoseChannel *pchan = NULL;
- if (ob->type == OB_ARMATURE ){
+ if (ob->type == OB_ARMATURE ) {
bPose *pose = ob->pose;
pchan = BKE_pose_channel_find_name(pose, bone->name);
if (!pchan)
@@ -922,15 +922,15 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
//BKE_scene_update_for_newframe(G.main,scene,scene->lay);
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
- if (bone){
- if( pchan->flag & POSE_CHAIN)
- {
+ if (bone) {
+ if (pchan->flag & POSE_CHAIN) {
enable_fcurves(ob->adt->action, NULL);
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
}
- else
- BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
+ else {
+ BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
+ }
// compute bone local mat
if (bone->parent) {
@@ -1324,9 +1324,9 @@ bool AnimationExporter::hasAnimations(Scene *sce)
}
//check shape key animation
- if(!fcu){
+ if (!fcu) {
Key *key = BKE_key_from_object(ob);
- if(key && key->adt && key->adt->action)
+ if (key && key->adt && key->adt->action)
fcu = (FCurve *)key->adt->action->curves.first;
}
if (fcu)
@@ -1497,8 +1497,8 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i
enable_fcurves(ob_arm->adt->action, NULL);
}
-bool AnimationExporter::validateConstraints(bConstraint *con){
-
+bool AnimationExporter::validateConstraints(bConstraint *con)
+{
bool valid = true;
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
/* these we can skip completely (invalid constraints...) */
@@ -1512,7 +1512,8 @@ bool AnimationExporter::validateConstraints(bConstraint *con){
return valid;
}
-void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[][4]){
+void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[][4])
+{
ListBase *conlist = get_active_constraints(ob);
bConstraint *con;
for (con = (bConstraint*)conlist->first; con; con = con->next) {
@@ -1524,7 +1525,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[
bConstraintTarget *ct;
Object *obtar;
cti->get_constraint_targets(con, &targets);
- for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next){
+ for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) {
obtar = ct->tar;
BKE_animsys_evaluate_animdata(scene, &obtar->id, obtar->adt, ctime, ADT_RECALC_ANIM);
BKE_object_where_is_calc_time(scene, obtar, ctime);
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 0929bfda6e7..a56010aeb27 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -273,7 +273,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
}
// SECOND_LIFE_COMPATIBILITY
- if (export_settings->second_life) {
+ if (export_settings->second_life) {
// Remove rotations vs armature from transform
// parent_rest_rot * mat * irest_rot
float temp[4][4];
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 86d9de64085..fefad7dd8ec 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -106,13 +106,14 @@ void ArmatureImporter::create_bone(SkinInfo* skin, COLLADAFW::Node *node, EditBo
else {
// bone-space
get_node_mat(obmat, node, NULL, NULL);
-
+
// get world-space
- if (parent){
+ if (parent) {
mult_m4_m4m4(mat, parent_mat, obmat);
}
- else
+ else {
copy_m4_m4(mat, obmat);
+ }
}
if (parent) bone->parent = parent;
@@ -645,7 +646,8 @@ bool ArmatureImporter::write_controller(const COLLADAFW::Controller *controller)
return true;
}
-void ArmatureImporter::make_shape_keys(){
+void ArmatureImporter::make_shape_keys()
+{
std::vector<COLLADAFW::MorphController *>::iterator mc;
float weight;
@@ -668,22 +670,26 @@ void ArmatureImporter::make_shape_keys(){
BKE_key_convert_from_mesh(source_me, kb);
//insert other shape keys
- for ( int i = 0 ; i < morphTargetIds.getCount() ; i++ ){
+ for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
//better to have a seperate map of morph objects,
//This'll do for now since only mesh morphing is imported
+
Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]);
- if(me){
+ if (me) {
me->key = key;
- kb = BKE_keyblock_add_ctime(key, me->id.name, FALSE);
+ std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name);
+
+ kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), FALSE);
BKE_key_convert_from_mesh(me, kb);
//apply weights
weight = morphWeights.getFloatValues()->getData()[i];
kb->curval = weight;
}
- else
+ else {
fprintf(stderr, "Morph target geometry not found.\n");
+ }
}
}
}
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index 57047346617..41693d4d680 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -120,9 +120,10 @@ void ControllerExporter::operator()(Object *ob)
Object *ob_arm = bc_get_assigned_armature(ob);
Key *key = BKE_key_from_object(ob);
- if (ob_arm)
+ if (ob_arm) {
export_skin_controller(ob, ob_arm);
- if(key){
+ }
+ if (key) {
export_morph_controller(ob, key);
}
}
@@ -388,7 +389,8 @@ std::string ControllerExporter::add_morph_weights(Key *key, Object *ob)
}
//Added to implemente support for animations.
-void ControllerExporter::add_weight_extras(Key *key){
+void ControllerExporter::add_weight_extras(Key *key)
+{
// can also try the base element and param alternative
COLLADASW::BaseExtraTechnique extra;
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 7437401ed09..8af4d0652d9 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -54,6 +54,7 @@ extern "C" {
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLI_fileops.h"
#include "BKE_camera.h"
#include "BKE_main.h"
@@ -100,7 +101,7 @@ extern "C" {
// #define ARMATURE_TEST
DocumentImporter::DocumentImporter(bContext *C, const ImportSettings *import_settings) :
- import_settings(import_settings),
+ import_settings(import_settings),
mImportStage(General),
mContext(C),
armature_importer(&unit_converter, &mesh_importer, &anim_importer, CTX_data_scene(C)),
@@ -213,15 +214,17 @@ void DocumentImporter::finish()
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.
- }
// 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);
+ std::vector<Object *> *objects_done;
+ objects_done = write_node(roots[i], NULL, sce, NULL, false);
+
+ if (!this->import_settings->import_units) {
+ // Match incoming scene with current unit settings
+ bc_match_scale(objects_done, *sce, unit_converter);
+ }
}
// update scene
@@ -432,8 +435,9 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
// to create constraints off node <extra> tags. Assumes only constraint data in
// current <extra> with blender profile.
-void DocumentImporter::create_constraints(ExtraTags *et, Object *ob){
- if ( et && et->isProfile("blender")){
+void DocumentImporter::create_constraints(ExtraTags *et, Object *ob)
+{
+ if (et && et->isProfile("blender")) {
std::string name;
short* type = 0;
et->setData("type", type);
@@ -442,7 +446,7 @@ void DocumentImporter::create_constraints(ExtraTags *et, Object *ob){
}
}
-void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par, bool is_library_node)
+std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par, bool is_library_node)
{
Object *ob = NULL;
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
@@ -536,16 +540,20 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
// XXX empty node may not mean it is empty object, not sure about this
if ( (geom_done + camera_done + lamp_done + controller_done + inst_done) < 1) {
//Check if Object is armature, by checking if immediate child is a JOINT node.
- if(is_armature(node))
+ if (is_armature(node)) {
ob = bc_add_object(sce, OB_ARMATURE, NULL);
- else ob = bc_add_object(sce, OB_EMPTY, NULL);
+ }
+ else {
+ ob = bc_add_object(sce, OB_EMPTY, NULL);
+ }
objects_done->push_back(ob);
}
// XXX: if there're multiple instances, only one is stored
- if (!ob) return;
+ if (!ob) return objects_done;
+
for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); ++it) {
ob = *it;
std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId();
@@ -557,6 +565,7 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
libnode_ob.push_back(ob);
}
+
//create_constraints(et,ob);
}
@@ -575,12 +584,19 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
}
// if node has child nodes write them
COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
+
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);
- }
}
+ else {
+ ob = NULL;
+ }
+
+ for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
+ write_node(child_nodes[i], node, sce, ob, is_library_node);
+ }
+
+ return objects_done;
}
/** When this method is called, the writer must write the entire visual scene.
@@ -985,17 +1001,29 @@ bool DocumentImporter::writeImage(const COLLADAFW::Image *image)
if (mImportStage != General)
return true;
- // 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 *)filepath.c_str();
+ const std::string& imagepath = image->getImageURI().toNativePath();
+
char dir[FILE_MAX];
- char full_path[FILE_MAX];
-
- BLI_split_dir_part(filename, dir, sizeof(dir));
- BLI_join_dirfile(full_path, sizeof(full_path), dir, filepath.c_str());
- Image *ima = BKE_image_load_exists(full_path);
+ char absolute_path[FILE_MAX];
+ const char *workpath;
+
+ BLI_split_dir_part(this->import_settings->filepath, dir, sizeof(dir));
+ BLI_join_dirfile(absolute_path, sizeof(absolute_path), dir, imagepath.c_str());
+ if (BLI_exists(absolute_path)) {
+ workpath = absolute_path;
+ }
+ else {
+ // Maybe imagepath was already absolute ?
+ if (!BLI_exists(imagepath.c_str())) {
+ fprintf(stderr, "Image not found: %s.\n", imagepath.c_str() );
+ return true;
+ }
+ workpath = imagepath.c_str();
+ }
+
+ Image *ima = BKE_image_load_exists(workpath);
if (!ima) {
- fprintf(stderr, "Cannot create image.\n");
+ fprintf(stderr, "Cannot create image: %s\n", workpath);
return true;
}
this->uid_image_map[image->getUniqueId()] = ima;
@@ -1238,15 +1266,18 @@ bool DocumentImporter::addExtraTags(const COLLADAFW::UniqueId &uid, ExtraTags *e
return true;
}
-bool DocumentImporter::is_armature(COLLADAFW::Node *node){
+bool DocumentImporter::is_armature(COLLADAFW::Node *node)
+{
COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
- for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
- if(child_nodes[i]->getType() == COLLADAFW::Node::JOINT) return true;
- else continue;
+ for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
+ 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 76d16f38a0c..ff0cbd44043 100644
--- a/source/blender/collada/DocumentImporter.h
+++ b/source/blender/collada/DocumentImporter.h
@@ -77,7 +77,7 @@ public:
Object* create_lamp_object(COLLADAFW::InstanceLight*, Scene*);
Object* create_instance_node(Object*, COLLADAFW::Node*, COLLADAFW::Node*, Scene*, bool);
void create_constraints(ExtraTags *et, Object *ob);
- void write_node(COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
+ std::vector<Object *> *write_node(COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
MTex* create_texture(COLLADAFW::EffectCommon*, COLLADAFW::Texture&, Material*, int, TexIndexTextureArrayMap&);
void write_profile_COMMON(COLLADAFW::EffectCommon*, Material*);
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 0720c1f9b81..4a6c5b43ce2 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -53,7 +53,8 @@ extern "C" {
#include "collada_utils.h"
// TODO: optimize UV sets by making indexed list with duplicates removed
-GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings) {
+GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings)
+{
}
@@ -160,7 +161,7 @@ void GeometryExporter::operator()(Object *ob)
if (this->export_settings->include_shapekeys) {
Key * key = BKE_key_from_object(ob);
- if(key) {
+ if (key) {
KeyBlock * kb = (KeyBlock*)key->block.first;
//skip the basis
kb = kb->next;
@@ -175,7 +176,8 @@ void GeometryExporter::operator()(Object *ob)
#endif
}
-void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb){
+void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb)
+{
std::string geom_id = get_geometry_id(ob, false) + "_morph_" + translate_id(kb->name);
std::vector<Normal> nor;
std::vector<Face> norind;
@@ -185,7 +187,7 @@ void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb){
return;
}
- std::string geom_name = id_name(ob) + "_morph_" + kb->name;
+ std::string geom_name = kb->name;
exportedGeometry.insert(geom_id);
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index bf5a39cfae8..26915f37002 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -952,6 +952,13 @@ Mesh *MeshImporter::get_mesh_by_geom_uid(const COLLADAFW::UniqueId& mesh_uid)
return NULL;
}
+std::string *MeshImporter::get_geometry_name(const std::string &mesh_name)
+{
+ if (this->mesh_geom_map.find(mesh_name) != this->mesh_geom_map.end())
+ return &this->mesh_geom_map[mesh_name];
+ return NULL;
+}
+
MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture,
Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map,
MTex *color_texture)
@@ -1300,7 +1307,9 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom)
// store the Mesh pointer to link it later with an Object
this->uid_mesh_map[mesh->getUniqueId()] = me;
-
+ // needed to map mesh to its geometry name (needed for shape key naming)
+ this->mesh_geom_map[std::string(me->id.name)] = str_geom_id;
+
int new_tris = 0;
read_vertices(mesh, me);
diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h
index 946f9ff99e3..8b0f5cdc200 100644
--- a/source/blender/collada/MeshImporter.h
+++ b/source/blender/collada/MeshImporter.h
@@ -60,6 +60,7 @@ class MeshImporterBase
public:
virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) = 0;
virtual Mesh *get_mesh_by_geom_uid(const COLLADAFW::UniqueId& mesh_uid) = 0;
+ virtual std::string *get_geometry_name(const std::string &mesh_name) = 0;
};
class UVDataWrapper
@@ -84,6 +85,7 @@ private:
Scene *scene;
ArmatureImporter *armature_importer;
+ std::map<std::string, std::string> mesh_geom_map; // needed for correct shape key naming
std::map<COLLADAFW::UniqueId, Mesh*> uid_mesh_map; // geometry unique id-to-mesh map
std::map<COLLADAFW::UniqueId, Object*> uid_object_map; // geom uid-to-object
std::vector<Object*> imported_objects; // list of imported objects
@@ -133,7 +135,7 @@ private:
CustomData create_edge_custom_data(EdgeHash *eh);
- void allocate_face_data(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris);
+ void allocate_face_data(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris);
// TODO: import uv set names
void read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris);
@@ -175,7 +177,7 @@ public:
// create a mesh storing a pointer in a map so it can be retrieved later by geometry UID
bool write_geometry(const COLLADAFW::Geometry* geom);
-
+ std::string *get_geometry_name(const std::string &mesh_name);
};
#endif
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index 3a06ca3bc0e..dbf7d40b373 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -182,7 +182,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
colladaNode.end();
}
- if (ob->constraints.first != NULL ){
+ if (ob->constraints.first != NULL ) {
bConstraint *con = (bConstraint*) ob->constraints.first;
while (con) {
std::string con_name(id_name(con));
@@ -208,8 +208,8 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
Object *obtar;
cti->get_constraint_targets(con, &targets);
- if(cti){
- for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next){
+ if (cti) {
+ for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) {
obtar = ct->tar;
std::string tar_id(id_name(obtar));
colladaNode.addExtraTechniqueChildParameter("blender",con_tag,"target_id",tar_id);
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index 913c0710cc6..67166d819a6 100644
--- a/source/blender/collada/TransformReader.cpp
+++ b/source/blender/collada/TransformReader.cpp
@@ -46,7 +46,7 @@ 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;
diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp
index fb8ba567192..fa813e0b961 100644
--- a/source/blender/collada/TransformWriter.cpp
+++ b/source/blender/collada/TransformWriter.cpp
@@ -51,10 +51,10 @@ void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[4][4],
converter->mat4_to_dae_double(dmat, local);
TransformBase::decompose(local, loc, rot, NULL, scale);
- if (node.getType() == COLLADASW::Node::JOINT)
+ //if (node.getType() == COLLADASW::Node::JOINT)
node.addMatrix("transform", dmat);
- else
- add_transform(node, loc, rot, scale);
+ //else
+ //add_transform(node, loc, rot, scale);
}
void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
@@ -115,7 +115,7 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
double d_obmat[4][4];
converter.mat4_to_dae_double(d_obmat, ob->obmat);
node.addMatrix("transform",d_obmat);
- add_transform(node, ob->loc, ob->rot, ob->size);
+ //add_transform(node, ob->loc, ob->rot, ob->size);
}
void TransformWriter::add_node_transform_identity(COLLADASW::Node& node)
@@ -131,10 +131,10 @@ void TransformWriter::add_transform(COLLADASW::Node& node, float loc[3], float r
node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1]));
node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0]));
#endif
+ node.addTranslate("location", loc[0], loc[1], loc[2]);
node.addRotateZ("rotationZ", RAD2DEGF(rot[2]));
node.addRotateY("rotationY", RAD2DEGF(rot[1]));
node.addRotateX("rotationX", RAD2DEGF(rot[0]));
node.addScale("scale", scale[0], scale[1], scale[2]);
- node.addTranslate("location", loc[0], loc[1], loc[2]);
}
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index 1aff0f166ba..b3c288c8fc5 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -40,7 +40,6 @@ extern "C"
/* make dummy file */
#include "BLI_fileops.h"
-#include "BLI_path_util.h"
#include "BLI_linklist.h"
int collada_import(bContext *C,
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index 587dc37b7db..2fa5b22bb15 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -33,6 +33,7 @@ extern "C" {
#endif
#include "BLI_linklist.h"
+#include "BLI_path_util.h"
#include "RNA_types.h"
typedef enum BC_export_mesh_type {
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index 64c567384a1..85f98dad437 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -33,7 +33,14 @@
UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP)
{
- /* pass */
+ unit_m4(x_up_mat4);
+ rotate_m4(x_up_mat4, 'Y', -0.5 * M_PI);
+
+ unit_m4(y_up_mat4);
+ rotate_m4(y_up_mat4, 'X', 0.5 * M_PI);
+
+ unit_m4(z_up_mat4);
+
}
void UnitConverter::read_asset(const COLLADAFW::FileInfo *asset)
@@ -102,6 +109,21 @@ void UnitConverter::mat4_to_dae_double(double out[4][4], float in[4][4])
out[i][j] = mat[i][j];
}
+float(&UnitConverter::get_rotation())[4][4]
+{
+ switch(up_axis) {
+ case COLLADAFW::FileInfo::X_UP:
+ return x_up_mat4;
+ break;
+ case COLLADAFW::FileInfo::Y_UP:
+ return y_up_mat4;
+ break;
+ default:
+ return z_up_mat4;
+ break;
+ }
+}
+
void TransformBase::decompose(float mat[4][4], float *loc, float eul[3], float quat[4], float *size)
{
mat4_to_size(size, mat);
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h
index ba077628499..7d59932bac9 100644
--- a/source/blender/collada/collada_internal.h
+++ b/source/blender/collada/collada_internal.h
@@ -39,7 +39,6 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_math.h"
-#include "BLI_math.h"
#include "BLI_linklist.h"
class UnitConverter
@@ -48,6 +47,10 @@ private:
COLLADAFW::FileInfo::Unit unit;
COLLADAFW::FileInfo::UpAxisType up_axis;
+ float x_up_mat4[4][4];
+ float y_up_mat4[4][4];
+ float z_up_mat4[4][4];
+
public:
enum UnitSystem {
@@ -74,6 +77,10 @@ public:
void mat4_to_dae(float out[4][4], float in[4][4]);
void mat4_to_dae_double(double out[4][4], float in[4][4]);
+
+ float(&get_rotation())[4][4];
+
+
};
class TransformBase
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 27af5c0aba2..45db8510cbb 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -295,11 +295,76 @@ std::string bc_url_encode(std::string data) {
}
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;
+ 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;
+}
+
+/**
+ Calculate a rescale factor such that the imported scene's scale
+ is preserved. I.e. 1 meter in the import will also be
+ 1 meter in the current scene.
+ XXX : I am not sure if it is correct to map 1 Blender Unit
+ to 1 Meter for unit type NONE. But it looks reasonable to me.
+*/
+void bc_match_scale(std::vector<Object *> *objects_done,
+ Scene &sce,
+ UnitConverter &bc_unit) {
+
+ Object *ob = NULL;
+
+ PointerRNA scene_ptr, unit_settings;
+ PropertyRNA *system_ptr, *scale_ptr;
+ RNA_id_pointer_create(&sce.id, &scene_ptr);
+
+ unit_settings = RNA_pointer_get(&scene_ptr, "unit_settings");
+ system_ptr = RNA_struct_find_property(&unit_settings, "system");
+ scale_ptr = RNA_struct_find_property(&unit_settings, "scale_length");
+
+ int type = RNA_property_enum_get(&unit_settings, system_ptr);
+
+ float bl_scale;
+
+ switch (type) {
+ case USER_UNIT_NONE:
+ bl_scale = 1.0; // map 1 Blender unit to 1 Meter
+ break;
+
+ case USER_UNIT_METRIC:
+ bl_scale = RNA_property_float_get(&unit_settings, scale_ptr);
+ break;
+
+ default :
+ bl_scale = RNA_property_float_get(&unit_settings, scale_ptr);
+ // it looks like the conversion to Imperial is done implicitly.
+ // So nothing to do here.
+ break;
+ }
+
+ float scale_conv = bc_unit.getLinearMeter() / bl_scale;
+
+ float rescale[3];
+ rescale[0] = rescale[1] = rescale[2] = scale_conv;
+
+ float size_mat4[4][4];
+
+ float axis_mat4[4][4];
+ unit_m4(axis_mat4);
+
+ size_to_mat4(size_mat4, rescale);
+
+ for (std::vector<Object *>::iterator it = objects_done->begin();
+ it != objects_done->end();
+ ++it)
+ {
+ ob = *it;
+ mult_m4_m4m4(ob->obmat, size_mat4, ob->obmat);
+ mult_m4_m4m4(ob->obmat, bc_unit.get_rotation(), ob->obmat);
+ BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
+ }
+
} \ No newline at end of file
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index 90282d9d28f..892b57e6a4a 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -42,15 +42,19 @@ extern "C" {
#include "DNA_texture_types.h"
#include "DNA_scene_types.h"
+#include "RNA_access.h"
+
#include "BLI_linklist.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_object.h"
#include "BKE_DerivedMesh.h"
+#include "BKE_scene.h"
}
#include "ExportSettings.h"
+#include "collada_internal.h"
typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex *> > TexIndexTextureArrayMap;
@@ -79,5 +83,5 @@ 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);
-
+extern void bc_match_scale(std::vector<Object *> *objects_done, Scene &sce, UnitConverter &unit_converter);
#endif
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp
index e3313750e66..fc4dea8cee3 100644
--- a/source/blender/compositor/nodes/COM_CompositorNode.cpp
+++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp
@@ -41,6 +41,7 @@ void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorConte
compositorOperation->setSceneName(editorNode->id->name);
compositorOperation->setRenderData(context->getRenderData());
compositorOperation->setbNodeTree(context->getbNodeTree());
+ compositorOperation->setIgnoreAlpha(editorNode->custom2 & 1);
imageSocket->relinkConnections(compositorOperation->getInputSocket(0), 0, graph);
alphaSocket->relinkConnections(compositorOperation->getInputSocket(1));
depthSocket->relinkConnections(compositorOperation->getInputSocket(2));
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cpp b/source/blender/compositor/nodes/COM_ViewerNode.cpp
index f44470a9b9a..94f3c2ebd80 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp
@@ -47,6 +47,7 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
viewerOperation->setChunkOrder((OrderOfChunks)editorNode->custom1);
viewerOperation->setCenterX(editorNode->custom3);
viewerOperation->setCenterY(editorNode->custom4);
+ viewerOperation->setIgnoreAlpha(editorNode->custom2 & 1);
viewerOperation->setViewSettings(context->getViewSettings());
viewerOperation->setDisplaySettings(context->getDisplaySettings());
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index e6a49082a71..43f491ad2d9 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -49,6 +49,8 @@ CompositorOperation::CompositorOperation() : NodeOperation()
this->m_alphaInput = NULL;
this->m_depthInput = NULL;
+ this->m_ignoreAlpha = false;
+
this->m_sceneName[0] = '\0';
}
@@ -138,9 +140,15 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber)
for (y = y1; y < y2 && (!breaked); y++) {
for (x = x1; x < x2 && (!breaked); x++) {
this->m_imageInput->read(color, x, y, COM_PS_NEAREST);
- if (this->m_alphaInput != NULL) {
- this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST);
+ if (this->m_ignoreAlpha) {
+ color[3] = 1.0f;
+ }
+ else {
+ if (this->m_alphaInput != NULL) {
+ this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST);
+ }
}
+
copy_v4_v4(buffer + offset4, color);
if (this->m_depthInput != NULL) {
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h
index c1d91c16a3c..27d29664610 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.h
+++ b/source/blender/compositor/operations/COM_CompositorOperation.h
@@ -65,6 +65,10 @@ private:
* @brief local reference to the depth operation
*/
SocketReader *m_depthInput;
+
+ /* Ignore any alpha input */
+ bool m_ignoreAlpha;
+
public:
CompositorOperation();
void executeRegion(rcti *rect, unsigned int tileNumber);
@@ -75,5 +79,6 @@ public:
void deinitExecution();
const CompositorPriority getRenderPriority() const { return COM_PRIORITY_MEDIUM; }
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
+ void setIgnoreAlpha(bool value) { this->m_ignoreAlpha = value; }
};
#endif
diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp
index 81ca06cfff0..edcd1563e03 100644
--- a/source/blender/compositor/operations/COM_InpaintOperation.cpp
+++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp
@@ -84,8 +84,8 @@ float *InpaintSimpleOperation::get_pixel(int x, int y)
ASSERT_XY_RANGE(x, y);
return &this->m_cached_buffer[
- y * width * COM_NUMBER_OF_CHANNELS
- + x * COM_NUMBER_OF_CHANNELS];
+ y * width * COM_NUMBER_OF_CHANNELS +
+ x * COM_NUMBER_OF_CHANNELS];
}
int InpaintSimpleOperation::mdist(int x, int y)
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
index d5f2c283c72..072246932db 100644
--- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
@@ -48,6 +48,7 @@ ViewerBaseOperation::ViewerBaseOperation() : NodeOperation()
this->m_doDepthBuffer = false;
this->m_viewSettings = NULL;
this->m_displaySettings = NULL;
+ this->m_ignoreAlpha = false;
}
void ViewerBaseOperation::initExecution()
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.h b/source/blender/compositor/operations/COM_ViewerBaseOperation.h
index f7d479eb3b8..9f7e80ad6fc 100644
--- a/source/blender/compositor/operations/COM_ViewerBaseOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.h
@@ -39,6 +39,7 @@ protected:
OrderOfChunks m_chunkOrder;
bool m_doDepthBuffer;
ImBuf *m_ibuf;
+ bool m_ignoreAlpha;
const ColorManagedViewSettings *m_viewSettings;
const ColorManagedDisplaySettings *m_displaySettings;
@@ -59,6 +60,7 @@ public:
OrderOfChunks getChunkOrder() { return this->m_chunkOrder; }
const CompositorPriority getRenderPriority() const;
bool isViewerOperation() { return true; }
+ void setIgnoreAlpha(bool value) { this->m_ignoreAlpha = value; }
void setViewSettings(const ColorManagedViewSettings *viewSettings) { this->m_viewSettings = viewSettings; }
void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings) { this->m_displaySettings = displaySettings; }
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index d1ac7d74ead..4d10e49aeeb 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -89,9 +89,14 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
for (y = y1; y < y2 && (!breaked); y++) {
for (x = x1; x < x2; x++) {
this->m_imageInput->read(&(buffer[offset4]), x, y, COM_PS_NEAREST);
- if (this->m_alphaInput != NULL) {
- this->m_alphaInput->read(alpha, x, y, COM_PS_NEAREST);
- buffer[offset4 + 3] = alpha[0];
+ if (this->m_ignoreAlpha) {
+ buffer[offset4 + 3] = 1.0f;
+ }
+ else {
+ if (this->m_alphaInput != NULL) {
+ this->m_alphaInput->read(alpha, x, y, COM_PS_NEAREST);
+ buffer[offset4 + 3] = alpha[0];
+ }
}
if (m_depthInput) {
this->m_depthInput->read(depth, x, y, COM_PS_NEAREST);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 3bcb4002ece..06e00cd02c1 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -2268,7 +2268,7 @@ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name)
BLI_addtail(arm->edbo, bone);
- bone->flag |= BONE_TIPSEL | BONE_RELATIVE_PARENTING;
+ bone->flag |= BONE_TIPSEL;
bone->weight = 1.0f;
bone->dist = 0.25f;
bone->xwidth = 0.1f;
@@ -3422,7 +3422,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
copy_v3_v3(newbone->tail, ebone->head);
newbone->parent = ebone->parent;
- newbone->flag = BONE_TIPSEL | BONE_RELATIVE_PARENTING;
+ newbone->flag = BONE_TIPSEL;
if (newbone->parent && (ebone->flag & BONE_CONNECTED)) {
newbone->flag |= BONE_CONNECTED;
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index b2c1b7fdcd0..48c0a4a38c3 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -663,7 +663,7 @@ static int poselib_rename_exec(bContext *C, wmOperator *op)
}
/* get index (and pointer) of pose to remove */
- marker = BLI_findlink(&act->markers, RNA_int_get(op->ptr, "pose"));
+ marker = BLI_findlink(&act->markers, RNA_enum_get(op->ptr, "pose"));
if (marker == NULL) {
BKE_report(op->reports, RPT_ERROR, "Invalid index for pose");
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h
index 1321765588d..4655188a3dd 100644
--- a/source/blender/editors/include/ED_mball.h
+++ b/source/blender/editors/include/ED_mball.h
@@ -32,6 +32,7 @@
#define __ED_MBALL_H__
struct bContext;
+struct MetaBall;
struct Object;
struct wmKeyConfig;
@@ -48,5 +49,6 @@ void load_editMball(struct Object *obedit);
void undo_push_mball(struct bContext *C, const char *name);
-#endif
+void ED_mball_transform(struct MetaBall *mb, float *mat);
+#endif /* __ED_MBALL_H__ */
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 533bfe2fa20..e212f2cc17d 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -83,6 +83,7 @@ typedef enum eParentType {
PAR_ARMATURE_ENVELOPE,
PAR_ARMATURE_AUTO,
PAR_BONE,
+ PAR_BONE_RELATIVE,
PAR_CURVE,
PAR_FOLLOW,
PAR_PATH_CONST,
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 4a5f3acad4f..d245349f2c4 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1800,9 +1800,9 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double
#ifdef WITH_PYTHON
if (str[0] != '\0') {
- int is_unit_but = ui_is_but_unit(but);
+ bool is_unit_but = (ui_is_but_float(but) && ui_is_but_unit(but));
/* only enable verbose if we won't run again with units */
- if (BPY_button_exec(C, str, value, is_unit_but == FALSE) != -1) {
+ if (BPY_button_exec(C, str, value, is_unit_but == false) != -1) {
/* if the value parsed ok without unit conversion this button may still need a unit multiplier */
if (is_unit_but) {
char str_new[128];
@@ -2781,21 +2781,21 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
return but;
}
-/* ui_def_but_rna_propname and ui_def_but_rna
+static void ui_def_but_rna__disable(uiBut *but)
+{
+ but->flag |= UI_BUT_DISABLED;
+ but->lock = true;
+ but->lockstr = "";
+}
+
+/**
+ * ui_def_but_rna_propname and ui_def_but_rna
* both take the same args except for propname vs prop, this is done so we can
* avoid an extra lookup on 'prop' when its already available.
*
* When this kind of change won't disrupt branches, best look into making more
* of our UI functions take prop rather then propname.
*/
-
-#define UI_DEF_BUT_RNA_DISABLE(but) { \
- but->flag |= UI_BUT_DISABLED; \
- but->lock = TRUE; \
- but->lockstr = ""; \
- } (void)0
-
-
static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str,
int x, int y, short width, short height,
PointerRNA *ptr, PropertyRNA *prop, int index,
@@ -2932,7 +2932,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
}
if (!RNA_property_editable(&but->rnapoin, prop)) {
- UI_DEF_BUT_RNA_DISABLE(but);
+ ui_def_but_rna__disable(but);
}
if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == FALSE)) {
@@ -2962,7 +2962,7 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, cons
else {
but = ui_def_but(block, type, retval, propname, x, y, width, height, NULL, min, max, a1, a2, tip);
- UI_DEF_BUT_RNA_DISABLE(but);
+ ui_def_but_rna__disable(but);
}
return but;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index edd5b901ca1..b166e532f84 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1610,7 +1610,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, strCursorJump
}
else {
int pos_i = but->pos;
- BLI_str_cursor_step_utf8(str, len, &pos_i, direction, jump);
+ BLI_str_cursor_step_utf8(str, len, &pos_i, direction, jump, true);
but->pos = pos_i;
if (select) {
@@ -1679,7 +1679,7 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
else if (but->pos >= 0 && but->pos < len) {
int pos = but->pos;
int step;
- BLI_str_cursor_step_utf8(str, len, &pos, direction, jump);
+ BLI_str_cursor_step_utf8(str, len, &pos, direction, jump, true);
step = pos - but->pos;
memmove(&str[but->pos], &str[but->pos + step], (len + 1) - but->pos);
changed = 1;
@@ -1694,7 +1694,7 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
int pos = but->pos;
int step;
- BLI_str_cursor_step_utf8(str, len, &pos, direction, jump);
+ BLI_str_cursor_step_utf8(str, len, &pos, direction, jump, true);
step = but->pos - pos;
memmove(&str[but->pos - step], &str[but->pos], (len + 1) - but->pos);
but->pos -= step;
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 1b2034d6e40..e466c481151 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -447,8 +447,8 @@ static void ui_draw_panel_dragwidget(const rctf *rect)
ymin = rect->ymin;
ymax = rect->ymax;
- dx = 0.333f * (xmax - xmin);
- dy = 0.333f * (ymax - ymin);
+ dx = (xmax - xmin) / 3.0f;
+ dy = (ymax - ymin) / 3.0f;
glEnable(GL_BLEND);
glColor4ub(255, 255, 255, 50);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 0876e8f362c..5e9a70ea895 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -518,7 +518,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
BLF_I18NCONTEXT_ID_CAMERA,
BLF_I18NCONTEXT_ID_WORLD,
BLF_I18NCONTEXT_ID_SCREEN,
- BLF_I18NCONTEXT_ID_TEXT);
+ BLF_I18NCONTEXT_ID_TEXT,
+ );
BLF_I18N_MSGID_MULTI_CTXT("New", BLF_I18NCONTEXT_ID_SPEAKER,
BLF_I18NCONTEXT_ID_SOUND,
BLF_I18NCONTEXT_ID_ARMATURE,
@@ -1856,7 +1857,7 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v)
/* use this for a fake extra empy space around the buttons */
uiDefBut(block, LABEL, 0, "", -4, 16, width + 8, 6 * UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- bt = uiDefButBitI(block, TOG, CUMA_DO_CLIP, 1, "Use Clipping",
+ bt = uiDefButBitI(block, TOG, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"),
0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, "");
uiButSetFunc(bt, curvemap_buttons_setclip, cumap, NULL);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 142ea5128c0..6735c8b173c 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -646,8 +646,8 @@ static void widget_verts_to_quad_strip_open(uiWidgetBase *wtb, const int totvert
for (a = 0; a < totvert; a++) {
quad_strip[a * 2][0] = wtb->outer_v[a][0];
quad_strip[a * 2][1] = wtb->outer_v[a][1];
- quad_strip[a * 2 + 1][0] = wtb->inner_v[a][0];
- quad_strip[a * 2 + 1][1] = wtb->inner_v[a][1];
+ quad_strip[a * 2 + 1][0] = wtb->outer_v[a][0];
+ quad_strip[a * 2 + 1][1] = wtb->outer_v[a][1] - 1.0f;
}
}
@@ -1900,12 +1900,12 @@ static void ui_hsv_cursor(float x, float y)
glTranslatef(x, y, 0.0f);
glColor3f(1.0f, 1.0f, 1.0f);
- glutil_draw_filled_arc(0.0f, M_PI * 2.0, 3.0f, 8);
+ glutil_draw_filled_arc(0.0f, M_PI * 2.0, 3.0f * U.pixelsize, 8);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glColor3f(0.0f, 0.0f, 0.0f);
- glutil_draw_lined_arc(0.0f, M_PI * 2.0, 3.0f, 12);
+ glutil_draw_lined_arc(0.0f, M_PI * 2.0, 3.0f * U.pixelsize, 12);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
@@ -1929,7 +1929,7 @@ void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rec
static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
{
- const int tot = 32;
+ const int tot = 64;
const float radstep = 2.0f * (float)M_PI / (float)tot;
const float centx = BLI_rcti_cent_x_fl(rect);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 7efda2f56c3..009d52ea283 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -696,6 +696,7 @@ void ui_theme_init_default(void)
ui_widget_color_init(&btheme->tui);
btheme->tui.iconfile[0] = 0;
+ btheme->tui.panel.show_back = FALSE;
btheme->tui.panel.show_header = FALSE;
rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
@@ -713,6 +714,8 @@ void ui_theme_init_default(void)
ui_theme_init_new(btheme);
/* space view3d */
+ btheme->tv3d.panelcolors.show_back = FALSE;
+ btheme->tv3d.panelcolors.show_header = FALSE;
rgba_char_args_set_fl(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0);
rgba_char_args_set(btheme->tv3d.text, 0, 0, 0, 255);
rgba_char_args_set(btheme->tv3d.text_hi, 255, 255, 255, 255);
@@ -1332,7 +1335,6 @@ void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3]
void init_userdef_do_versions(void)
{
Main *bmain = G.main;
-// countall();
/* the UserDef struct is not corrected with do_versions() .... ugh! */
if (U.wheellinescroll == 0) U.wheellinescroll = 3;
@@ -2121,7 +2123,8 @@ void init_userdef_do_versions(void)
}
}
- if (bmain->versionfile < 266) {
+ /* NOTE!! from now on use U.versionfile and U.subversionfile */
+ if (U.versionfile < 266) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -2133,7 +2136,7 @@ void init_userdef_do_versions(void)
}
}
- if (!MAIN_VERSION_ATLEAST(bmain, 265, 4)) {
+ if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 4)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
rgba_char_args_set(btheme->text.syntaxd, 50, 0, 140, 255); /* Decorator/Preprocessor Dir. Blue-purple */
@@ -2142,14 +2145,14 @@ void init_userdef_do_versions(void)
}
}
- if (!MAIN_VERSION_ATLEAST(bmain, 265, 6)) {
+ if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 6)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
copy_v4_v4_char(btheme->tv3d.gradients.high_gradient, btheme->tv3d.back);
}
}
- if (!MAIN_VERSION_ATLEAST(bmain, 265, 9)) {
+ if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 9)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
rgba_char_args_test_set(btheme->tnode.syntaxs, 151, 116, 116, 255); /* matte nodes */
@@ -2157,6 +2160,9 @@ void init_userdef_do_versions(void)
}
}
+ /* NOTE!! from now on use U.versionfile and U.subversionfile */
+
+
if (U.pixelsize == 0.0f)
U.pixelsize = 1.0f;
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index 2004b18adf6..7703a8638c9 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -319,14 +319,12 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
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;
+ 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;
+ BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document (see console for details)");
+ return OPERATOR_CANCELLED;
}
}
@@ -368,8 +366,10 @@ void WM_OT_collada_import(wmOperatorType *ot)
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");
+ RNA_def_boolean(ot->srna,
+ "import_units", 0, "Import Units",
+ "If disabled match import to Blender's current Unit settings, "
+ "otherwise use the settings from the Imported scene");
}
#endif
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 647bb6c1d77..b58e393811d 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1744,9 +1744,9 @@ void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot)
"Lambda factor", "", 0.0000001f, 1000.0f);
RNA_def_float(ot->srna, "lambda_border", 0.00005f, 0.0000001f, 1000.0f,
"Lambda factor in border", "", 0.0000001f, 1000.0f);
- RNA_def_boolean(ot->srna, "use_x", 1, "Smooth X Axis", "Smooth object along X axis");
- RNA_def_boolean(ot->srna, "use_y", 1, "Smooth Y Axis", "Smooth object along Y axis");
- RNA_def_boolean(ot->srna, "use_z", 1, "Smooth Z Axis", "Smooth object along Z axis");
+ RNA_def_boolean(ot->srna, "use_x", 1, "Smooth X Axis", "Smooth object along X axis");
+ RNA_def_boolean(ot->srna, "use_y", 1, "Smooth Y Axis", "Smooth object along Y axis");
+ RNA_def_boolean(ot->srna, "use_z", 1, "Smooth Z Axis", "Smooth object along Z axis");
RNA_def_boolean(ot->srna, "preserve_volume", 1, "Preserve Volume", "Apply volume preservation after smooth");
}
@@ -4977,7 +4977,7 @@ static float edbm_bevel_mval_factor(wmOperator *op, wmEvent *event)
if (event->shift) {
if (opdata->shift_factor < 0.0f) {
#ifdef NEW_BEVEL
- opdata->shift_factor = RNA_float_get(op->ptr, "percent");
+ opdata->shift_factor = RNA_float_get(op->ptr, "offset");
#else
opdata->shift_factor = RNA_float_get(op->ptr, "factor");
#endif
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 96b8f1080b9..cb69faa5b51 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -502,6 +502,9 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* tessface data removed above, no need to update */
mesh_update_customdata_pointers(me, FALSE);
+
+ /* update normals in case objects with non-uniform scale are joined */
+ ED_mesh_calc_normals(me);
/* old material array */
for (a = 1; a <= ob->totcol; a++) {
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 8633a7a9b38..6c056df5a38 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -586,3 +586,27 @@ void undo_push_mball(bContext *C, const char *name)
undo_editmode_push(C, name, get_data, free_undoMball, undoMball_to_editMball, editMball_to_undoMball, NULL);
}
+/* matrix is 4x4 */
+void ED_mball_transform(MetaBall *mb, float *mat)
+{
+ MetaElem *me;
+ float quat[4];
+ const float scale = mat4_to_scale((float (*)[4])mat);
+ const float scale_sqrt = sqrtf(scale);
+
+ mat4_to_quat(quat, (float (*)[4])mat);
+
+ for (me = mb->elems.first; me; me = me->next) {
+ mul_m4_v3((float (*)[4])mat, &me->x);
+ mul_qt_qtqt(me->quat, quat, me->quat);
+ me->rad *= scale;
+ /* hrmf, probably elems shouldn't be
+ * treating scale differently - campbell */
+ if (!MB_TYPE_SIZE_SQUARED(me->type)) {
+ mul_v3_fl(&me->expx, scale);
+ }
+ else {
+ mul_v3_fl(&me->expx, scale_sqrt);
+ }
+ }
+}
diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c
index e98654f589a..f91d57424a1 100644
--- a/source/blender/editors/metaball/mball_ops.c
+++ b/source/blender/editors/metaball/mball_ops.c
@@ -28,10 +28,6 @@
* \ingroup edmeta
*/
-
-#include "WM_api.h"
-#include "WM_types.h"
-
#include "RNA_access.h"
#include "ED_mball.h"
@@ -40,6 +36,9 @@
#include "BLI_utildefines.h"
+#include "WM_api.h"
+#include "WM_types.h"
+
#include "mball_intern.h"
void ED_operatortypes_metaball(void)
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 05c042a4182..a92b25c6c85 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -20,6 +20,7 @@
set(INC
../include
+ ../../blenfont
../../blenkernel
../../blenlib
../../blenloader
@@ -66,4 +67,8 @@ if(WITH_GAMEENGINE)
add_definitions(-DWITH_GAMEENGINE)
endif()
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_object "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript
index df51198df92..203d7dff768 100644
--- a/source/blender/editors/object/SConscript
+++ b/source/blender/editors/object/SConscript
@@ -29,7 +29,7 @@ Import ('env')
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenlib ../../blenfont ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc ../../blenloader'
incs += ' ../../makesrna ../../python ../../ikplugin ../../bmesh'
incs += ' ../../render/extern/include ../../gpu' # for object_bake.c
@@ -50,4 +50,7 @@ if env['WITH_BF_PYTHON']:
if env['WITH_BF_GAMEENGINE']:
defs.append('WITH_GAMEENGINE')
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
env.BlenderLib ( 'bf_editors_object', sources, Split(incs), defs, libtype=['core'], priority=[35] )
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 6cb7cd5e326..7746329c17f 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -718,81 +718,87 @@ void CONSTRAINT_OT_limitdistance_reset(wmOperatorType *ot)
/* ------------- Child-Of Constraint ------------------ */
-static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, float invmat[4][4])
+static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, float invmat[4][4], const int owner)
{
- bConstraint *lastcon = NULL;
- bPoseChannel *pchan = NULL;
-
/* nullify inverse matrix first */
unit_m4(invmat);
- /* try to find a pose channel - assume that this is the constraint owner */
- /* TODO: get from context instead? */
- if (ob && ob->pose)
- pchan = BKE_pose_channel_active(ob);
-
- /* calculate/set inverse matrix:
- * We just calculate all transform-stack eval up to but not including this constraint.
- * This is because inverse should just inverse correct for just the constraint's influence
- * when it gets applied; that is, at the time of application, we don't know anything about
- * what follows.
- */
- if (pchan) {
- float imat[4][4], tmat[4][4];
- float pmat[4][4];
-
- /* 1. calculate posemat where inverse doesn't exist yet (inverse was cleared above),
- * to use as baseline ("pmat") to derive delta from. This extra calc saves users
- * from having pressing "Clear Inverse" first
- */
- BKE_pose_where_is(scene, ob);
- copy_m4_m4(pmat, pchan->pose_mat);
-
- /* 2. knock out constraints starting from this one */
- lastcon = pchan->constraints.last;
- pchan->constraints.last = con->prev;
-
- if (con->prev) {
- /* new end must not point to this one, else this chain cutting is useless */
- con->prev->next = NULL;
- }
- else {
- /* constraint was first */
- pchan->constraints.first = NULL;
- }
-
- /* 3. solve pose without disabled constraints */
- BKE_pose_where_is(scene, ob);
-
- /* 4. determine effect of constraint by removing the newly calculated
- * pchan->pose_mat from the original pchan->pose_mat, thus determining
- * the effect of the constraint
- */
- invert_m4_m4(imat, pchan->pose_mat);
- mult_m4_m4m4(tmat, pmat, imat);
- invert_m4_m4(invmat, tmat);
-
- /* 5. restore constraints */
- pchan->constraints.last = lastcon;
-
- if (con->prev) {
- /* hook up prev to this one again */
- con->prev->next = con;
- }
- else {
- /* set as first again */
- pchan->constraints.first = con;
+ if (owner == EDIT_CONSTRAINT_OWNER_BONE) {
+ bPoseChannel *pchan;
+ /* try to find a pose channel - assume that this is the constraint owner */
+ /* TODO: get from context instead? */
+ if (ob && ob->pose && (pchan = BKE_pose_channel_active(ob))) {
+ bConstraint *con_last;
+ /* calculate/set inverse matrix:
+ * We just calculate all transform-stack eval up to but not including this constraint.
+ * This is because inverse should just inverse correct for just the constraint's influence
+ * when it gets applied; that is, at the time of application, we don't know anything about
+ * what follows.
+ */
+ float imat[4][4], tmat[4][4];
+ float pmat[4][4];
+
+ /* make sure we passed the correct constraint */
+ BLI_assert(BLI_findindex(&pchan->constraints, con) != -1);
+
+ /* 1. calculate posemat where inverse doesn't exist yet (inverse was cleared above),
+ * to use as baseline ("pmat") to derive delta from. This extra calc saves users
+ * from having pressing "Clear Inverse" first
+ */
+ BKE_pose_where_is(scene, ob);
+ copy_m4_m4(pmat, pchan->pose_mat);
+
+ /* 2. knock out constraints starting from this one */
+ con_last = pchan->constraints.last;
+ pchan->constraints.last = con->prev;
+
+ if (con->prev) {
+ /* new end must not point to this one, else this chain cutting is useless */
+ con->prev->next = NULL;
+ }
+ else {
+ /* constraint was first */
+ pchan->constraints.first = NULL;
+ }
+
+ /* 3. solve pose without disabled constraints */
+ BKE_pose_where_is(scene, ob);
+
+ /* 4. determine effect of constraint by removing the newly calculated
+ * pchan->pose_mat from the original pchan->pose_mat, thus determining
+ * the effect of the constraint
+ */
+ invert_m4_m4(imat, pchan->pose_mat);
+ mult_m4_m4m4(tmat, pmat, imat);
+ invert_m4_m4(invmat, tmat);
+
+ /* 5. restore constraints */
+ pchan->constraints.last = con_last;
+
+ if (con->prev) {
+ /* hook up prev to this one again */
+ con->prev->next = con;
+ }
+ else {
+ /* set as first again */
+ pchan->constraints.first = con;
+ }
+
+ /* 6. recalculate pose with new inv-mat applied */
+ BKE_pose_where_is(scene, ob);
}
-
- /* 6. recalculate pose with new inv-mat applied */
- BKE_pose_where_is(scene, ob);
}
- else if (ob) {
- Object workob;
-
- /* use BKE_object_workob_calc_parent to find inverse - just like for normal parenting */
- BKE_object_workob_calc_parent(scene, ob, &workob);
- invert_m4_m4(invmat, workob.obmat);
+ if (owner == EDIT_CONSTRAINT_OWNER_OBJECT) {
+ if (ob) {
+ Object workob;
+
+ /* make sure we passed the correct constraint */
+ BLI_assert(BLI_findindex(&ob->constraints, con) != -1);
+
+ /* use BKE_object_workob_calc_parent to find inverse - just like for normal parenting */
+ BKE_object_workob_calc_parent(scene, ob, &workob);
+ invert_m4_m4(invmat, workob.obmat);
+ }
}
}
@@ -803,6 +809,7 @@ static int childof_set_inverse_exec(bContext *C, wmOperator *op)
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL;
+ const int owner = RNA_enum_get(op->ptr, "owner");
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL) {
@@ -811,7 +818,7 @@ static int childof_set_inverse_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- child_get_inverse_matrix(scene, ob, con, data->invmat);
+ child_get_inverse_matrix(scene, ob, con, data->invmat, owner);
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
@@ -1024,6 +1031,7 @@ static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL;
+ const int owner = RNA_enum_get(op->ptr, "owner");
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL) {
@@ -1032,7 +1040,7 @@ static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- child_get_inverse_matrix(scene, ob, con, data->invmat);
+ child_get_inverse_matrix(scene, ob, con, data->invmat, owner);
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index caeff1e82a7..1387ef94091 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -386,6 +386,31 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
}
}
+static void object_hook_from_context(bContext *C, PointerRNA *ptr, const int num,
+ Object **r_ob, HookModifierData **r_hmd)
+{
+ Object *ob;
+ HookModifierData *hmd;
+
+ if (ptr->data) { /* if modifier context is available, use that */
+ ob = ptr->id.data;
+ hmd = ptr->data;
+ }
+ else { /* use the provided property */
+ ob = CTX_data_edit_object(C);
+ hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
+ }
+
+ if (ob && hmd && (hmd->modifier.type == eModifierType_Hook)) {
+ *r_ob = ob;
+ *r_hmd = hmd;
+ }
+ else {
+ *r_ob = NULL;
+ *r_hmd = NULL;
+ }
+}
+
static void object_hook_select(Object *ob, HookModifierData *hmd)
{
if (hmd->indexar == NULL)
@@ -663,16 +688,9 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
int num = RNA_enum_get(op->ptr, "modifier");
Object *ob = NULL;
HookModifierData *hmd = NULL;
-
- if (ptr.data) { /* if modifier context is available, use that */
- ob = ptr.id.data;
- hmd = ptr.data;
- }
- else { /* use the provided property */
- ob = CTX_data_edit_object(C);
- hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
- }
- if (!ob || !hmd) {
+
+ object_hook_from_context(C, &ptr, num, &ob, &hmd);
+ if (hmd == NULL) {
BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
return OPERATOR_CANCELLED;
}
@@ -732,15 +750,8 @@ static int object_hook_recenter_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
float bmat[3][3], imat[3][3];
- if (ptr.data) { /* if modifier context is available, use that */
- ob = ptr.id.data;
- hmd = ptr.data;
- }
- else { /* use the provided property */
- ob = CTX_data_edit_object(C);
- hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
- }
- if (!ob || !hmd) {
+ object_hook_from_context(C, &ptr, num, &ob, &hmd);
+ if (hmd == NULL) {
BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
return OPERATOR_CANCELLED;
}
@@ -790,15 +801,8 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
char name[MAX_NAME];
int *indexar, tot;
- if (ptr.data) { /* if modifier context is available, use that */
- ob = ptr.id.data;
- hmd = ptr.data;
- }
- else { /* use the provided property */
- ob = CTX_data_edit_object(C);
- hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
- }
- if (!ob || !hmd) {
+ object_hook_from_context(C, &ptr, num, &ob, &hmd);
+ if (hmd == NULL) {
BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
return OPERATOR_CANCELLED;
}
@@ -852,15 +856,8 @@ static int object_hook_select_exec(bContext *C, wmOperator *op)
Object *ob = NULL;
HookModifierData *hmd = NULL;
- if (ptr.data) { /* if modifier context is available, use that */
- ob = ptr.id.data;
- hmd = ptr.data;
- }
- else { /* use the provided property */
- ob = CTX_data_edit_object(C);
- hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
- }
- if (!ob || !hmd) {
+ object_hook_from_context(C, &ptr, num, &ob, &hmd);
+ if (hmd == NULL) {
BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 7d3d6861418..00082b03781 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1196,6 +1196,11 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
+
+ if (ob->mode & OB_MODE_SCULPT) {
+ /* ensure that grid paint mask layer is created */
+ ED_sculpt_mask_layers_ensure(ob, mmd);
+ }
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 33b159f3cf2..629dba465bc 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -35,6 +35,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
+#include "DNA_armature_types.h"
#include "DNA_mesh_types.h"
#include "DNA_constraint_types.h"
#include "DNA_group_types.h"
@@ -55,6 +56,8 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_armature.h"
@@ -578,6 +581,7 @@ EnumPropertyItem prop_make_parent_types[] = {
{PAR_ARMATURE_AUTO, "ARMATURE_AUTO", 0, " With Automatic Weights", ""},
{PAR_ARMATURE_ENVELOPE, "ARMATURE_ENVELOPE", 0, " With Envelope Weights", ""},
{PAR_BONE, "BONE", 0, "Bone", ""},
+ {PAR_BONE_RELATIVE, "BONE_RELATIVE", 0, "Bone Relative", ""},
{PAR_CURVE, "CURVE", 0, "Curve Deform", ""},
{PAR_FOLLOW, "FOLLOW", 0, "Follow Path", ""},
{PAR_PATH_CONST, "PATH_CONST", 0, "Path Constraint", ""},
@@ -624,7 +628,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
partype = PAR_OBJECT;
}
}
- else if (partype == PAR_BONE) {
+ else if (ELEM(partype, PAR_BONE, PAR_BONE_RELATIVE)) {
pchan = BKE_pose_channel_active(par);
if (pchan == NULL) {
@@ -705,8 +709,16 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
}
}
}
- else if (partype == PAR_BONE)
+ else if (partype == PAR_BONE) {
+ ob->partype = PARBONE; /* note, dna define, not operator property */
+ if (pchan->bone)
+ pchan->bone->flag &= ~BONE_RELATIVE_PARENTING;
+ }
+ else if (partype == PAR_BONE_RELATIVE) {
ob->partype = PARBONE; /* note, dna define, not operator property */
+ if (pchan->bone)
+ pchan->bone->flag |= BONE_RELATIVE_PARENTING;
+ }
else
ob->partype = PAROBJECT; /* note, dna define, not operator property */
@@ -791,7 +803,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
Object *ob = ED_object_active_context(C);
- uiPopupMenu *pup = uiPupMenuBegin(C, "Set Parent To", ICON_NONE);
+ uiPopupMenu *pup = uiPupMenuBegin(C, IFACE_("Set Parent To"), ICON_NONE);
uiLayout *layout = uiPupMenuLayout(pup);
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_parent_set", TRUE);
@@ -800,11 +812,12 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE
#if 0
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_OBJECT);
#else
- opptr = uiItemFullO_ptr(layout, ot, "Object", ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ opptr = uiItemFullO_ptr(layout, ot, IFACE_("Object"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&opptr, "type", PAR_OBJECT);
RNA_boolean_set(&opptr, "keep_transform", FALSE);
- opptr = uiItemFullO_ptr(layout, ot, "Object (Keep Transform)", ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ opptr = uiItemFullO_ptr(layout, ot, IFACE_("Object (Keep Transform)"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT,
+ UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&opptr, "type", PAR_OBJECT);
RNA_boolean_set(&opptr, "keep_transform", TRUE);
#endif
@@ -815,6 +828,7 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_ENVELOPE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE);
+ uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE_RELATIVE);
}
else if (ob->type == OB_CURVE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_CURVE);
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 68075e7b6f9..9dd34623739 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -67,6 +67,7 @@
#include "ED_armature.h"
#include "ED_keyframing.h"
+#include "ED_mball.h"
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_view3d.h"
@@ -407,6 +408,12 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
change = 0;
}
}
+ else if (ob->type == OB_MBALL) {
+ if (ID_REAL_USERS(ob->data) > 1) {
+ BKE_report(reports, RPT_ERROR, "Cannot apply to a multi user metaball, doing nothing");
+ change = 0;
+ }
+ }
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu;
@@ -516,6 +523,10 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
bp++;
}
}
+ else if (ob->type == OB_MBALL) {
+ MetaBall *mb = ob->data;
+ ED_mball_transform(mb, (float *)mat);
+ }
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu = ob->data;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index a1fb0eb98d2..87ff42ef4db 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -3151,7 +3151,7 @@ void OBJECT_OT_vertex_group_clean(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_float(ot->srna, "limit", 0.01f, 0.0f, 1.0, "Limit", "Remove weights under this limit", 0.001f, 0.99f);
+ RNA_def_float(ot->srna, "limit", 0.0f, 0.0f, 1.0, "Limit", "Remove weights under this limit", 0.0f, 0.99f);
RNA_def_boolean(ot->srna, "all_groups", FALSE, "All Groups", "Clean all vertex groups");
RNA_def_boolean(ot->srna, "keep_single", FALSE, "Keep Single",
"Keep verts assigned to at least one group when cleaning");
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index c51b3ca4c43..ecc7ea4ae00 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -304,7 +304,9 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
if (blender_test_break()) return 0;
/* Update progress bar cursor */
- WM_cursor_time(win, (int)progress);
+ if (!G.background) {
+ WM_cursor_time(win, (int)progress);
+ }
/* calculate a frame */
scene->r.cfra = (int)frame;
@@ -346,6 +348,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
*/
static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
{
+ wmWindow *win = CTX_wm_window(C);
DynamicPaintModifierData *pmd = NULL;
DynamicPaintCanvasSettings *canvas;
Object *ob = ED_object_context(C);
@@ -379,7 +382,9 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
status = dynamicPaint_bakeImageSequence(C, surface, ob);
/* Clear bake */
canvas->flags &= ~MOD_DPAINT_BAKING;
- WM_cursor_restore(CTX_wm_window(C));
+ if (!G.background) {
+ WM_cursor_restore(win);
+ }
dynamicPaint_freeSurfaceData(surface);
/* Bake was successful:
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 78377834b9f..31079de275e 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1112,7 +1112,7 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
mul_v3_fl(vec, 0.25);
}
else
- mul_v3_fl(vec, 0.3333f);
+ mul_v3_fl(vec, 1.0f / 3.0f);
normalize_v3(nor);
diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c
index b2f53379090..a72a409f277 100644
--- a/source/blender/editors/physics/rigidbody_constraint.c
+++ b/source/blender/editors/physics/rigidbody_constraint.c
@@ -133,7 +133,6 @@ static int rigidbody_con_add_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(CTX_data_main(C), 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -181,7 +180,6 @@ static int rigidbody_con_remove_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(CTX_data_main(C), 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index 9ce4656d4cd..2bf962f4f4a 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -93,11 +93,6 @@ void ED_rigidbody_ob_add(wmOperator *op, Scene *scene, Object *ob, int type)
{
RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene);
- /* check that object doesn't already belong to the current simulation */
- if (ob->rigidbody_object) {
- BKE_reportf(op->reports, RPT_INFO, "Object '%s' already has a Rigid Body", ob->id.name + 2);
- return;
- }
if (ob->type != OB_MESH) {
BKE_report(op->reports, RPT_ERROR, "Can't add Rigid Body to non mesh object");
return;
@@ -118,11 +113,16 @@ void ED_rigidbody_ob_add(wmOperator *op, Scene *scene, Object *ob, int type)
}
/* make rigidbody object settings */
- ob->rigidbody_object = BKE_rigidbody_create_object(scene, ob, type);
+ if (ob->rigidbody_object == NULL) {
+ ob->rigidbody_object = BKE_rigidbody_create_object(scene, ob, type);
+ }
+ ob->rigidbody_object->type = type;
ob->rigidbody_object->flag |= RBO_FLAG_NEEDS_VALIDATE;
/* add object to rigid body group */
add_to_group(rbw->group, ob, scene, NULL);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
void ED_rigidbody_ob_remove(Scene *scene, Object *ob)
@@ -154,7 +154,6 @@ static int rigidbody_ob_add_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(CTX_data_main(C), 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -201,7 +200,6 @@ static int rigidbody_ob_remove_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(CTX_data_main(C), 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -247,7 +245,7 @@ static int rigidbody_obs_add_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(CTX_data_main(C), 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -293,8 +291,7 @@ static int rigidbody_obs_remove_exec(bContext *C, wmOperator *UNUSED(op))
/* send updates */
DAG_ids_flush_update(CTX_data_main(C), 0);
- WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
/* done */
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/physics/rigidbody_world.c b/source/blender/editors/physics/rigidbody_world.c
index 5ab8e7697c5..babe32c74b2 100644
--- a/source/blender/editors/physics/rigidbody_world.c
+++ b/source/blender/editors/physics/rigidbody_world.c
@@ -128,9 +128,6 @@ static int rigidbody_world_remove_exec(bContext *C, wmOperator *op)
BKE_rigidbody_free_world(rbw);
scene->rigidbody_world = NULL;
- /* send updates */
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
-
/* done */
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 994c7275ecd..dfc80e4cf51 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -360,7 +360,11 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
}
}
-
+ else {
+ /* use current scene world to light sphere */
+ if (mat->pr_type == MA_SPHERE_A)
+ sce->world = scene->world;
+ }
if (sp->pr_method == PR_ICON_RENDER) {
if (mat->material_type == MA_TYPE_HALO) {
@@ -926,8 +930,10 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
* already there. Very expensive for large images. Need to find a way to
* only get existing ibuf */
ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
- if (ibuf == NULL || ibuf->rect == NULL)
+ if (ibuf == NULL || ibuf->rect == NULL) {
+ BKE_image_release_ibuf(ima, ibuf, NULL);
return;
+ }
icon_copy_rect(ibuf, sp->sizex, sp->sizey, sp->pr_rect);
@@ -1019,6 +1025,7 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short
sp->pr_method = PR_ICON_RENDER;
sp->pr_rect = cur_size->rect;
sp->id = ip->id;
+ sp->pr_main = pr_main;
common_preview_startjob(sp, stop, do_update, progress);
shader_preview_free(sp);
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index f15f7b539f3..8b2ac740e47 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -289,7 +289,10 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
/* is there another window showing result? */
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
- if (win->screen->temp || (win == winshow && winshow != wincur)) {
+ bScreen *sc = win->screen;
+ if ((sc->temp && ((ScrArea *)sc->areabase.first)->spacetype == SPACE_IMAGE) ||
+ (win == winshow && winshow != wincur))
+ {
wm_window_raise(win);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index da2facc244a..12a7a33c893 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2963,7 +2963,7 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *U
uiPopupMenu *pup;
uiLayout *layout;
- pup = uiPupMenuBegin(C, N_("Header"), ICON_NONE);
+ pup = uiPupMenuBegin(C, IFACE_("Header"), ICON_NONE);
layout = uiPupMenuLayout(pup);
ED_screens_header_tools_menu_create(C, layout, NULL);
@@ -3597,7 +3597,7 @@ static void SCENE_OT_delete(wmOperatorType *ot)
/* ***************** region alpha blending ***************** */
-/* implementation note: a disapplearing region needs at least 1 last draw with 100% backbuffer
+/* implementation note: a disappearing 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 */
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 74399857a97..1f8c06f6bf7 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -140,7 +140,7 @@ BLI_INLINE unsigned char f_to_char(const float val)
#define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS)
#define IMAPAINT_TILE_NUMBER(size) (((size) + IMAPAINT_TILE_SIZE - 1) >> IMAPAINT_TILE_BITS)
-static void imapaint_image_update(Scene *scene, SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint);
+static void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint);
typedef struct ImagePaintState {
@@ -904,7 +904,7 @@ static int project_paint_occlude_ptv_clip(const ProjPaintState *ps, const MFace
/* Check if a screenspace location is occluded by any other faces
* check, pixelScreenCo must be in screenspace, its Z-Depth only needs to be used for comparison
- * and dosn't need to be correct in relation to X and Y coords (this is the case in perspective view) */
+ * and doesn't need to be correct in relation to X and Y coords (this is the case in perspective view) */
static int project_bucket_point_occluded(const ProjPaintState *ps, LinkNode *bucketFace, const int orig_face, float pixelScreenCo[4])
{
MFace *mf;
@@ -3656,7 +3656,7 @@ static int project_image_refresh_tagged(ProjPaintState *ps)
pr = &(projIma->partRedrawRect[i]);
if (pr->x2 != -1) { /* TODO - use 'enabled' ? */
imapaintpartial = *pr;
- imapaint_image_update(NULL, NULL, projIma->ima, projIma->ibuf, 1); /*last 1 is for texpaint*/
+ imapaint_image_update(NULL, projIma->ima, projIma->ibuf, 1); /*last 1 is for texpaint*/
redraw = 1;
}
}
@@ -4417,16 +4417,13 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w,
IMB_freeImBuf(tmpibuf);
}
-static void imapaint_image_update(Scene *scene, SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint)
+static void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint)
{
- if (scene) {
- IMB_partial_display_buffer_update(ibuf, ibuf->rect_float, (unsigned char *) ibuf->rect, ibuf->x, 0, 0,
- &scene->view_settings, &scene->display_settings,
- imapaintpartial.x1, imapaintpartial.y1,
- imapaintpartial.x2, imapaintpartial.y2, FALSE);
- }
- else {
- ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
+ if (imapaintpartial.x1 != imapaintpartial.x2 &&
+ imapaintpartial.y1 != imapaintpartial.y2)
+ {
+ IMB_partial_display_buffer_update_delayed(ibuf, imapaintpartial.x1, imapaintpartial.y1,
+ imapaintpartial.x2, imapaintpartial.y2);
}
if (ibuf->mipmap[0])
@@ -4790,7 +4787,7 @@ static int imapaint_paint_sub_stroke(ImagePaintState *s, BrushPainter *painter,
*/
if (BKE_brush_painter_paint(painter, imapaint_paint_op, pos, time, pressure, s, is_data == FALSE)) {
if (update)
- imapaint_image_update(s->scene, s->sima, image, ibuf, texpaint);
+ imapaint_image_update(s->sima, image, ibuf, texpaint);
BKE_image_release_ibuf(image, ibuf, NULL);
return 1;
}
@@ -5019,23 +5016,29 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
{
Scene *scene = CTX_data_scene(C);
ToolSettings *settings = scene->toolsettings;
- Brush *brush = paint_brush(&settings->imapaint.paint);
/* brush */
- ps->brush = brush;
- ps->tool = brush->imagepaint_tool;
- ps->blend = brush->blend;
+ ps->brush = paint_brush(&settings->imapaint.paint);
+ if (ps->brush) {
+ Brush *brush = ps->brush;
+ ps->tool = brush->imagepaint_tool;
+ ps->blend = brush->blend;
+
+ /* disable for 3d mapping also because painting on mirrored mesh can create "stripes" */
+ ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW ||
+ brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) ? false : true;
+ ps->is_texbrush = (brush->mtex.tex) ? 1 : 0;
+ }
+ else {
+ /* brush may be NULL*/
+ ps->do_masking = false;
+ ps->is_texbrush = false;
+ }
/* sizeof ProjPixel, since we alloc this a _lot_ */
ps->pixel_sizeof = project_paint_pixel_sizeof(ps->tool);
BLI_assert(ps->pixel_sizeof >= sizeof(ProjPixel));
- /* disable for 3d mapping also because painting on mirrored mesh can create "stripes" */
- ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW ||
- brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) ? false : true;
- ps->is_texbrush = (brush->mtex.tex) ? 1 : 0;
-
-
/* these can be NULL */
ps->v3d = CTX_wm_view3d(C);
ps->rv3d = CTX_wm_region_view3d(C);
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 0b76c88df66..84250853f38 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -197,8 +197,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf,
for (x = origx; x < w; x++, bf += 4, mf += 4, tf += 4) {
if (dotexold) {
- copy_v3_v3(tf, otf);
- tf[3] = otf[3];
+ copy_v4_v4(tf, otf);
otf += 4;
}
else {
@@ -249,7 +248,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf,
}
}
-static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, const float pos[2])
+static void brush_painter_tiled_tex_partial_update(BrushPainter *painter, const float pos[2])
{
const Scene *scene = painter->scene;
Brush *brush = painter->brush;
@@ -265,7 +264,6 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, const
oldtexibuf = cache->texibuf;
cache->texibuf = IMB_allocImBuf(diameter, diameter, 32, imbflag);
-
if (oldtexibuf) {
srcx = srcy = 0;
destx = (int)painter->lastpaintpos[0] - (int)pos[0];
@@ -334,7 +332,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2
if (do_tiled) {
BKE_brush_imbuf_new(scene, brush, flt, 3, size, &cache->maskibuf, use_color_correction);
- brush_painter_fixed_tex_partial_update(painter, pos);
+ brush_painter_tiled_tex_partial_update(painter, pos);
}
else
BKE_brush_imbuf_new(scene, brush, flt, 2, size, &cache->ibuf, use_color_correction);
@@ -348,7 +346,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2
int dy = (int)painter->lastpaintpos[1] - (int)pos[1];
if ((dx != 0) || (dy != 0))
- brush_painter_fixed_tex_partial_update(painter, pos);
+ brush_painter_tiled_tex_partial_update(painter, pos);
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 408572c7979..ba33ad22f92 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -721,8 +721,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0);
/* these keys are from 2.4x but could be changed */
- WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
- WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample_group", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample_group", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_gradient", LEFTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "type", WPAINT_GRADIENT_TYPE_LINEAR);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_gradient", LEFTMOUSE, KM_PRESS, KM_ALT | KM_CTRL, 0)->ptr, "type", WPAINT_GRADIENT_TYPE_RADIAL);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 956f8d2c136..8ff2a68013c 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -3182,8 +3182,11 @@ static int paint_weight_gradient_modal(bContext *C, wmOperator *op, wmEvent *eve
VPaint *wp = ts->wpaint;
Object *ob = CTX_data_active_object(C);
Mesh *me = ob->data;
- BKE_defvert_array_copy(me->dvert, wp->wpaint_prev, me->totvert);
- free_wpaint_prev(wp);
+ if (wp->wpaint_prev) {
+ BKE_defvert_array_free_elems(me->dvert, me->totvert);
+ BKE_defvert_array_copy(me->dvert, wp->wpaint_prev, me->totvert);
+ free_wpaint_prev(wp);
+ }
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
@@ -3200,6 +3203,7 @@ static int paint_weight_gradient_modal(bContext *C, wmOperator *op, wmEvent *eve
static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
{
wmGesture *gesture = op->customdata;
+ DMGradient_vertStore *vert_cache;
struct ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
@@ -3210,24 +3214,31 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
int y_end = RNA_int_get(op->ptr, "yend");
float sco_start[2] = {x_start, y_start};
float sco_end[2] = {x_end, y_end};
-
+ const bool is_interactive = (gesture != NULL);
DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
DMGradient_userData data = {0};
- if (gesture->userdata == NULL) {
- VPaint *wp = scene->toolsettings->wpaint;
+ if (is_interactive) {
+ if (gesture->userdata == NULL) {
+ VPaint *wp = scene->toolsettings->wpaint;
- gesture->userdata = MEM_mallocN(sizeof(DMGradient_vertStore) * me->totvert, __func__);
- data.is_init = TRUE;
+ gesture->userdata = MEM_mallocN(sizeof(DMGradient_vertStore) * me->totvert, __func__);
+ data.is_init = true;
- copy_wpaint_prev(wp, me->dvert, me->totvert);
+ copy_wpaint_prev(wp, me->dvert, me->totvert);
- /* on init only, convert face -> vert sel */
- if (me->editflag & ME_EDIT_PAINT_FACE_SEL) {
- BKE_mesh_flush_select_from_polys(me);
+ /* on init only, convert face -> vert sel */
+ if (me->editflag & ME_EDIT_PAINT_FACE_SEL) {
+ BKE_mesh_flush_select_from_polys(me);
+ }
}
+ vert_cache = gesture->userdata;
+ }
+ else {
+ data.is_init = true;
+ vert_cache = MEM_mallocN(sizeof(DMGradient_vertStore) * me->totvert, __func__);
}
data.ar = ar;
@@ -3238,7 +3249,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
data.sco_line_div = 1.0f / len_v2v2(sco_start, sco_end);
data.def_nr = ob->actdef - 1;
data.use_select = (me->editflag & (ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL));
- data.vert_cache = gesture->userdata;
+ data.vert_cache = vert_cache;
data.type = RNA_enum_get(op->ptr, "type");
{
@@ -3254,6 +3265,10 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ if (is_interactive == false) {
+ MEM_freeN(vert_cache);
+ }
+
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index e56962a3964..fa1bdd6ca82 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -73,7 +73,7 @@ void sculpt_pbvh_clear(Object *ob);
void sculpt_update_after_dynamic_topology_toggle(bContext *C);
void sculpt_dynamic_topology_enable(struct bContext *C);
void sculpt_dynamic_topology_disable(struct bContext *C,
- struct SculptUndoNode *unode);
+ struct SculptUndoNode *unode);
/* Undo */
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 3c2d9ac2eee..19bfe05e8a4 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -97,14 +97,15 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
sbuts->mainbuser = sbuts->mainb;
}
-#define BUT_UNIT_X (UI_UNIT_X + 2)
+#define BUT_UNIT_X (UI_UNIT_X + 2 * U.pixelsize)
void buttons_header_buttons(const bContext *C, ARegion *ar)
{
SpaceButs *sbuts = CTX_wm_space_buts(C);
uiBlock *block;
uiBut *but;
- int xco, yco = 2;
+ int headery = ED_area_headersize();
+ int xco, yco = 0.5f * (headery - UI_UNIT_Y);
buttons_context_compute(C, sbuts);
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 54261974993..8b6682ff1c9 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -40,6 +40,8 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -70,7 +72,7 @@ static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(e
RNA_pointer_create(&sc->id, &RNA_SpaceProperties, sbuts, &ptr);
- pup = uiPupMenuBegin(C, "Align", ICON_NONE);
+ pup = uiPupMenuBegin(C, IFACE_("Align"), ICON_NONE);
layout = uiPupMenuLayout(pup);
uiItemsEnumR(layout, &ptr, "align");
uiPupMenuEnd(C, pup);
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index cc1b8d444bc..09d97c36436 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -159,7 +159,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
MovieTrackingDopesheetChannel *channel;
float y, xscale, yscale;
float strip[4], selected_strip[4];
- float height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT * 2);
+ float height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT);
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
@@ -272,7 +272,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
tracking = &clip->tracking;
dopesheet = &tracking->dopesheet;
- height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT * 2);
+ height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT);
if (height > BLI_rcti_size_y(&v2d->mask)) {
/* don't use totrect set, as the width stays the same
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 9d0421349d7..f0c0e7b72fd 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1282,6 +1282,9 @@ static void clip_channels_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
+ /* ensure the 2d view sync works - main region has bottom scroller */
+ ar->v2d.scroll = V2D_SCROLL_BOTTOM;
+
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
keymap = WM_keymap_find(wm->defaultconf, "Clip Dopesheet Editor", SPACE_CLIP, 0);
@@ -1293,7 +1296,6 @@ static void clip_channels_area_draw(const bContext *C, ARegion *ar)
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
View2D *v2d = &ar->v2d;
- View2DScrollers *scrollers;
if (clip)
BKE_tracking_dopesheet_update(&clip->tracking);
@@ -1309,11 +1311,6 @@ static void clip_channels_area_draw(const bContext *C, ARegion *ar)
/* reset view matrix */
UI_view2d_view_restore(C);
-
- /* scrollers */
- scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
- UI_view2d_scrollers_draw(C, v2d, scrollers);
- UI_view2d_scrollers_free(scrollers);
}
static void clip_channels_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 22c260de1a1..c195cb39157 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -158,9 +158,9 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
if (tvc->iter_index == 0) {
const SpaceConsole *sc = (SpaceConsole *)tvc->arg1;
const ConsoleLine *cl = (ConsoleLine *)sc->history.last;
- const int prompt_len = strlen(sc->prompt);
- const int cursor_loc = cl->cursor + prompt_len;
- const int line_len = cl->len + prompt_len;
+ const int prompt_len = BLI_strlen_utf8(sc->prompt);
+ const int cursor_loc = BLI_strnlen_utf8(cl->line, cl->cursor) + prompt_len;
+ const int line_len = BLI_strlen_utf8(cl->line) + prompt_len;
int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN};
int pen[2];
xy[1] += tvc->lheight / 6;
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 36716aeab95..1242d123a41 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -34,11 +34,12 @@
#include "DNA_userdef_types.h"
+#include "BLI_utildefines.h"
#include "BLI_listbase.h"
#include "BLI_string_cursor_utf8.h"
+#include "BLI_string_utf8.h"
#include "BLI_string.h"
#include "BLI_dynstr.h"
-#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BKE_context.h"
@@ -283,28 +284,28 @@ static int console_move_exec(bContext *C, wmOperator *op)
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_PREV,
- STRCUR_JUMP_ALL);
+ STRCUR_JUMP_ALL, true);
done = console_line_cursor_set(ci, pos);
break;
case LINE_END:
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_NEXT,
- STRCUR_JUMP_ALL);
+ STRCUR_JUMP_ALL, true);
done = console_line_cursor_set(ci, pos);
break;
case PREV_CHAR:
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_PREV,
- STRCUR_JUMP_NONE);
+ STRCUR_JUMP_NONE, true);
done = console_line_cursor_set(ci, pos);
break;
case NEXT_CHAR:
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_NEXT,
- STRCUR_JUMP_NONE);
+ STRCUR_JUMP_NONE, true);
done = console_line_cursor_set(ci, pos);
break;
@@ -314,14 +315,14 @@ static int console_move_exec(bContext *C, wmOperator *op)
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_PREV,
- STRCUR_JUMP_DELIM);
+ STRCUR_JUMP_DELIM, true);
done = console_line_cursor_set(ci, pos);
break;
case NEXT_WORD:
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_NEXT,
- STRCUR_JUMP_DELIM);
+ STRCUR_JUMP_DELIM, true);
done = console_line_cursor_set(ci, pos);
break;
}
@@ -393,15 +394,26 @@ static int console_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
// if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
if (!RNA_string_length(op->ptr, "text")) {
- /* if alt/ctrl/super are pressed pass through */
- if (event->ctrl || event->oskey) {
+ /* if alt/ctrl/super are pressed pass through except for utf8 character event
+ * (when input method are used for utf8 inputs, the user may assign key event
+ * including alt/ctrl/super like ctrl+m to commit utf8 string. in such case,
+ * the modifiers in the utf8 character event make no sense.) */
+ if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) {
return OPERATOR_PASS_THROUGH;
}
else {
- char str[2];
- str[0] = event->ascii;
- str[1] = '\0';
-
+ char str[BLI_UTF8_MAX + 1];
+ size_t len;
+
+ if (event->utf8_buf[0]) {
+ len = BLI_str_utf8_size_safe(event->utf8_buf);
+ memcpy(str, event->utf8_buf, len);
+ }
+ else {
+ /* in theory, ghost can set value to extended ascii here */
+ len = BLI_str_utf8_from_unicode(event->ascii, str);
+ }
+ str[len] = '\0';
RNA_string_set(op->ptr, "text", str);
}
}
@@ -550,7 +562,7 @@ static int console_delete_exec(bContext *C, wmOperator *op)
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_NEXT,
- (type == DEL_NEXT_CHAR) ? STRCUR_JUMP_NONE : STRCUR_JUMP_DELIM);
+ (type == DEL_NEXT_CHAR) ? STRCUR_JUMP_NONE : STRCUR_JUMP_DELIM, true);
stride = pos - ci->cursor;
if (stride) {
memmove(ci->line + ci->cursor, ci->line + ci->cursor + stride, (ci->len - ci->cursor) + 1);
@@ -566,7 +578,7 @@ static int console_delete_exec(bContext *C, wmOperator *op)
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_PREV,
- (type == DEL_PREV_CHAR) ? STRCUR_JUMP_NONE : STRCUR_JUMP_DELIM);
+ (type == DEL_PREV_CHAR) ? STRCUR_JUMP_NONE : STRCUR_JUMP_DELIM, true);
stride = ci->cursor - pos;
if (stride) {
ci->cursor -= stride; /* same as above */
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 08f01b47b52..afe32ec0b85 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -335,7 +335,9 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
float scale;
int ex, ey;
- if ( (imb->x > layout->prv_w) || (imb->y > layout->prv_h) ) {
+ if ((imb->x * UI_DPI_FAC > layout->prv_w) ||
+ (imb->y * UI_DPI_FAC > layout->prv_h))
+ {
if (imb->x > imb->y) {
scaledx = (float)layout->prv_w;
scaledy = ( (float)imb->y / (float)imb->x) * layout->prv_w;
@@ -348,10 +350,11 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
}
}
else {
- scaledx = (float)imb->x;
- scaledy = (float)imb->y;
- scale = 1.0;
+ scaledx = (float)imb->x * UI_DPI_FAC;
+ scaledy = (float)imb->y * UI_DPI_FAC;
+ scale = UI_DPI_FAC;
}
+
ex = (int)scaledx;
ey = (int)scaledy;
fx = ((float)layout->prv_w - (float)ex) / 2.0f;
@@ -461,7 +464,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
int i;
short is_icon;
short align;
-
+ int column_space = 0.6f * UI_UNIT_X;
numfiles = filelist_numfiles(files);
@@ -492,7 +495,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
for (i = offset; (i < numfiles) && (i < offset + numfiles_layout); i++) {
ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
- sx += (int)(v2d->tot.xmin + 2.0f);
+ sx += (int)(v2d->tot.xmin + 0.1f * UI_UNIT_X);
sy = (int)(v2d->tot.ymax - sy);
file = filelist_file(files, i);
@@ -521,13 +524,13 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
else {
file_draw_icon(block, file->path, sx, sy - (UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE);
- sx += ICON_DEFAULT_WIDTH_SCALE + 4;
+ sx += ICON_DEFAULT_WIDTH_SCALE + 0.2f * UI_UNIT_X;
}
UI_ThemeColor4(TH_TEXT);
if (file->selflag & EDITING_FILE) {
- uiBut *but = uiDefBut(block, TEX, 1, "", sx, sy - layout->tile_h - 3,
+ uiBut *but = uiDefBut(block, TEX, 1, "", sx, sy - layout->tile_h - 0.15f * UI_UNIT_X,
textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit), 0, 0, "");
uiButSetRenameFunc(but, renamebutton_cb, file);
uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
@@ -543,39 +546,39 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
if (params->display == FILE_SHORTDISPLAY) {
- sx += (int)layout->column_widths[COLUMN_NAME] + 12;
+ sx += (int)layout->column_widths[COLUMN_NAME] + column_space;
if (!(file->type & S_IFDIR)) {
file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);
- sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
+ sx += (int)layout->column_widths[COLUMN_SIZE] + column_space;
}
}
else if (params->display == FILE_LONGDISPLAY) {
- sx += (int)layout->column_widths[COLUMN_NAME] + 12;
+ sx += (int)layout->column_widths[COLUMN_NAME] + column_space;
#ifndef WIN32
/* rwx rwx rwx */
file_draw_string(sx, sy, file->mode1, layout->column_widths[COLUMN_MODE1], layout->tile_h, align);
- sx += layout->column_widths[COLUMN_MODE1] + 12;
+ sx += layout->column_widths[COLUMN_MODE1] + column_space;
file_draw_string(sx, sy, file->mode2, layout->column_widths[COLUMN_MODE2], layout->tile_h, align);
- sx += layout->column_widths[COLUMN_MODE2] + 12;
+ sx += layout->column_widths[COLUMN_MODE2] + column_space;
file_draw_string(sx, sy, file->mode3, layout->column_widths[COLUMN_MODE3], layout->tile_h, align);
- sx += layout->column_widths[COLUMN_MODE3] + 12;
+ sx += layout->column_widths[COLUMN_MODE3] + column_space;
file_draw_string(sx, sy, file->owner, layout->column_widths[COLUMN_OWNER], layout->tile_h, align);
- sx += layout->column_widths[COLUMN_OWNER] + 12;
+ sx += layout->column_widths[COLUMN_OWNER] + column_space;
#endif
file_draw_string(sx, sy, file->date, layout->column_widths[COLUMN_DATE], layout->tile_h, align);
- sx += (int)layout->column_widths[COLUMN_DATE] + 12;
+ sx += (int)layout->column_widths[COLUMN_DATE] + column_space;
file_draw_string(sx, sy, file->time, layout->column_widths[COLUMN_TIME], layout->tile_h, align);
- sx += (int)layout->column_widths[COLUMN_TIME] + 12;
+ sx += (int)layout->column_widths[COLUMN_TIME] + column_space;
if (!(file->type & S_IFDIR)) {
file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);
- sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
+ sx += (int)layout->column_widths[COLUMN_SIZE] + column_space;
}
}
}
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 8c45b161d26..3c6f6358171 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -500,12 +500,12 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
layout->textheight = textheight;
if (params->display == FILE_IMGDISPLAY) {
- layout->prv_w = 96;
- layout->prv_h = 96;
- layout->tile_border_x = 6;
- layout->tile_border_y = 6;
- layout->prv_border_x = 6;
- layout->prv_border_y = 6;
+ layout->prv_w = 4.8f * UI_UNIT_X;
+ layout->prv_h = 4.8f * UI_UNIT_Y;
+ layout->tile_border_x = 0.3f * UI_UNIT_X;
+ layout->tile_border_y = 0.3f * UI_UNIT_X;
+ layout->prv_border_x = 0.3f * UI_UNIT_X;
+ layout->prv_border_y = 0.3f * UI_UNIT_Y;
layout->tile_w = layout->prv_w + 2 * layout->prv_border_x;
layout->tile_h = layout->prv_h + 2 * layout->prv_border_y + textheight;
layout->width = (int)(BLI_rctf_size_x(&v2d->cur) - 2 * layout->tile_border_x);
@@ -520,10 +520,13 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
layout->flag = FILE_LAYOUT_VER;
}
else {
+ int column_space = 0.6f * UI_UNIT_X;
+ int column_icon_space = 0.2f * UI_UNIT_X;
+
layout->prv_w = 0;
layout->prv_h = 0;
- layout->tile_border_x = 8;
- layout->tile_border_y = 2;
+ layout->tile_border_x = 0.4f * UI_UNIT_X;
+ layout->tile_border_y = 0.1f * UI_UNIT_Y;
layout->prv_border_x = 0;
layout->prv_border_y = 0;
layout->tile_h = textheight * 3 / 2;
@@ -533,22 +536,22 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
column_widths(sfile->files, layout);
if (params->display == FILE_SHORTDISPLAY) {
- maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
- (int)layout->column_widths[COLUMN_NAME] + 12 +
- (int)layout->column_widths[COLUMN_SIZE] + 12;
+ maxlen = ICON_DEFAULT_WIDTH_SCALE + column_icon_space +
+ (int)layout->column_widths[COLUMN_NAME] + column_space +
+ (int)layout->column_widths[COLUMN_SIZE] + column_space;
}
else {
- maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
- (int)layout->column_widths[COLUMN_NAME] + 12 +
+ maxlen = ICON_DEFAULT_WIDTH_SCALE + column_icon_space +
+ (int)layout->column_widths[COLUMN_NAME] + column_space +
#ifndef WIN32
- (int)layout->column_widths[COLUMN_MODE1] + 12 +
- (int)layout->column_widths[COLUMN_MODE2] + 12 +
- (int)layout->column_widths[COLUMN_MODE3] + 12 +
- (int)layout->column_widths[COLUMN_OWNER] + 12 +
+ (int)layout->column_widths[COLUMN_MODE1] + column_space +
+ (int)layout->column_widths[COLUMN_MODE2] + column_space +
+ (int)layout->column_widths[COLUMN_MODE3] + column_space +
+ (int)layout->column_widths[COLUMN_OWNER] + column_space +
#endif
- (int)layout->column_widths[COLUMN_DATE] + 12 +
- (int)layout->column_widths[COLUMN_TIME] + 12 +
- (int)layout->column_widths[COLUMN_SIZE] + 12;
+ (int)layout->column_widths[COLUMN_DATE] + column_space +
+ (int)layout->column_widths[COLUMN_TIME] + column_space +
+ (int)layout->column_widths[COLUMN_SIZE] + column_space;
}
layout->tile_w = maxlen;
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 7cc322c06bb..0a4b922bb38 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -478,6 +478,7 @@ static void file_channel_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
+ ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
ED_region_panels_init(wm, ar);
/* own keymaps */
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index afae9535fee..01364fcacf0 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -498,17 +498,17 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr,
}
/* decrease, increase arrows */
- but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 17, 20, NULL, 0, 0, 0, 0, TIP_("Previous Layer"));
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Layer"));
uiButSetFunc(but, image_multi_declay_cb, rr, iuser);
- but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 18, 20, NULL, 0, 0, 0, 0, TIP_("Next Layer"));
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Layer"));
uiButSetFunc(but, image_multi_inclay_cb, rr, iuser);
uiblock_layer_pass_buttons(row, rr, iuser, 230 * dpi_fac, render_slot);
/* decrease, increase arrows */
- but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 17, 20, NULL, 0, 0, 0, 0, TIP_("Previous Pass"));
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Pass"));
uiButSetFunc(but, image_multi_decpass_cb, rr, iuser);
- but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 18, 20, NULL, 0, 0, 0, 0, TIP_("Next Pass"));
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Pass"));
uiButSetFunc(but, image_multi_incpass_cb, rr, iuser);
uiBlockEndAlign(block);
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 00bc3d1d26b..cae71885b87 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -185,29 +185,28 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
/* noisy, high contrast make impossible to read if lower alpha is used. */
glColor4ub(0, 0, 0, 190);
- glRecti(0.0, 0.0, BLI_rcti_size_x(&ar->winrct) + 1, 20);
+ glRecti(0.0, 0.0, BLI_rcti_size_x(&ar->winrct) + 1, UI_UNIT_Y);
glDisable(GL_BLEND);
- BLF_size(blf_mono_font, 11, 72);
+ BLF_size(blf_mono_font, 11 * U.pixelsize, U.dpi);
glColor3ub(255, 255, 255);
BLI_snprintf(str, sizeof(str), "X:%-4d Y:%-4d |", x, y);
- // UI_DrawString(6, 6, str); // works ok but fixed width is nicer.
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_Y, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
if (zp) {
glColor3ub(255, 255, 255);
BLI_snprintf(str, sizeof(str), " Z:%-.4f |", 0.5f + 0.5f * (((float)*zp) / (float)0x7fffffff));
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
if (zpf) {
glColor3ub(255, 255, 255);
BLI_snprintf(str, sizeof(str), " Z:%-.3f |", *zpf);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
@@ -220,7 +219,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
BLI_snprintf(str, sizeof(str), " R:%-3d", cp[0]);
else
BLI_snprintf(str, sizeof(str), " R:-");
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
@@ -231,7 +230,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
BLI_snprintf(str, sizeof(str), " G:%-3d", cp[1]);
else
BLI_snprintf(str, sizeof(str), " G:-");
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
@@ -242,7 +241,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
BLI_snprintf(str, sizeof(str), " B:%-3d", cp[2]);
else
BLI_snprintf(str, sizeof(str), " B:-");
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
@@ -254,7 +253,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
BLI_snprintf(str, sizeof(str), " A:%-3d", cp[3]);
else
BLI_snprintf(str, sizeof(str), "- ");
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
@@ -268,7 +267,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
IMB_colormanagement_pixel_to_display_space_v4(pixel, fp, &scene->view_settings, &scene->display_settings);
BLI_snprintf(str, sizeof(str), " | CM R:%-.4f G:%-.4f B:%-.4f", pixel[0], pixel[1], pixel[2]);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
@@ -326,24 +325,24 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
glDisable(GL_BLEND);
glColor3fv(finalcol);
- dx += 5;
+ dx += 0.25f * UI_UNIT_X;
glBegin(GL_QUADS);
- glVertex2f(dx, 3);
- glVertex2f(dx, 17);
- glVertex2f(dx + 30, 17);
- glVertex2f(dx + 30, 3);
+ glVertex2f(dx, 0.15f * UI_UNIT_Y);
+ glVertex2f(dx, 0.85f * UI_UNIT_Y);
+ glVertex2f(dx + 1.5f * UI_UNIT_X, 0.85 * UI_UNIT_Y);
+ glVertex2f(dx + 1.5f * UI_UNIT_X, 0.15f * UI_UNIT_Y);
glEnd();
/* draw outline */
glColor3ub(128, 128, 128);
glBegin(GL_LINE_LOOP);
- glVertex2f(dx, 3);
- glVertex2f(dx, 17);
- glVertex2f(dx + 30, 17);
- glVertex2f(dx + 30, 3);
+ glVertex2f(dx, 0.15f * UI_UNIT_Y);
+ glVertex2f(dx, 0.85f * UI_UNIT_Y);
+ glVertex2f(dx + 1.5f * UI_UNIT_X, 0.85f * UI_UNIT_Y);
+ glVertex2f(dx + 1.5f * UI_UNIT_X, 0.15f * UI_UNIT_Y);
glEnd();
- dx += 35;
+ dx += 1.75f * UI_UNIT_X;
glColor3ub(255, 255, 255);
if (channels == 1) {
@@ -357,12 +356,12 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
}
BLI_snprintf(str, sizeof(str), "V:%-.4f", val);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
@@ -377,22 +376,22 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
}
BLI_snprintf(str, sizeof(str), "H:%-.4f", hue);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
BLI_snprintf(str, sizeof(str), " S:%-.4f", sat);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
BLI_snprintf(str, sizeof(str), " V:%-.4f", val);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 35ba83a8bc6..ca8270ba0f5 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -750,6 +750,7 @@ static void image_buttons_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
+ ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
ED_region_panels_init(wm, ar);
keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
@@ -789,6 +790,7 @@ static void image_scope_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
+ ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
ED_region_panels_init(wm, ar);
keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 3f73fc2605a..976769752f9 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -41,6 +41,8 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
+#include "BLF_translation.h"
+
#include "BKE_anim.h"
#include "BKE_blender.h"
#include "BKE_curve.h"
@@ -166,8 +168,11 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
if (ebo->flag & BONE_SELECTED) stats->totbonesel++;
/* if this is a connected child and it's parent is being moved, remove our root */
- if ((ebo->flag & BONE_CONNECTED) && (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL))
+ if ((ebo->flag & BONE_CONNECTED) && (ebo->flag & BONE_ROOTSEL) &&
+ ebo->parent && (ebo->parent->flag & BONE_TIPSEL))
+ {
stats->totvertsel--;
+ }
stats->totvert += 2;
}
@@ -362,9 +367,9 @@ static void stats_string(Scene *scene)
mmap_in_use = MEM_get_mapped_memory_in_use();
/* get memory statistics */
- s = memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use - mmap_in_use) >> 10) / 1024.0);
+ s = memstr + sprintf(memstr, IFACE_(" | Mem:%.2fM"), (double)((mem_in_use - mmap_in_use) >> 10) / 1024.0);
if (mmap_in_use)
- sprintf(s, " (%.2fM)", (double)((mmap_in_use) >> 10) / 1024.0);
+ sprintf(s, IFACE_(" (%.2fM)"), (double)((mmap_in_use) >> 10) / 1024.0);
s = stats->infostr;
@@ -372,31 +377,34 @@ static void stats_string(Scene *scene)
if (scene->obedit) {
if (BKE_keyblock_from_object(scene->obedit))
- s += sprintf(s, "(Key) ");
+ s += sprintf(s, IFACE_("(Key) "));
if (scene->obedit->type == OB_MESH) {
- s += sprintf(s, "Verts:%d/%d | Edges:%d/%d | Faces:%d/%d | Tris:%d",
- stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface, stats->tottri);
+ s += sprintf(s, IFACE_("Verts:%d/%d | Edges:%d/%d | Faces:%d/%d | Tris:%d"),
+ stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel,
+ stats->totface, stats->tottri);
}
else if (scene->obedit->type == OB_ARMATURE) {
- s += sprintf(s, "Verts:%d/%d | Bones:%d/%d", stats->totvertsel, stats->totvert, stats->totbonesel, stats->totbone);
+ s += sprintf(s, IFACE_("Verts:%d/%d | Bones:%d/%d"), stats->totvertsel, stats->totvert, stats->totbonesel,
+ stats->totbone);
}
else {
- s += sprintf(s, "Verts:%d/%d", stats->totvertsel, stats->totvert);
+ s += sprintf(s, IFACE_("Verts:%d/%d"), stats->totvertsel, stats->totvert);
}
strcat(s, memstr);
}
else if (ob && (ob->mode & OB_MODE_POSE)) {
- s += sprintf(s, "Bones:%d/%d %s",
+ s += sprintf(s, IFACE_("Bones:%d/%d %s"),
stats->totbonesel, stats->totbone, memstr);
}
else if (stats_is_object_dynamic_topology_sculpt(ob)) {
- s += sprintf(s, "Verts:%d | Tris:%d", stats->totvert, stats->tottri);
+ s += sprintf(s, IFACE_("Verts:%d | Tris:%d"), stats->totvert, stats->tottri);
}
else {
- s += sprintf(s, "Verts:%d | Faces:%d| Tris:%d | Objects:%d/%d | Lamps:%d/%d%s",
- stats->totvert, stats->totface, stats->tottri, stats->totobjsel, stats->totobj, stats->totlampsel, stats->totlamp, memstr);
+ s += sprintf(s, IFACE_("Verts:%d | Faces:%d | Tris:%d | Objects:%d/%d | Lamps:%d/%d%s"),
+ stats->totvert, stats->totface, stats->tottri, stats->totobjsel, stats->totobj, stats->totlampsel,
+ stats->totlamp, memstr);
}
if (ob)
@@ -419,4 +427,3 @@ const char *ED_info_stats_string(Scene *scene)
return scene->stats->infostr;
}
-
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 9b342ed8f44..f303bba9886 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -2654,10 +2654,21 @@ static void node_composit_buts_ellipsemask(uiLayout *layout, bContext *UNUSED(C)
uiItemR(layout, ptr, "mask_type", 0, NULL, ICON_NONE);
}
+static void node_composit_buts_composite(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "use_alpha", 0, NULL, ICON_NONE);
+}
+
+static void node_composit_buts_viewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "use_alpha", 0, NULL, ICON_NONE);
+}
+
static void node_composit_buts_viewer_but(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
+ uiItemR(layout, ptr, "use_alpha", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "tile_order", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "tile_order") == 0) {
col = uiLayoutColumn(layout, TRUE);
@@ -2965,10 +2976,13 @@ static void node_composit_set_butfunc(bNodeType *ntype)
ntype->uifunc = node_composit_buts_bokehblur;
break;
case CMP_NODE_VIEWER:
- ntype->uifunc = NULL;
+ ntype->uifunc = node_composit_buts_viewer;
ntype->uifuncbut = node_composit_buts_viewer_but;
ntype->uibackdropfunc = node_composit_backdrop_viewer;
break;
+ case CMP_NODE_COMPOSITE:
+ ntype->uifunc = node_composit_buts_composite;
+ break;
case CMP_NODE_MASK:
ntype->uifunc = node_composit_buts_mask;
break;
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index d5d2ace6fa7..34f7799d47c 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -368,7 +368,8 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
}
/* buttons rect? */
- if ((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
+ /* TODO: NODE_OPTION shall be cleaned up */
+ if (/*(node->flag & NODE_OPTIONS) && */node->typeinfo->uifunc) {
dy -= NODE_DYS / 2;
/* set this for uifunc() that don't use layout engine yet */
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index e92d93485a1..f26b6ff0f54 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -234,7 +234,7 @@ static void node_menu_add(const bContext *C, Menu *menu)
uiLayoutSetActive(layout, FALSE);
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
- uiItemO(layout, "Search ...", 0, "NODE_OT_add_search");
+ uiItemO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Search ..."), 0, "NODE_OT_add_search");
if (ntreetype && ntreetype->foreach_nodeclass)
ntreetype->foreach_nodeclass(scene, layout, node_menu_add_foreach_cb);
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index a5f6ca9ded0..264bea5f871 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -498,6 +498,7 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
case NC_SCENE:
case NC_MATERIAL:
case NC_TEXTURE:
+ case NC_WORLD:
case NC_NODE:
ED_region_tag_redraw(ar);
break;
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index b64019b01be..cacbc6d6268 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1677,7 +1677,7 @@ void draw_outliner(const bContext *C)
* (OL_RNA_COL_X), whichever is wider...
* - column 2 is fixed at OL_RNA_COL_SIZEX
*
- * (*) XXX max width for now is a fixed factor of UI_UNIT_X*(max_indention+100)
+ * (*) XXX max width for now is a fixed factor of (UI_UNIT_X * (max_indention + 100))
*/
/* get actual width of column 1 */
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 1f209f90007..b60528bcee8 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1312,9 +1312,11 @@ void TEXT_OT_select_line(wmOperatorType *ot)
static int text_select_word_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text = CTX_data_edit_text(C);
+ /* don't advance cursor before stepping */
+ const bool use_init_step = false;
- txt_jump_left(text, 0);
- txt_jump_right(text, 1);
+ txt_jump_left(text, false, use_init_step);
+ txt_jump_right(text, true, use_init_step);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
@@ -1816,11 +1818,11 @@ static int text_move_cursor(bContext *C, int type, int select)
break;
case PREV_WORD:
- txt_jump_left(text, select);
+ txt_jump_left(text, select, true);
break;
case NEXT_WORD:
- txt_jump_right(text, select);
+ txt_jump_right(text, select, true);
break;
case PREV_CHAR:
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 70e2e663b33..35a0111e575 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -1071,7 +1071,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
draw_mesh_face_select(rv3d, me, dm);
}
else if ((do_light == FALSE) || (ob->dtx & OB_DRAWWIRE)) {
- const int use_depth = (v3d->flag & V3D_ZBUF_SELECT);
+ const int use_depth = (v3d->flag & V3D_ZBUF_SELECT) || !(ob->mode & OB_MODE_WEIGHT_PAINT);
/* weight paint in solid mode, special case. focus on making the weights clear
* rather than the shading, this is also forced in wire view */
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index ff63f16d125..2b28b958248 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -871,7 +871,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect)
static void draw_selected_name(Scene *scene, Object *ob, rcti *rect)
{
char info[256], *markern;
- short offset = 30 + rect->xmin;
+ short offset = 1.5f * UI_UNIT_X + rect->xmin;
/* get name of marker on current frame (if available) */
markern = BKE_scene_find_marker_name(scene, CFRA);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 5c2e75776e4..8c0a2dc4b65 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -83,6 +83,9 @@
#include "view3d_intern.h" /* own include */
+/* for ndof prints */
+// #define DEBUG_NDOF_MOTION
+
/* ********************** view3d_edit: view manipulations ********************* */
int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
@@ -1043,11 +1046,10 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event)
float view_inv[4];
invert_qt_qt(view_inv, rv3d->viewquat);
- /* #define DEBUG_NDOF_MOTION */
- #ifdef DEBUG_NDOF_MOTION
+#ifdef DEBUG_NDOF_MOTION
printf("ndof: T=(%.2f,%.2f,%.2f) R=(%.2f,%.2f,%.2f) dt=%.3f delivered to 3D view\n",
ndof->tx, ndof->ty, ndof->tz, ndof->rx, ndof->ry, ndof->rz, ndof->dt);
- #endif
+#endif
if (rv3d->viewlock == RV3D_LOCKED) {
/* rotation not allowed -- explore panning options instead */
@@ -1204,11 +1206,10 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
float view_inv[4];
invert_qt_qt(view_inv, rv3d->viewquat);
- /* #define DEBUG_NDOF_MOTION */
- #ifdef DEBUG_NDOF_MOTION
+#ifdef DEBUG_NDOF_MOTION
printf("ndof: T=(%.2f,%.2f,%.2f) R=(%.2f,%.2f,%.2f) dt=%.3f delivered to 3D view\n",
ndof->tx, ndof->ty, ndof->tz, ndof->rx, ndof->ry, ndof->rz, ndof->dt);
- #endif
+#endif
if (ndof->tz) {
/* Zoom!
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 98d4c5e7b81..8ffa04050a2 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -894,6 +894,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw |= TREDRAW_HARD;
WM_event_add_mousemove(t->context);
}
+ else if (t->mode == TFM_SEQ_SLIDE) {
+ t->flag ^= T_ALT_TRANSFORM;
+ t->redraw |= TREDRAW_HARD;
+ }
else {
if (t->obedit && t->obedit->type == OB_MESH) {
if ((t->mode == TFM_TRANSLATION) && (t->spacetype == SPACE_VIEW3D)) {
@@ -958,6 +962,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
initSnapping(t, NULL); // need to reinit after mode change
t->redraw |= TREDRAW_HARD;
}
+ else if (t->mode == TFM_SHRINKFATTEN) {
+ t->flag ^= T_ALT_TRANSFORM;
+ t->redraw |= TREDRAW_HARD;
+ }
else if (t->mode == TFM_RESIZE) {
if (t->options & CTX_MOVIECLIP) {
restoreTransObjects(t);
@@ -1920,6 +1928,8 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
}
+ t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
+
initSnapping(t, op); // Initialize snapping data AFTER mode flags
/* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */
@@ -4054,7 +4064,8 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
{
float distance;
int i;
- char str[64];
+ char str[128];
+ char *str_p;
TransData *td = t->data;
distance = -t->values[0];
@@ -4064,17 +4075,33 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &distance);
/* header print for NumInput */
+ str_p = str;
+ str_p += BLI_snprintf(str_p, sizeof(str), "Shrink/Fatten:");
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
-
outputNumInput(&(t->num), c);
-
- sprintf(str, "Shrink/Fatten: %s %s", c, t->proptext);
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %s", c);
}
else {
/* default header print */
- sprintf(str, "Shrink/Fatten: %.4f %s", distance, t->proptext);
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %.4f", distance);
+ }
+
+ if (t->proptext[0]) {
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %s", t->proptext);
+ }
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), ", (");
+
+ {
+ wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE);
+ if (kmi) {
+ str_p += WM_keymap_item_to_string(kmi, str_p, sizeof(str) - (str_p - str));
+ }
}
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " or Alt) Even Thickness %s",
+ (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
+ /* done with header string */
+
t->values[0] = -distance;
@@ -5899,7 +5926,7 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
&c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
}
else {
- BLI_snprintf(str, sizeof(str), "Edge Slide: %.2f (E)ven: %s, (F)lipped: %s",
+ BLI_snprintf(str, sizeof(str), "Edge Slide: %.4f (E)ven: %s, (F)lipped: %s",
final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
}
@@ -6027,6 +6054,7 @@ static int createVertSlideVerts(TransInfo *t)
}
sld->is_proportional = true;
+ sld->is_clamp = true;
sld->curr_sv_index = 0;
sld->flipped_vtx = false;
@@ -6220,6 +6248,16 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event)
}
break;
}
+ case CKEY:
+ {
+ /* use like a modifier key */
+ if (event->val == KM_PRESS) {
+ sld->is_clamp = !sld->is_clamp;
+ calcVertSlideCustomPoints(t);
+ return 1;
+ }
+ break;
+ }
#if 0
case EVT_MODAL_MAP:
{
@@ -6240,7 +6278,7 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event)
case MOUSEMOVE:
{
/* don't recalculat the best edge */
- if (!(t->flag & T_ALT_TRANSFORM)) {
+ if (sld->is_clamp) {
calcVertSlideMouseActiveEdges(t, event->mval);
}
calcVertSlideCustomPoints(t);
@@ -6266,7 +6304,6 @@ static void drawVertSlide(const struct bContext *C, TransInfo *t)
const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
const int alpha_shade = -30;
int i;
- bool is_constrained = !(t->flag & T_ALT_TRANSFORM);
if (v3d && v3d->zbuf)
glDisable(GL_DEPTH_TEST);
@@ -6282,7 +6319,7 @@ static void drawVertSlide(const struct bContext *C, TransInfo *t)
glLineWidth(line_size);
UI_ThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
glBegin(GL_LINES);
- if (is_constrained) {
+ if (sld->is_clamp) {
sv = sld->sv;
for (i = 0; i < sld->totsv; i++, sv++) {
glVertex3fv(sv->co_orig_3d);
@@ -6370,11 +6407,12 @@ static int doVertSlide(TransInfo *t, float perc)
int VertSlide(TransInfo *t, const int UNUSED(mval[2]))
{
char str[128];
+ char *str_p;
float final;
VertSlideData *sld = t->customData;
const bool flipped = sld->flipped_vtx;
const bool is_proportional = sld->is_proportional;
- const bool is_constrained = !((t->flag & T_ALT_TRANSFORM) || hasNumInput(&t->num));
+ const bool is_constrained = !(sld->is_clamp == false || hasNumInput(&t->num));
final = t->values[0];
@@ -6385,20 +6423,24 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2]))
CLAMP(final, 0.0f, 1.0f);
}
+ /* header string */
+ str_p = str;
+ str_p += BLI_snprintf(str_p, sizeof(str), "Vert Slide: ");
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
-
applyNumInput(&t->num, &final);
-
outputNumInput(&(t->num), c);
-
- BLI_snprintf(str, sizeof(str), "Vert Slide: %s (E)ven: %s, (F)lipped: %s, Alt Hold: %s",
- &c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF", (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "%s", &c[0]);
}
else {
- BLI_snprintf(str, sizeof(str), "Vert Slide: %.2f (E)ven: %s, (F)lipped: %s, Alt Hold: %s",
- final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF", (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "%.4f ", final);
}
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(E)ven: %s, ", !is_proportional ? "ON" : "OFF");
+ if (!is_proportional) {
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(F)lipped: %s, ", flipped ? "ON" : "OFF");
+ }
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(C)lamp: %s", sld->is_clamp ? "ON" : "OFF");
+ /* done with header string */
if (is_constrained) {
CLAMP(final, 0.0f, 1.0f);
@@ -6718,9 +6760,10 @@ void initSeqSlide(TransInfo *t)
t->num.increment = t->snap[1];
}
-static void headerSeqSlide(TransInfo *t, float val[2], char *str)
+static void headerSeqSlide(TransInfo *t, float val[2], char *str, size_t str_len)
{
char tvec[NUM_STR_REP_LEN * 3];
+ char *str_p;
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
@@ -6729,7 +6772,17 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str)
sprintf(&tvec[0], "%.0f, %.0f", val[0], val[1]);
}
- sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text);
+ str_p = str;
+ str_p += BLI_snprintf(str, str_len, "Sequence Slide: %s%s, (", &tvec[0], t->con.text);
+
+ {
+ wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
+ if (kmi) {
+ str_p += WM_keymap_item_to_string(kmi, str_p, str_len - (str_p - str));
+ }
+ }
+ str_p += BLI_snprintf(str_p, str_len - (str_p - str), " or Alt) Expand to fit %s",
+ (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
}
static void applySeqSlide(TransInfo *t, float val[2])
@@ -6773,7 +6826,7 @@ int SeqSlide(TransInfo *t, const int UNUSED(mval[2]))
t->values[0] = floor(t->values[0] + 0.5f);
t->values[1] = floor(t->values[1] + 0.5f);
- headerSeqSlide(t, t->values, str);
+ headerSeqSlide(t, t->values, str, sizeof(str));
applySeqSlide(t, t->values);
recalcData(t);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index a27fe91c3c3..78f346be2aa 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -239,6 +239,7 @@ typedef struct VertSlideData {
float perc;
bool is_proportional;
+ bool is_clamp;
bool flipped_vtx;
int curr_sv_index;
@@ -351,6 +352,7 @@ typedef struct TransInfo {
struct Scene *scene;
struct ToolSettings *settings;
struct wmTimer *animtimer;
+ struct wmKeyMap *keymap; /* so we can do lookups for header text */
int mval[2]; /* current mouse position */
struct Object *obedit;
void *draw_handle_apply;
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index dd1510498b0..4e9a54692a5 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -307,15 +307,8 @@ static void calcSpringFactor(MouseInput *mi)
void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
{
- /* may have been allocated previously */
- /* TODO, holding R-key can cause mem leak, but this causes [#28903]
- * disable for now. */
-#if 0
- if (mi->data) {
- MEM_freeN(mi->data);
- mi->data = NULL;
- }
-#endif
+ /* incase we allocate a new value */
+ void *mi_data_prev = mi->data;
switch (mode) {
case INPUT_VECTOR:
@@ -374,6 +367,12 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
break;
}
+ /* if we've allocated new data, free the old data
+ * less hassle then checking before every alloc above */
+ if (mi_data_prev && (mi_data_prev != mi->data)) {
+ MEM_freeN(mi_data_prev);
+ }
+
/* bootstrap mouse input with initial values */
applyMouseInput(t, mi, mi->imval, t->values);
}
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 7e3302e233e..767003bdd84 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -60,6 +60,7 @@
{ /*printf("Assertion %s:%d\n", __FILE__, __LINE__); abort();*/ } (void)0
#define param_warning(message) \
{ /*printf("Warning %s:%d: %s\n", __FILE__, __LINE__, message);*/ } (void)0
+#if 0
#define param_test_equals_ptr(str, a, b) \
if (a != b) \
{ /*printf("Equals %s => %p != %p\n", str, a, b);*/ } (void)0
@@ -67,6 +68,7 @@
if (a != b) \
{ /*printf("Equals %s => %d != %d\n", str, a, b);*/ } (void)0
#endif
+#endif
typedef enum PBool {
P_TRUE = 1,
P_FALSE = 0
@@ -3047,6 +3049,8 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
PVert *v, *pin1 = chart->u.lscm.pin1, *pin2 = chart->u.lscm.pin2;
PFace *f;
float *alpha = chart->u.lscm.abf_alpha;
+ float area_pinned_up, area_pinned_down;
+ bool flip_faces;
int row;
nlMakeCurrent(chart->u.lscm.context);
@@ -3085,6 +3089,26 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
}
}
+ /* detect up direction based on pinned vertices */
+ area_pinned_up = 0.0f;
+ area_pinned_down = 0.0f;
+
+ for (f = chart->faces; f; f = f->nextlink) {
+ PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
+ PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
+
+ if ((v1->flag & PVERT_PIN) && (v2->flag & PVERT_PIN) && (v3->flag & PVERT_PIN)) {
+ float area = p_face_uv_area_signed(f);
+
+ if (area > 0.0f)
+ area_pinned_up += area;
+ else
+ area_pinned_down -= area;
+ }
+ }
+
+ flip_faces = (area_pinned_down > area_pinned_up);
+
/* construct matrix */
nlBegin(NL_MATRIX);
@@ -3105,6 +3129,12 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
else
p_face_angles(f, &a1, &a2, &a3);
+ if (flip_faces) {
+ SWAP(float, a2, a3);
+ SWAP(PEdge *, e2, e3);
+ SWAP(PVert *, v2, v3);
+ }
+
sina1 = sin(a1);
sina2 = sin(a2);
sina3 = sin(a3);
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 1b43d829947..5bb8105cd14 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -100,11 +100,13 @@ struct IslandStitchData;
typedef struct IslandStitchData {
/* rotation can be used only for edges, for vertices there is no such notion */
float rotation;
+ float rotation_neg;
float translation[2];
/* Used for rotation, the island will rotate around this point */
float medianPoint[2];
int numOfElements;
int num_rot_elements;
+ int num_rot_elements_neg;
/* flag to remember if island has been added for preview */
char addedForPreview;
/* flag an island to be considered for determining static island */
@@ -286,20 +288,15 @@ static int getNumOfIslandUvs(UvElementMap *elementMap, int island)
}
}
-static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2], float aspect)
+static void stitch_uv_rotate(float mat[2][2], float medianPoint[2], float uv[2], float aspect)
{
float uv_rotation_result[2];
uv[1] /= aspect;
- uv[0] -= medianPoint[0];
- uv[1] -= medianPoint[1];
-
- uv_rotation_result[0] = cosf(rotation) * uv[0] - sinf(rotation) * uv[1];
- uv_rotation_result[1] = sinf(rotation) * uv[0] + cosf(rotation) * uv[1];
-
- uv[0] = uv_rotation_result[0] + medianPoint[0];
- uv[1] = uv_rotation_result[1] + medianPoint[1];
+ sub_v2_v2(uv, medianPoint);
+ mul_v2_m2v2(uv_rotation_result, mat, uv);
+ add_v2_v2v2(uv, uv_rotation_result, medianPoint);
uv[1] *= aspect;
}
@@ -412,17 +409,40 @@ static void stitch_calculate_island_snapping(StitchState *state, PreviewPosition
for (i = 0; i < state->element_map->totalIslands; i++) {
if (island_stitch_data[i].addedForPreview) {
int numOfIslandUVs = 0, j;
+ int totelem = island_stitch_data[i].num_rot_elements_neg + island_stitch_data[i].num_rot_elements;
+ float rotation;
+ float rotation_mat[2][2];
/* check to avoid divide by 0 */
- if (island_stitch_data[i].num_rot_elements > 0) {
+ if (island_stitch_data[i].num_rot_elements > 1)
island_stitch_data[i].rotation /= island_stitch_data[i].num_rot_elements;
+
+ if (island_stitch_data[i].num_rot_elements_neg > 1)
+ island_stitch_data[i].rotation_neg /= island_stitch_data[i].num_rot_elements_neg;
+
+ if (island_stitch_data[i].numOfElements > 1) {
island_stitch_data[i].medianPoint[0] /= island_stitch_data[i].numOfElements;
island_stitch_data[i].medianPoint[1] /= island_stitch_data[i].numOfElements;
- island_stitch_data[i].medianPoint[1] /= state->aspect;
+
+ island_stitch_data[i].translation[0] /= island_stitch_data[i].numOfElements;
+ island_stitch_data[i].translation[1] /= island_stitch_data[i].numOfElements;
+ }
+
+ island_stitch_data[i].medianPoint[1] /= state->aspect;
+ if ((island_stitch_data[i].rotation + island_stitch_data[i].rotation_neg < (float)M_PI_2) ||
+ island_stitch_data[i].num_rot_elements == 0 || island_stitch_data[i].num_rot_elements_neg == 0)
+ {
+ rotation = (island_stitch_data[i].rotation * island_stitch_data[i].num_rot_elements -
+ island_stitch_data[i].rotation_neg *
+ island_stitch_data[i].num_rot_elements_neg) / totelem;
+ }
+ else {
+ rotation = (island_stitch_data[i].rotation * island_stitch_data[i].num_rot_elements +
+ (2.0f * (float)M_PI - island_stitch_data[i].rotation_neg) *
+ island_stitch_data[i].num_rot_elements_neg) / totelem;
}
- island_stitch_data[i].translation[0] /= island_stitch_data[i].numOfElements;
- island_stitch_data[i].translation[1] /= island_stitch_data[i].numOfElements;
+ rotate_m2(rotation_mat, rotation);
numOfIslandUVs = getNumOfIslandUvs(state->element_map, i);
element = &state->element_map->buf[state->element_map->islandIndices[i]];
for (j = 0; j < numOfIslandUVs; j++, element++) {
@@ -436,15 +456,16 @@ static void stitch_calculate_island_snapping(StitchState *state, PreviewPosition
if (final) {
- stitch_uv_rotate(island_stitch_data[i].rotation, island_stitch_data[i].medianPoint, luv->uv, state->aspect);
+ stitch_uv_rotate(rotation_mat, island_stitch_data[i].medianPoint, luv->uv, state->aspect);
add_v2_v2(luv->uv, island_stitch_data[i].translation);
}
else {
+
int face_preview_pos = preview_position[BM_elem_index_get(element->l->f)].data_position;
- stitch_uv_rotate(island_stitch_data[i].rotation, island_stitch_data[i].medianPoint,
+ stitch_uv_rotate(rotation_mat, island_stitch_data[i].medianPoint,
preview->preview_polys + face_preview_pos + 2 * element->tfindex, state->aspect);
add_v2_v2(preview->preview_polys + face_preview_pos + 2 * element->tfindex,
@@ -500,13 +521,16 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta
edgecos = dot_v2v2(uv1, uv2);
edgesin = cross_v2v2(uv1, uv2);
+ rotation = acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
- rotation = (edgesin > 0.0f) ?
- +acosf(max_ff(-1.0f, min_ff(1.0f, edgecos))) :
- -acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
-
- island_stitch_data[element1->island].num_rot_elements++;
- island_stitch_data[element1->island].rotation += rotation;
+ if (edgesin > 0.0f) {
+ island_stitch_data[element1->island].num_rot_elements++;
+ island_stitch_data[element1->island].rotation += rotation;
+ }
+ else {
+ island_stitch_data[element1->island].num_rot_elements_neg++;
+ island_stitch_data[element1->island].rotation_neg += rotation;
+ }
}
@@ -515,7 +539,8 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
float edgecos = 1.0f, edgesin = 0.0f;
int index;
UvElement *element_iter;
- float rotation = 0;
+ float rotation = 0, rotation_neg = 0;
+ int rot_elem = 0, rot_elem_neg = 0;
BMLoop *l;
if (element->island == state->static_island && !state->midpoints)
@@ -544,16 +569,25 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
negate_v2_v2(normal, state->normals + index_tmp2 * 2);
edgecos = dot_v2v2(normal, state->normals + index_tmp1 * 2);
edgesin = cross_v2v2(normal, state->normals + index_tmp1 * 2);
- rotation += (edgesin > 0.0f) ?
- +acosf(max_ff(-1.0f, min_ff(1.0f, edgecos))) :
- -acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
+ if (edgesin > 0.0f) {
+ rotation += acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
+ rot_elem++;
+ }
+ else {
+ rotation_neg += acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
+ rot_elem_neg++;
+ }
}
}
- if (state->midpoints)
+ if (state->midpoints) {
rotation /= 2.0f;
- island_stitch_data[element->island].num_rot_elements++;
+ rotation_neg /= 2.0f;
+ }
+ island_stitch_data[element->island].num_rot_elements += rot_elem;
island_stitch_data[element->island].rotation += rotation;
+ island_stitch_data[element->island].num_rot_elements_neg += rot_elem_neg;
+ island_stitch_data[element->island].rotation_neg += rotation_neg;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 45e7831d20d..8fc18bf8726 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -390,6 +390,17 @@ void set_rgba_zero(out vec4 outval)
outval = vec4(0.0);
}
+void brightness_contrast(vec4 col, float brightness, float contrast, out vec4 outcol)
+{
+ float a = 1.0 + contrast;
+ float b = brightness - contrast*0.5;
+
+ outcol.r = max(a*col.r + b, 0.0);
+ outcol.g = max(a*col.g + b, 0.0);
+ outcol.b = max(a*col.b + b, 0.0);
+ outcol.a = col.a;
+}
+
void mix_blend(float fac, vec4 col1, vec4 col2, out vec4 outcol)
{
fac = clamp(fac, 0.0, 1.0);
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index 1e33f8da363..a05f0d5b3e6 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -133,6 +133,8 @@ void IMB_partial_display_buffer_update(struct ImBuf *ibuf, const float *linear_b
int xmin, int ymin, int xmax, int ymax,
int update_orig_byte_buffer);
+void IMB_partial_display_buffer_update_delayed(struct ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax);
+
/* ** Pixel processor functions ** */
struct ColormanageProcessor *IMB_colormanagement_display_processor_new(const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings);
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index e30f1618c81..dde8d4d4ab7 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -28,6 +28,8 @@
#ifndef __IMB_IMBUF_TYPES_H__
#define __IMB_IMBUF_TYPES_H__
+#include "DNA_vec_types.h" /* for rcti */
+
/**
* \file IMB_imbuf_types.h
* \ingroup imbuf
@@ -132,6 +134,7 @@ typedef struct ImBuf {
unsigned int *display_buffer_flags; /* array of per-display display buffers dirty flags */
struct ColormanageCache *colormanage_cache; /* cache used by color management */
int colormanage_flag;
+ rcti invalid_rect;
/* information for compressed textures */
struct DDSData dds_data;
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 23804291a65..ff297d70cc3 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -57,6 +57,7 @@
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_threads.h"
+#include "BLI_rect.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
@@ -1823,6 +1824,18 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSet
colormanage_view_settings_to_cache(&cache_view_settings, applied_view_settings);
colormanage_display_settings_to_cache(&cache_display_settings, display_settings);
+ if (ibuf->invalid_rect.xmin != ibuf->invalid_rect.xmax) {
+ if ((ibuf->userflags & IB_DISPLAY_BUFFER_INVALID) == 0) {
+ IMB_partial_display_buffer_update(ibuf, ibuf->rect_float, (unsigned char *) ibuf->rect,
+ ibuf->x, 0, 0, applied_view_settings, display_settings,
+ ibuf->invalid_rect.xmin, ibuf->invalid_rect.ymin,
+ ibuf->invalid_rect.xmax, ibuf->invalid_rect.ymax,
+ FALSE);
+ }
+
+ BLI_rcti_init(&ibuf->invalid_rect, 0, 0, 0, 0);
+ }
+
BLI_lock_thread(LOCK_COLORMANAGE);
/* ensure color management bit fields exists */
@@ -2478,7 +2491,7 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer,
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);
if (cm_processor)
IMB_colormanagement_processor_free(cm_processor);
@@ -2488,6 +2501,18 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer,
}
}
+void IMB_partial_display_buffer_update_delayed(ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax)
+{
+ if (ibuf->invalid_rect.xmin == ibuf->invalid_rect.xmax) {
+ BLI_rcti_init(&ibuf->invalid_rect, xmin, xmax, ymin, ymax);
+ }
+ else {
+ rcti rect;
+ BLI_rcti_init(&rect, xmin, xmax, ymin, ymax);
+ BLI_rcti_union(&ibuf->invalid_rect, &rect);
+ }
+}
+
/*********************** Pixel processor functions *************************/
ColormanageProcessor *IMB_colormanagement_display_processor_new(const ColorManagedViewSettings *view_settings,
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 51fee232034..9193954f1d6 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -506,6 +506,10 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter)
imb_freemipmapImBuf(ibuf);
+ /* no mipmap for non RGBA images */
+ if (ibuf->rect_float && ibuf->channels < 4)
+ return;
+
ibuf->miptot = 1;
while (curmap < IB_MIPMAP_LEVELS) {
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index d2b0645cf93..0b739b9fe92 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -594,11 +594,13 @@ void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, i
void IMB_rectfill_alpha(ImBuf *ibuf, const float value)
{
int i;
- if (ibuf->rect_float) {
+
+ if (ibuf->rect_float && (ibuf->channels == 4)) {
float *fbuf = ibuf->rect_float + 3;
for (i = ibuf->x * ibuf->y; i > 0; i--, fbuf += 4) { *fbuf = value; }
}
- else {
+
+ if (ibuf->rect) {
const unsigned char cvalue = value * 255;
unsigned char *cbuf = ((unsigned char *)ibuf->rect) + 3;
for (i = ibuf->x * ibuf->y; i > 0; i--, cbuf += 4) { *cbuf = cvalue; }
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index b85bdecee02..2323c95d8ba 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -118,9 +118,14 @@ typedef struct MLoopUV {
#define MLOOPUV_VERTSEL 2
#define MLOOPUV_PINNED 4
-/* at the moment alpha is abused for vertex painting
- * and not used for transparency,
- * note that red and blue are _not_ swapped, as they are with #MCol */
+/**
+ * at the moment alpha is abused for vertex painting,
+ * otherwise it should _always_ be initialized to 255
+ * Mostly its not used for transparency...
+ * (except for blender-internal rendering, see [#34096]).
+ *
+ * \note red and blue are _not_ swapped, as they are with #MCol
+ */
typedef struct MLoopCol {
char r, g, b, a;
} MLoopCol;
diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h
index 5b37ff523cb..56683bf4797 100644
--- a/source/blender/makesdna/DNA_meta_types.h
+++ b/source/blender/makesdna/DNA_meta_types.h
@@ -121,6 +121,8 @@ typedef struct MetaBall {
#define MB_ELIPSOID 6
#define MB_CUBE 7
+#define MB_TYPE_SIZE_SQUARED(type) (type == MB_ELIPSOID)
+
/* ml->flag */
#define MB_NEGATIVE 2
#define MB_HIDE 8
diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h
index ca703130edc..1636f2f4e4b 100644
--- a/source/blender/makesdna/DNA_rigidbody_types.h
+++ b/source/blender/makesdna/DNA_rigidbody_types.h
@@ -80,7 +80,9 @@ typedef enum eRigidBodyWorld_Flag {
/* sim data needs to be rebuilt */
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),
+ /* need to step simulation after frame update */
+ RBW_FLAG_FRAME_UPDATE = (1 << 3)
} eRigidBodyWorld_Flag;
/* ******************************** */
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index f4a992011a2..418f33cca8a 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -367,6 +367,9 @@ typedef struct SolidLight {
} SolidLight;
typedef struct UserDef {
+ /* UserDef has separate do-version handling, and can be read from other files */
+ int versionfile, subversionfile;
+
int flag, dupflag;
int savetime;
char tempdir[768]; /* FILE_MAXDIR length */
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index d3cf7dc8095..54d2efcf4cf 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -120,6 +120,7 @@ typedef enum PropertySubType {
PROP_FACTOR = 15,
PROP_ANGLE = 16 | PROP_UNIT_ROTATION,
PROP_TIME = 17 | PROP_UNIT_TIME,
+ /* distance in 3d space, don't use for pixel distance for eg. */
PROP_DISTANCE = 18 | PROP_UNIT_LENGTH,
/* number arrays */
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index e9a0245210f..585e08ea706 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -111,6 +111,7 @@ set(APISRC
rna_main_api.c
rna_material_api.c
rna_mesh_api.c
+ rna_meta_api.c
rna_texture_api.c
rna_object_api.c
rna_pose_api.c
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 57cd77bdf93..5c6a414718b 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -3251,7 +3251,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_main.c", "rna_main_api.c", RNA_def_main},
{"rna_material.c", "rna_material_api.c", RNA_def_material},
{"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
- {"rna_meta.c", NULL, RNA_def_meta},
+ {"rna_meta.c", "rna_meta_api.c", RNA_def_meta},
{"rna_modifier.c", NULL, RNA_def_modifier},
{"rna_nla.c", NULL, RNA_def_nla},
{"rna_nodetree.c", NULL, RNA_def_nodetree},
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 4fb26f2b007..c995d3b52c7 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -618,7 +618,7 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Brush_update");
/* number values */
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
RNA_def_property_int_funcs(prop, NULL, "rna_Brush_set_size", NULL);
RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
@@ -645,7 +645,7 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Spacing", "Spacing between brush daubs as a percentage of brush diameter");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop = RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 10, 200);
RNA_def_property_ui_text(prop, "Smooth Stroke Radius", "Minimum distance from last point before stroke continues");
RNA_def_property_update(prop, 0, "rna_Brush_update");
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index c32255ac645..97ef4dfd0a8 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -971,6 +971,14 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
{
IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+#ifndef RNA_RUNTIME
+ if (subtype == PROP_DISTANCE) {
+ fprintf(stderr, "%s: subtype does not apply to 'PROP_INT' \"%s.%s\"\n", __func__,
+ CONTAINER_RNA_ID(cont), identifier);
+ DefRNA.error = 1;
+ }
+#endif
+
iprop->hardmin = (subtype == PROP_UNSIGNED) ? 0 : INT_MIN;
iprop->hardmax = INT_MAX;
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 204f4018d56..1c0909c946f 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -267,6 +267,7 @@ void RNA_api_keymapitems(struct StructRNA *srna);
void RNA_api_main(struct StructRNA *srna);
void RNA_api_material(StructRNA *srna);
void RNA_api_mesh(struct StructRNA *srna);
+void RNA_api_meta(struct StructRNA *srna);
void RNA_api_object(struct StructRNA *srna);
void RNA_api_object_base(struct StructRNA *srna);
void RNA_api_pose(struct StructRNA *srna);
@@ -404,7 +405,9 @@ 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);
+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, int calc_tessface);
/* 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);
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 5b3a759697f..75ad64b1f29 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -37,6 +37,7 @@
#include "DNA_modifier_types.h"
#include "BLI_path_util.h"
+#include "BLI_utildefines.h"
#include "RNA_define.h"
#include "RNA_access.h"
@@ -266,7 +267,9 @@ static Mesh *rna_Main_meshes_new(Main *bmain, const char *name)
/* 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 *rna_Main_meshes_new_from_object(
+ Main *bmain, ReportList *reports, Scene *sce,
+ Object *ob, int apply_modifiers, int settings, int calc_tessface)
{
Mesh *tmpmesh;
Curve *tmpcu = NULL, *copycu;
@@ -449,8 +452,10 @@ Mesh *rna_Main_meshes_new_from_object(Main *bmain, ReportList *reports, Scene *s
break;
} /* end copy materials */
- /* cycles and exporters rely on this still */
- BKE_mesh_tessface_ensure(tmpmesh);
+ if (calc_tessface) {
+ /* cycles and exporters rely on this still */
+ BKE_mesh_tessface_ensure(tmpmesh);
+ }
/* make sure materials get updated in objects */
test_object_materials(&tmpmesh->id);
@@ -1163,6 +1168,7 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
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);
+ RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces");
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);
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index 08eefc082bf..4813f25dea7 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -351,6 +351,8 @@ static void rna_def_metaball(BlenderRNA *brna)
/* anim */
rna_def_animdata_common(srna);
+
+ RNA_api_meta(srna);
}
void RNA_def_meta(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_meta_api.c b/source/blender/makesrna/intern/rna_meta_api.c
new file mode 100644
index 00000000000..500e202b16f
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_meta_api.c
@@ -0,0 +1,60 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/makesrna/intern/rna_meta_api.c
+ * \ingroup RNA
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+
+#include "BLO_sys_types.h"
+
+#include "BLI_utildefines.h"
+
+#include "ED_mball.h"
+
+#include "rna_internal.h" /* own include */
+
+#ifdef RNA_RUNTIME
+/* none */
+#else
+
+void RNA_api_meta(StructRNA *srna)
+{
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "transform", "ED_mball_transform");
+ RNA_def_function_ui_description(func, "Transform meta elements by a matrix");
+ parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+}
+
+#endif
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index fee4b429a11..397e05b6a97 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -4083,6 +4083,21 @@ static void def_cmp_viewer(StructRNA *srna)
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Y", "");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 1);
+ RNA_def_property_ui_text(prop, "Use Alpha", "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
+static void def_cmp_composite(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 1);
+ RNA_def_property_ui_text(prop, "Use Alpha", "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_keyingscreen(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index d6e0ce2f11a..b7ec9235483 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -31,6 +31,8 @@
#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc)
#endif
+/* WARNING! If you edit those strings, please do the same in relevant nodes files (under blender/nodes/...)! */
+
/* Tree type Node ID RNA def function Enum name Struct name UI Name UI Description */
DefNode( ShaderNode, SH_NODE_OUTPUT, 0, "OUTPUT", Output, "Output", "" )
DefNode( ShaderNode, SH_NODE_MATERIAL, def_sh_material, "MATERIAL", Material, "Material", "" )
@@ -45,12 +47,12 @@ DefNode( ShaderNode, SH_NODE_GAMMA, 0, "GAMMA
DefNode( ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" )
DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" )
DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" )
-DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" )
-DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curve", "" )
+DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curves", "" )
+DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curves", "" )
DefNode( ShaderNode, SH_NODE_CAMERA, 0, "CAMERA", CameraData, "Camera Data", "" )
DefNode( ShaderNode, SH_NODE_MATH, def_math, "MATH", Math, "Math", "" )
DefNode( ShaderNode, SH_NODE_VECT_MATH, def_vector_math, "VECT_MATH", VectorMath, "Vector Math", "" )
-DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze", "" )
+DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze Value", "" )
DefNode( ShaderNode, SH_NODE_MATERIAL_EXT, def_sh_material, "MATERIAL_EXT", ExtendedMaterial, "Extended Material", "" )
DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" )
@@ -68,14 +70,14 @@ DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "AT
DefNode( ShaderNode, SH_NODE_AMBIENT_OCCLUSION, 0, "AMBIENT_OCCLUSION", AmbientOcclusion, "Ambient Occlusion", "" )
DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "" )
DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, 0, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic Bsdf", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse Bsdf", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy Bsdf", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glossy, "BSDF_GLASS", BsdfGlass, "Glass Bsdf", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_REFRACTION, def_glossy, "BSDF_REFRACTION", BsdfRefraction, "Refraction Bsdf", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent Bsdf", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent Bsdf", "" )
-DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet Bsdf", "" )
+DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, 0, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" )
+DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "" )
+DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "" )
+DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glossy, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "" )
+DefNode( ShaderNode, SH_NODE_BSDF_REFRACTION, def_glossy, "BSDF_REFRACTION", BsdfRefraction, "Refraction BSDF", "" )
+DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent BSDF", "" )
+DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent BSDF", "" )
+DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet BSDF", "" )
DefNode( ShaderNode, SH_NODE_VOLUME_TRANSPARENT, 0, "VOLUME_TRANSPARENT", VolumeTransparent,"Transparent Volume","" )
DefNode( ShaderNode, SH_NODE_VOLUME_ISOTROPIC, 0, "VOLUME_ISOTROPIC", VolumeIsotropic, "Isotropic Volume", "" )
DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "" )
@@ -109,7 +111,7 @@ DefNode( CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_R
DefNode( CompositorNode, CMP_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" )
DefNode( CompositorNode, CMP_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
DefNode( CompositorNode, CMP_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
-DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curve", "" )
+DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curves", "" )
DefNode( CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" )
DefNode( CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, "ALPHAOVER", AlphaOver, "Alpha Over", "" )
DefNode( CompositorNode, CMP_NODE_BLUR, def_cmp_blur, "BLUR", Blur, "Blur", "" )
@@ -124,7 +126,7 @@ DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETAL
DefNode( CompositorNode, CMP_NODE_HUE_SAT, def_cmp_hue_saturation, "HUE_SAT", HueSat, "Hue Saturation Value","" )
DefNode( CompositorNode, CMP_NODE_IMAGE, def_cmp_image, "IMAGE", Image, "Image", "" )
DefNode( CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, "R_LAYERS", RLayers, "Render Layers", "" )
-DefNode( CompositorNode, CMP_NODE_COMPOSITE, 0, "COMPOSITE", Composite, "Composite", "" )
+DefNode( CompositorNode, CMP_NODE_COMPOSITE, def_cmp_composite, "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, def_cmp_translate, "TRANSLATE", Translate, "Translate", "" )
@@ -194,7 +196,7 @@ DefNode( TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_R
DefNode( TextureNode, TEX_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
DefNode( TextureNode, TEX_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" )
DefNode( TextureNode, TEX_NODE_IMAGE, def_tex_image, "IMAGE", Image, "Image", "" )
-DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curve", "" )
+DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" )
DefNode( TextureNode, TEX_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
DefNode( TextureNode, TEX_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" )
DefNode( TextureNode, TEX_NODE_CURVE_TIME, def_time, "CURVE_TIME", CurveTime, "Curve Time", "" )
@@ -203,8 +205,8 @@ DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWE
DefNode( TextureNode, TEX_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" )
DefNode( TextureNode, TEX_NODE_COORD, 0, "COORD", Coordinates, "Coordinates", "" )
DefNode( TextureNode, TEX_NODE_DISTANCE, 0, "DISTANCE", Distance, "Distance", "" )
-DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Compose", "" )
-DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Decompose", "" )
+DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Combine RGBA", "" )
+DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Separate RGBA", "" )
DefNode( TextureNode, TEX_NODE_VALTONOR, 0, "VALTONOR", ValToNor, "Value to Normal", "" )
DefNode( TextureNode, TEX_NODE_SCALE, 0, "SCALE", Scale, "Scale", "" )
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 51725bda7f9..2b7df1ca317 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -34,6 +34,8 @@
#include <string.h>
#include <time.h>
+#include "BLI_utildefines.h"
+
#include "RNA_define.h"
#include "DNA_constraint_types.h"
@@ -109,9 +111,11 @@ static void rna_Scene_mat_convert_space(Object *ob, ReportList *reports, bPoseCh
/* copied from Mesh_getFromObject and adapted to RNA interface */
/* settings: 0 - preview, 1 - render */
-static Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings)
+static Mesh *rna_Object_to_mesh(
+ Object *ob, ReportList *reports, Scene *sce,
+ int apply_modifiers, int settings, int calc_tessface)
{
- return rna_Main_meshes_new_from_object(G.main, reports, sce, ob, apply_modifiers, settings);
+ return rna_Main_meshes_new_from_object(G.main, reports, sce, ob, apply_modifiers, settings, calc_tessface);
}
/* mostly a copy from convertblender.c */
@@ -442,6 +446,7 @@ void RNA_api_object(StructRNA *srna)
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);
+ RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces");
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);
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index b737410bbab..7270ccadb81 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -163,13 +163,6 @@ static void rna_RigidBodyOb_type_set(PointerRNA *ptr, int value)
rbo->type = value;
rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
-
-#ifdef WITH_BULLET
- /* do physics sim updates */
- if (rbo->physics_object) {
- RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
- }
-#endif
}
static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index c4269e1ddff..db9250ab2fc 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1926,7 +1926,7 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna)
/* unified paint settings that override the equivalent settings
* from the active brush */
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
@@ -3279,7 +3279,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_NO_MATERIAL_CACHING);
RNA_def_property_ui_text(prop, "Use Material Caching",
"Cache materials in the converter (this is faster, but can cause problems with older "
- "Singletexture and Multitexture games");
+ "Singletexture and Multitexture games)");
/* obstacle simulation */
prop = RNA_def_property(srna, "obstacle_simulation", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index ff0c9d9dec6..e0687295c70 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -236,7 +236,7 @@ static void rna_Sculpt_ShowDiffuseColor_update(Main *UNUSED(bmain), Scene *scene
{
Object *ob = (scene->basact) ? scene->basact->object : NULL;
- if (ob) {
+ if (ob && ob->sculpt) {
Sculpt *sd = scene->toolsettings->sculpt;
ob->sculpt->show_diffuse_color = sd->flags & SCULPT_SHOW_DIFFUSE;
@@ -378,7 +378,7 @@ static void rna_def_sculpt(BlenderRNA *brna)
"Show diffuse color of object and overlay sculpt mask on top of it");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowDiffuseColor_update");
- prop = RNA_def_property(srna, "detail_size", PROP_INT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "detail_size", PROP_INT, PROP_NONE);
RNA_def_property_ui_range(prop, 2, 100, 0, 0);
RNA_def_property_ui_text(prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (in pixels)");
@@ -632,7 +632,7 @@ static void rna_def_particle_edit(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_ParticleBrush_path");
RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, SHRT_MAX);
RNA_def_property_ui_range(prop, 1, 100, 10, 3);
RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index fc67ae27387..e007fe67c0b 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -1842,7 +1842,7 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna)
prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "file_format");
RNA_def_property_enum_items(prop, file_format_items);
- RNA_def_property_ui_text(prop, "File Format", "Format of the source data set to render ");
+ RNA_def_property_ui_text(prop, "File Format", "Format of the source data set to render");
RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index 1298d281de8..638f8f0ae01 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -161,7 +161,7 @@ static void createFacepa(ExplodeModifierData *emd,
mul_v3_fl(center, 0.25);
}
else
- mul_v3_fl(center, 0.3333f);
+ mul_v3_fl(center, 1.0f / 3.0f);
p = BLI_kdtree_find_nearest(tree, center, NULL, NULL);
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index c0e529f1eae..77250ec4025 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -1,4 +1,4 @@
-/**
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -25,6 +25,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/modifiers/intern/MOD_ocean.c
+ * \ingroup modifiers
+ */
+
#include "MEM_guardedalloc.h"
#include "DNA_customdata_types.h"
@@ -486,7 +490,8 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
mlcol = &mloopcols[mp->loopstart + j];
mlcol->r = mlcol->g = mlcol->b = (char)(foam * 255);
- /* mc->a = 255; */ /* no need to set */
+ /* This needs to be set (render engine uses) */
+ mlcol->a = 255;
} while (j--);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index 2654aa94be0..3722ad179d0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -54,7 +54,7 @@ void register_node_type_cmp_alphaover(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out);
- node_type_size(&ntype, 80, 40, 120);
+ node_type_size(&ntype, 80, 40, 160);
node_type_init(&ntype, node_alphaover_init);
node_type_storage(&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c
index ca12b500e5b..6cff4039767 100644
--- a/source/blender/nodes/composite/nodes/node_composite_composite.c
+++ b/source/blender/nodes/composite/nodes/node_composite_composite.c
@@ -43,7 +43,7 @@ void register_node_type_cmp_composite(bNodeTreeType *ttype)
{
static bNodeType ntype;
- node_type_base(ttype, &ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW);
+ node_type_base(ttype, &ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_OPTIONS | NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_composite_in, NULL);
node_type_size(&ntype, 80, 60, 200);
diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c
index 24affc8f374..233a0627a7a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c
@@ -56,7 +56,7 @@ void register_node_type_cmp_viewer(bNodeTreeType *ttype)
{
static bNodeType ntype;
- node_type_base(ttype, &ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW);
+ node_type_base(ttype, &ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_OPTIONS | NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_viewer_in, NULL);
node_type_size(&ntype, 80, 60, 200);
node_type_init(&ntype, node_composit_init_viewer);
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 3eb2cdc8ab7..1123a0dc44a 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -46,7 +46,7 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
if (ns->sockettype==SOCK_FLOAT)
*in= *from;
else
- *in= 0.333333f*(from[0]+from[1]+from[2]);
+ *in= (from[0]+from[1]+from[2]) / 3.0f;
}
else if (type_in==SOCK_VECTOR) {
if (ns->sockettype==SOCK_FLOAT) {
diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.c b/source/blender/nodes/shader/nodes/node_shader_brightness.c
index 9c23a29cae9..fa77fce4c88 100644
--- a/source/blender/nodes/shader/nodes/node_shader_brightness.c
+++ b/source/blender/nodes/shader/nodes/node_shader_brightness.c
@@ -43,6 +43,11 @@ static bNodeSocketTemplate sh_node_brightcontrast_out[] = {
{ -1, 0, "" }
};
+static int gpu_shader_brightcontrast(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
+{
+ return GPU_stack_link(mat, "brightness_contrast", in, out);
+}
+
void register_node_type_sh_brightcontrast(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -54,7 +59,7 @@ void register_node_type_sh_brightcontrast(bNodeTreeType *ttype)
node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, NULL);
- node_type_gpu(&ntype, NULL);
+ node_type_gpu(&ntype, gpu_shader_brightcontrast);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c
index 25da4f19e52..43a8ba1babf 100644
--- a/source/blender/nodes/texture/nodes/node_texture_compose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_compose.c
@@ -61,7 +61,7 @@ void register_node_type_tex_compose(bNodeTreeType *ttype)
{
static bNodeType ntype;
- node_type_base(ttype, &ntype, TEX_NODE_COMPOSE, "Compose RGBA", NODE_CLASS_OP_COLOR, 0);
+ node_type_base(ttype, &ntype, TEX_NODE_COMPOSE, "Combine RGBA", NODE_CLASS_OP_COLOR, 0);
node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c
index a2875c31d9e..0866428ca6c 100644
--- a/source/blender/nodes/texture/nodes/node_texture_decompose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c
@@ -82,7 +82,7 @@ void register_node_type_tex_decompose(bNodeTreeType *ttype)
{
static bNodeType ntype;
- node_type_base(ttype, &ntype, TEX_NODE_DECOMPOSE, "Decompose RGBA", NODE_CLASS_OP_COLOR, 0);
+ node_type_base(ttype, &ntype, TEX_NODE_DECOMPOSE, "Separate RGBA", NODE_CLASS_OP_COLOR, 0);
node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
node_type_exec(&ntype, exec);
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
index d4c8033589a..fad3e4a35cd 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -48,11 +48,13 @@
static int bpy_bm_op_as_py_error(BMesh *bm)
{
if (BMO_error_occurred(bm)) {
+ /* note: we could have multiple errors */
const char *errmsg;
if (BMO_error_get(bm, &errmsg, NULL)) {
PyErr_Format(PyExc_RuntimeError,
"bmesh operator: %.200s",
errmsg);
+ BMO_error_clear(bm);
return -1;
}
}
@@ -692,6 +694,9 @@ PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
{
BPY_BM_CHECK_OBJ(py_bm);
bm = py_bm->bm;
+
+ /* could complain about entering with exceptions... */
+ BMO_error_clear(bm);
}
else {
PyErr_SetString(PyExc_TypeError,
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 0abff03da46..b95db945eb1 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -50,6 +50,8 @@
#include "bmesh_py_types_customdata.h"
#include "bmesh_py_types_meshdata.h"
+static void bm_dealloc_editmode_warn(BPy_BMesh *self);
+
/* Common Flags
* ************ */
@@ -847,6 +849,8 @@ static PyObject *bpy_bmesh_free(BPy_BMesh *self)
if (self->bm) {
BMesh *bm = self->bm;
+ bm_dealloc_editmode_warn(self);
+
if ((self->flag & BPY_BMFLAG_IS_WRAPPED) == 0) {
BM_mesh_free(bm);
}
@@ -2828,6 +2832,8 @@ static void bpy_bmesh_dealloc(BPy_BMesh *self)
/* have have been freed by bmesh */
if (bm) {
+ bm_dealloc_editmode_warn(self);
+
BM_data_layer_free(bm, &bm->vdata, CD_BM_ELEM_PYPTR);
BM_data_layer_free(bm, &bm->edata, CD_BM_ELEM_PYPTR);
BM_data_layer_free(bm, &bm->pdata, CD_BM_ELEM_PYPTR);
@@ -3638,3 +3644,51 @@ char *BPy_BMElem_StringFromHType(const char htype)
static char ret[32];
return BPy_BMElem_StringFromHType_ex(htype, ret);
}
+
+
+/* -------------------------------------------------------------------- */
+/* keep at bottom */
+/* BAD INCLUDES */
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_tessmesh.h"
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
+#include "MEM_guardedalloc.h"
+
+/* there are cases where this warning isnt needed, otherwise it could be made into an error */
+static void bm_dealloc_warn(const char *mesh_name)
+{
+ PySys_WriteStdout("Modified BMesh '%.200s' from a wrapped editmesh is freed without a call "
+ "to bmesh.update_edit_mesh(mesh, destructive=True), this is will likely cause a crash\n",
+ mesh_name);
+}
+
+/* this function is called on free, it should stay quite fast */
+static void bm_dealloc_editmode_warn(BPy_BMesh *self)
+{
+ if (self->flag & BPY_BMFLAG_IS_WRAPPED) {
+ /* likely editmesh */
+ BMesh *bm = self->bm;
+ Scene *scene;
+ for (scene = G.main->scene.first; scene; scene = scene->id.next) {
+ Base *base = scene->basact;
+ if (base && base->object->type == OB_MESH) {
+ Mesh *me = base->object->data;
+ BMEditMesh *em = me->edit_btmesh;
+ if (em && em->bm == bm) {
+ /* not foolproof, scripter may have added/removed verts */
+ if (((em->vert_index && (MEM_allocN_len(em->vert_index) / sizeof(*em->vert_index)) != bm->totvert)) ||
+ ((em->edge_index && (MEM_allocN_len(em->edge_index) / sizeof(*em->edge_index)) != bm->totedge)) ||
+ ((em->face_index && (MEM_allocN_len(em->face_index) / sizeof(*em->face_index)) != bm->totface)))
+ {
+ bm_dealloc_warn(me->id.name + 2);
+ break;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
index b6d2f624229..7c89972b486 100644
--- a/source/blender/python/intern/bpy_app_translations.c
+++ b/source/blender/python/intern/bpy_app_translations.c
@@ -74,7 +74,7 @@ typedef struct GHashKey {
static GHashKey *_ghashutil_keyalloc(const void *msgctxt, const void *msgid)
{
GHashKey *key = MEM_mallocN(sizeof(GHashKey), "Py i18n GHashKey");
- key->msgctxt = BLI_strdup(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT_BPY_INTERN);
+ key->msgctxt = BLI_strdup(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT_BPY);
key->msgid = BLI_strdup(msgid);
return key;
}
@@ -195,7 +195,7 @@ static void _build_translations_cache(PyObject *py_messages, const char *locale)
else {
PyObject *tmp = PyTuple_GET_ITEM(pykey, 0);
if (tmp == Py_None) {
- msgctxt = BLF_I18NCONTEXT_DEFAULT;
+ msgctxt = BLF_I18NCONTEXT_DEFAULT_BPY;
}
else if (PyUnicode_Check(tmp)) {
msgctxt = _PyUnicode_AsString(tmp);
@@ -288,9 +288,7 @@ const char *BPY_app_translations_py_pgettext(const char *msgctxt, const char *ms
_ghashutil_keyfree((void *)key);
- if (tmp)
- return tmp;
- return msgid;
+ return tmp ? tmp : msgid;
#undef STATIC_LOCALE_SIZE
}
@@ -435,8 +433,8 @@ static PyObject *app_translations_contexts_make(void)
PyDoc_STRVAR(app_translations_contexts_doc,
"A named tuple containing all pre-defined translation contexts.\n"
- "WARNING: do not use the \"" BLF_I18NCONTEXT_DEFAULT_BPY_INTERN "\" context, it is internally assimilated as the "
- "default one!\n"
+ "WARNING: Never use a (new) context starting with \"" BLF_I18NCONTEXT_DEFAULT_BPY "\", it would be internally "
+ "assimilated as the default one!\n"
);
PyDoc_STRVAR(app_translations_contexts_C_to_py_doc,
@@ -495,6 +493,39 @@ PyGetSetDef app_translations_getseters[] = {
{NULL}
};
+/* pgettext helper. */
+static PyObject *_py_pgettext(PyObject *args, PyObject *kw, const char *(*_pgettext)(const char *, const char *))
+{
+ static const char *kwlist[] = {"msgid", "msgctxt", NULL};
+
+#ifdef WITH_INTERNATIONAL
+ char *msgid, *msgctxt = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kw,
+ "s|z:bpy.app.translations.pgettext",
+ (char **)kwlist, &msgid, &msgctxt))
+ {
+ return NULL;
+ }
+
+ return PyUnicode_FromString((*_pgettext)(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT, msgid));
+#else
+ PyObject *msgid, *msgctxt;
+ (void)_pgettext;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kw,
+ "O|O:bpy.app.translations.pgettext",
+ (char **)kwlist, &msgid, &msgctxt))
+ {
+ return NULL;
+ }
+
+ Py_INCREF(msgid);
+
+ return msgid;
+#endif
+}
+
PyDoc_STRVAR(app_translations_pgettext_doc,
".. method:: pgettext(msgid, msgctxt)\n"
"\n"
@@ -502,7 +533,8 @@ PyDoc_STRVAR(app_translations_pgettext_doc,
" NOTE: The (msgid, msgctxt) parameter orders has been switched compared to gettext function, to allow\n"
" single-parameter calls (context then defaults to BLF_I18NCONTEXT_DEFAULT).\n"
" NOTE: You should really rarely need to use this function in regular addon code, as all translation should be\n"
-" handled by Blender internal code.\n"
+" handled by Blender internal code. The only exception are string containing formatting (like \"File: %r\"),\n"
+" but you should rather use pgettext_iface/_tip in those cases!\n"
" Note: Does nothing when Blender is built without internationalization support (hence always returns msgid).\n"
"\n"
" :arg msgid: The string to translate.\n"
@@ -515,26 +547,45 @@ PyDoc_STRVAR(app_translations_pgettext_doc,
);
static PyObject *app_translations_pgettext(BlenderAppTranslations *UNUSED(self), PyObject *args, PyObject *kw)
{
- /* Note we could optimize this a bit when WITH_INTERNATIONAL is not defined, but don't think "code complexity" would
- * be worth it, as this func should not often be used!
- */
- /* XXX This code fails with scons when WITH_INTERNATIONAL is not defined, at link time, stating that BLF_pgettext
- * is undefined... So using #ifdef after all, rather than removing scons from blender trunk!
- */
- static const char *kwlist[] = {"msgid", "msgctxt", NULL};
- char *msgid, *msgctxt = NULL;
+ return _py_pgettext(args, kw, BLF_pgettext);
+}
- if (!PyArg_ParseTupleAndKeywords(args, kw, "s|z:bpy.app.translations.pgettext", (char **)kwlist,
- &msgid, &msgctxt))
- {
- return NULL;
- }
+PyDoc_STRVAR(app_translations_pgettext_iface_doc,
+".. method:: pgettext_iface(msgid, msgctxt)\n"
+"\n"
+" Try to translate the given msgid (with optional msgctxt), if labels' translation is enabled.\n"
+" NOTE: See pgettext notes.\n"
+"\n"
+" :arg msgid: The string to translate.\n"
+" :type msgid: string\n"
+" :arg msgctxt: The translation context.\n"
+" :type msgctxt: string or None\n"
+" :default msgctxt: BLF_I18NCONTEXT_DEFAULT value.\n"
+" :return: The translated string (or msgid if no translation was found).\n"
+"\n"
+);
+static PyObject *app_translations_pgettext_iface(BlenderAppTranslations *UNUSED(self), PyObject *args, PyObject *kw)
+{
+ return _py_pgettext(args, kw, BLF_translate_do_iface);
+}
-#ifdef WITH_INTERNATIONAL
- return PyUnicode_FromString(BLF_pgettext(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT, msgid));
-#else
- return PyUnicode_FromString(msgid);
-#endif
+PyDoc_STRVAR(app_translations_pgettext_tip_doc,
+".. method:: pgettext(msgid, msgctxt)\n"
+"\n"
+" Try to translate the given msgid (with optional msgctxt), if tooltips' translation is enabled.\n"
+" NOTE: See pgettext notes.\n"
+"\n"
+" :arg msgid: The string to translate.\n"
+" :type msgid: string\n"
+" :arg msgctxt: The translation context.\n"
+" :type msgctxt: string or None\n"
+" :default msgctxt: BLF_I18NCONTEXT_DEFAULT value.\n"
+" :return: The translated string (or msgid if no translation was found).\n"
+"\n"
+);
+static PyObject *app_translations_pgettext_tip(BlenderAppTranslations *UNUSED(self), PyObject *args, PyObject *kw)
+{
+ return _py_pgettext(args, kw, BLF_translate_do_tooltip);
}
PyDoc_STRVAR(app_translations_locale_explode_doc,
@@ -575,6 +626,10 @@ PyMethodDef app_translations_methods[] = {
app_translations_py_messages_unregister_doc},
{(char *)"pgettext", (PyCFunction)app_translations_pgettext, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_pgettext_doc},
+ {(char *)"pgettext_iface", (PyCFunction)app_translations_pgettext_iface, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_iface_doc},
+ {(char *)"pgettext_tip", (PyCFunction)app_translations_pgettext_tip, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_tip_doc},
{(char *)"locale_explode", (PyCFunction)app_translations_locale_explode, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_locale_explode_doc},
{NULL}
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 55dadc14989..12286fc9999 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -1042,6 +1042,10 @@ static void image_mipmap_test(Tex *tex, ImBuf *ibuf)
IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP);
BLI_unlock_thread(LOCK_IMAGE);
}
+ /* if no mipmap could be made, fall back on non-mipmap render */
+ if (ibuf->mipmap[0] == NULL) {
+ tex->imaflag &= ~TEX_MIPMAP;
+ }
}
}
diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c
index 89f67335c39..ea42049989b 100644
--- a/source/blender/render/intern/source/multires_bake.c
+++ b/source/blender/render/intern/source/multires_bake.c
@@ -938,17 +938,18 @@ static void build_permutation_table(unsigned short permutation[], unsigned short
permutation[i] = temp_permutation[entry];
/* delete entry */
- for(k = entry; k < nr_entries_left - 1; k++)
+ for (k = entry; k < nr_entries_left - 1; k++) {
temp_permutation[k] = temp_permutation[k + 1];
+ }
}
/* verify permutation table
* every entry must appear exactly once
*/
#if 0
- for(i = 0; i < number_of_rays; i++) temp_permutation[i] = 0;
- for(i = 0; i < number_of_rays; i++) ++temp_permutation[permutation[i]];
- for(i = 0; i < number_of_rays; i++) BLI_assert(temp_permutation[i] == 1);
+ for (i = 0; i < number_of_rays; i++) temp_permutation[i] = 0;
+ for (i = 0; i < number_of_rays; i++) ++temp_permutation[permutation[i]];
+ for (i = 0; i < number_of_rays; i++) BLI_assert(temp_permutation[i] == 1);
#endif
}
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 73c3b1c9366..05601a6b5e6 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1338,6 +1338,7 @@ static void render_scene(Render *re, Scene *sce, int cfra)
resc->main = re->main;
resc->scene = sce;
resc->lay = sce->lay;
+ resc->scene_color_manage = BKE_scene_check_color_management_enabled(sce);
/* ensure scene has depsgraph, base flags etc OK */
BKE_scene_set_background(re->main, sce);
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index 11c6356f9c5..be1a3806e43 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -1101,6 +1101,10 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd)
if (BKE_imtype_valid_depths(rd->im_format.imtype) & (R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_24 | R_IMF_CHAN_DEPTH_32)) {
IMB_float_from_rect(ibuf);
}
+ else {
+ /* ensure no float buffer remained from previous frame */
+ ibuf->rect_float = NULL;
+ }
}
/* color -> grayscale */
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 3ea94981cac..15ca865643b 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -171,9 +171,9 @@ static void tex_normal_derivate(Tex *tex, TexResult *texres)
do_colorband(tex->coba, texres->nor[2], col);
fac3= (col[0]+col[1]+col[2]);
- texres->nor[0]= 0.3333f*(fac0 - fac1);
- texres->nor[1]= 0.3333f*(fac0 - fac2);
- texres->nor[2]= 0.3333f*(fac0 - fac3);
+ texres->nor[0]= (fac0 - fac1) / 3.0f;
+ texres->nor[1]= (fac0 - fac2) / 3.0f;
+ texres->nor[2]= (fac0 - fac3) / 3.0f;
return;
}
@@ -1754,7 +1754,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
/* center, main return value */
texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres, pool);
- cd = fromrgb ? (texres->tr + texres->tg + texres->tb)*0.33333333f : texres->tin;
+ cd = fromrgb ? (texres->tr + texres->tg + texres->tb) / 3.0f : texres->tin;
if (mtex->texco == TEXCO_UV) {
/* for the uv case, use the same value for both du/dv,
@@ -1768,7 +1768,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
tco[2] = 0.f;
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
- ud = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb)*0.33333333f : ttexr.tin));
+ ud = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
/* +v val */
tco[0] = co[0] + compat_bump->dudnv*du;
@@ -1776,7 +1776,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
tco[2] = 0.f;
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
- vd = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb)*0.33333333f : ttexr.tin));
+ vd = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
}
else {
float tu[3], tv[3];
@@ -1810,7 +1810,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
tco[2] = co[2] + tu[2]*du;
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
- ud = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb)*0.33333333f : ttexr.tin));
+ ud = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
/* +v val */
tco[0] = co[0] + tv[0]*dv;
@@ -1818,7 +1818,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
tco[2] = co[2] + tv[2]*dv;
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
- vd = idv*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb)*0.33333333f : ttexr.tin));
+ vd = idv*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
}
/* bumped normal */
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 77d6644479a..92099060bf5 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -185,7 +185,7 @@ static void load_frame_image_sequence(VoxelData *vd, Tex *tex)
for (y = 0; y < ibuf->y; y++) {
for (x = 0; x < ibuf->x; x++) {
/* currently averaged to monchrome */
- vd->dataset[BLI_VOXEL_INDEX(x, y, z, vd->resol)] = (rf[0] + rf[1] + rf[2]) * 0.333f;
+ vd->dataset[BLI_VOXEL_INDEX(x, y, z, vd->resol)] = (rf[0] + rf[1] + rf[2]) / 3.0f;
rf += 4;
}
}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index e91d4f388af..a1437b70090 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -171,7 +171,7 @@ int WM_modal_tweak_exit(struct wmEvent *evt, int tweak_event);
void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *reference);
void WM_main_add_notifier(unsigned int type, void *reference);
-void wm_event_add (struct wmWindow *win, struct wmEvent *event_to_add); /* XXX only for warning */
+void wm_event_add(struct wmWindow *win, const struct wmEvent *event_to_add);
/* at maximum, every timestep seconds it triggers event_type events */
struct wmTimer *WM_event_add_timer(struct wmWindowManager *wm, struct wmWindow *win, int event_type, double timestep);
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index 43369154dbb..49ee759bbf2 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -64,7 +64,7 @@ wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, const char *idname, in
int val, int modifier, int keymodifier);
int WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
-char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len);
+int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, const int len);
wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid);
wmKeyMap *WM_keymap_find(struct wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid);
@@ -81,6 +81,7 @@ wmKeyMap *WM_modalkeymap_add(struct wmKeyConfig *keyconf, const char *idname, st
wmKeyMap *WM_modalkeymap_get(struct wmKeyConfig *keyconf, const char *idname);
wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value);
wmKeyMapItem *WM_modalkeymap_add_item_str(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value);
+wmKeyMapItem *WM_modalkeymap_find_propvalue(wmKeyMap *km, const int propvalue);
void WM_modalkeymap_assign(struct wmKeyMap *km, const char *opname);
/* Keymap Editor */
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 91be03986c1..6044e3fb771 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -800,7 +800,7 @@ void wm_draw_update(bContext *C)
if (state == GHOST_kWindowStateMinimized) {
/* do not update minimized windows, it gives issues on intel drivers (see [#33223])
- * anyway, it seems logical to skip update for invisile windows
+ * anyway, it seems logical to skip update for invisible windows
*/
continue;
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 9e3722777ba..206297d2c95 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -91,9 +91,9 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
/* ************ event management ************** */
-void wm_event_add(wmWindow *win, wmEvent *event_to_add)
+void wm_event_add(wmWindow *win, const wmEvent *event_to_add)
{
- wmEvent *event = MEM_callocN(sizeof(wmEvent), "wmEvent");
+ wmEvent *event = MEM_mallocN(sizeof(wmEvent), "wmEvent");
*event = *event_to_add;
@@ -590,6 +590,9 @@ static void wm_operator_finished(bContext *C, wmOperator *op, int repeat)
}
if (wm_operator_register_check(wm, op->type)) {
+ /* take ownership of reports (in case python provided own) */
+ op->reports->flag |= RPT_FREE;
+
wm_operator_register(C, op);
WM_operator_region_active_win_set(C);
}
@@ -935,6 +938,9 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event,
wm_operator_finished(C, op, 0);
}
else if (retval & OPERATOR_RUNNING_MODAL) {
+ /* take ownership of reports (in case python provided own) */
+ op->reports->flag |= RPT_FREE;
+
/* grab cursor during blocking modal ops (X11)
* Also check for macro
*/
@@ -1170,13 +1176,6 @@ int WM_operator_call_py(bContext *C, wmOperatorType *ot, short context,
if (!is_undo && wm && (wm == CTX_wm_manager(C))) wm->op_undo_depth--;
- /* keep the reports around if needed later */
- if ((retval & OPERATOR_RUNNING_MODAL) ||
- ((retval & OPERATOR_FINISHED) && wm_operator_register_check(CTX_wm_manager(C), ot)))
- {
- reports->flag |= RPT_FREE; /* let blender manage freeing */
- }
-
return retval;
}
@@ -1766,6 +1765,10 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
break;
}
else {
+ if (action & WM_HANDLER_HANDLED)
+ if (G.debug & (G_DEBUG_EVENTS | G_DEBUG_HANDLERS))
+ printf("%s: handled - and pass on! '%s'\n", __func__, kmi->idname);
+
#ifndef NDEBUG
if (do_debug_handler) {
printf("%s: un-handled '%s'...", __func__, kmi->idname);
@@ -3042,7 +3045,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event.keymodifier = 0;
/* this case happened with an external numpad, it's not really clear
- * why, but it's also impossible to map a key modifier to an unknwon
+ * why, but it's also impossible to map a key modifier to an unknown
* key, so it shouldn't harm */
if (event.keymodifier == UNKNOWNKEY)
event.keymodifier = 0;
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 168c2312d9f..302bf61756a 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -309,17 +309,19 @@ static void wm_gesture_draw_lasso(wmGesture *gt)
static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
{
rcti *rect = (rcti *)gt->customdata;
-
+ int winsizex = WM_window_pixels_x(win);
+ int winsizey = WM_window_pixels_y(win);
+
glEnable(GL_LINE_STIPPLE);
glColor3ub(96, 96, 96);
glLineStipple(1, 0xCCCC);
- sdrawline(rect->xmin - win->sizex, rect->ymin, rect->xmin + win->sizex, rect->ymin);
- sdrawline(rect->xmin, rect->ymin - win->sizey, rect->xmin, rect->ymin + win->sizey);
+ sdrawline(rect->xmin - winsizex, rect->ymin, rect->xmin + winsizex, rect->ymin);
+ sdrawline(rect->xmin, rect->ymin - winsizey, rect->xmin, rect->ymin + winsizey);
glColor3ub(255, 255, 255);
glLineStipple(1, 0x3333);
- sdrawline(rect->xmin - win->sizex, rect->ymin, rect->xmin + win->sizex, rect->ymin);
- sdrawline(rect->xmin, rect->ymin - win->sizey, rect->xmin, rect->ymin + win->sizey);
+ sdrawline(rect->xmin - winsizex, rect->ymin, rect->xmin + winsizex, rect->ymin);
+ sdrawline(rect->xmin, rect->ymin - winsizey, rect->xmin, rect->ymin + winsizey);
glDisable(GL_LINE_STIPPLE);
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 3739462ac2c..92a310ac34e 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -126,10 +126,13 @@ static int wm_keymap_item_equals(wmKeyMapItem *a, wmKeyMapItem *b)
/* properties can be NULL, otherwise the arg passed is used and ownership is given to the kmi */
void WM_keymap_properties_reset(wmKeyMapItem *kmi, struct IDProperty *properties)
{
- WM_operator_properties_free(kmi->ptr);
- MEM_freeN(kmi->ptr);
+ if (LIKELY(kmi->ptr)) {
+ WM_operator_properties_free(kmi->ptr);
+ MEM_freeN(kmi->ptr);
+
+ kmi->ptr = NULL;
+ }
- kmi->ptr = NULL;
kmi->properties = properties;
wm_keymap_item_properties_set(kmi);
@@ -734,6 +737,24 @@ wmKeyMapItem *WM_modalkeymap_add_item_str(wmKeyMap *km, int type, int val, int m
return kmi;
}
+wmKeyMapItem *WM_modalkeymap_find_propvalue(wmKeyMap *km, const int propvalue)
+{
+
+ if (km->flag & KEYMAP_MODAL) {
+ wmKeyMapItem *kmi;
+ for (kmi = km->items.first; kmi; kmi = kmi->next) {
+ if (kmi->propvalue == propvalue) {
+ return kmi;
+ }
+ }
+ }
+ else {
+ BLI_assert(!"called with non modal keymap");
+ }
+
+ return NULL;
+}
+
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0);
@@ -782,7 +803,7 @@ const char *WM_key_event_string(short type)
return "";
}
-char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
+int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
{
char buf[128];
@@ -815,9 +836,7 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
}
strcat(buf, WM_key_event_string(kmi->type));
- BLI_strncpy(str, buf, len);
-
- return str;
+ return BLI_snprintf(str, len, "%s", buf);
}
static wmKeyMapItem *wm_keymap_item_find_handlers(
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index e22694a6560..41dd618caa5 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1204,8 +1204,13 @@ void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, "Y Start", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, "Y End", "", INT_MIN, INT_MAX);
- if (cursor)
- RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, "Cursor", "Mouse cursor style to use during the modal operator", 0, INT_MAX);
+ if (cursor) {
+ PropertyRNA *prop;
+
+ prop = RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX,
+ "Cursor", "Mouse cursor style to use during the modal operator", 0, INT_MAX);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ }
}
@@ -1341,7 +1346,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
uiBlockClearFlag(block, UI_BLOCK_LOOP);
- /* intentionally don't use 'UI_BLOCK_MOVEMOUSE_QUIT', some dialogs have many items
+ /* intentionally don't use 'UI_BLOCK_MOVEMOUSE_QUIT', some dialogues have many items
* where quitting by accident is very annoying */
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
@@ -1998,7 +2003,7 @@ static int wm_link_append_poll(bContext *C)
if (WM_operator_winactive(C)) {
/* linking changes active object which is pretty useful in general,
* but which totally confuses edit mode (i.e. it becoming not so obvious
- * to leave from edit mode and inwalid tools in toolbar might be displayed)
+ * to leave from edit mode and invalid tools in toolbar might be displayed)
* so disable link/append when in edit mode (sergey) */
if (CTX_data_edit_object(C))
return 0;
@@ -3256,6 +3261,7 @@ static void radial_control_set_initial_mouse(RadialControl *rc, wmEvent *event)
rc->initial_mouse[1] = event->y;
switch (rc->subtype) {
+ case PROP_NONE:
case PROP_DISTANCE:
d[0] = rc->initial_value;
break;
@@ -3355,6 +3361,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
float zoom[2], col[3] = {1, 1, 1};
switch (rc->subtype) {
+ case PROP_NONE:
case PROP_DISTANCE:
r1 = rc->current_value;
r2 = rc->initial_value;
@@ -3593,8 +3600,8 @@ static int radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* get subtype of property */
rc->subtype = RNA_property_subtype(rc->prop);
- if (!ELEM3(rc->subtype, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE)) {
- BKE_report(op->reports, RPT_ERROR, "Property must be a distance, a factor, or an angle");
+ if (!ELEM4(rc->subtype, PROP_NONE, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE)) {
+ BKE_report(op->reports, RPT_ERROR, "Property must be a none, distance, a factor, or an angle");
MEM_freeN(rc);
return OPERATOR_CANCELLED;
}
@@ -3678,6 +3685,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
/* calculate new value and apply snapping */
switch (rc->subtype) {
+ case PROP_NONE:
case PROP_DISTANCE:
new_value = dist;
if (snap) new_value = ((int)new_value + 5) / 10 * 10;
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index d8b987a196c..a1ab0de49cf 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -763,6 +763,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
// window_handle(win, INPUTCHANGE, win->active);
/* bad ghost support for modifier keys... so on activate we set the modifiers again */
+
+ /* TODO: This is not correct since a modifier may be held when a window is activated...
+ * better solve this at ghost level. attempted fix r54450 but it caused bug [#34255] */
kdata.ascii = '\0';
kdata.utf8_buf[0] = '\0';
if (win->eventstate->shift && !query_qual(SHIFT)) {
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index deb7cae9f77..21443fba8b7 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -380,6 +380,8 @@ int ED_space_image_check_show_maskedit(struct Scene *scene, struct SpaceImage *s
void ED_nurb_set_spline_type(struct Nurb *nu, int type) {}
+void ED_mball_transform(struct MetaBall *mb, float *mat) {}
+
void make_editLatt(struct Object *obedit) {}
void load_editLatt(struct Object *obedit) {}
diff --git a/source/creator/creator.c b/source/creator/creator.c
index c664ae4540a..5d5d5d470b7 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -88,6 +88,7 @@
#include "BKE_depsgraph.h" /* for DAG_on_visible_update */
#include "BKE_font.h"
#include "BKE_global.h"
+#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_packedFile.h"
@@ -306,6 +307,7 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
printf("\n");
BLI_argsPrintArgDoc(ba, "--python");
+ BLI_argsPrintArgDoc(ba, "--python-text");
BLI_argsPrintArgDoc(ba, "--python-console");
BLI_argsPrintArgDoc(ba, "--addons");
@@ -503,8 +505,7 @@ static void blender_crash_handler_backtrace(FILE *fp)
symbolinfo->MaxNameLen = MAXSYMBOL - 1;
symbolinfo->SizeOfStruct = sizeof(SYMBOL_INFO);
- for( i = 0; i < nframes; i++ )
- {
+ for (i = 0; i < nframes; i++) {
SymFromAddr(process, ( DWORD64 )( stack[ i ] ), 0, symbolinfo);
fprintf(fp, "%u: %s - 0x%0X\n", nframes - i - 1, symbolinfo->Name, symbolinfo->Address);
@@ -1094,11 +1095,11 @@ static int set_skip_frame(int argc, const char **argv, void *data)
_cmd; \
} \
CTX_data_scene_set(C, prevscene); \
- } \
+ } (void)0 \
#endif /* WITH_PYTHON */
-static int run_python(int argc, const char **argv, void *data)
+static int run_python_file(int argc, const char **argv, void *data)
{
#ifdef WITH_PYTHON
bContext *C = data;
@@ -1110,12 +1111,42 @@ static int run_python(int argc, const char **argv, void *data)
BLI_strncpy(filename, argv[1], sizeof(filename));
BLI_path_cwd(filename);
- BPY_CTX_SETUP(BPY_filepath_exec(C, filename, NULL))
+ BPY_CTX_SETUP(BPY_filepath_exec(C, filename, NULL));
return 1;
}
else {
- printf("\nError: you must specify a Python script after '-P / --python'.\n");
+ printf("\nError: you must specify a filepath after '%s'.\n", argv[0]);
+ return 0;
+ }
+#else
+ (void)argc; (void)argv; (void)data; /* unused */
+ printf("This blender was built without python support\n");
+ return 0;
+#endif /* WITH_PYTHON */
+}
+
+static int run_python_text(int argc, const char **argv, void *data)
+{
+#ifdef WITH_PYTHON
+ bContext *C = data;
+
+ /* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */
+ if (argc > 1) {
+ /* Make the path absolute because its needed for relative linked blends to be found */
+ struct Text *text = (struct Text *)BKE_libblock_find_name(ID_TXT, argv[1]);
+
+ if (text) {
+ BPY_CTX_SETUP(BPY_text_exec(C, text, NULL, false));
+ return 1;
+ }
+ else {
+ printf("\nError: text block not found %s.\n", argv[1]);
+ return 1;
+ }
+ }
+ else {
+ printf("\nError: you must specify a text block after '%s'.\n", argv[0]);
return 0;
}
#else
@@ -1130,7 +1161,7 @@ static int run_python_console(int UNUSED(argc), const char **argv, void *data)
#ifdef WITH_PYTHON
bContext *C = data;
- BPY_CTX_SETUP(BPY_string_exec(C, "__import__('code').interact()"))
+ BPY_CTX_SETUP(BPY_string_exec(C, "__import__('code').interact()"));
return 0;
#else
@@ -1344,7 +1375,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
BLI_argsAdd(ba, 2, "-p", "--window-geometry", "<sx> <sy> <w> <h>\n\tOpen with lower left corner at <sx>, <sy> and width and height as <w>, <h>", prefsize, NULL);
BLI_argsAdd(ba, 2, "-w", "--window-border", "\n\tForce opening with borders (default)", with_borders, NULL);
BLI_argsAdd(ba, 2, "-W", "--window-borderless", "\n\tForce opening without borders", without_borders, NULL);
- BLI_argsAdd(ba, 2, "-con", "--start-console", "\n\tStart with the console window open (ignored if -b is set)", start_with_console, NULL);
+ BLI_argsAdd(ba, 2, "-con", "--start-console", "\n\tStart with the console window open (ignored if -b is set), (Windows only)", start_with_console, NULL);
BLI_argsAdd(ba, 2, "-R", NULL, "\n\tRegister .blend extension, then exit (Windows only)", register_extension, NULL);
BLI_argsAdd(ba, 2, "-r", NULL, "\n\tSilently register .blend extension, then exit (Windows only)", register_extension, ba);
BLI_argsAdd(ba, 2, NULL, "--no-native-pixels", "\n\tDo not use native pixel size, for high resolution displays (MacBook 'Retina')", native_pixels, ba);
@@ -1363,7 +1394,8 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
BLI_argsAdd(ba, 4, "-s", "--frame-start", "<frame>\n\tSet start to frame <frame> (use before the -a argument)", set_start_frame, C);
BLI_argsAdd(ba, 4, "-e", "--frame-end", "<frame>\n\tSet end to frame <frame> (use before the -a argument)", set_end_frame, C);
BLI_argsAdd(ba, 4, "-j", "--frame-jump", "<frames>\n\tSet number of frames to step forward after each rendered frame", set_skip_frame, C);
- BLI_argsAdd(ba, 4, "-P", "--python", "<filename>\n\tRun the given Python script (filename or Blender Text)", run_python, C);
+ BLI_argsAdd(ba, 4, "-P", "--python", "<filename>\n\tRun the given Python script file", run_python_file, C);
+ BLI_argsAdd(ba, 4, NULL, "--python-text", "<name>\n\tRun the given Python script text block", run_python_text, C);
BLI_argsAdd(ba, 4, NULL, "--python-console", "\n\tRun blender with an interactive console", run_python_console, C);
BLI_argsAdd(ba, 4, NULL, "--addons", "\n\tComma separated list of addons (no spaces)", set_addons, C);
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index e5503dfd0a7..f7726ebaf78 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -921,9 +921,6 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
/* do Texture Face materials */
Image* bima = (tface)? (Image*)tface->tpage: NULL;
STR_String imastr = (tface)? (bima? (bima)->id.name : "" ) : "";
-
- if (!converter->GetCacheMaterials())
- polymat = NULL;
char alpha_blend=0;
short tile=0;
@@ -1045,9 +1042,8 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace
polymat->m_specular.setValue(0.0f,0.0f,0.0f);
polymat->m_shininess = 35.0;
}
-
- if (converter->GetCacheMaterials())
- converter->CachePolyMaterial(ma, polymat);
+
+ converter->CachePolyMaterial(ma, polymat);
}
}
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 376f75959ed..cd5dec4669d 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -601,22 +601,24 @@ void KX_BlenderSceneConverter::RegisterPolyMaterial(RAS_IPolyMaterial *polymat)
void KX_BlenderSceneConverter::CachePolyMaterial(struct Material *mat, RAS_IPolyMaterial *polymat)
{
- m_polymat_cache[mat] = polymat;
+ if (m_use_mat_cache)
+ m_polymat_cache[mat] = polymat;
}
RAS_IPolyMaterial *KX_BlenderSceneConverter::FindCachedPolyMaterial(struct Material *mat)
{
- return m_polymat_cache[mat];
+ return (m_use_mat_cache) ? m_polymat_cache[mat] : NULL;
}
void KX_BlenderSceneConverter::CacheBlenderMaterial(struct Material *mat, BL_Material *blmat)
{
- m_mat_cache[mat] = blmat;
+ if (m_use_mat_cache)
+ m_mat_cache[mat] = blmat;
}
BL_Material *KX_BlenderSceneConverter::FindCachedBlenderMaterial(struct Material *mat)
{
- return m_mat_cache[mat];
+ return (m_use_mat_cache) ? m_mat_cache[mat] : NULL;
}
void KX_BlenderSceneConverter::RegisterInterpolatorList(
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 63854c6aebd..3a60ccc85e9 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1400,6 +1400,14 @@ CListValue* KX_GameObject::GetChildrenRecursive()
return list;
}
+KX_Scene* KX_GameObject::GetScene()
+{
+ SG_Node* node = this->GetSGNode();
+ KX_Scene* scene = static_cast<KX_Scene*>(node->GetSGClientInfo());
+
+ return scene;
+}
+
/* ---------------------------------------------------------------------
* Some stuff taken from the header
* --------------------------------------------------------------------- */
@@ -1754,8 +1762,7 @@ PyObject *KX_GameObject::PyReplaceMesh(PyObject *args)
PyObject *KX_GameObject::PyEndObject()
{
- SG_Node* node = this->GetSGNode();
- KX_Scene* scene = static_cast<KX_Scene*>(node->GetSGClientInfo());
+ KX_Scene* scene = GetScene();
scene->DelayedRemoveObject(this);
@@ -2003,8 +2010,7 @@ PyObject *KX_GameObject::pyattr_get_group_members(void *self_v, const KX_PYATTRI
PyObject* KX_GameObject::pyattr_get_scene(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_GameObject *self = static_cast<KX_GameObject*>(self_v);
- SG_Node *node = self->GetSGNode();
- KX_Scene *scene = static_cast<KX_Scene *>(node->GetSGClientInfo());
+ KX_Scene *scene = self->GetScene();
if (scene) {
return scene->GetProxy();
}
@@ -3056,7 +3062,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
if (dist != 0.0f)
toPoint = fromPoint + dist * (toPoint-fromPoint).safe_normalized();
- PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
+ PHY_IPhysicsEnvironment* pe = GetScene()->GetPhysicsEnvironment();
KX_IPhysicsController *spc = GetPhysicsController();
KX_GameObject *parent = GetParent();
if (!spc && parent)
@@ -3202,7 +3208,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
return none_tuple_3();
}
- PHY_IPhysicsEnvironment* pe = KX_GetActiveScene()->GetPhysicsEnvironment();
+ PHY_IPhysicsEnvironment* pe = GetScene()->GetPhysicsEnvironment();
KX_IPhysicsController *spc = GetPhysicsController();
KX_GameObject *parent = GetParent();
if (!spc && parent)
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 253b5e26ebe..86c712ea017 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -923,6 +923,8 @@ public:
CListValue* GetChildren();
CListValue* GetChildrenRecursive();
+ KX_Scene* GetScene();
+
#ifdef WITH_PYTHON
/**
* \section Python interface functions.
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
index df72056565b..b2b766b65e8 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
@@ -148,7 +148,8 @@ void RAS_BucketManager::RenderAlphaBuckets(
// Having depth masks disabled/enabled gives different artifacts in
// case no sorting is done or is done inexact. For compatibility, we
// disable it.
- rasty->SetDepthMask(RAS_IRasterizer::KX_DEPTHMASK_DISABLED);
+ if (rasty->GetDrawingMode() != RAS_IRasterizer::KX_SHADOW)
+ rasty->SetDepthMask(RAS_IRasterizer::KX_DEPTHMASK_DISABLED);
OrderBuckets(cameratrans, m_AlphaBuckets, slots, true);
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
index 490c26a5c3b..7bcc8dc9034 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
@@ -74,7 +74,7 @@ void RAS_StorageIM::TexCoord(const RAS_TexVert &tv)
if (GLEW_ARB_multitexture) {
for (unit = 0; unit < *m_texco_num; unit++) {
- switch(m_texco[unit]) {
+ switch (m_texco[unit]) {
case RAS_IRasterizer::RAS_TEXCO_ORCO:
case RAS_IRasterizer::RAS_TEXCO_GLOB:
glMultiTexCoord3fvARB(GL_TEXTURE0_ARB + unit, tv.getXYZ());
@@ -97,7 +97,7 @@ void RAS_StorageIM::TexCoord(const RAS_TexVert &tv)
if (GLEW_ARB_vertex_program) {
int uv = 0;
for (unit = 0; unit < *m_attrib_num; unit++) {
- switch(m_attrib[unit]) {
+ switch (m_attrib[unit]) {
case RAS_IRasterizer::RAS_TEXCO_ORCO:
case RAS_IRasterizer::RAS_TEXCO_GLOB:
glVertexAttrib3fvARB(unit, tv.getXYZ());
diff --git a/source/tests/bl_load_py_modules.py b/source/tests/bl_load_py_modules.py
index d65b9605d36..9677397e01d 100644
--- a/source/tests/bl_load_py_modules.py
+++ b/source/tests/bl_load_py_modules.py
@@ -26,6 +26,12 @@ import addon_utils
import sys
import os
+BLACKLIST = {
+ "bl_i18n_utils",
+ "cycles",
+ "io_export_dxf", # TODO, check on why this fails
+ }
+
def source_list(path, filename_check=None):
from os.path import join
@@ -73,20 +79,26 @@ def load_modules():
for script_path in paths:
for mod_dir in sys.path:
if mod_dir.startswith(script_path):
- module_paths.append(mod_dir)
+ if mod_dir not in module_paths:
+ if os.path.exists(mod_dir):
+ module_paths.append(mod_dir)
#
# collect modules from our paths.
- module_names = set()
+ module_names = {}
for mod_dir in module_paths:
# print("mod_dir", mod_dir)
for mod, mod_full in bpy.path.module_names(mod_dir):
+ if mod in BLACKLIST:
+ continue
if mod in module_names:
- raise Exception("Module found twice %r" % mod)
+ mod_dir_prev, mod_full_prev = module_names[mod]
+ raise Exception("Module found twice %r.\n (%r -> %r, %r -> %r)" %
+ (mod, mod_dir, mod_full, mod_dir_prev, mod_full_prev))
modules.append(__import__(mod))
- module_names.add(mod)
+ module_names[mod] = mod_dir, mod_full
del module_names
#
@@ -128,7 +140,7 @@ def load_modules():
ignore_paths = [
os.sep + "presets" + os.sep,
os.sep + "templates" + os.sep,
- ]
+ ] + [(os.sep + f + os.sep) for f in BLACKLIST]
for f in source_files:
ok = False
diff --git a/source/tests/bl_run_operators.py b/source/tests/bl_run_operators.py
index 5bb25537458..0202f7c64fb 100644
--- a/source/tests/bl_run_operators.py
+++ b/source/tests/bl_run_operators.py
@@ -26,6 +26,11 @@
import bpy
import sys
+USE_ATTRSET = False
+USE_RANDOM = False
+RANDOM_SEED = [1] # so we can redo crashes
+RANDOM_RESET = 0.1 # 10% chance of resetting on each mew operator
+
op_blacklist = (
"script.reload",
"export*.*",
@@ -36,18 +41,40 @@ op_blacklist = (
"*.link_append",
"render.render",
"render.play_rendered_anim",
+ "sound.bake_animation", # OK but slow
+ "sound.mixdown", # OK but slow
+ "object.bake_image", # OK but slow
+ "object.paths_calculate", # OK but slow
+ "object.paths_update", # OK but slow
+ "ptcache.bake_all", # OK but slow
+ "nla.bake", # OK but slow
"*.*_export",
"*.*_import",
+ "ed.undo_push",
"wm.blenderplayer_start",
"wm.url_open",
"wm.doc_view",
+ "wm.doc_edit",
+ "wm.doc_view_manual",
"wm.path_open",
"wm.theme_install",
"wm.context_*",
+ "wm.properties_add",
+ "wm.properties_remove",
+ "wm.properties_edit",
+ "wm.properties_context_change",
"wm.operator_cheat_sheet",
- "wm.keyconfig_test", # just annoying - but harmless
- "wm.memory_statistics", # another annoying one
- "console.*", # just annoying - but harmless
+ "wm.interface_theme_*",
+ "wm.appconfig_*", # just annoying - but harmless
+ "wm.keyitem_add", # just annoying - but harmless
+ "wm.keyconfig_activate", # just annoying - but harmless
+ "wm.keyconfig_preset_add", # just annoying - but harmless
+ "wm.keyconfig_test", # just annoying - but harmless
+ "wm.memory_statistics", # another annoying one
+ "wm.dependency_relations", # another annoying one
+ "wm.keymap_restore", # another annoying one
+ "wm.addon_*", # harmless, but dont change state
+ "console.*", # just annoying - but harmless
)
@@ -64,8 +91,112 @@ def filter_op_list(operators):
operators[:] = [op for op in operators if is_op_ok(op[0])]
+def reset_blend():
+ bpy.ops.wm.read_factory_settings()
+ for scene in bpy.data.scenes:
+ # reduce range so any bake action doesnt take too long
+ scene.frame_start = 1
+ scene.frame_end = 5
+
+
+if USE_ATTRSET:
+ def build_property_typemap(skip_classes):
+
+ property_typemap = {}
+
+ for attr in dir(bpy.types):
+ cls = getattr(bpy.types, attr)
+ if issubclass(cls, skip_classes):
+ continue
+
+ ## to support skip-save we cant get all props
+ # properties = cls.bl_rna.properties.keys()
+ properties = []
+ for prop_id, prop in cls.bl_rna.properties.items():
+ if not prop.is_skip_save:
+ properties.append(prop_id)
+
+ properties.remove("rna_type")
+ property_typemap[attr] = properties
+
+ return property_typemap
+ CLS_BLACKLIST = (
+ bpy.types.BrushTextureSlot,
+ bpy.types.Brush,
+ )
+ property_typemap = build_property_typemap(CLS_BLACKLIST)
+ bpy_struct_type = bpy.types.Struct.__base__
+
+ def id_walk(value, parent):
+ value_type = type(value)
+ value_type_name = value_type.__name__
+
+ value_id = getattr(value, "id_data", Ellipsis)
+ value_props = property_typemap.get(value_type_name, ())
+
+ for prop in value_props:
+ subvalue = getattr(value, prop)
+
+ if subvalue == parent:
+ continue
+
+ subvalue_type = type(subvalue)
+ yield value, prop, subvalue_type
+ subvalue_id = getattr(subvalue, "id_data", Ellipsis)
+
+ if value_id == subvalue_id:
+ if subvalue_type == float:
+ pass
+ elif subvalue_type == int:
+ pass
+ elif subvalue_type == bool:
+ pass
+ elif subvalue_type == str:
+ pass
+ elif hasattr(subvalue, "__len__"):
+ for sub_item in subvalue[:]:
+ if isinstance(sub_item, bpy_struct_type):
+ subitem_id = getattr(sub_item, "id_data", Ellipsis)
+ if subitem_id == subvalue_id:
+ yield from id_walk(sub_item, value)
+
+ if subvalue_type.__name__ in property_typemap:
+ yield from id_walk(subvalue, value)
+
+ # main function
+ _random_values = (
+ None, object,
+ 1, 0.1, -1,
+ "", "test", b"", b"test",
+ (), [], {},
+ (10,), (10, 20), (0, 0, 0),
+ {},
+ )
+
+ def attrset_data():
+ for attr in dir(bpy.data):
+ if attr == "window_managers":
+ continue
+ seq = getattr(bpy.data, attr)
+ if seq.__class__.__name__ == 'bpy_prop_collection':
+ for id_data in seq:
+ for val, prop, tp in id_walk(id_data, bpy.data):
+ # print(id_data)
+ for val_rnd in _random_values:
+ try:
+ setattr(val, prop, val_rnd)
+ except:
+ pass
+
+
def run_ops(operators, setup_func=None, reset=True):
print("\ncontext:", setup_func.__name__)
+
+ if USE_RANDOM:
+ import random
+ if random.random() < (1.0 - RANDOM_RESET):
+ reset = False
+
# first invoke
for op_id, op in operators:
if op.poll():
@@ -74,9 +205,16 @@ def run_ops(operators, setup_func=None, reset=True):
# disable will get blender in a bad state and crash easy!
if reset:
- bpy.ops.wm.read_factory_settings()
+ reset_blend()
- setup_func()
+ if USE_RANDOM:
+ # we can't be sure it will work
+ try:
+ setup_func()
+ except:
+ pass
+ else:
+ setup_func()
for mode in {'EXEC_DEFAULT', 'INVOKE_DEFAULT'}:
try:
@@ -86,11 +224,21 @@ def run_ops(operators, setup_func=None, reset=True):
#traceback.print_exc()
pass
+ if USE_ATTRSET:
+ attrset_data()
+
if not operators:
# run test
if reset:
- bpy.ops.wm.read_factory_settings()
- setup_func()
+ reset_blend()
+ if USE_RANDOM:
+ # we can't be sure it will work
+ try:
+ setup_func()
+ except:
+ pass
+ else:
+ setup_func()
# contexts
@@ -217,7 +365,7 @@ def main():
bpy_check_type_duplicates()
- # bpy.ops.wm.read_factory_settings()
+ # reset_blend()
import bpy
operators = []
for mod_name in dir(bpy.ops):
@@ -233,8 +381,10 @@ def main():
# for testing, mix the list up.
#operators.reverse()
- #import random
- #random.shuffle(operators)
+ if USE_RANDOM:
+ import random
+ random.seed(RANDOM_SEED[0])
+ random.shuffle(operators)
# 2 passes, first just run setup_func to make sure they are ok
for operators_test in ((), operators):
@@ -270,4 +420,7 @@ def main():
print("Finished %r" % __file__)
if __name__ == "__main__":
+ #~ for i in range(200):
+ #~ RANDOM_SEED[0] += 1
+ #~ main()
main()